From 48cbe00a8d474476ea4e9abf6aa416b31067db05 Mon Sep 17 00:00:00 2001 From: Animator Anon Date: Fri, 3 Feb 2023 17:30:29 +1000 Subject: [PATCH] Style error handler --- .gitignore | 5 +++++ .idea/.gitignore | 3 +++ scripts/animator.py | 8 ++++++-- scripts/functions/keyframe_functions.py | 14 +++++++++----- 4 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.gitignore b/.gitignore index e7a7d65..a0ed3df 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ __pycache__ *.pyc *.pyo debug.txt +.idea/animator_extension.iml +.idea/inspectionProfiles/profiles_settings.xml +.idea/misc.xml +.idea/modules.xml +.idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/scripts/animator.py b/scripts/animator.py index 6365cf4..ec4e6a5 100644 --- a/scripts/animator.py +++ b/scripts/animator.py @@ -107,6 +107,8 @@ def myprocess(*args, **kwargs): # Make bat files before video incase we interrupt it, and so we can generate vids on the fly. export.make_batch_files(myset) + # tmp_live_previews_enable = shared.opts.live_previews_enable + # shared.opts.live_previews_enable = False shared.state.interrupted = False if myset['loopback']: @@ -120,6 +122,8 @@ def myprocess(*args, **kwargs): shared.state.end() + # shared.opts.live_previews_enable = tmp_live_previews_enable + return result, "done" @@ -281,7 +285,7 @@ def ui_block_output(): # Basic layout of page # def on_ui_tabs(): - print("on_ui_tabs") + # print("on_ui_tabs") with gr.Blocks(analytics_enabled=False) as animator_tabs: with gr.Row(): # left Column @@ -332,7 +336,7 @@ def on_ui_tabs(): # Define my options that will be stored in webui config # def on_ui_settings(): - print("on_ui_settings") + # print("on_ui_settings") mysection = ('animatoranon', 'Animator Extension') shared.opts.add_option("animatoranon_film_folder", diff --git a/scripts/functions/keyframe_functions.py b/scripts/functions/keyframe_functions.py index f98e241..9b138b8 100644 --- a/scripts/functions/keyframe_functions.py +++ b/scripts/functions/keyframe_functions.py @@ -119,11 +119,15 @@ def process_keyframes(mysettings: dict) -> pd.DataFrame: frame_count = math.ceil(mysettings['fps'] * mysettings['total_time']) - # Try and apply styles in addition to what was written into the template text boxes. - mysettings['tmpl_pos'] = shared.prompt_styles.apply_styles_to_prompt(mysettings['tmpl_pos'], - [mysettings['_style_pos'], 'None']) - mysettings['tmpl_neg'] = shared.prompt_styles.apply_negative_styles_to_prompt(mysettings['tmpl_neg'], - [mysettings['_style_neg'], 'None']) + try: + # Try and apply styles in addition to what was written into the template text boxes. + mysettings['tmpl_pos'] = shared.prompt_styles.apply_styles_to_prompt(mysettings['tmpl_pos'], + [mysettings['_style_pos'], 'None']) + mysettings['tmpl_neg'] = shared.prompt_styles.apply_negative_styles_to_prompt(mysettings['tmpl_neg'], + [mysettings['_style_neg'], + 'None']) + except Exception as e: + print(f"Error: Failed to apply styles to templates: {e}") # Define the columns in the pandas dataframe that will hold and calculate all the changing values.. variables = {'pos1': np.nan,