summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_node.cpp7
-rw-r--r--editor/editor_themes.cpp24
-rw-r--r--editor/editor_themes.h2
-rw-r--r--editor/import_dock.cpp11
-rw-r--r--editor/import_dock.h1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp10
-rw-r--r--editor/project_settings_editor.cpp1
7 files changed, 42 insertions, 14 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0675cf2c75..9931f75314 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -284,9 +284,10 @@ void EditorNode::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/editor/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
- Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
+ Ref<Theme> theme = create_custom_theme(theme_base->get_theme());
theme_base->set_theme(theme);
+ gui_base->set_theme(theme);
gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
@@ -4691,9 +4692,9 @@ EditorNode::EditorNode() {
theme_base->add_child(gui_base);
gui_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- Ref<Theme> theme = create_editor_theme();
+ Ref<Theme> theme = create_custom_theme();
theme_base->set_theme(theme);
- gui_base->set_theme(create_custom_theme());
+ gui_base->set_theme(theme);
gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
resource_preview = memnew(EditorResourcePreview);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ffa978e194..0f9f50095d 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -582,7 +582,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color_disabled", "CheckButton", font_color_disabled);
theme->set_color("icon_color_hover", "CheckButton", font_color_hl);
+ theme->set_constant("hseparation", "CheckButton", 4 * EDSCALE);
+ theme->set_constant("check_vadjust", "CheckButton", 0 * EDSCALE);
+
// Checkbox
+ Ref<StyleBoxFlat> sb_checkbox = style_menu->duplicate();
+ // HACK, in reality, the checkbox draws the text over the icon by default, so the margin compensates that.
+ const int cb_w = theme->get_icon("GuiChecked", "EditorIcons")->get_width() + default_margin_size;
+ sb_checkbox->set_default_margin(MARGIN_LEFT, cb_w * EDSCALE);
+ sb_checkbox->set_default_margin(MARGIN_RIGHT, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(MARGIN_BOTTOM, default_margin_size * EDSCALE);
+
+ theme->set_stylebox("normal", "CheckBox", sb_checkbox);
+ theme->set_stylebox("pressed", "CheckBox", sb_checkbox);
+ theme->set_stylebox("disabled", "CheckBox", sb_checkbox);
+ theme->set_stylebox("hover", "CheckBox", sb_checkbox);
theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons"));
@@ -594,6 +609,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color_disabled", "CheckBox", font_color_disabled);
theme->set_color("icon_color_hover", "CheckBox", font_color_hl);
+ theme->set_constant("hseparation", "CheckBox", 4 * EDSCALE);
+ theme->set_constant("check_vadjust", "CheckBox", 0 * EDSCALE);
+
// PopupMenu
Ref<StyleBoxFlat> style_popup_menu = style_popup;
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
@@ -1049,12 +1067,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
return theme;
}
-Ref<Theme> create_custom_theme() {
- Ref<Theme> theme = create_editor_theme();
+Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
+ Ref<Theme> theme;
String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme != "") {
theme = ResourceLoader::load(custom_theme);
+ } else {
+ theme = create_editor_theme(p_theme);
}
String global_font = EditorSettings::get_singleton()->get("interface/editor/custom_font");
diff --git a/editor/editor_themes.h b/editor/editor_themes.h
index a644c5936f..6f3b83e0b0 100644
--- a/editor/editor_themes.h
+++ b/editor/editor_themes.h
@@ -34,6 +34,6 @@
Ref<Theme> create_editor_theme(Ref<Theme> p_theme = NULL);
-Ref<Theme> create_custom_theme();
+Ref<Theme> create_custom_theme(Ref<Theme> p_theme = NULL);
#endif
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index e52f3bab72..df4254e2a3 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -263,6 +263,14 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
imported->set_text(itos(p_paths.size()) + TTR(" Files"));
}
+void ImportDock::_importer_selected(int i_idx) {
+ String name = import_as->get_selected_metadata();
+ Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(name);
+ ERR_FAIL_COND(importer.is_null());
+
+ params->importer = importer;
+}
+
void ImportDock::_preset_selected(int p_idx) {
int item_id = preset->get_popup()->get_item_id(p_idx);
@@ -336,6 +344,7 @@ void ImportDock::_reimport() {
Error err = config->load(params->paths[i] + ".import");
ERR_CONTINUE(err != OK);
+ config->set_value("remap", "importer", params->importer->get_importer_name());
config->erase_section("params");
for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) {
@@ -367,6 +376,7 @@ void ImportDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_reimport"), &ImportDock::_reimport);
ClassDB::bind_method(D_METHOD("_preset_selected"), &ImportDock::_preset_selected);
+ ClassDB::bind_method(D_METHOD("_importer_selected"), &ImportDock::_importer_selected);
}
void ImportDock::initialize_import_options() const {
@@ -384,6 +394,7 @@ ImportDock::ImportDock() {
HBoxContainer *hb = memnew(HBoxContainer);
add_margin_child(TTR("Import As:"), hb);
import_as = memnew(OptionButton);
+ import_as->connect("item_selected", this, "_importer_selected");
hb->add_child(import_as);
import_as->set_h_size_flags(SIZE_EXPAND_FILL);
preset = memnew(MenuButton);
diff --git a/editor/import_dock.h b/editor/import_dock.h
index 029c458320..a9bb22e568 100644
--- a/editor/import_dock.h
+++ b/editor/import_dock.h
@@ -54,6 +54,7 @@ class ImportDock : public VBoxContainer {
ImportDockParameters *params;
void _preset_selected(int p_idx);
+ void _importer_selected(int i_idx);
void _reimport();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 16564ce45f..4919cded53 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4373,7 +4373,7 @@ void CanvasItemEditorViewport::_on_mouse_exit() {
void CanvasItemEditorViewport::_on_select_type(Object *selected) {
CheckBox *check = Object::cast_to<CheckBox>(selected);
String type = check->get_text();
- selector_label->set_text(vformat(TTR("Add %s"), type));
+ selector->set_title(vformat(TTR("Add %s"), type));
label->set_text(vformat(TTR("Adding %s..."), type));
}
@@ -4698,7 +4698,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
CheckBox *check = Object::cast_to<CheckBox>(btn_list[i]);
check->set_pressed(check->get_text() == default_type);
}
- selector_label->set_text(vformat(TTR("Add %s"), default_type));
+ selector->set_title(vformat(TTR("Add %s"), default_type));
selector->popup_centered_minsize();
} else {
_perform_drop_data();
@@ -4757,12 +4757,6 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
vbc->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE);
- selector_label = memnew(Label);
- vbc->add_child(selector_label);
- selector_label->set_align(Label::ALIGN_CENTER);
- selector_label->set_valign(Label::VALIGN_BOTTOM);
- selector_label->set_custom_minimum_size(Size2(0, 30) * EDSCALE);
-
btn_group = memnew(VBoxContainer);
vbc->add_child(btn_group);
btn_group->set_h_size_flags(0);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 340ea708b4..926f26af14 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1782,6 +1782,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tab_container->add_child(translations);
//remap for properly select language in popup
translation_locales_idxs_remap = Vector<int>();
+ translation_locales_list_created = false;
{