diff --git a/BatchFuncs.py b/BatchFuncs.py index b6f593e..c325407 100644 --- a/BatchFuncs.py +++ b/BatchFuncs.py @@ -170,7 +170,7 @@ def interpolate_prompt_series(animation_prompts, max_frames, start_frame, pre_te prompt_weight_2[i], prompt_weight_3[i], prompt_weight_4[i]) if Is_print == True: # Show the to/from prompts with evaluated expressions for transparency. - print("\n", "Max Frames: ", max_frames, "\n", "frame index: ", index_offset, "\n", "Current Prompt: ", + print("\n", "Max Frames: ", max_frames, "\n", "frame index: ", (start_frame+index_offset), "\n", "Current Prompt: ", cur_prompt_series[index_offset], "\n", "Next Prompt: ", nxt_prompt_series[index_offset], "\n", "Strength : ", weight_series[i], "\n") index_offset = index_offset+1 diff --git a/FrameNodes.py b/FrameNodes.py index 652f5e1..0a7da44 100644 --- a/FrameNodes.py +++ b/FrameNodes.py @@ -2,25 +2,38 @@ class StringConcatenate: def __init__(self): pass + defaultPrompt = """"0" :"", + "12" :"", + "24" :"", + "36" :"", + "48" :"", + "60" :"", + "72" :"", + "84" :"", + "96" :"", + "108" :"", + "120" :"" + """ @classmethod def INPUT_TYPES(cls): return { "required": { - "text_a": ("STRING", {"forceInput": True}), - "text_b": ("STRING", {"forceInput": True}), - "frame_b": ("INT", {"default": 32, "min": 1}) + "text_a": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_a": ("INT", {"default": 0}), + "text_b": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_b": ("INT", {"default": 12}) }, "optional": { - "text_c": ("STRING", {"forceInput": True}), - "frame_c": ("INT", {"min": 2}), - "text_d": ("STRING", {"forceInput": True}), - "frame_d": ("INT", {"min": 3}), - "text_e": ("STRING", {"forceInput": True}), - "frame_e": ("INT", {"min": 4}), - "text_f": ("STRING", {"forceInput": True}), - "frame_f": ("INT", {"min": 5}), - "text_g": ("STRING", {"forceInput": True}), - "frame_g": ("INT", {"min": 6}) + "text_c": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_c": ("INT", {"default": 24}), + "text_d": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_d": ("INT", {"default": 36}), + "text_e": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_e": ("INT", {"default": 48}), + "text_f": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_f": ("INT", {"default": 60}), + "text_g": ("STRING", {"forceInput": True, "multiline": True, "default": ""}), + "frame_g": ("INT", {"default": 72}) } } RETURN_TYPES = ("STRING",) @@ -28,25 +41,41 @@ class StringConcatenate: CATEGORY = "FizzNodes 📅🅕🅝/FrameNodes" - def frame_concatenate_list(self, text_a, text_b, frame_b, text_c=None, frame_c=None, text_d=None, frame_d=None, text_e=None, frame_e=None, text_f=None, frame_f=None, text_g=None, frame_g=None): - - text_list = f'"0": "{text_a}",\n' - text_list += f'"{frame_b}": "{text_b}",\n' - if frame_c and text_c: - text_list += f'"{frame_c}": "{text_c}",\n' - if frame_d and text_d: - text_list += f'"{frame_d}": "{text_d}",\n' - if frame_e and text_e: - text_list += f'"{frame_e}": "{text_e}",\n' - if frame_f and text_f: - text_list += f'"{frame_f}": "{text_f}",\n' - if frame_g and text_g: - text_list += f'"{frame_g}": "{text_g}",\n' - - text_list = text_list[:-2] + def frame_concatenate_list(self, text_a, frame_a, text_b, frame_b, text_c=None, frame_c=None, text_d=None, + frame_d=None, text_e=None, frame_e=None, text_f=None, frame_f=None, text_g=None, + frame_g=None): + + text_a = text_a.replace('\n', '') + text_b = text_b.replace('\n', '') + text_c = text_c.replace('\n', '') if text_c is not None else None + text_d = text_d.replace('\n', '') if text_d is not None else None + text_e = text_e.replace('\n', '') if text_e is not None else None + text_f = text_f.replace('\n', '') if text_f is not None else None + text_g = text_g.replace('\n', '') if text_g is not None else None + + text_list = f'"{frame_a}": "{text_a}",' + text_list += f'"{frame_b}": "{text_b}",' + + if frame_c is not None and text_c is not None: + text_list += f'"{frame_c}": "{text_c}",' + + if frame_d is not None and text_d is not None: + text_list += f'"{frame_d}": "{text_d}",' + + if frame_e is not None and text_e is not None: + text_list += f'"{frame_e}": "{text_e}",' + + if frame_f is not None and text_f is not None: + text_list += f'"{frame_f}": "{text_f}",' + + if frame_g is not None and text_g is not None: + text_list += f'"{frame_g}": "{text_g}",' + + print(text_list) return (text_list,) - + + class InitNodeFrame: def __init__(self): self.frames = {} diff --git a/HelperNodes.py b/HelperNodes.py index 814c144..9030346 100644 --- a/HelperNodes.py +++ b/HelperNodes.py @@ -1,6 +1,5 @@ - -class CalculateLatentInterpFrameNumber: +class CalculateFrameOffset: @classmethod def INPUT_TYPES(cls): return { @@ -8,17 +7,53 @@ class CalculateLatentInterpFrameNumber: "current_frame": ("INT", {"default": 0, "min": 0}), "max_frames": ("INT", {"default": 18, "min": 0}), "num_latent_inputs": ("INT", {"default": 4, "min": 0}), + "index": ("INT", {"default": 4, "min": 0}), } } - RETURN_TYPES = ("INT", "INT" ,"INT" ,"INT", ) + RETURN_TYPES = ("INT", ) FUNCTION = "assignFrameNum" - CATEGORY = "FizzNodes 📅🅕🅝/FrameNodes" + CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes" - def assignFrameNum(self, current_frame, max_frames, batch_size): + def assignFrameNum(self, current_frame, max_frames, num_latent_inputs, index): if current_frame == 0: - return 0, 1, 2, 3 + return (index,) else: - start_frame = (current_frame - 1) * (batch_size - 1) + 3 - print(tuple((start_frame + i) % max_frames for i in range(4))) - return tuple((start_frame + i) % max_frames for i in range(4)) \ No newline at end of file + start_frame = (current_frame - 1) * (num_latent_inputs - 1) + (num_latent_inputs-1) + return ((start_frame + index) % max_frames,) +class ConcatStringSingle: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "string_a": ("STRING", {"forceInput":True,"default":"","multiline": True}), + "string_b": ("STRING", {"forceInput":True,"default":"","multiline": True}), + } + } + RETURN_TYPES = ("STRING", ) + FUNCTION = "concat" + + CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes" + + def concat(self, string_a, string_b): + c = string_a + string_b + return (c,) + +class convertKeyframeKeysToBatchKeys: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "input": ("INT", {"forceInput": True, "default": 0}), + "num_latents": ("INT", {"default": 16}), + } + } + + RETURN_TYPES = ("INT",) + FUNCTION = "concat" + + CATEGORY = "FizzNodes 📅🅕🅝/HelperNodes" + + def concat(self, input, num_latents): + c = input * num_latents -1 + return (c,) \ No newline at end of file diff --git a/__init__.py b/__init__.py index 64cb66b..5989dea 100644 --- a/__init__.py +++ b/__init__.py @@ -61,7 +61,7 @@ from .ScheduledNodes import ( #, BatchPromptScheduleNodeFlowEnd #, BatchGLIGENSchedule ) from .FrameNodes import FrameConcatenate, InitNodeFrame, NodeFrame, StringConcatenate -from .HelperNodes import CalculateLatentInterpFrameNumber +from .HelperNodes import ConcatStringSingle, convertKeyframeKeysToBatchKeys, CalculateFrameOffset NODE_CLASS_MAPPINGS = { "Lerp": Lerp, @@ -95,7 +95,9 @@ NODE_CLASS_MAPPINGS = { "FizzFrame":NodeFrame, "FizzFrameConcatenate":FrameConcatenate, - "CalculateLatentInterpFrameNumber": CalculateLatentInterpFrameNumber + "ConcatStringSingle": ConcatStringSingle, + "convertKeyframeKeysToBatchKeys": convertKeyframeKeysToBatchKeys, + "CalculateFrameOffset":CalculateFrameOffset, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -121,11 +123,15 @@ NODE_DISPLAY_NAME_MAPPINGS = { "BatchPromptSchedule": "Batch Prompt Schedule 📅🅕🅝", "BatchValueSchedule": "Batch Value Schedule 📅🅕🅝", "PromptScheduleEncodeSDXL": "Prompt Schedule SDXL 📅🅕🅝", - "BatchPromptScheduleEncodeSDXL": "Batch Prompt Schedule SDXL📅🅕🅝", + "BatchPromptScheduleEncodeSDXL": "Batch Prompt Schedule SDXL 📅🅕🅝", "BatchStringSchedule": "Batch String Schedule 📅🅕🅝", "BatchValueScheduleLatentInput": "Batch Value Schedule (Latent Input) 📅🅕🅝", "BatchPromptScheduleSDXLLatentInput": "Batch Prompt Schedule SDXL (Latent Input) 📅🅕🅝", "BatchPromptScheduleLatentInput": "Batch Prompt Schedule (Latent Input) 📅🅕🅝", - "CalculateLatentInterpFrameNumber": "Calculate Frame Numbers (Latent Interp) 📅🅕🅝" + "ConcatStringSingle": "Concat String (Single) 📅🅕🅝", + "convertKeyframeKeysToBatchKeys":"Keyframe Keys To Batch Keys 📅🅕🅝", + "SelectFrameNumber":"Select Frame Number 📅🅕🅝", + "CalculateFrameOffset":"Calculate Frame Offset 📅🅕🅝", + } print('\033[34mFizzleDorf Custom Nodes: \033[92mLoaded\033[0m')