Skip to content

Commit

Permalink
Merge pull request #77 from pydn/kwargs-hotfix
Browse files Browse the repository at this point in the history
Kwargs hotfix
  • Loading branch information
pydn authored Sep 16, 2024
2 parents 39c2229 + ea32a8f commit 14824e3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion comfyui_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,18 @@ def generate_workflow(
for idx, data, is_special_function in load_order:
# Generate class definition and inputs from the data
inputs, class_type = data["inputs"], data["class_type"]
input_types = self.node_class_mappings[class_type].INPUT_TYPES()
class_def = self.node_class_mappings[class_type]()

# If required inputs are not present, skip the node as it will break the code if passed through to the script
missing_required_variable = False
if "required" in input_types.keys():
for required in input_types["required"]:
if required not in inputs.keys():
missing_required_variable = True
if missing_required_variable:
continue

# If the class hasn't been initialized yet, initialize it and generate the import statements
if class_type not in initialized_objects:
# No need to use preview image nodes since we are executing the script in a terminal
Expand Down Expand Up @@ -242,7 +252,12 @@ def generate_workflow(
if no_params or key in class_def_params
}
# Deal with hidden variables
if class_def_params is not None:
if (
"hidden" in input_types.keys()
and "unique_id" in input_types["hidden"].keys()
):
inputs["unique_id"] = random.randint(1, 2**64)
elif class_def_params is not None:
if "unique_id" in class_def_params:
inputs["unique_id"] = random.randint(1, 2**64)

Expand Down

0 comments on commit 14824e3

Please sign in to comment.