Skip to content

Commit 14824e3

Browse files
authored
Merge pull request #77 from pydn/kwargs-hotfix
Kwargs hotfix
2 parents 39c2229 + ea32a8f commit 14824e3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

comfyui_to_python.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,18 @@ def generate_workflow(
211211
for idx, data, is_special_function in load_order:
212212
# Generate class definition and inputs from the data
213213
inputs, class_type = data["inputs"], data["class_type"]
214+
input_types = self.node_class_mappings[class_type].INPUT_TYPES()
214215
class_def = self.node_class_mappings[class_type]()
215216

217+
# If required inputs are not present, skip the node as it will break the code if passed through to the script
218+
missing_required_variable = False
219+
if "required" in input_types.keys():
220+
for required in input_types["required"]:
221+
if required not in inputs.keys():
222+
missing_required_variable = True
223+
if missing_required_variable:
224+
continue
225+
216226
# If the class hasn't been initialized yet, initialize it and generate the import statements
217227
if class_type not in initialized_objects:
218228
# No need to use preview image nodes since we are executing the script in a terminal
@@ -242,7 +252,12 @@ def generate_workflow(
242252
if no_params or key in class_def_params
243253
}
244254
# Deal with hidden variables
245-
if class_def_params is not None:
255+
if (
256+
"hidden" in input_types.keys()
257+
and "unique_id" in input_types["hidden"].keys()
258+
):
259+
inputs["unique_id"] = random.randint(1, 2**64)
260+
elif class_def_params is not None:
246261
if "unique_id" in class_def_params:
247262
inputs["unique_id"] = random.randint(1, 2**64)
248263

0 commit comments

Comments
 (0)