class Example:
"""
A example node
Class methods # 类方法
-------------
INPUT_TYPES (dict): # 告诉主程序输入节点参数。
Tell the main program input parameters of nodes.
IS_CHANGED: # 这个类方法是可选的,控制何时重新执行节点的可选方法。
optional method to control when the node is re executed.
Attributes
----------
RETURN_TYPES (`tuple`): # 输出元组中每个元素的类型
The type of each element in the output tulple.
RETURN_NAMES (`tuple`): # 可选属性,为输出元组中的每个元素提供描述性名称。
Optional: The name of each output in the output tulple.
FUNCTION (`str`): # 入口方法的名称
The name of the entry-point method. For example, if `FUNCTION = "execute"` then it will run Example().execute()
OUTPUT_NODE ([`bool`]): # 如果此节点是输出节点,则从图中输出结果/图像
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.
Assumed to be False if not present.
CATEGORY (`str`): # 节点在用户界面中应该出现的类别。这有助于用户根据功能查找和组织节点。
The category the node should appear in the UI.
execute(s) -> tuple || None: # 入口方法。该方法的名称必须与 FUNCTION 属性的值相同。
The entry point method. The name of this method must be the same as the value of property `FUNCTION`.
For example, if `FUNCTION = "execute"` then this method's name must be `execute`, if `FUNCTION = "foo"` then it must be `foo`.
"""
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
"""
Return a dictionary which contains config for all input fields. # 这个函数的作用的返回一个字典,其中包含所有输入字段的配置。
Some types (string): "MODEL", "VAE", "CLIP", "CONDITIONING", "LATENT", "IMAGE", "INT", "STRING", "FLOAT".
# 部分类型(字符串):“MODEL”、
comfyui节点编写示例文件(上)
于 2024-02-23 14:22:42 首次发布