@@ -847,6 +847,61 @@ class Load3DAnimation(Load3D):
847847 ...
848848
849849
850+ @comfytype (io_type = "LAYERS" )
851+ class Layers (ComfyTypeIO ):
852+ BlendMode = Literal [
853+ "normal" , "multiply" , "screen" , "overlay" , "darken" , "lighten" ,
854+ "color-dodge" , "color-burn" , "hard-light" , "soft-light" , "difference" ,
855+ "exclusion" , "linear-dodge" , "linear-burn" , "vivid-light" , "pin-light" ,
856+ "linear-light" , "hard-mix" , "subtract" , "divide" , "grain-extract" ,
857+ "grain-merge" , "hue" , "saturation" , "color" , "luminosity" ,
858+ ]
859+
860+ class LayerItem (TypedDict ):
861+ image : torch .Tensor
862+ type : Literal ["raster" ]
863+ x : NotRequired [int ]
864+ y : NotRequired [int ]
865+ mask : NotRequired [torch .Tensor ]
866+ z_index : int
867+ name : NotRequired [str ]
868+ opacity : NotRequired [float ]
869+ blend_mode : NotRequired ["Layers.BlendMode" ]
870+ visible : NotRequired [bool ]
871+ flip_h : NotRequired [bool ]
872+ flip_v : NotRequired [bool ]
873+ rotation : NotRequired [float ]
874+ w : NotRequired [int ]
875+ h : NotRequired [int ]
876+
877+ class Document (TypedDict ):
878+ version : int
879+ canvas : NotRequired [tuple [int , int ]]
880+ layers : list ["Layers.LayerItem" ]
881+
882+ Type = Document
883+
884+
885+ @comfytype (io_type = "COMPOSITOR" )
886+ class Compositor (ComfyTypeIO ):
887+ class LayerState (TypedDict ):
888+ version : NotRequired [int ]
889+ canvas : dict
890+ background : NotRequired [dict ]
891+ inputs : NotRequired [list [str ]]
892+ order : NotRequired [list [int ]]
893+ layers : list [dict ]
894+
895+ Type = LayerState
896+
897+ class Input (WidgetInput ):
898+ def __init__ (self , id : str , display_name : str = None , optional = False , tooltip : str = None ,
899+ socketless : bool = True , default : dict = None , advanced : bool = None ):
900+ super ().__init__ (id , display_name , optional , tooltip , None , default , socketless , None , None , None , None , advanced )
901+ if default is None :
902+ self .default = {}
903+
904+
850905@comfytype (io_type = "PHOTOMAKER" )
851906class Photomaker (ComfyTypeIO ):
852907 Type = Any
@@ -2403,6 +2458,8 @@ def as_dict(self):
24032458 "Load3DModelInfo" ,
24042459 "Load3D" ,
24052460 "Load3DAnimation" ,
2461+ "Compositor" ,
2462+ "Layers" ,
24062463 "Photomaker" ,
24072464 "Point" ,
24082465 "FaceAnalysis" ,
0 commit comments