From cd8feed0df5dd765a53c447ff70f59a8518c240c Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Mon, 31 Jul 2017 13:19:45 -0500 Subject: [PATCH] Some theme and usability improvements Fixed create script editor dialog not changing extension Options menu for inspector element is bigger --- editor/editor_themes.cpp | 11 +++++- editor/icons/2x/icon_GUI_dropdown.png | Bin 183 -> 198 bytes editor/icons/icon_GUI_dropdown.png | Bin 130 -> 136 bytes editor/icons/source/icon_GUI_dropdown.svg | 22 +++++------ editor/icons/source/icon_connect.svg | 46 +++++++++++++++++----- editor/project_settings_editor.cpp | 18 ++++----- editor/script_create_dialog.cpp | 33 ++++++---------- 7 files changed, 78 insertions(+), 52 deletions(-) diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 6b985c7b4bc..df16de947e0 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -163,6 +163,13 @@ Ref create_editor_theme() { theme->set_color("light_color_1", "Editor", light_color_1); theme->set_color("light_color_2", "Editor", light_color_2); + Color success_color = highlight_color.linear_interpolate(Color(0, 1, .8), 0.8); + Color warning_color = highlight_color.linear_interpolate(Color(1, 1, .2), 0.8); + Color error_color = highlight_color.linear_interpolate(Color(1, .2, .2), 0.8); + theme->set_color("success_color", "Editor", success_color); + theme->set_color("warning_color", "Editor", warning_color); + theme->set_color("error_color", "Editor", error_color); + // Checkbox icon theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons")); @@ -307,8 +314,8 @@ Ref create_editor_theme() { theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons")); theme->set_stylebox("bg_focus", "Tree", focus_sbt); - theme->set_stylebox("custom_button", "Tree", style_button_type); - theme->set_stylebox("custom_button_pressed", "Tree", style_button_type); + theme->set_stylebox("custom_button", "Tree", make_empty_stylebox()); + theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox()); theme->set_stylebox("custom_button_hover", "Tree", style_button_type); theme->set_color("custom_button_font_highlight", "Tree", HIGHLIGHT_COLOR_LIGHT); diff --git a/editor/icons/2x/icon_GUI_dropdown.png b/editor/icons/2x/icon_GUI_dropdown.png index c959378430b59566671f467014cb44e86a547c9f..78d3352e4e1d6b75f8dd7bdb385fdd45e2f6cfb5 100644 GIT binary patch delta 187 zcmdnac#Ki8Gr-TCmrII^fq{Y7)59eQNXvjQ2OE$q;=Mm*qM~ShwWo_?h)3t!DUMtX z3IeY4AI@CGePz|VTZ{M}&Q-cCu|*<9gsZD^_QA&Y?5*te$EUI-^~lX=G+WEG!RmRL z@4e|_Ou`0t&Lz+4R=X1-Qg&$F^|ov-)joCZ<|6f=&+XZ>u3u(LSiR%;4~;Y_PGes& ngTe~DWM4ftrx_3$@=r U*Yy1b+RxzW>gTe~i7BB807fc0{{R30 diff --git a/editor/icons/icon_GUI_dropdown.png b/editor/icons/icon_GUI_dropdown.png index 4bd6544830f0425453ce6af78990c5fd55383dde..d21cdb634e4c1adb7e760d0d71282a50c16a84b5 100644 GIT binary patch delta 124 zcmZo->|j*v4DfU3<&xrJU|`_&^l%9R(tIGy!3HGdJ#;TlR1^)e^>lFz(U_Q=u)yrc z|Nr~{1A+RV|Nrmv&$bbk+sntp!;=#*OQrX>q=ZDBk%57X!l_PXb~k2reuR&Xo?*iLZX1*tw|J@->)$H^ P8P4G8>gTe~DWM4fhd?S* diff --git a/editor/icons/source/icon_GUI_dropdown.svg b/editor/icons/source/icon_GUI_dropdown.svg index f313b09983e..897f63c2689 100644 --- a/editor/icons/source/icon_GUI_dropdown.svg +++ b/editor/icons/source/icon_GUI_dropdown.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="8" + width="14" height="14" - viewBox="0 0 8 14" + viewBox="0 0 14 14" id="svg2" version="1.1" inkscape:version="0.92+devel unknown" @@ -28,9 +28,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="45.254834" - inkscape:cx="1.2944669" - inkscape:cy="5.9830116" + inkscape:zoom="32" + inkscape:cx="6.5843041" + inkscape:cy="6.8000184" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -72,21 +72,21 @@ id="layer1" transform="translate(0,-1038.3622)"> + style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686" /> diff --git a/editor/icons/source/icon_connect.svg b/editor/icons/source/icon_connect.svg index 745d3cc4361..15c8b481a1e 100644 --- a/editor/icons/source/icon_connect.svg +++ b/editor/icons/source/icon_connect.svg @@ -14,7 +14,7 @@ viewBox="0 0 16 16" id="svg2" version="1.1" - inkscape:version="0.91 r13725" + inkscape:version="0.92+devel unknown" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png" inkscape:export-xdpi="45" inkscape:export-ydpi="45" @@ -28,9 +28,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="22.627418" - inkscape:cx="0.78663326" - inkscape:cy="12.940707" + inkscape:zoom="32.000001" + inkscape:cx="13.864856" + inkscape:cy="7.2235346" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -46,7 +46,8 @@ inkscape:window-height="1016" inkscape:window-x="0" inkscape:window-y="27" - inkscape:window-maximized="1"> + inkscape:window-maximized="1" + inkscape:document-rotation="0"> @@ -68,10 +69,37 @@ inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)"> + + id="circle4268" + style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + sodipodi:type="arc" + sodipodi:cx="4" + sodipodi:cy="1048.3622" + sodipodi:rx="5" + sodipodi:ry="5" + sodipodi:start="4.712389" + sodipodi:end="0" + sodipodi:arc-type="arc" + d="M 4.0000001,1043.3622 A 5,5 0 0 1 9,1048.3622" + sodipodi:open="true" /> + diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 6d23e874df9..6238cad14d9 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -140,7 +140,7 @@ void ProjectSettingsEditor::_action_edited() { add_at = "input/" + old_name; message->set_text(TTR("Invalid action (anything goes but '/' or ':').")); - message->popup_centered(Size2(300, 100)); + message->popup_centered(Size2(300, 100) * EDSCALE); return; } @@ -152,7 +152,7 @@ void ProjectSettingsEditor::_action_edited() { add_at = "input/" + old_name; message->set_text(vformat(TTR("Action '%s' already exists!"), new_name)); - message->popup_centered(Size2(300, 100)); + message->popup_centered(Size2(300, 100) * EDSCALE); return; } @@ -399,7 +399,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref p_exiting_even device_index->add_item(TTR("Button 7")); device_index->add_item(TTR("Button 8")); device_index->add_item(TTR("Button 9")); - device_input->popup_centered_minsize(Size2(350, 95)); + device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); Ref mb = p_exiting_event; if (mb.is_valid()) { @@ -420,7 +420,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref p_exiting_even String desc = _axis_names[i]; device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + (i & 1 ? "+" : "-") + desc); } - device_input->popup_centered_minsize(Size2(350, 95)); + device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); Ref jm = p_exiting_event; if (jm.is_valid()) { @@ -441,7 +441,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref p_exiting_even device_index->add_item(itos(i) + ": " + String(_button_names[i])); } - device_input->popup_centered_minsize(Size2(350, 95)); + device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); Ref jb = p_exiting_event; if (jb.is_valid()) { @@ -835,13 +835,13 @@ void ProjectSettingsEditor::_action_add() { String action = action_name->get_text(); if (action.find("/") != -1 || action.find(":") != -1 || action == "") { message->set_text(TTR("Invalid action (anything goes but '/' or ':').")); - message->popup_centered(Size2(300, 100)); + message->popup_centered(Size2(300, 100) * EDSCALE); return; } if (ProjectSettings::get_singleton()->has("input/" + action)) { message->set_text(vformat(TTR("Action '%s' already exists!"), action)); - message->popup_centered(Size2(300, 100)); + message->popup_centered(Size2(300, 100) * EDSCALE); return; } @@ -879,7 +879,7 @@ void ProjectSettingsEditor::_save() { Error err = ProjectSettings::get_singleton()->save(); message->set_text(err != OK ? TTR("Error saving settings.") : TTR("Settings saved OK.")); - message->popup_centered(Size2(300, 100)); + message->popup_centered(Size2(300, 100) * EDSCALE); } void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) { @@ -1554,7 +1554,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { add = memnew(Button); hbc->add_child(add); - add->set_custom_minimum_size(Size2(150, 0)); + add->set_custom_minimum_size(Size2(150, 0) * EDSCALE); add->set_text(TTR("Add")); add->connect("pressed", this, "_action_add"); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index c3a3410717f..0748c43b5f0 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -29,11 +29,12 @@ /*************************************************************************/ #include "script_create_dialog.h" +#include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor_file_system.h" -#include "project_settings.h" #include "io/resource_saver.h" #include "os/file_access.h" +#include "project_settings.h" #include "script_language.h" void ScriptCreateDialog::_notification(int p_what) { @@ -229,7 +230,7 @@ void ScriptCreateDialog::_lang_changed(int l) { List extensions; // get all possible extensions for script for (int l = 0; l < language_menu->get_item_count(); l++) { - language->get_recognized_extensions(&extensions); + ScriptServer::get_language(l)->get_recognized_extensions(&extensions); } for (List::Element *E = extensions.front(); E; E = E->next()) { @@ -240,8 +241,11 @@ void ScriptCreateDialog::_lang_changed(int l) { } } } - file_path->set_text(path); + } else { + path = "class" + selected_ext; + _path_changed(path); } + file_path->set_text(path); bool use_templates = language->is_using_templates(); template_menu->set_disabled(!use_templates); @@ -403,9 +407,9 @@ void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { error_label->set_text(TTR(p_msg)); if (valid) { - error_label->add_color_override("font_color", Color(0, 1.0, 0.8, 0.8)); + error_label->add_color_override("font_color", get_color("success_color", "Editor")); } else { - error_label->add_color_override("font_color", Color(1, 0.2, 0.2, 0.8)); + error_label->add_color_override("font_color", get_color("error_color", "Editor")); } } @@ -413,9 +417,9 @@ void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) { path_error_label->set_text(TTR(p_msg)); if (valid) { - path_error_label->add_color_override("font_color", Color(0, 1.0, 0.8, 0.8)); + path_error_label->add_color_override("font_color", get_color("success_color", "Editor")); } else { - path_error_label->add_color_override("font_color", Color(1, 0.4, 0.0, 0.8)); + path_error_label->add_color_override("font_color", get_color("error_color", "Editor")); } } @@ -543,19 +547,6 @@ ScriptCreateDialog::ScriptCreateDialog() { gc = memnew(GridContainer); gc->set_columns(2); - /* Error Stylebox Background */ - - StyleBoxFlat *sb = memnew(StyleBoxFlat); - sb->set_bg_color(Color(0, 0, 0, 0.05)); - sb->set_light_color(Color(1, 1, 1, 0.05)); - sb->set_dark_color(Color(1, 1, 1, 0.05)); - sb->set_border_blend(false); - sb->set_border_size(1); - sb->set_default_margin(MARGIN_TOP, 10.0 * EDSCALE); - sb->set_default_margin(MARGIN_BOTTOM, 10.0 * EDSCALE); - sb->set_default_margin(MARGIN_LEFT, 10.0 * EDSCALE); - sb->set_default_margin(MARGIN_RIGHT, 10.0 * EDSCALE); - /* Error Messages Field */ vb = memnew(VBoxContainer); @@ -582,7 +573,7 @@ ScriptCreateDialog::ScriptCreateDialog() { pc = memnew(PanelContainer); pc->set_h_size_flags(Control::SIZE_FILL); - pc->add_style_override("panel", sb); + pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree")); pc->add_child(vb); /* Margins */