From 618c72e22e61c6f3c5294b8ceea4a107fcec39e9 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Tue, 7 Feb 2023 18:09:55 +0000 Subject: [PATCH] No More Shots tag + updated analytics of scenes. --- studio/checklist.py | 7 ++++ studio/story.py | 21 +++++++++++- studio/studio_scriptLayer.py | 64 ++++++++++++++++++++++++++++++++++-- 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/studio/checklist.py b/studio/checklist.py index bb94650..5c01f65 100644 --- a/studio/checklist.py +++ b/studio/checklist.py @@ -19,6 +19,7 @@ from settings import talk #studio from studio import analytics +from studio import story from studio import history def get_list(filepath): @@ -523,6 +524,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.analytics = analytics.load(win.project) @@ -665,6 +667,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.analytics = analytics.load(win.project) @@ -699,6 +702,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.analytics = analytics.load(win.project) @@ -795,6 +799,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.multiuser["last_request"] = "" @@ -915,6 +920,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.analytics = analytics.load(win.project) @@ -1096,6 +1102,7 @@ def draw(outlayer, win, path, back="story_editor"): # Saving save(path, win.checklists[path]) + win.story = story.load(win.project) win.checklists = {} win.assets = {} win.analytics = analytics.load(win.project) diff --git a/studio/story.py b/studio/story.py index 151d467..abd59fc 100644 --- a/studio/story.py +++ b/studio/story.py @@ -675,7 +675,10 @@ def load(project): for scenename in data["scenes"]: shotsfractions = [] + textlength = 0 for shot in data["scenes"][scenename]["shots"]: + for t in shot[-1]: + textlength = textlength + len(t[-1]) if shot[0] == "shot_block": # Let's see if it has a checklist. @@ -709,10 +712,26 @@ def load(project): shotsfractions.append(0.2) except: shotsfractions.append(0.0) + + + # If the last block isn't shot_block. It's safe to assume that + # not all of the shots are yet marked in the text. Therefor we + # want to estimate how much is marked. + + multiply_by = 1 + if not data["scenes"][scenename].get("no_more_shots") and data["scenes"][scenename]["shots"][-1][0] == "text_block": + lastlen = 0 + for t in data["scenes"][scenename]["shots"][-1][-1]: + lastlen = lastlen + len(t[-1]) + try: + multiply_by = (textlength - lastlen) / textlength + except: + multiply_by = 1 + try: data["scenes"][scenename]["fraction"] = \ - sum(shotsfractions) / len(shotsfractions) + ( sum(shotsfractions) / len(shotsfractions) ) * multiply_by except: data["scenes"][scenename]["fraction"] = 0.0 diff --git a/studio/studio_scriptLayer.py b/studio/studio_scriptLayer.py index 7f37465..53a7585 100644 --- a/studio/studio_scriptLayer.py +++ b/studio/studio_scriptLayer.py @@ -2094,7 +2094,33 @@ def layer(win): # or rendering. # Since it's the last thing I'm drawing to this layer. I guess we can clip it. + + # Small progress bar of the scene: + # # Progressbar + scenedone = win.story["scenes"][scene]["fraction"] + UI_color.set(layer, win, "progress_background") + UI_elements.roundrect(layer, win, + 150, + 25, + win.current["w"]/4-180, + 20, + 10, + tip="Entire scene: "+str(round(scenedone*100, 1))+"%") + + + + + # Project Done + UI_color.set(layer, win, "progress_active") + UI_elements.roundrect(layer, win, + 150, + 25, + (win.current["w"]/4-180)*scenedone, + 20, + 10) + + x = 10 y = 70 width = win.current["w"] / 4 - 20 @@ -2781,7 +2807,7 @@ def layer(win): try: for blend in os.listdir(win.project+"/rnd"+win.cur): - if blend.endswith(".blend"): + if blend.endswith(".blend") and "_backup" not in blend: blendfiles.append(blend) except: pass @@ -3159,7 +3185,41 @@ def layer(win): break current_Y_shots = current_Y_shots + 60 - + + # Button for [ That's All The Shots ]. + # The idea is that untill this button is pressed the program will try + # to estimate how many shots there are still in the text, by looking at + # the amount of the text. If this button is pressed. The estimation will + # be ignored. + + if "no_more_shots" not in win.story["scenes"][scene]: + win.story["scenes"][scene]["no_more_shots"] = False + icon = "checked" + if not win.story["scenes"][scene]["no_more_shots"]: + icon = "unchecked" + + def do(): + win.story["scenes"][scene]["no_more_shots"] = not win.story["scenes"][scene]["no_more_shots"] + story.save(win.project, win.story) + win.story = story.load(win.project) + + UI_elements.roundrect(layer, win, + x, + y+win.scroll["script_shots"]+current_Y_shots, + width, + 40, + 10, + button=do, + icon=icon) + + UI_color.set(layer, win, "text_normal") + layer.set_font_size(20) + layer.move_to(x+50, + y+win.scroll["script_shots"]+current_Y_shots+27 ) + layer.show_text("No More Shots") + current_Y_shots = current_Y_shots + 60 + + # Scroll UI_elements.scroll_area(layer, win, "script_shots", x+0,