Compare commits

...

3 Commits

Author SHA1 Message Date
Elias Hogstvedt
bd75c248c0
Merge e568474e29 into 89e4ea0175 2025-04-05 12:32:25 +02:00
Elias Hogstvedt
e568474e29 Update example node 2024-01-25 08:27:30 +07:00
Elias Hogstvedt
4102ff1951 Add support for DISPLAY_NAME in custom nodes
as an alternative to NODE_DISPLAY_NAME_MAPPINGS
2024-01-25 08:21:33 +07:00
2 changed files with 5 additions and 1 deletions

View File

@ -21,6 +21,8 @@ class Example:
If this node is an output node that outputs a result/image from the graph. The SaveImage node is an example. If this node is an output node that outputs a result/image from the graph. The SaveImage node is an example.
The backend iterates on these output nodes and tries to execute all their parents if their parent graph is properly connected. The backend iterates on these output nodes and tries to execute all their parents if their parent graph is properly connected.
Assumed to be False if not present. Assumed to be False if not present.
DISPLAY_NAME (`str`):
A friendly/humanly readable title for the node.
CATEGORY (`str`): CATEGORY (`str`):
The category the node should appear in the UI. The category the node should appear in the UI.
DEPRECATED (`bool`): DEPRECATED (`bool`):
@ -88,6 +90,7 @@ class Example:
#OUTPUT_NODE = False #OUTPUT_NODE = False
DISPLAY_NAME = "Example Node"
CATEGORY = "Example" CATEGORY = "Example"
def check_lazy_status(self, image, string_field, int_field, float_field, print_to_screen): def check_lazy_status(self, image, string_field, int_field, float_field, print_to_screen):
@ -150,6 +153,7 @@ NODE_CLASS_MAPPINGS = {
} }
# A dictionary that contains the friendly/humanly readable titles for the nodes # A dictionary that contains the friendly/humanly readable titles for the nodes
# NOTE: This is the same as using the DISPLAY_NAME property
NODE_DISPLAY_NAME_MAPPINGS = { NODE_DISPLAY_NAME_MAPPINGS = {
"Example": "Example Node" "Example": "Example Node"
} }

View File

@ -561,7 +561,7 @@ class PromptServer():
info['output_is_list'] = obj_class.OUTPUT_IS_LIST if hasattr(obj_class, 'OUTPUT_IS_LIST') else [False] * len(obj_class.RETURN_TYPES) info['output_is_list'] = obj_class.OUTPUT_IS_LIST if hasattr(obj_class, 'OUTPUT_IS_LIST') else [False] * len(obj_class.RETURN_TYPES)
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output'] info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output']
info['name'] = node_class info['name'] = node_class
info['display_name'] = nodes.NODE_DISPLAY_NAME_MAPPINGS[node_class] if node_class in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else node_class info['display_name'] = obj_class.DISPLAY_NAME if hasattr(obj_class,'DISPLAY_NAME') else nodes.NODE_DISPLAY_NAME_MAPPINGS[node_class] if node_class in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else node_class
info['description'] = obj_class.DESCRIPTION if hasattr(obj_class,'DESCRIPTION') else '' info['description'] = obj_class.DESCRIPTION if hasattr(obj_class,'DESCRIPTION') else ''
info['python_module'] = getattr(obj_class, "RELATIVE_PYTHON_MODULE", "nodes") info['python_module'] = getattr(obj_class, "RELATIVE_PYTHON_MODULE", "nodes")
info['category'] = 'sd' info['category'] = 'sd'