From 768e03586870726da6f92e69d5ebd40ce9497214 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 31 Jan 2025 13:09:07 -0500 Subject: [PATCH] Add node for preview 3d animation (#6594) * Add node for preview 3d animation * remove bg_color param * remove animation_speed param --- comfy_extras/nodes_load_3d.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 436131ab..3b969e45 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -20,7 +20,6 @@ class Load3D(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), @@ -67,10 +66,8 @@ class Load3DAnimation(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), - "animation_speed": (["0.1", "0.5", "1", "1.5", "2"], {"default": "1"}), "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), }} @@ -104,7 +101,28 @@ class Preview3D(): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), "material": (["original", "normal", "wireframe", "depth"],), - "bg_color": ("STRING", {"default": "#000000", "multiline": False}), + "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), + "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), + "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), + }} + + OUTPUT_NODE = True + RETURN_TYPES = () + + CATEGORY = "3d" + + FUNCTION = "process" + EXPERIMENTAL = True + + def process(self, model_file, **kwargs): + return {"ui": {"model_file": [model_file]}, "result": ()} + +class Preview3DAnimation(): + @classmethod + def INPUT_TYPES(s): + return {"required": { + "model_file": ("STRING", {"default": "", "multiline": False}), + "material": (["original", "normal", "wireframe", "depth"],), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), @@ -124,11 +142,13 @@ class Preview3D(): NODE_CLASS_MAPPINGS = { "Load3D": Load3D, "Load3DAnimation": Load3DAnimation, - "Preview3D": Preview3D + "Preview3D": Preview3D, + "Preview3DAnimation": Preview3DAnimation } NODE_DISPLAY_NAME_MAPPINGS = { "Load3D": "Load 3D", "Load3DAnimation": "Load 3D - Animation", - "Preview3D": "Preview 3D" + "Preview3D": "Preview 3D", + "Preview3DAnimation": "Preview 3D - Animation" }