Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions addons/block_code/block_code_node/block_code.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class_name BlockCode
extends Node

@export var block_script: BlockScriptData = null
static var plugin


func _ready():
Expand All @@ -31,10 +30,6 @@ func _enter_tree():
new_bsd.generated_script = new_bsd.generated_script.replace("INHERIT_DEFAULT", new_bsd.script_inherits)
block_script = new_bsd

if plugin == null:
plugin = ClassDB.instantiate("EditorPlugin")
plugin.add_inspector_plugin(load("res://addons/block_code/inspector_plugin/block_script_inspector.gd").new())


func _update_parent_script():
if Engine.is_editor_hint():
Expand Down
10 changes: 9 additions & 1 deletion addons/block_code/block_code_plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const MainPanel := preload("res://addons/block_code/ui/main_panel.tscn")
static var main_panel: MainPanel
static var block_code_button: Button

const BlockInspectorPlugin := preload("res://addons/block_code/inspector_plugin/block_script_inspector.gd")
var block_inspector_plugin: BlockInspectorPlugin

var editor_inspector: EditorInspector
var editor_selection: EditorSelection

Expand Down Expand Up @@ -52,6 +55,8 @@ func _enter_tree():
main_panel = MainPanel.instantiate()
main_panel.undo_redo = get_undo_redo()
block_code_button = add_control_to_bottom_panel(main_panel, _get_plugin_name())
block_inspector_plugin = BlockInspectorPlugin.new()
add_inspector_plugin(block_inspector_plugin)

# Remove unwanted class nodes from create node
old_feature_profile = EditorInterface.get_current_feature_profile()
Expand All @@ -71,6 +76,8 @@ func _enter_tree():


func _exit_tree():
remove_inspector_plugin(block_inspector_plugin)

if block_code_button:
remove_control_from_bottom_panel(main_panel)
block_code_button = null
Expand Down Expand Up @@ -155,7 +162,8 @@ func select_block_code_node(block_code: BlockCode):


func _refresh_block_code_node():
main_panel.switch_block_code_node(_selected_block_code)
if main_panel:
main_panel.switch_block_code_node(_selected_block_code)


func _on_selected_block_code_changed():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func _parse_begin(object):

var button := Button.new()
button.text = "Open Block Script"
button.pressed.connect(func(): BlockCodePlugin.main_panel.switch_script(block_code))
button.pressed.connect(func(): BlockCodePlugin.main_panel.switch_block_code_node(block_code))

var container := MarginContainer.new()
container.add_theme_constant_override("margin_bottom", 10)
Expand Down
2 changes: 1 addition & 1 deletion addons/block_code/ui/picker/categories/block_category.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class_name BlockCategory
extends Object
extends RefCounted

var name: String
var block_list: Array[Block]
Expand Down