mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-09-14 05:25:23 +00:00
Added hidden and state to passed-in clone of node class
This commit is contained in:
@@ -11,10 +11,17 @@ class XYZ:
|
||||
class Output(io.OutputV3):
|
||||
...
|
||||
|
||||
class MyState(io.NodeState):
|
||||
my_str: str
|
||||
my_int: int
|
||||
|
||||
|
||||
class V3TestNode(io.ComfyNodeV3):
|
||||
|
||||
state: MyState
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.hahajkunless = ";)"
|
||||
|
||||
@classmethod
|
||||
@@ -64,6 +71,15 @@ class V3TestNode(io.ComfyNodeV3):
|
||||
|
||||
@classmethod
|
||||
def execute(cls, image: io.Image.Type, some_int: int, combo: io.Combo.Type, combo2: io.MultiCombo.Type, xyz: XYZ.Type=None, mask: io.Mask.Type=None, **kwargs):
|
||||
zzz = cls.hidden.prompt
|
||||
cls.state.my_str = "LOLJK"
|
||||
expected_int = 123
|
||||
cls.state.my_int = expected_int
|
||||
if cls.state.my_int is None:
|
||||
cls.state.my_int = expected_int
|
||||
else:
|
||||
if cls.state.my_int != expected_int:
|
||||
raise Exception(f"Explicit state object did not maintain expected value: {cls.state.my_int} != {expected_int}")
|
||||
#some_int
|
||||
if hasattr(cls, "hahajkunless"):
|
||||
raise Exception("The 'cls' variable leaked instance state between runs!")
|
||||
|
@@ -3,7 +3,7 @@ from comfy_api.v3.io import (
|
||||
ComfyNodeV3, SchemaV3, NumberDisplay,
|
||||
IntegerInput, MaskInput, ImageInput, ComboInput, CustomInput, StringInput, CustomType,
|
||||
IntegerOutput, ImageOutput, MultitypedInput, InputV3, OutputV3,
|
||||
NodeOutput, Hidden
|
||||
NodeOutput
|
||||
)
|
||||
import logging
|
||||
|
||||
|
Reference in New Issue
Block a user