Skip to content

Commit 6a1d3a1

Browse files
authored
convert hunyuan3d.py to V3 schema (#10664)
1 parent 65ee24c commit 6a1d3a1

File tree

5 files changed

+178
-120
lines changed

5 files changed

+178
-120
lines changed

comfy_api/latest/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from comfy_api.internal.async_to_sync import create_sync_class
88
from comfy_api.latest._input import ImageInput, AudioInput, MaskInput, LatentInput, VideoInput
99
from comfy_api.latest._input_impl import VideoFromFile, VideoFromComponents
10-
from comfy_api.latest._util import VideoCodec, VideoContainer, VideoComponents
10+
from comfy_api.latest._util import VideoCodec, VideoContainer, VideoComponents, MESH, VOXEL
1111
from . import _io as io
1212
from . import _ui as ui
1313
# from comfy_api.latest._resources import _RESOURCES as resources #noqa: F401
@@ -104,6 +104,8 @@ class Types:
104104
VideoCodec = VideoCodec
105105
VideoContainer = VideoContainer
106106
VideoComponents = VideoComponents
107+
MESH = MESH
108+
VOXEL = VOXEL
107109

108110
ComfyAPI = ComfyAPI_latest
109111

comfy_api/latest/_io.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
prune_dict, shallow_clone_class)
2828
from comfy_api.latest._resources import Resources, ResourcesLocal
2929
from comfy_execution.graph_utils import ExecutionBlocker
30+
from ._util import MESH, VOXEL
3031

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

@@ -656,11 +657,11 @@ class LossMapDict(TypedDict):
656657

657658
@comfytype(io_type="VOXEL")
658659
class Voxel(ComfyTypeIO):
659-
Type = Any # TODO: VOXEL class is defined in comfy_extras/nodes_hunyuan3d.py; should be moved to somewhere else before referenced directly in v3
660+
Type = VOXEL
660661

661662
@comfytype(io_type="MESH")
662663
class Mesh(ComfyTypeIO):
663-
Type = Any # TODO: MESH class is defined in comfy_extras/nodes_hunyuan3d.py; should be moved to somewhere else before referenced directly in v3
664+
Type = MESH
664665

665666
@comfytype(io_type="HOOKS")
666667
class Hooks(ComfyTypeIO):

comfy_api/latest/_util/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
from .video_types import VideoContainer, VideoCodec, VideoComponents
2+
from .geometry_types import VOXEL, MESH
23

34
__all__ = [
45
# Utility Types
56
"VideoContainer",
67
"VideoCodec",
78
"VideoComponents",
9+
"VOXEL",
10+
"MESH",
811
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import torch
2+
3+
4+
class VOXEL:
5+
def __init__(self, data: torch.Tensor):
6+
self.data = data
7+
8+
9+
class MESH:
10+
def __init__(self, vertices: torch.Tensor, faces: torch.Tensor):
11+
self.vertices = vertices
12+
self.faces = faces

0 commit comments

Comments
 (0)