From a4daeb5febdd15c229335153c63b4508c93a625a Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Tue, 7 Apr 2026 00:04:50 +0530 Subject: [PATCH] Fixed additional params --- clientlibs/utils.js | 18 +++++++++++++ modules/threeDInference.py | 13 +++++++--- modules/threeDInferenceInputs.py | 44 ++++++++++++++++++++++---------- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/clientlibs/utils.js b/clientlibs/utils.js index 27df2d4..cfc49fb 100644 --- a/clientlibs/utils.js +++ b/clientlibs/utils.js @@ -1925,8 +1925,26 @@ function sourcefulProviderSettingsFontsToggleHandler(fontsNode) { } function threeDInferenceToggleHandler(node) { + const useSeedWidget = node.widgets.find(w => w && w.name === "useSeed"); + const seedWidget = node.widgets.find(w => w && w.name === "seed"); const useOutputQualityWidget = node.widgets.find(w => w.name === "useOutputQuality"); const outputQualityWidget = node.widgets.find(w => w.name === "outputQuality"); + + if (useSeedWidget && seedWidget) { + function toggleSeed() { + const enabled = useSeedWidget.value === true; + toggleWidgetEnabled(seedWidget, enabled, node); + if (seedWidget.options && seedWidget.options.element) { + seedWidget.options.element.disabled = !enabled; + seedWidget.options.element.style.opacity = enabled ? "1" : "0.5"; + seedWidget.options.element.style.pointerEvents = enabled ? "auto" : "none"; + } + node.setDirtyCanvas(true); + } + setTimeout(toggleSeed, 100); + appendWidgetCB(useSeedWidget, () => setTimeout(toggleSeed, 50)); + } + if (!useOutputQualityWidget || !outputQualityWidget) return; function toggleEnabled() { const enabled = useOutputQualityWidget.value === true; diff --git a/modules/threeDInference.py b/modules/threeDInference.py index ee60822..a7ab4dd 100644 --- a/modules/threeDInference.py +++ b/modules/threeDInference.py @@ -28,8 +28,12 @@ class threeDInference: "placeholder": "Describe the 3D object you want to generate...", "tooltip": "A text prompt describing the 3D object to generate." }), + "useSeed": ("BOOLEAN", { + "tooltip": "Include seed in the API request. Turn off if the model should not receive a seed.", + "default": True, + }), "seed": ("INT", { - "tooltip": "Seed for reproducibility. Use the same seed to get the same result.", + "tooltip": "Seed for reproducibility. Only sent when 'Use Seed' is on.", "default": 1, "min": 1, "max": 2147483647, @@ -52,7 +56,7 @@ class threeDInference: "step": 1, }), "inputs": ("RUNWARE3DINFERENCEINPUTS", { - "tooltip": "Connect a Runware 3D Inference Inputs node to provide image and mask inputs.", + "tooltip": "Connect Runware 3D Inference Inputs for image, mask, meshFile, images (array from images_1…4), etc.", }), "settings": ("RUNWARE3DINFERENCESETTINGS", { "tooltip": "Connect Runware 3D Inference Settings for textureSize, decimation, remesh, resolution, imageAutoFix, faceLimit, texture, pbr, quad, Tripo options, sparseStructure, shapeSlat, texSlat, etc.", @@ -71,6 +75,7 @@ class threeDInference: modelName = kwargs.get("Model", "Meta SAM 3D") positivePrompt = kwargs.get("positivePrompt", "") seed = kwargs.get("seed", 1) + use_seed = kwargs.get("useSeed", True) outputFormat = kwargs.get("outputFormat", "GLB") use_output_quality = kwargs.get("useOutputQuality", False) output_quality = kwargs.get("outputQuality", 95) @@ -98,8 +103,8 @@ class threeDInference: if positivePrompt and positivePrompt.strip() != "": genConfig[0]["positivePrompt"] = positivePrompt.strip() - # Add seed - genConfig[0]["seed"] = seed + if use_seed: + genConfig[0]["seed"] = seed if use_output_quality: genConfig[0]["outputQuality"] = int(output_quality) diff --git a/modules/threeDInferenceInputs.py b/modules/threeDInferenceInputs.py index 626c481..46236b1 100644 --- a/modules/threeDInferenceInputs.py +++ b/modules/threeDInferenceInputs.py @@ -1,28 +1,38 @@ from .utils import runwareUtils as rwUtils +_IMAGE_SLOTS = 4 + class threeDInferenceInputs: """3D Inference Inputs node for configuring 3D generation inputs""" @classmethod def INPUT_TYPES(cls): + optional = { + "image": ("IMAGE", { + "tooltip": "Input image for 3D inference. This image will be used as the source for generating the 3D model.", + }), + "mask": ("IMAGE", { + "tooltip": "Optional mask image to specify a region of interest in the input image for 3D generation.", + }), + "meshFile": ("STRING", { + "default": "", + "tooltip": "Base64 data URI of mesh file (.glb or .ply) from Runware Load Mesh.", + }), + } + for i in range(1, _IMAGE_SLOTS + 1): + optional[f"images_{i}"] = ("IMAGE", { + "tooltip": f"Multi-view image slot {i}; merged in order into inputs.images as a list of data URIs.", + }) return { "required": {}, - "optional": { - "image": ("IMAGE", { - "tooltip": "Input image for 3D inference. This image will be used as the source for generating the 3D model." - }), - "mask": ("IMAGE", { - "tooltip": "Optional mask image to specify a region of interest in the input image for 3D generation." - }), - "meshFile": ("STRING", { - "default": "", - "tooltip": "Base64 data URI of mesh file (.glb or .ply) from Runware Load Mesh.", - }), - } + "optional": optional, } - DESCRIPTION = "Configure custom inputs for Runware 3D Inference, including image and mask inputs." + DESCRIPTION = ( + "Configure custom inputs for Runware 3D Inference: image, mask, meshFile, and images_1…images_4 " + "(merged into inputs.images as an array)." + ) FUNCTION = "createInputs" RETURN_TYPES = ("RUNWARE3DINFERENCEINPUTS",) RETURN_NAMES = ("Inputs",) @@ -45,6 +55,14 @@ class threeDInferenceInputs: if mesh_file and isinstance(mesh_file, str) and mesh_file.strip(): inputs["meshFile"] = mesh_file.strip() + images_list: list = [] + for i in range(1, _IMAGE_SLOTS + 1): + slot = kwargs.get(f"images_{i}") + if slot is not None: + images_list.append(rwUtils.convertTensor2IMG(slot)) + if images_list: + inputs["images"] = images_list + return (inputs,)