2026-01-18 23:27:59 +01:00
|
|
|
@tool
|
|
|
|
|
extends EditorPlugin
|
|
|
|
|
|
2026-02-17 23:08:36 +01:00
|
|
|
var editor_dock:EditorDock = null
|
|
|
|
|
var animation_graph_editor:AnimationGraphEditor = null
|
2026-01-18 23:27:59 +01:00
|
|
|
|
|
|
|
|
func _enable_plugin() -> void:
|
|
|
|
|
# Add autoloads here.
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _disable_plugin() -> void:
|
|
|
|
|
# Remove autoloads here.
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _enter_tree() -> void:
|
2026-02-17 23:08:36 +01:00
|
|
|
editor_dock = EditorDock.new()
|
|
|
|
|
editor_dock.title = "Animation Graph"
|
|
|
|
|
editor_dock.default_slot = EditorDock.DOCK_SLOT_BOTTOM
|
|
|
|
|
animation_graph_editor = preload ("res://addons/blendalot/animation_graph_editor.tscn").instantiate()
|
|
|
|
|
editor_dock.add_child(animation_graph_editor)
|
|
|
|
|
add_dock(editor_dock)
|
2026-01-18 23:27:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _exit_tree() -> void:
|
2026-02-17 23:08:36 +01:00
|
|
|
remove_dock(editor_dock)
|
|
|
|
|
editor_dock.queue_free()
|
|
|
|
|
editor_dock = null
|
|
|
|
|
|
|
|
|
|
animation_graph_editor.queue_free()
|
|
|
|
|
animation_graph_editor = null
|
2026-01-18 23:27:59 +01:00
|
|
|
|
|
|
|
|
|
2026-02-17 23:08:36 +01:00
|
|
|
func _has_main_screen() -> bool:
|
|
|
|
|
return false
|
2026-01-18 23:27:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _make_visible(visible):
|
2026-02-17 23:08:36 +01:00
|
|
|
pass
|
2026-01-18 23:27:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _get_plugin_name():
|
|
|
|
|
return "Blendalot"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _get_plugin_icon():
|
|
|
|
|
return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
|
2026-01-24 15:39:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handles(obj: Object) -> bool:
|
|
|
|
|
return obj is BLTAnimationNodeBlendTree
|
2026-01-28 21:05:16 +01:00
|
|
|
|
2026-02-17 23:08:36 +01:00
|
|
|
|
2026-01-28 21:05:16 +01:00
|
|
|
func _edit(object: Object):
|
2026-02-17 23:08:36 +01:00
|
|
|
if not is_instance_valid(animation_graph_editor):
|
|
|
|
|
push_error("Cannot edit object as AnimationGraphEditor is not initialized")
|
|
|
|
|
return
|
|
|
|
|
|
2026-01-28 21:05:16 +01:00
|
|
|
if object is BLTAnimationNodeBlendTree:
|
2026-02-17 23:08:36 +01:00
|
|
|
animation_graph_editor.edit_animation_root_node(object)
|
2026-01-28 21:05:16 +01:00
|
|
|
return
|
|
|
|
|
|
|
|
|
|
print("Cannot (yet) edit object " + str(object))
|