No More Shots tag + updated analytics of scenes.

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-07 18:09:55 +00:00
parent 7d8a433d97
commit 618c72e22e
3 changed files with 89 additions and 3 deletions

View file

@ -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)

View file

@ -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.
@ -710,9 +713,25 @@ def load(project):
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

View file

@ -2095,6 +2095,32 @@ def layer(win):
# 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
@ -3160,6 +3186,40 @@ def layer(win):
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,