Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make settings a full-screen editor #1150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions addons/dialogic/Editor/Common/Toolbar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand All @@ -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:
Expand Down
36 changes: 22 additions & 14 deletions addons/dialogic/Editor/EditorView.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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():
Expand All @@ -45,6 +48,7 @@ func edit_timeline(object):
_load_timeline(object)
show_timeline_editor()
%CharacterEditor.hide()
%SettingsEditor.close()


func edit_character(object):
Expand All @@ -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()
Expand Down Expand Up @@ -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
########################################
Expand Down
21 changes: 12 additions & 9 deletions addons/dialogic/Editor/EditorView.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand All @@ -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"]
21 changes: 11 additions & 10 deletions addons/dialogic/Editor/Settings/SettingsEditor.gd
Original file line number Diff line number Diff line change
@@ -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()
25 changes: 9 additions & 16 deletions addons/dialogic/Editor/Settings/SettingsEditor.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
49 changes: 25 additions & 24 deletions addons/dialogic/Editor/Settings/Settings_General.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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),
"format": "LumAlpha8",
Expand All @@ -19,27 +19,27 @@ data = {
}

[sub_resource type="ImageTexture" id="7"]
image = SubResource("Image_wik83")
image = SubResource("Image_svkl2")

[node name="General" type="HBoxContainer"]
anchor_right = 1.0
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"]
Expand All @@ -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"]
Expand All @@ -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"]
Expand Down