From 8542fabbb4d08bfb127dcd6b8d3f21a80565dc79 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Thu, 16 Jun 2022 21:38:20 +0100 Subject: [PATCH] Bugfix * Fixed editor active flag becoming stuck after rolling back to before it was called * Put editor onto interface layer to exclude it from transitions --- game/scripts/interface/hotkeys.rpy | 2 +- game/scripts/utility/editor.rpy | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/game/scripts/interface/hotkeys.rpy b/game/scripts/interface/hotkeys.rpy index f7f5c0d1..0b498805 100644 --- a/game/scripts/interface/hotkeys.rpy +++ b/game/scripts/interface/hotkeys.rpy @@ -153,7 +153,7 @@ init 1 python: #director = director.Start(), performance = ToggleScreen("_performance"), accessibility = ShowMenu("preferences", page="accessibility"), - editor = [ToggleField(e, "active", True, False), ToggleScreen("editor")], + editor = ToggleEditor(), ) config.underlay = [ _default_keymap ] diff --git a/game/scripts/utility/editor.rpy b/game/scripts/utility/editor.rpy index c6899ad9..31acc28c 100644 --- a/game/scripts/utility/editor.rpy +++ b/game/scripts/utility/editor.rpy @@ -410,6 +410,21 @@ init python: return self.read_history(file, line) + @renpy.pure + class ToggleEditor(Action, NoRollback): + def __call__(self): + if not config.developer: + return + + if renpy.get_screen("editor", layer="interface"): + e.active = False + renpy.hide_screen("editor", layer="interface") + else: + e.active = True + renpy.show_screen("editor") + + renpy.restart_interaction() + if config.developer: e = Editor() @@ -421,6 +436,7 @@ init python: screen editor(): zorder 50 style_prefix "editor" + layer "interface" text "Active" pos (25, 25)