From a50ae2b8eae5baf7468401f5e88a23dbb4929dae Mon Sep 17 00:00:00 2001 From: FizzleDorf <1fizzledorf@gmail.com> Date: Fri, 24 May 2024 22:51:13 -0400 Subject: [PATCH] added end_frame --- BatchFuncs.py | 4 ++++ ScheduleFuncs.py | 2 ++ ScheduledNodes.py | 23 +++++++++++++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/BatchFuncs.py b/BatchFuncs.py index 73862de..1f3271e 100644 --- a/BatchFuncs.py +++ b/BatchFuncs.py @@ -280,12 +280,16 @@ def interpolate_prompt_series(animation_prompts, max_frames, start_frame, pre_te current_weight = 0.0 index_offset = 0 + + + # Evaluate the current and next prompt's expressions for i in range(start_frame, len(cur_prompt_series)): cur_prompt_series[i] = prepare_batch_prompt(cur_prompt_series[i], max_frames, i, prompt_weight_1[i], prompt_weight_2[i], prompt_weight_3[i], prompt_weight_4[i]) nxt_prompt_series[i] = prepare_batch_prompt(nxt_prompt_series[i], max_frames, i, prompt_weight_1[i], 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: ", (start_frame + i), "\n", "Current Prompt: ", diff --git a/ScheduleFuncs.py b/ScheduleFuncs.py index 25df47d..953c827 100644 --- a/ScheduleFuncs.py +++ b/ScheduleFuncs.py @@ -32,6 +32,7 @@ class ScheduleSettings: pw_c: float, pw_d: float, start_frame: int, + end_frame:int, width: int, height: int, crop_w: int, @@ -53,6 +54,7 @@ class ScheduleSettings: self.pw_c=pw_c self.pw_d=pw_d self.start_frame=start_frame + self.end_frame=end_frame self.width=width self.height=height self.crop_w=crop_w diff --git a/ScheduledNodes.py b/ScheduledNodes.py index 72ef9fc..6468c21 100644 --- a/ScheduledNodes.py +++ b/ScheduledNodes.py @@ -89,6 +89,7 @@ class PromptSchedule: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=None, height=None, crop_w=None, @@ -115,7 +116,8 @@ class BatchPromptSchedule: "optional": { "pre_text": ("STRING", {"multiline": True, "forceInput": True}), "app_text": ("STRING", {"multiline": True, "forceInput": True}), - "start_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, }), + "start_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, "display": "start_frame(print_only)", }), + "end_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, "display": "end_frame(print_only)",}), "pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}), "pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}), "pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}), @@ -129,7 +131,7 @@ class BatchPromptSchedule: CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes" - def animate(self, text, max_frames, print_output, clip, start_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='' + def animate(self, text, max_frames, print_output, clip, start_frame, end_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='' ): settings = ScheduleSettings( text_g=text, @@ -146,6 +148,7 @@ class BatchPromptSchedule: pw_c=pw_c, pw_d=pw_d, start_frame=start_frame, + end_frame=end_frame, width=None, height=None, crop_w=None, @@ -174,7 +177,8 @@ class BatchPromptScheduleLatentInput: }, "optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}), "app_text": ("STRING", {"multiline": True, "forceInput": True}), - "start_frame": ("INT", {"default": 0.0, "min": 0, "max": 9999, "step": 1, }), + "start_frame": ("INT", {"default": 0.0, "min": 0, "max": 9999, "step": 1, "display": "start_frame(print_only)", }), + "end_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, "display": "end_frame(print_only)", }), "pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }), "pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }), "pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }), @@ -188,7 +192,7 @@ class BatchPromptScheduleLatentInput: CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes" - def animate(self, text, num_latents, print_output, clip, start_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='' + def animate(self, text, num_latents, print_output, clip, start_frame, end_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='' ): settings = ScheduleSettings( text_g=text, @@ -205,6 +209,7 @@ class BatchPromptScheduleLatentInput: pw_c=pw_c, pw_d=pw_d, start_frame=start_frame, + end_frame=end_frame, width=None, height=None, crop_w=None, @@ -255,6 +260,7 @@ class StringSchedule: pw_c = pw_c, pw_d = pw_d, start_frame = 0, + end_frame=0, width = None, height = None, crop_w = None, @@ -309,6 +315,7 @@ class BatchStringSchedule: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=None, height=None, crop_w=None, @@ -373,6 +380,7 @@ class PromptScheduleEncodeSDXL: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=width, height=height, crop_w=crop_w, @@ -436,6 +444,7 @@ class BatchPromptScheduleEncodeSDXL: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=width, height=height, crop_w=crop_w, @@ -500,6 +509,7 @@ class BatchPromptScheduleEncodeSDXLLatentInput: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=width, height=height, crop_w=crop_w, @@ -586,6 +596,7 @@ class PromptScheduleNodeFlowEnd: pw_c=pw_c, pw_d=pw_d, start_frame=0, + end_frame=0, width=None, height=None, crop_w=None, @@ -619,7 +630,7 @@ class BatchPromptScheduleNodeFlowEnd: CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes" - def animate(self, text, max_frames, start_frame, print_output, clip, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', + def animate(self, text, max_frames, start_frame, end_frame, print_output, clip, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text=''): if text[-1] == ",": text = text[:-1] @@ -640,6 +651,7 @@ class BatchPromptScheduleNodeFlowEnd: pw_c=pw_c, pw_d=pw_d, start_frame=start_frame, + end_frame=end_frame, width=None, height=None, crop_w=None, @@ -800,7 +812,6 @@ class ImagesFromBatchSchedule: def animate(self, images, text, current_frame, max_frames, print_output): inputText = str("{" + text + "}") inputText = re.sub(r',\s*}', '}', inputText) - start_frame = 0 animation_prompts = json.loads(inputText.strip()) pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_series(animation_prompts, max_frames, 0, "", "", 0,