72 lines
1.9 KiB
GDScript
72 lines
1.9 KiB
GDScript
tool
|
|
extends EditorPlugin
|
|
|
|
signal sd_scene_changed(new_scene)
|
|
|
|
const MainScreen = preload("res://addons/summer_day/main_screen.tscn")
|
|
const Timeline = preload("res://addons/summer_day/tool/timeline/timeline.tscn")
|
|
|
|
var main_screen_instance: SummerDayMainScreen
|
|
var timeline_instance: SummerDayTimeline
|
|
|
|
|
|
func _enter_tree():
|
|
main_screen_instance = MainScreen.instance()
|
|
self.connect("sd_scene_changed",
|
|
main_screen_instance.get_node("Canvas"), "_on_SummerDay_scene_changed"
|
|
)
|
|
# Add the main panel to the editor's main viewport.
|
|
get_editor_interface().get_editor_viewport().add_child(main_screen_instance)
|
|
# Hide the main panel. Very much required.
|
|
make_visible(false)
|
|
|
|
timeline_instance = Timeline.instance()
|
|
add_control_to_bottom_panel(timeline_instance, "SummerDay Timeline")
|
|
|
|
add_custom_type("SummerDayScene", "Resource",
|
|
load("res://addons/summer_day/data_structure/scene/scene.gd"),
|
|
get_editor_interface().get_base_control().get_icon("Animation", "EditorIcons"))
|
|
|
|
add_custom_type("SummerDayDisplay", "Control",
|
|
load("res://addons/summer_day/interface/display.gd"),
|
|
get_editor_interface().get_base_control().get_icon("TextureRect", "EditorIcons"))
|
|
|
|
|
|
func _exit_tree():
|
|
if main_screen_instance:
|
|
main_screen_instance.queue_free()
|
|
remove_custom_type("SummerDayScene")
|
|
remove_custom_type("SummerDayDisplay")
|
|
remove_control_from_bottom_panel(timeline_instance)
|
|
|
|
|
|
func has_main_screen():
|
|
return true
|
|
|
|
|
|
func make_visible(visible):
|
|
if main_screen_instance:
|
|
main_screen_instance.visible = visible
|
|
|
|
# if visible:
|
|
# make_bottom_panel_item_visible(timeline_instance)
|
|
# else:
|
|
# hide_bottom_panel()
|
|
|
|
|
|
func handles(object):
|
|
if object is SummerDayScene:
|
|
return true
|
|
|
|
|
|
func edit(scene):
|
|
emit_signal("sd_scene_changed", scene)
|
|
|
|
|
|
func get_plugin_name():
|
|
return "SummerDay"
|
|
|
|
|
|
func get_plugin_icon():
|
|
return get_editor_interface().get_base_control().get_icon("AnimationPlayer", "EditorIcons")
|