diff --git a/__init__.py b/__init__.py index 4ddd42c..a422160 100644 --- a/__init__.py +++ b/__init__.py @@ -61,10 +61,7 @@ class SetVariable: OUTPUT_NODE = True @classmethod - def IS_CHANGED(cls, variable_name, value=None): - # Store the value during IS_CHANGED phase (runs before all node execution) - # This ensures GetVariable nodes can find values even without trigger connection - _variable_storage[variable_name] = value + def IS_CHANGED(cls, **kwargs): return time.time() def set_var(self, variable_name, value=None): @@ -74,12 +71,18 @@ class SetVariable: class GetVariable: - """Retrieve data by variable name - shows preview on node""" + """Retrieve data by variable name - shows preview on node + + Connect SetVariable's output to 'trigger' to ensure proper execution order. + """ @classmethod def INPUT_TYPES(cls): return { "required": { "variable_name": ("STRING", {"default": "my_var"}), + }, + "optional": { + "trigger": (ANY,), } } RETURN_TYPES = (ANY,) @@ -90,10 +93,9 @@ class GetVariable: @classmethod def IS_CHANGED(cls, **kwargs): - # Always re-execute to get latest variable value return time.time() - def get_var(self, variable_name): + def get_var(self, variable_name, trigger=None): if variable_name not in _variable_storage: available = list(_variable_storage.keys()) preview = f"{variable_name} = NOT SET (available: {available})"