Script Tool Mode Open Scene in Editor

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By aaschmitz
:warning: Old Version Published before Godot 3 was released.

How to open a sceneA (.tscn) directly in the editor (not when playing the game but when editing it) using other sceneB with a script (.gd)?

The sceneB is using the “Tool Mode” (tool in the top of script) and have a button with the relative path of sceneA.

The idea would be to click the button in sceneB and open the sceneA for editing directly in the editor, in a new tab.

:bust_in_silhouette: Reply From: eons

I don’t think a simple tool can interact with the editor, you may need to make a plugin and with the EditorPlugin use edit or edit_resource.

Another option that involves a lot less work would just be to create an EditorScript that gets the EditorInterface during the _run method and uses it to set the current scene in the editor. You can then easily run it by going to the ScriptEditor, opening the script, and hitting Ctrl+Shift+X to run it.

Will Nations | 2018-02-01 19:35