2026-01-28 21:05:16 +01:00

57 lines
1.1 KiB
GDScript

@tool
extends EditorPlugin
const MainPanel = preload("res://addons/blendalot/blendalot_main_panel.tscn")
var main_panel_instance:BlendalotMainPanel
func _enable_plugin() -> void:
# Add autoloads here.
pass
func _disable_plugin() -> void:
# Remove autoloads here.
pass
func _enter_tree() -> void:
main_panel_instance = MainPanel.instantiate()
# Add the main panel to the editor's main viewport.
EditorInterface.get_editor_main_screen().add_child(main_panel_instance)
# Hide the main panel. Very much required.
_make_visible(false)
func _exit_tree() -> void:
if main_panel_instance:
main_panel_instance.queue_free()
func _has_main_screen():
return true
func _make_visible(visible):
if main_panel_instance:
main_panel_instance.visible = visible
func _get_plugin_name():
return "Blendalot"
func _get_plugin_icon():
return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
func _handles(obj: Object) -> bool:
return obj is BLTAnimationNodeBlendTree
func _edit(object: Object):
if object is BLTAnimationNodeBlendTree:
main_panel_instance.edit_blend_tree(object)
return
print("Cannot (yet) edit object " + str(object))