feat: Queue Trigger (Countdown), Sleep

This commit is contained in:
Dr.Lt.Data
2023-11-23 21:38:53 +09:00
parent d7811bf49b
commit a6bdd458c7
4 changed files with 56 additions and 1 deletions
+2
View File
@@ -184,6 +184,8 @@ This takes latent as input and outputs latent as the result.
* ImpactCompare, ImpactConditionalBranch, ImpactInt, ImpactValueSender, ImpactValueReceiver, ImpactImageInfo, ImpactMinMax, ImpactNeg, ImpactConditionalStopIteration
* ImpactIsNotEmptySEGS - This node returns `true` only if the input SEGS is not empty.
* Queue Trigger - When this node is executed, it adds a new queue to assist with repetitive tasks. It will only execute if the signal's status changes.
* Queue Trigger (Countdown) - Like the Queue Trigger, it adds a queue, but only adds it if it's greater than 1, and decrements the count by one each time it runs.
* Sleep - Waits for the specified time (in seconds).
* Set Widget Value - This node sets one of the optional inputs to the specified node's widget. An error may occur if the types do not match.
* Set Mute State - This node changes the mute state of a specific node.
* Control Bridge - Depending on whether the mode is set to `block` or `pass`, it changes the mute status of connected nodes. If there are nodes that require a change, the current execution is paused, the mute status is updated, and a new prompt queue is inserted.
+4
View File
@@ -269,10 +269,12 @@ NODE_CLASS_MAPPINGS = {
"ImpactDummyInput": ImpactDummyInput,
"ImpactQueueTrigger": ImpactQueueTrigger,
"ImpactQueueTriggerCountdown": ImpactQueueTriggerCountdown,
"ImpactSetWidgetValue": ImpactSetWidgetValue,
"ImpactNodeSetMuteState": ImpactNodeSetMuteState,
"ImpactControlBridge": ImpactControlBridge,
"ImpactIsNotEmptySEGS": ImpactNotEmptySEGS,
"ImpactSleep": ImpactSleep,
"ImpactHFTransformersClassifierProvider": HF_TransformersClassifierProvider,
"ImpactSEGSClassify": SEGS_Classify
@@ -369,9 +371,11 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"ImpactCombineConditionings": "Combine Conditionings",
"ImpactQueueTrigger": "Queue Trigger",
"ImpactQueueTriggerCountdown": "Queue Trigger (Countdown)",
"ImpactSetWidgetValue": "Set Widget Value",
"ImpactNodeSetMuteState": "Set Mute State",
"ImpactControlBridge": "Control Bridge",
"ImpactSleep": "Sleep",
"ImpactHFTransformersClassifierProvider": "HF Transformers Classifier Provider",
"ImpactSEGSClassify": "SEGS Classify",
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version = "V4.32.1"
version = "V4.33"
dependency_version = 19
+49
View File
@@ -1,4 +1,5 @@
import sys
import time
import execution
import folder_paths
@@ -293,6 +294,32 @@ class ImpactQueueTrigger:
return (signal,)
class ImpactQueueTriggerCountdown:
@classmethod
def INPUT_TYPES(cls):
return {"required": {
"signal": (any_typ,),
"count": ("INT", {"default": 10, "min": 0, "max": 0xffffffffffffffff})
},
"hidden": {"unique_id": "UNIQUE_ID"}
}
FUNCTION = "doit"
CATEGORY = "ImpactPack/Logic/_for_test"
RETURN_TYPES = (any_typ, "INT")
RETURN_NAMES = ("signal_opt", "count")
OUTPUT_NODE = True
def doit(self, signal, count, unique_id):
if count > 0:
PromptServer.instance.send_sync("impact-node-feedback",
{"id": unique_id, "widget_name": "count", "type": "int", "value": count-1})
PromptServer.instance.send_sync("impact-add-queue", {})
return (signal, count)
class ImpactSetWidgetValue:
@classmethod
def INPUT_TYPES(cls):
@@ -362,6 +389,27 @@ class ImpactNodeSetMuteState:
return (signal,)
class ImpactSleep:
@classmethod
def INPUT_TYPES(cls):
return {"required": {
"signal": (any_typ,),
"seconds": ("FLOAT", {"default": 0.5, "min": 0, "max": 3600}),
}
}
FUNCTION = "doit"
CATEGORY = "ImpactPack/Logic/_for_test"
RETURN_TYPES = (any_typ,)
RETURN_NAMES = ("signal_opt",)
OUTPUT_NODE = True
def doit(self, signal, seconds):
time.sleep(seconds)
return (signal,)
error_skip_flag = False
try:
import sys
@@ -393,6 +441,7 @@ def workflow_to_map(workflow):
return nodes, links
class ImpactControlBridge:
@classmethod
def INPUT_TYPES(cls):