Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions comfy_api/latest/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
prune_dict, shallow_clone_class)
from ._resources import Resources, ResourcesLocal
from comfy_execution.graph_utils import ExecutionBlocker
from ._util import MESH, VOXEL
from ._util import MESH, VOXEL, SVG as _SVG

# from comfy_extras.nodes_images import SVG as SVG_ # NOTE: needs to be moved before can be imported due to circular reference

class FolderType(str, Enum):
input = "input"
Expand Down Expand Up @@ -656,7 +655,7 @@ class Video(ComfyTypeIO):

@comfytype(io_type="SVG")
class SVG(ComfyTypeIO):
Type = Any # TODO: SVG class is defined in comfy_extras/nodes_images.py, causing circular reference; should be moved to somewhere else before referenced directly in v3
Type = _SVG

@comfytype(io_type="LORA_MODEL")
class LoraModel(ComfyTypeIO):
Expand Down
2 changes: 2 additions & 0 deletions comfy_api/latest/_util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .video_types import VideoContainer, VideoCodec, VideoComponents
from .geometry_types import VOXEL, MESH
from .image_types import SVG

__all__ = [
# Utility Types
Expand All @@ -8,4 +9,5 @@
"VideoComponents",
"VOXEL",
"MESH",
"SVG",
]
18 changes: 18 additions & 0 deletions comfy_api/latest/_util/image_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from io import BytesIO


class SVG:
"""Stores SVG representations via a list of BytesIO objects."""

def __init__(self, data: list[BytesIO]):
self.data = data

def combine(self, other: 'SVG') -> 'SVG':
return SVG(self.data + other.data)

@staticmethod
def combine_all(svgs: list['SVG']) -> 'SVG':
all_svgs_list: list[BytesIO] = []
for svg_item in svgs:
all_svgs_list.extend(svg_item.data)
return SVG(all_svgs_list)
Loading