mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-18 18:43:05 +08:00
Add get_all function to inputs for id validation purposes
This commit is contained in:
parent
8a0a00442b
commit
a89903e425
@ -185,6 +185,9 @@ class Input(_IO_V3):
|
||||
def get_io_type(self):
|
||||
return _StringIOType(self.io_type)
|
||||
|
||||
def get_all(self) -> list[Input]:
|
||||
return [self]
|
||||
|
||||
class WidgetInput(Input):
|
||||
'''
|
||||
Base class for a V3 Input with widget.
|
||||
@ -898,6 +901,9 @@ class DynamicCombo(ComfyTypeI):
|
||||
def get_dynamic(self) -> list[Input]:
|
||||
return [self]
|
||||
|
||||
def get_all(self) -> list[Input]:
|
||||
return [self] + [input for option in self.options for input in option.inputs]
|
||||
|
||||
def as_dict(self):
|
||||
return super().as_dict() | prune_dict({
|
||||
"options": [o.as_dict() for o in self.options],
|
||||
@ -1099,7 +1105,10 @@ class Schema:
|
||||
'''Validate the schema:
|
||||
- verify ids on inputs and outputs are unique - both internally and in relation to each other
|
||||
'''
|
||||
input_ids = [i.id for i in self.inputs] if self.inputs is not None else []
|
||||
nested_inputs: list[Input] = []
|
||||
for input in self.inputs:
|
||||
nested_inputs.extend(input.get_all())
|
||||
input_ids = [i.id for i in nested_inputs] if nested_inputs is not None else []
|
||||
output_ids = [o.id for o in self.outputs] if self.outputs is not None else []
|
||||
input_set = set(input_ids)
|
||||
output_set = set(output_ids)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user