mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-18 18:43:05 +08:00
Make nested DynamicCombos work properly with prefixed keys on latest frontend; breaks old Autogrow, but is pretty much ready for upcoming Autogrow keys
This commit is contained in:
parent
639cf870f9
commit
154bf49204
@ -1004,6 +1004,7 @@ class Autogrow(ComfyTypeI):
|
|||||||
curr_prefix = handle_prefix(curr_prefix, self.id)
|
curr_prefix = handle_prefix(curr_prefix, self.id)
|
||||||
# need to remove self from expected inputs dictionary; replaced by template inputs in frontend
|
# need to remove self from expected inputs dictionary; replaced by template inputs in frontend
|
||||||
for inner_dict in d.values():
|
for inner_dict in d.values():
|
||||||
|
# TODO: once frontend is ready, replace self.id with finalize_prefix(curr_prefix, self.id)
|
||||||
if self.id in inner_dict:
|
if self.id in inner_dict:
|
||||||
del inner_dict[self.id]
|
del inner_dict[self.id]
|
||||||
self.template.expand_schema_for_dynamic(d, live_inputs, curr_prefix)
|
self.template.expand_schema_for_dynamic(d, live_inputs, curr_prefix)
|
||||||
@ -1031,9 +1032,10 @@ class DynamicCombo(ComfyTypeI):
|
|||||||
|
|
||||||
def expand_schema_for_dynamic(self, d: dict[str, Any], live_inputs: dict[str, Any], curr_prefix: list[str] | None=None):
|
def expand_schema_for_dynamic(self, d: dict[str, Any], live_inputs: dict[str, Any], curr_prefix: list[str] | None=None):
|
||||||
# check if dynamic input's id is in live_inputs
|
# check if dynamic input's id is in live_inputs
|
||||||
if self.id in live_inputs:
|
|
||||||
curr_prefix = handle_prefix(curr_prefix, self.id)
|
curr_prefix = handle_prefix(curr_prefix, self.id)
|
||||||
key = live_inputs[self.id]
|
finalized_id = finalize_prefix(curr_prefix)
|
||||||
|
if finalized_id in live_inputs:
|
||||||
|
key = live_inputs[finalized_id]
|
||||||
selected_option = None
|
selected_option = None
|
||||||
for option in self.options:
|
for option in self.options:
|
||||||
if option.key == key:
|
if option.key == key:
|
||||||
@ -1111,9 +1113,14 @@ def add_dynamic_id_mapping(d: dict[str, Any], inputs: list[Input], curr_prefix:
|
|||||||
if self is not None:
|
if self is not None:
|
||||||
dynamic[finalize_prefix(curr_prefix[:-1], self.id)] = finalize_prefix(curr_prefix, self.id)
|
dynamic[finalize_prefix(curr_prefix[:-1], self.id)] = finalize_prefix(curr_prefix, self.id)
|
||||||
for i in inputs:
|
for i in inputs:
|
||||||
# if not isinstance(i, DynamicInput):
|
if not isinstance(i, DynamicInput):
|
||||||
dynamic[finalize_prefix(curr_prefix, i.id)] = finalize_prefix(curr_prefix, i.id)
|
dynamic[finalize_prefix(curr_prefix, i.id)] = finalize_prefix(curr_prefix, i.id)
|
||||||
|
|
||||||
|
def add_to_dynamic_dict(dynamic: dict[str, Any], curr_prefix: list[str], id: str, value: str):
|
||||||
|
finalize_key = finalize_prefix(curr_prefix, id)
|
||||||
|
if finalize_key not in dynamic:
|
||||||
|
dynamic[finalize_key] = value
|
||||||
|
|
||||||
class V3Data(TypedDict):
|
class V3Data(TypedDict):
|
||||||
hidden_inputs: dict[str, Any]
|
hidden_inputs: dict[str, Any]
|
||||||
dynamic_paths: dict[str, Any]
|
dynamic_paths: dict[str, Any]
|
||||||
|
|||||||
@ -756,6 +756,7 @@ async def validate_inputs(prompt_id, prompt, item, validated):
|
|||||||
validate_function_inputs = []
|
validate_function_inputs = []
|
||||||
validate_has_kwargs = False
|
validate_has_kwargs = False
|
||||||
if issubclass(obj_class, _ComfyNodeInternal):
|
if issubclass(obj_class, _ComfyNodeInternal):
|
||||||
|
obj_class: _io._ComfyNodeBaseInternal
|
||||||
class_inputs, _, _ = obj_class.INPUT_TYPES(include_hidden=False, return_schema=True, live_inputs=inputs)
|
class_inputs, _, _ = obj_class.INPUT_TYPES(include_hidden=False, return_schema=True, live_inputs=inputs)
|
||||||
validate_function_name = "validate_inputs"
|
validate_function_name = "validate_inputs"
|
||||||
validate_function = first_real_override(obj_class, validate_function_name)
|
validate_function = first_real_override(obj_class, validate_function_name)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user