44 lines
1.3 KiB
GDScript
44 lines
1.3 KiB
GDScript
@tool
|
|
extends EditorInspectorPlugin
|
|
|
|
const CONFIG_DIALOG = preload("res://addons/transition_configurator/config_dialog.gd")
|
|
|
|
var config_dialog: Window = null
|
|
|
|
func _can_handle(object: Object) -> bool:
|
|
return object is TransitionPiece
|
|
|
|
func _parse_begin(object: Object) -> void:
|
|
var container = VBoxContainer.new()
|
|
container.add_theme_constant_override("separation", 10)
|
|
|
|
# Header label
|
|
var header = Label.new()
|
|
header.text = "Exit Configuration"
|
|
header.add_theme_font_size_override("font_size", 14)
|
|
container.add_child(header)
|
|
|
|
# Configure button
|
|
var button = Button.new()
|
|
button.text = "Configure Exit..."
|
|
button.custom_minimum_size = Vector2(200, 40)
|
|
button.pressed.connect(_on_configure_pressed.bind(object))
|
|
container.add_child(button)
|
|
|
|
# Separator
|
|
var separator = HSeparator.new()
|
|
separator.add_theme_constant_override("separation", 10)
|
|
container.add_child(separator)
|
|
|
|
add_custom_control(container)
|
|
|
|
func _on_configure_pressed(transition_piece: TransitionPiece) -> void:
|
|
if config_dialog == null:
|
|
config_dialog = CONFIG_DIALOG.new()
|
|
EditorInterface.get_editor_main_screen().add_child(config_dialog)
|
|
|
|
config_dialog.transition_piece = transition_piece
|
|
config_dialog.populate_rooms()
|
|
|
|
EditorInterface.popup_dialog_centered(config_dialog, Vector2i(900, 600))
|