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
23 changes: 23 additions & 0 deletions addons/beehave/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends EditorPlugin
const BeehaveEditorDebugger := preload("debug/debugger.gd")
var editor_debugger: BeehaveEditorDebugger
var frames: RefCounted
var _custom_types: Array[StringName] = []


func _init():
Expand Down Expand Up @@ -33,7 +34,29 @@ func _enter_tree() -> void:
else:
frames = preload("debug/old_frames.gd").new()
add_debugger_plugin(editor_debugger)
_register_custom_types()


func _exit_tree() -> void:
_unregister_custom_types()
remove_debugger_plugin(editor_debugger)


func _register_custom_types() -> void:
# Some users report the script-class cache randomly missing BeehaveTree,
# which makes the editor return a null instance. Register the type manually
# so the node is still available even if the cache is broken.
var tree_script: Script = load("res://addons/beehave/nodes/beehave_tree.gd")
if tree_script == null:
push_warning("Beehave: failed to load BeehaveTree script; custom type not registered.")
return

var tree_icon: Texture2D = load("res://addons/beehave/icons/tree.svg")
add_custom_type("BeehaveTree", "Node", tree_script, tree_icon)
_custom_types.append(&"BeehaveTree")


func _unregister_custom_types() -> void:
for type_name in _custom_types:
remove_custom_type(type_name)
_custom_types.clear()
2 changes: 1 addition & 1 deletion addons/gdUnit4/GdUnitRunner.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2991,4 +2991,4 @@
}
],
"version": "5.0"
}
}