ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

once IS_CHANGED is defined, the node always re-execute.

Open metsweet999 opened this issue 6 months ago • 2 comments

Your question

i am developing a extension, when coding a node, i just want to try controlling when the node re-execute or not, so i am trying to define IS_CHANGED of this node. the testing code is :

class myinvertImage1:
    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "image": ("IMAGE", ),
            },
        }

    CATEGORY = "myNodes/image"
    RETURN_TYPES = ("IMAGE",)
    FUNCTION = "f"

    def f(self, image):
        image = 1.0 - image
        return (image,)

    @classmethod
    def IS_CHANGED(s):
        a = 3
        return int(a)

the node re-executes every time i press ctrl+enter in comfyui. it doesn't accord with its logic : "when the return value of IS_CHANGED is the same as the value u got in the last execution, the node doesn't re-execute." i checked everything i could check , didn't work. i thought it could be a bug, but it seems impossible that so many extensions was developed successfully with this bug exists. i searched "IS_CHANGED" in issues, one of them was almost the same problem, but it didn't give a clear answer and was closed.(https://github.com/comfyanonymous/ComfyUI/issues/1962) i think i now can do nothing but only try to get ur help, thank u a lot. and maybe it can also help some other ones.

Logs

No response

Other

No response

metsweet999 avatar Aug 16 '24 10:08 metsweet999