From 91b9a94c4b35ac556af1d0eae4df3d16bf08e9fd Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Wed, 8 Feb 2023 19:12:41 +0000 Subject: [PATCH] Scroll scenes with keyboard. Left Right Enter Escape. --- studio/studio_scriptLayer.py | 5 ++-- studio/studio_storyLayer.py | 54 +++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/studio/studio_scriptLayer.py b/studio/studio_scriptLayer.py index 53a7585..f45391a 100644 --- a/studio/studio_scriptLayer.py +++ b/studio/studio_scriptLayer.py @@ -1831,7 +1831,7 @@ def layer(win): del win.text["scene_name"] except: pass - win.story["selected"] = [] + win.story["selected"] = [["scene", scene]] win.scroll["script"] = 0 win.current["scene_edited_already"] = False @@ -1847,7 +1847,8 @@ def layer(win): # Short cut ESC if 65307 in win.current["keys"] and not win.textactive: - do() + do() + win.current["keys"].remove(65307) ############# CHECKLIST ################# diff --git a/studio/studio_storyLayer.py b/studio/studio_storyLayer.py index 7742f3c..d05aafc 100644 --- a/studio/studio_storyLayer.py +++ b/studio/studio_storyLayer.py @@ -1264,7 +1264,59 @@ def layer(win): and win.url == "story_editor" and win.story["selected"] and not win.textactive: win.url = "story_deletion_dialog" - + + # Enter + if 65293 in win.current["keys"] and win.current["tool"] == "selection": + print(win.story["selected"]) + + if win.story["selected"][0][0] == "scene": + win.url = "script" + win.cur = "/"+win.story["selected"][0][1] + win.current["tool"] = "selection" + + win.current["keys"].remove(65293) + + # Right + if 65363 in win.current["keys"] and win.current["tool"] == "selection": + try: + if win.story["selected"][0][0] == "scene": + scene = win.story["selected"][0][1] + for arrow in win.story["arrows"]: + if arrow[0][1] == scene and arrow[1] != "end": + win.story["selected"] = [["scene", arrow[1][1]]] + win.story["active"] = ["scene", arrow[1][1]] + nex = 0-win.story["scenes"][arrow[1][1]]["position"][0] + win.current["w"]/2 + ney = 0-win.story["scenes"][arrow[1][1]]["position"][1] + win.current["h"]/2 + + + UI_elements.animate("cameraX", win, win.story["camera"][0],nex, time=20, force=True) + UI_elements.animate("cameraY", win, win.story["camera"][1],ney, time=20, force=True) + + + win.current["keys"].remove(65363) + except: + pass + # Left + if 65361 in win.current["keys"] and win.current["tool"] == "selection": + try: + if win.story["selected"][0][0] == "scene": + scene = win.story["selected"][0][1] + for arrow in win.story["arrows"]: + if arrow[1][1] == scene and arrow[0] != "start": + win.story["selected"] = [["scene", arrow[0][1]]] + win.story["active"] = ["scene", arrow[0][1]] + nex = 0-win.story["scenes"][arrow[0][1]]["position"][0] + win.current["w"]/2 + ney = 0-win.story["scenes"][arrow[0][1]]["position"][1] + win.current["h"]/2 + + + UI_elements.animate("cameraX", win, win.story["camera"][0],nex, time=20, force=True) + UI_elements.animate("cameraY", win, win.story["camera"][1],ney, time=20, force=True) + + + win.current["keys"].remove(65361) + except: + pass + ########### TIMES RECORDING FOR PERFONMANCE MEASURING ############# fif = datetime.datetime.now() mil = fif - stf