Scroll scenes with keyboard. Left Right Enter Escape.

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-08 19:12:41 +00:00
parent cfd9286c7a
commit 91b9a94c4b
2 changed files with 56 additions and 3 deletions

View file

@ -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
@ -1848,6 +1848,7 @@ def layer(win):
# Short cut ESC
if 65307 in win.current["keys"] and not win.textactive:
do()
win.current["keys"].remove(65307)
############# CHECKLIST #################

View file

@ -1265,6 +1265,58 @@ def layer(win):
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