diff --git a/studio/history.py b/studio/history.py index d0de35c..04826f0 100644 --- a/studio/history.py +++ b/studio/history.py @@ -60,9 +60,9 @@ def record(win, filename, task, checklist=[] ): ################### CHECKLIST OF IMPEMENTED DATATYPES ###################### # [V] [Openned] # WHEN BLEND FILE IS OPENNED [ settings/oscalls.py ] - # [ ] [Linked] # AS LINKED ASSET INTO BLEND [] - # [ ] [Edited] # WHEN EDITED STORY [] - # [ ] [Updated] # WHEN CONFIGURED STUFF [] + # [V] [Linked] # AS LINKED ASSET INTO BLEND [ studio/studio_shot_linkLayer.py ] + # [V] [Edited] # WHEN EDITED STORY [ studio/studio_scriptLayer.py ] + # [V] [Updated] # WHEN CONFIGURED STUFF [ studio/studio_asset_configureLayer.py ] # [V] [Added] # WHEN ADDING A BLEND FILE [ settings/oscalls.py ] # [V] [Added Asset] # WHEN ADDING AN ASSET [ studio/studio_asset_selectLayer.py ] # [V] [Checked] # WHEN [V] IN CHECKLIST [ studio/checklist.py ] @@ -102,6 +102,11 @@ def record(win, filename, task, checklist=[] ): item = item.replace("//", "/") filename = filename.replace("//", "/") + + # Somebody please look at this. Maybe there is more clever way to record + # editing of scenes. I don't know. + if task == "[Edited]": + item = filename print("HISTORY: ", t, item, filename, task, checklist) @@ -305,9 +310,17 @@ def draw(outlayer, win): # ICON if i == "scenes" and not win.cur: - UI_elements.image(layer, win, - "settings/themes/"+win.settings["Theme"]+"/icons/scene.png", - 5, win.scroll["history"] + current_Y+5, 40, 40) + + if item.count("/") > 1: + + UI_elements.image(layer, win, + "settings/themes/"+win.settings["Theme"]+"/icons/shot.png", + 5, win.scroll["history"] + current_Y+5, 40, 40) + else: + + UI_elements.image(layer, win, + "settings/themes/"+win.settings["Theme"]+"/icons/scene.png", + 5, win.scroll["history"] + current_Y+5, 40, 40) elif i == "assets" and not win.cur: if os.path.exists(os.getcwd()+"/settings/themes/"+win.settings["Theme"]+"/icons/"+acur+".png"): @@ -335,7 +348,10 @@ def draw(outlayer, win): win.scroll["history"] + current_Y+30, ) if not win.cur: - layer.show_text(name) + if "chr" not in item and "veh" not in item and "loc" not in item and "obj" not in item and "set" not in item: + layer.show_text(item.replace("/","",1).replace("/", " | ")) + else: + layer.show_text(name.replace("project.progress", win.analytics["name"])) else: layer.show_text(theday) # Selection button @@ -450,7 +466,7 @@ def draw(outlayer, win): operation_icons = { "[Openned]":"blender", "[Linked]":"file_link", - "[Edited]":"copy_file", + "[Edited]":"scene", "[Updated]":"update", "[Added]":"new", "[Added Asset]":"asset_new", diff --git a/studio/story.py b/studio/story.py index 6dd3021..1a6f9c9 100644 --- a/studio/story.py +++ b/studio/story.py @@ -707,10 +707,7 @@ def load(project): except: data["scenes"][scenename]["fraction"] = 0.0 - print(shotsfractions) - print(data["scenes"][scenename]["fraction"]) - print(scenename) - print() + fractions = [] @@ -739,3 +736,73 @@ def load(project): return data + +def undo_record(win): + + # This function will record undo of the story. The undo will be basically + # copies of the script JSON file as a whole. The /pln/story.vcss + + # This function will not read the files. It's not nessesary. But it will + # make a copy of the whole thing. So I guess we need to implement some kind + # of limiter. + + limit = int(win.settings["Undo_Limit"]) + + # Now let's advance the undo history 1 forward. + win.undo_index = min(len(win.undo_history)+1, limit) + + # Let's read our file + f = open(win.project+'/pln/story.vcss') + + win.undo_history.append(f.read()) + + # And now let's limit our selves + + win.undo_history = win.undo_history[0-limit:] + + +# Following 2 functions are a big buggy at the moment. I will aprecieate if +# someone going to look at them. Maybe it's to do with studio/studio_storyLayer.py +# where I was testing them. But they work. Just not every time. + +def undo(win): + + # This function will do the undo. Tho this function will not nessesarily + # sens the Ctrl - Z by it self. It should be activated from any place + # in the UI. + + # Let's move our index back 1 way. + win.undo_index = max(0, win.undo_index-1) + + + # Now let's read our data + d = win.undo_history[win.undo_index] + + # And let's save the data back to the file + f = open(win.project+'/pln/story.vcss', "w") + f.write(d) + f.close() + + # And let's refresh story + win.story = load(win.project) + +def redo(win): + + # This function will do the redo. Tho this function will not nessesarily + # sens the Ctrl - Y by it self. It should be activated from any place + # in the UI. + + # Let's move our index back 1 way. + win.undo_index = min(len(win.undo_history)-1, win.undo_index+1) + + + # Now let's read our data + d = win.undo_history[win.undo_index] + + # And let's save the data back to the file + f = open(win.project+'/pln/story.vcss', "w") + f.write(d) + f.close() + + # And let's refresh story + win.story = load(win.project)