Browse Source

Some theme and usability improvements
Fixed create script editor dialog not changing extension
Options menu for inspector element is bigger

Daniel J. Ramirez 8 years ago
parent
commit
cd8feed0df

+ 9 - 2
editor/editor_themes.cpp

@@ -163,6 +163,13 @@ Ref<Theme> 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<Theme> 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);
 

BIN
editor/icons/2x/icon_GUI_dropdown.png


BIN
editor/icons/icon_GUI_dropdown.png


+ 11 - 11
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)">
     <circle
-       style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
+       style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
        id="path4268"
-       cx="4.5"
+       cx="7.5"
        cy="1040.8622"
        r="1.5" />
     <circle
        r="1.5"
        cy="1045.8622"
-       cx="4.5"
+       cx="7.5"
        id="circle4271"
-       style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686" />
+       style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686" />
     <circle
-       style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
+       style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
        id="circle4273"
-       cx="4.5"
+       cx="7.5"
        cy="1050.8622"
        r="1.5" />
   </g>

+ 37 - 9
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">
     <inkscape:grid
        type="xygrid"
        id="grid3336" />
@@ -68,10 +69,37 @@
      inkscape:groupmode="layer"
      id="layer1"
      transform="translate(0,-1036.3622)">
+    <circle
+       style="fill:#e0e0e0;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
+       id="path4266"
+       cx="4"
+       cy="1048.3622"
+       r="2" />
     <path
-       style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 7 2 A 2 2 0 0 0 5 4 L 5 7 L 1 7 L 1 9 L 5 9 L 5 12 A 2 2 0 0 0 7 14 L 11 14 L 11 12 L 14 12 L 14 10 L 11 10 L 11 6 L 14 6 L 14 4 L 11 4 L 11 2 L 7 2 z "
-       transform="translate(0,1036.3622)"
-       id="rect4155" />
+       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" />
+    <path
+       id="circle4270"
+       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="9"
+       sodipodi:ry="9"
+       sodipodi:start="4.712389"
+       sodipodi:end="0"
+       sodipodi:open="true"
+       sodipodi:arc-type="arc"
+       d="m 4.0000002,1039.3622 a 9,9 0 0 1 8.9999998,9" />
   </g>
 </svg>

+ 9 - 9
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<InputEvent> 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<InputEventMouseButton> mb = p_exiting_event;
 			if (mb.is_valid()) {
@@ -420,7 +420,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> 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<InputEventJoypadMotion> jm = p_exiting_event;
 			if (jm.is_valid()) {
@@ -441,7 +441,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> 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<InputEventJoypadButton> 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");
 

+ 12 - 21
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<String> 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<String>::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 */