diff --git a/addons/dialogic/Editor/Common/Toolbar.gd b/addons/dialogic/Editor/Common/Toolbar.gd index b51dbbdef..c1d7bb79f 100644 --- a/addons/dialogic/Editor/Common/Toolbar.gd +++ b/addons/dialogic/Editor/Common/Toolbar.gd @@ -89,15 +89,20 @@ func load_timeline(timeline_path:String) -> void: resource_used(timeline_path) %ResourcePicker.set_value(DialogicUtil.pretty_name(timeline_path)) %ResourcePicker.resource_icon = get_theme_icon("TripleBar", "EditorIcons") - $PlayTimeline.show() - $ToggleVisualEditor.show() + show_timeline_tool_buttons() func _on_play_timeline() -> void: emit_signal('play_timeline') $PlayTimeline.release_focus() +func show_timeline_tool_buttons() -> void: + $PlayTimeline.show() + $ToggleVisualEditor.show() +func hide_timeline_tool_buttons() -> void: + $PlayTimeline.hide() + $ToggleVisualEditor.hide() ################################################################################ ## CHARACTER_MODE ################################################################################ @@ -106,8 +111,7 @@ func load_character(character_path:String) -> void: resource_used(character_path) %ResourcePicker.set_value(DialogicUtil.pretty_name(character_path)) %ResourcePicker.resource_icon = load("res://addons/dialogic/Editor/Images/Resources/character.svg") - $PlayTimeline.hide() - $ToggleVisualEditor.hide() + hide_timeline_tool_buttons() func _on_ResourcePicker_value_changed(property_name, value) -> void: diff --git a/addons/dialogic/Editor/EditorView.gd b/addons/dialogic/Editor/EditorView.gd index fd361658a..320988f83 100644 --- a/addons/dialogic/Editor/EditorView.gd +++ b/addons/dialogic/Editor/EditorView.gd @@ -10,18 +10,14 @@ var _last_timeline_opened signal continue_opening_resource func _ready(): - $MarginContainer/VBoxContainer/Toolbar/Settings.button_up.connect(show_settings) + $MarginContainer/VBoxContainer/Toolbar/Settings.button_up.connect(settings_pressed) # File dialog editor_file_dialog = EditorFileDialog.new() add_child(editor_file_dialog) # Open the last edited scene - if ProjectSettings.has_setting('dialogic/editor/last_resources'): - var directory = Directory.new(); - var path = ProjectSettings.get_setting('dialogic/editor/last_resources')[0] - if directory.file_exists(path): - DialogicUtil.get_dialogic_plugin().editor_interface.inspect_object(load(path)) + open_last_resource() # Hide the character editor by default and connect its signals %CharacterEditor.hide() @@ -37,6 +33,13 @@ func _ready(): $SaveConfirmationDialog.add_button('No Saving Please!', true, 'nosave') $SaveConfirmationDialog.hide() +func open_last_resource(): + if ProjectSettings.has_setting('dialogic/editor/last_resources'): + var directory := Directory.new(); + var path :String= ProjectSettings.get_setting('dialogic/editor/last_resources')[0] + if directory.file_exists(path): + DialogicUtil.get_dialogic_plugin().editor_interface.inspect_object(load(path)) + func edit_timeline(object): if %Toolbar.is_current_unsaved(): @@ -45,6 +48,7 @@ func edit_timeline(object): _load_timeline(object) show_timeline_editor() %CharacterEditor.hide() + %SettingsEditor.close() func edit_character(object): @@ -54,13 +58,20 @@ func edit_character(object): %CharacterEditor.load_character(object) _hide_timeline_editor() %CharacterEditor.show() + %SettingsEditor.close() -func show_settings(): - $SettingsEditor.popup_centered() - $SettingsEditor.size = get_viewport().size/1.5 - $SettingsEditor.position -= $SettingsEditor.size / 2 - +func settings_pressed(): + if %SettingsEditor.visible: + open_last_resource() + else: + if %Toolbar.is_current_unsaved(): + save_current_resource() + await continue_opening_resource + %SettingsEditor.show() + _hide_timeline_editor() + %Toolbar.hide_timeline_tool_buttons() + %CharacterEditor.hide() func save_current_resource(): $SaveConfirmationDialog.popup_centered() @@ -103,9 +114,6 @@ func godot_file_dialog(callable, filter, mode = EditorFileDialog.FILE_MODE_OPEN_ return editor_file_dialog -func _on_settings_editor_close_requested(): - $SettingsEditor.hide() - ######################################## # Timeline editor ######################################## diff --git a/addons/dialogic/Editor/EditorView.tscn b/addons/dialogic/Editor/EditorView.tscn index 0881e5152..bc6f4029d 100644 --- a/addons/dialogic/Editor/EditorView.tscn +++ b/addons/dialogic/Editor/EditorView.tscn @@ -7,16 +7,17 @@ [ext_resource type="PackedScene" uid="uid://dr7l1304wixcs" path="res://addons/dialogic/Editor/TextEditor/TextEditor.tscn" id="5_px80h"] [ext_resource type="PackedScene" uid="uid://bak1jk2glij8r" path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" id="6"] -[sub_resource type="CodeHighlighter" id="CodeHighlighter_6teiw"] +[sub_resource type="CodeHighlighter" id="CodeHighlighter_p5dsy"] number_color = Color(0.8025, 0.81, 0.8225, 1) symbol_color = Color(0.8025, 0.81, 0.8225, 1) +function_color = Color(0.8025, 0.81, 0.8225, 1) member_variable_color = Color(0.8025, 0.81, 0.8225, 1) color_regions = { -"\" \"": Color(1, 0.925, 0.63, 1), -"- ": Color(0.556, 1, 0.856, 1), +"\" \"": Color(1, 0.93, 0.63, 1), +"- ": Color(0.56, 1, 0.86, 1), "< >": Color(0.34, 0.7, 1, 1), "[ ]": Color(0.34, 0.7, 1, 1), -"{ }": Color(0.556, 1, 0.856, 1) +"{ }": Color(0.56, 1, 0.86, 1) } [node name="EditorView" type="Control"] @@ -51,6 +52,7 @@ size_flags_vertical = 3 [node name="CharacterEditor" parent="MarginContainer/VBoxContainer" instance=ExtResource("6")] unique_name_in_owner = true +visible = false anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 320.0 @@ -64,15 +66,16 @@ visible = false offset_top = 37.0 size_flags_horizontal = 3 size_flags_vertical = 3 -syntax_highlighter = SubResource("CodeHighlighter_6teiw") +syntax_highlighter = SubResource("CodeHighlighter_p5dsy") -[node name="SettingsEditor" parent="." instance=ExtResource("3")] -unresizable = false -popup_window = false +[node name="SettingsEditor" parent="MarginContainer/VBoxContainer" instance=ExtResource("3")] +unique_name_in_owner = true +offset_top = 320.0 +offset_right = 1024.0 +size_flags_vertical = 3 [node name="SaveConfirmationDialog" type="AcceptDialog" parent="."] size = Vector2i(207, 100) -[connection signal="close_requested" from="SettingsEditor" to="." method="_on_settings_editor_close_requested"] [connection signal="confirmed" from="SaveConfirmationDialog" to="." method="_on_SaveConfirmationDialog_confirmed"] [connection signal="custom_action" from="SaveConfirmationDialog" to="." method="_on_SaveConfirmationDialog_custom_action"] diff --git a/addons/dialogic/Editor/Settings/SettingsEditor.gd b/addons/dialogic/Editor/Settings/SettingsEditor.gd index e949a18c7..87a6b4f0a 100644 --- a/addons/dialogic/Editor/Settings/SettingsEditor.gd +++ b/addons/dialogic/Editor/Settings/SettingsEditor.gd @@ -1,29 +1,30 @@ @tool -extends Popup +extends PanelContainer func _ready(): hide() - about_to_popup.connect(refresh) - - if not Engine.is_editor_hint(): - popup() + visibility_changed.connect(_on_visibility_changed) # Subsystems for script in DialogicUtil.get_event_scripts(): for subsystem in load(script).new().get_required_subsystems(): if subsystem.has('settings'): - $Panel/Tabs.add_child(load(subsystem.settings).instantiate()) + $Tabs.add_child(load(subsystem.settings).instantiate()) refresh() +func _on_visibility_changed(): + if visible: + refresh() + else: + close() func refresh(): - for child in $Panel/Tabs.get_children(): + for child in $Tabs.get_children(): if child.has_method('refresh'): child.refresh() - -func _on_settings_editor_close_requested(): - for child in $Panel/Tabs.get_children(): +func close(): + for child in $Tabs.get_children(): if child.has_method('_about_to_close'): child._about_to_close() hide() diff --git a/addons/dialogic/Editor/Settings/SettingsEditor.tscn b/addons/dialogic/Editor/Settings/SettingsEditor.tscn index 0ba5172d3..4a03118de 100644 --- a/addons/dialogic/Editor/Settings/SettingsEditor.tscn +++ b/addons/dialogic/Editor/Settings/SettingsEditor.tscn @@ -4,27 +4,20 @@ [ext_resource type="PackedScene" uid="uid://bmuda00fbd6i7" path="res://addons/dialogic/Editor/Settings/Settings_General.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://dgg785aucy0l3" path="res://addons/dialogic/Editor/Settings/Translations.tscn" id="3_q3qwt"] -[node name="SettingsEditor" type="Popup"] -title = "Dialogic Settings" -size = Vector2i(1024, 600) -borderless = false -min_size = Vector2i(700, 500) +[node name="SettingsEditor" type="PanelContainer"] +visible = false +offset_right = 1020.0 +offset_bottom = 600.0 script = ExtResource("1") -[node name="Panel" type="Panel" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 - -[node name="Tabs" type="TabContainer" parent="Panel"] -anchor_right = 1.0 -anchor_bottom = 1.0 +[node name="Tabs" type="TabContainer" parent="."] +offset_right = 1020.0 +offset_bottom = 600.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="General" parent="Panel/Tabs" instance=ExtResource("3")] +[node name="General" parent="Tabs" instance=ExtResource("3")] offset_top = 31.0 -[node name="Translations" parent="Panel/Tabs" instance=ExtResource("3_q3qwt")] +[node name="Translations" parent="Tabs" instance=ExtResource("3_q3qwt")] visible = false - -[connection signal="close_requested" from="." to="." method="_on_settings_editor_close_requested"] diff --git a/addons/dialogic/Editor/Settings/Settings_General.tscn b/addons/dialogic/Editor/Settings/Settings_General.tscn index 54ec36ab3..1b5daba5a 100644 --- a/addons/dialogic/Editor/Settings/Settings_General.tscn +++ b/addons/dialogic/Editor/Settings/Settings_General.tscn @@ -2,14 +2,14 @@ [ext_resource type="Script" path="res://addons/dialogic/Editor/Settings/Settings_General.gd" id="2"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vujr8"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3nwa2"] content_margin_left = 5.0 content_margin_top = 5.0 content_margin_right = 5.0 content_margin_bottom = 5.0 bg_color = Color(0.545098, 0.545098, 0.545098, 0.211765) -[sub_resource type="Image" id="Image_wik83"] +[sub_resource type="Image" id="Image_svkl2"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "LumAlpha8", @@ -19,7 +19,7 @@ data = { } [sub_resource type="ImageTexture" id="7"] -image = SubResource("Image_wik83") +image = SubResource("Image_svkl2") [node name="General" type="HBoxContainer"] anchor_right = 1.0 @@ -27,19 +27,19 @@ anchor_bottom = 1.0 script = ExtResource("2") [node name="General" type="VBoxContainer" parent="."] -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 600.0 size_flags_horizontal = 3 [node name="TitleLabel" type="Label" parent="General"] -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 36.0 -theme_override_styles/normal = SubResource("StyleBoxFlat_vujr8") +theme_override_styles/normal = SubResource("StyleBoxFlat_3nwa2") text = "Extensions" [node name="HBoxContainer" type="HBoxContainer" parent="General"] offset_top = 40.0 -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 66.0 [node name="Label" type="Label" parent="General/HBoxContainer"] @@ -50,39 +50,40 @@ text = "Custom events folder" [node name="CustomEventsFolderLabel" type="Label" parent="General/HBoxContainer"] unique_name_in_owner = true offset_left = 170.0 -offset_right = 478.0 +offset_right = 802.0 offset_bottom = 26.0 size_flags_horizontal = 3 text = "res://addons/dialogic_additions/Events" +text_overrun_behavior = 1 [node name="CustomEventsFolderButton" type="Button" parent="General/HBoxContainer"] unique_name_in_owner = true -offset_left = 482.0 -offset_right = 506.0 +offset_left = 806.0 +offset_right = 830.0 offset_bottom = 26.0 icon = SubResource("7") [node name="Label" type="Label" parent="General"] offset_top = 70.0 -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 96.0 text = "You should restart godot after changing this path!" [node name="HSeparator" type="HSeparator" parent="General"] offset_top = 100.0 -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 104.0 [node name="TitleLabel2" type="Label" parent="General"] offset_top = 108.0 -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 144.0 -theme_override_styles/normal = SubResource("StyleBoxFlat_vujr8") +theme_override_styles/normal = SubResource("StyleBoxFlat_3nwa2") text = "Testing" [node name="HBoxContainer2" type="HBoxContainer" parent="General"] offset_top = 148.0 -offset_right = 506.0 +offset_right = 830.0 offset_bottom = 174.0 [node name="Label" type="Label" parent="General/HBoxContainer2"] @@ -93,38 +94,38 @@ text = "Testing scene" [node name="TestingSceneLabel" type="Label" parent="General/HBoxContainer2"] unique_name_in_owner = true offset_left = 109.0 -offset_right = 478.0 +offset_right = 802.0 offset_bottom = 26.0 size_flags_horizontal = 3 text = "res://addons/dialogic_additions/Events" +text_overrun_behavior = 2 [node name="TestingSceneButton" type="Button" parent="General/HBoxContainer2"] unique_name_in_owner = true -offset_left = 482.0 -offset_right = 506.0 +offset_left = 806.0 +offset_right = 830.0 offset_bottom = 26.0 icon = SubResource("7") [node name="VSeparator" type="VSeparator" parent="."] -offset_left = 510.0 -offset_right = 514.0 +offset_left = 834.0 +offset_right = 838.0 offset_bottom = 600.0 [node name="Theming" type="VBoxContainer" parent="."] -offset_left = 518.0 +offset_left = 842.0 offset_right = 1024.0 offset_bottom = 600.0 -size_flags_horizontal = 3 [node name="Label" type="Label" parent="Theming"] -offset_right = 506.0 +offset_right = 182.0 offset_bottom = 26.0 text = "Color palette" [node name="Colors" type="HBoxContainer" parent="Theming"] unique_name_in_owner = true offset_top = 30.0 -offset_right = 506.0 +offset_right = 182.0 offset_bottom = 38.0 [node name="Color1" type="ColorPickerButton" parent="Theming/Colors"]