Update ddm_nodes.py

This commit is contained in:
Revmagi
2025-10-30 14:21:58 -04:00
committed by GitHub
parent 52387f293a
commit 8ee9a91f21
+5 -36
View File
@@ -19,28 +19,21 @@ class DDM_SetNode:
Store any value with a unique identifier.
"""
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"value": (any_type,),
"id": ("STRING", {
"default": "value",
}),
"id": ("STRING", {"default": "value"}),
},
}
RETURN_TYPES = (any_type,)
RETURN_NAMES = ("value",)
RETURN_NAMES = ("*",)
FUNCTION = "execute"
CATEGORY = "DDM Bundle"
OUTPUT_NODE = False
def execute(self, value, id):
"""Store the value and pass it through"""
STORAGE[id] = value
return (value,)
@@ -50,53 +43,29 @@ class DDM_GetNode:
Retrieve a stored value by identifier.
"""
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"id": ("STRING", {
"default": "value",
}),
"id": ("STRING", {"default": "value"}),
},
}
RETURN_TYPES = (any_type,)
RETURN_NAMES = ("value",)
RETURN_NAMES = ("*",)
FUNCTION = "execute"
CATEGORY = "DDM Bundle"
OUTPUT_NODE = False
@classmethod
def VALIDATE_INPUTS(cls, id):
"""
Always return True - validation happens at execution time
"""
return True
@classmethod
def IS_CHANGED(cls, id):
"""
Force re-execution every time
"""
return float("nan")
def execute(self, id):
"""
Retrieve the stored value
"""
if id not in STORAGE:
print(f"Warning: DDM_GetNode - ID '{id}' not found in storage")
print(f"Available IDs: {list(STORAGE.keys())}")
# Return a dummy value to prevent validation errors
return (None,)
raise ValueError(f"DDM Get Node: ID '{id}' not found in storage. Available: {list(STORAGE.keys())}")
return (STORAGE[id],)
# Node registration for ComfyUI
NODE_CLASS_MAPPINGS = {
"DDM_SetNode": DDM_SetNode,
"DDM_GetNode": DDM_GetNode,