Spaces:
Restarting
on
Zero
Restarting
on
Zero
File size: 5,248 Bytes
4450790 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
#---------------------------------------------------------------------------------------------------------------------#
# Comfyroll Studio custom nodes by RockOfFire and Akatsuzi https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes
# for ComfyUI https://github.com/comfyanonymous/ComfyUI
#---------------------------------------------------------------------------------------------------------------------#
from ..categories import icons
#---------------------------------------------------------------------------------------------------------------------#
class CR_Trigger:
@classmethod
def INPUT_TYPES(s):
return {"required": {"index": ("INT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0,}),
"trigger_value": ("INT", {"default": 1, "min": 0, "max": 10000}),
},
}
RETURN_TYPES = ("INT", "BOOLEAN", "STRING", )
RETURN_NAMES = ("index", "trigger", "show_help", )
FUNCTION = "trigger"
CATEGORY = icons.get("Comfyroll/Utils/Index")
def trigger(self, index, trigger_value):
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Index-Nodes#cr-trigger"
return (index, index == trigger_value, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_Index:
@classmethod
def INPUT_TYPES(s):
return {"required": {"index": ("INT", {"default": 1, "min": 0, "max": 10000}),
"print_to_console": (["Yes","No"],),
},
}
RETURN_TYPES = ("INT", "STRING", )
RETURN_NAMES = ("INT", "show_help", )
FUNCTION = "index"
CATEGORY = icons.get("Comfyroll/Utils/Index")
def index(self, index, print_to_console):
if print_to_console == "Yes":
print(f"[Info] CR Index:{index}")
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Index-Nodes#cr-index"
return (index, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_IncrementIndex:
@classmethod
def INPUT_TYPES(s):
return {"required":{
"index": ("INT", {"default": 1, "min": -10000, "max": 10000, "forceInput": True}),
"interval": ("INT", {"default": 1, "min": -10000, "max": 10000}),
}
}
RETURN_TYPES = ("INT", "INT", "STRING", )
RETURN_NAMES = ("index", "interval", "show_help", )
FUNCTION = "increment"
CATEGORY = icons.get("Comfyroll/Utils/Index")
def increment(self, index, interval):
index+=interval
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Index-Nodes#cr-index-increment"
return (index, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_MultiplyIndex:
@classmethod
def INPUT_TYPES(s):
return {"required":{
"index": ("INT", {"default": 1, "min": 0, "max": 10000, "forceInput": True}),
"factor": ("INT", {"default": 1, "min": 0, "max": 10000}),
}
}
RETURN_TYPES = ("INT", "INT", "STRING", )
RETURN_NAMES = ("index", "factor", "show_help", )
FUNCTION = "multiply"
CATEGORY = icons.get("Comfyroll/Utils/Index")
def multiply(self, index, factor):
index = index * factor
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Index-Nodes#cr-index-multiply"
return (index, factor, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_IndexReset:
@classmethod
def INPUT_TYPES(s):
return {"required":{
"index": ("INT", {"default": 1, "min": 0, "max": 10000, "forceInput": True}),
"reset_to": ("INT", {"default": 1, "min": 0, "max": 10000}),
}
}
RETURN_TYPES = ("INT", "INT", "STRING", )
RETURN_NAMES = ("index", "reset_to", "show_help", )
FUNCTION = "reset"
CATEGORY = icons.get("Comfyroll/Utils/Index")
def reset(self, index, reset_to):
index = reset_to
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Index-Nodes#cr-index-reset"
return (index, reset_to, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
#---------------------------------------------------------------------------------------------------------------------#
# For reference only, actual mappings are in __init__.py
'''
NODE_CLASS_MAPPINGS = {
# Index
"CR Index":CR_Index,
"CR Index Increment":CR_IncrementIndex,
"CR Index Multiply":CR_MultiplyIndex,
"CR Index Reset":CR_IndexReset,
"CR Trigger":CR_Trigger,
}
'''
|