Initial Android commit

This commit is contained in:
OleSTEEP 2024-11-10 03:34:28 +03:00
commit 1e2b80c13d
8521 changed files with 231475 additions and 0 deletions

View file

@ -0,0 +1,109 @@
tool
extends EditorProperty
var timelines_dropdown = MenuButton.new()
var container = HBoxContainer.new()
var edit_button = Button.new()
var editor_inspector_plugin = null
var current_value = ""
var updating = false
func get_tooltip_text():
return "Click to select a Dialogic timeline.\nPress the tool button to directly switch to the editor"
func _ready():
edit_button.icon = get_icon("Tools", "EditorIcons")
func _init():
timelines_dropdown.rect_min_size.x = 80
timelines_dropdown.set_h_size_flags(SIZE_EXPAND_FILL)
timelines_dropdown.clip_text = true
container.add_child(timelines_dropdown)
container.add_child(edit_button)
edit_button.flat = true
edit_button.hint_tooltip = "Edit Timeline"
edit_button.disabled = true
add_child(container)
add_focusable(timelines_dropdown)
timelines_dropdown.connect("about_to_show", self, "_about_to_show_menu")
timelines_dropdown.get_popup().connect("index_pressed", self, "_on_timeline_selected")
edit_button.connect("pressed", self, "_on_editTimelineButton_pressed")
func _about_to_show_menu():
if (updating):
return
timelines_dropdown.get_popup().clear()
var index = 0
for c in DialogicUtil.get_sorted_timeline_list():
timelines_dropdown.get_popup().add_item(c["name"])
timelines_dropdown.get_popup().set_item_metadata(index, {"file":c["file"], "color":c["color"]})
index += 1
func _on_timeline_selected(index):
var text = timelines_dropdown.get_popup().get_item_text(index)
var metadata = timelines_dropdown.get_popup().get_item_metadata(index)
current_value = metadata["file"]
timelines_dropdown.text = text
timelines_dropdown.hint_tooltip = text
_update_edit_button(current_value)
emit_changed(get_edited_property(), current_value)
func _on_editTimelineButton_pressed():
if (current_value != "" and editor_inspector_plugin != null):
editor_inspector_plugin.switch_to_dialogic_timeline(current_value)
func update_property():
var new_value = get_edited_object()[get_edited_property()]
_update_edit_button(new_value)
if (new_value == current_value):
return
updating = true
current_value = new_value
timelines_dropdown.text = ""
if (current_value == ""):
timelines_dropdown.hint_tooltip = "Click to select a timeline"
for c in DialogicUtil.get_timeline_list():
if c["file"] == current_value:
timelines_dropdown.text = c["name"]
timelines_dropdown.hint_tooltip = c["name"]
updating = false
_update_edit_button(current_value)
func _update_edit_button(value):
if (value == ""):
edit_button.disabled = true
else :
edit_button.disabled = false