Skip to content

Commit b8260b8

Browse files
authored
Merge pull request #41 from endlessm/show-editor-automatically
Show Block Code editor when BlockCode node is selected
2 parents 49c8240 + 696befe commit b8260b8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

addons/block_code/block_code_plugin.gd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ extends EditorPlugin
55
const MainPanel := preload("res://addons/block_code/ui/main_panel.tscn")
66
static var main_panel
77

8+
var editor_inspector: EditorInspector
9+
810
var old_feature_profile: String = ""
911

1012
const DISABLED_CLASSES := [
@@ -47,6 +49,8 @@ const DISABLED_CLASSES := [
4749
func _enter_tree():
4850
Types.init_cast_graph()
4951

52+
editor_inspector = EditorInterface.get_inspector()
53+
5054
main_panel = MainPanel.instantiate()
5155
main_panel.undo_redo = get_undo_redo()
5256

@@ -91,6 +95,16 @@ func _exit_tree():
9195
EditorInterface.set_current_feature_profile("")
9296

9397

98+
func _ready():
99+
editor_inspector.connect("edited_object_changed", _on_editor_inspector_edited_object_changed)
100+
101+
102+
func _on_editor_inspector_edited_object_changed():
103+
var block_code: BlockCode = editor_inspector.get_edited_object() as BlockCode
104+
if block_code:
105+
BlockCodePlugin.main_panel.switch_script(block_code)
106+
107+
94108
func _has_main_screen():
95109
return true
96110

0 commit comments

Comments
 (0)