diff options
Diffstat (limited to 'editor')
38 files changed, 469 insertions, 329 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index a7516c091f..ee1faf5a55 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1010,7 +1010,7 @@ void CodeTextEditor::_reset_zoom() { Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default if (font.is_valid()) { - EditorSettings::get_singleton()->set("interface/source_font_size", 14); + EditorSettings::get_singleton()->set("interface/editor/source_font_size", 14); font->set_size(14); } } @@ -1025,8 +1025,9 @@ void CodeTextEditor::_text_changed() { if (text_editor->is_insert_text_operation()) { code_complete_timer->start(); - idle->start(); } + + idle->start(); } void CodeTextEditor::_code_complete_timer_timeout() { @@ -1066,7 +1067,7 @@ void CodeTextEditor::_font_resize_timeout() { if (font.is_valid()) { int new_size = CLAMP(font->get_size() + font_resize_val, 8 * EDSCALE, 96 * EDSCALE); if (new_size != font->get_size()) { - EditorSettings::get_singleton()->set("interface/source_font_size", new_size / EDSCALE); + EditorSettings::get_singleton()->set("interface/editor/source_font_size", new_size / EDSCALE); font->set_size(new_size); } @@ -1197,17 +1198,9 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_brace_matching(true); text_editor->set_auto_indent(true); - MarginContainer *status_mc = memnew(MarginContainer); - add_child(status_mc); - status_mc->set("custom_constants/margin_left", 2); - status_mc->set("custom_constants/margin_top", 5); - status_mc->set("custom_constants/margin_right", 2); - status_mc->set("custom_constants/margin_bottom", 1); - HBoxContainer *status_bar = memnew(HBoxContainer); - status_mc->add_child(status_bar); + add_child(status_bar); status_bar->set_h_size_flags(SIZE_EXPAND_FILL); - status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible idle = memnew(Timer); add_child(idle); @@ -1226,14 +1219,18 @@ CodeTextEditor::CodeTextEditor() { error->set_clip_text(true); //do not change, or else very long errors can push the whole container to the right error->set_valign(Label::VALIGN_CENTER); error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + error->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch + status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible + Label *line_txt = memnew(Label); status_bar->add_child(line_txt); line_txt->set_align(Label::ALIGN_RIGHT); line_txt->set_valign(Label::VALIGN_CENTER); line_txt->set_v_size_flags(SIZE_FILL); line_txt->set_text(TTR("Line:")); + line_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); line_nb = memnew(Label); status_bar->add_child(line_nb); @@ -1242,6 +1239,8 @@ CodeTextEditor::CodeTextEditor() { line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); + line_nb->set_align(Label::ALIGN_RIGHT); + line_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); Label *col_txt = memnew(Label); status_bar->add_child(col_txt); @@ -1249,6 +1248,7 @@ CodeTextEditor::CodeTextEditor() { col_txt->set_valign(Label::VALIGN_CENTER); col_txt->set_v_size_flags(SIZE_FILL); col_txt->set_text(TTR("Col:")); + col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); col_nb = memnew(Label); status_bar->add_child(col_nb); @@ -1257,6 +1257,9 @@ CodeTextEditor::CodeTextEditor() { col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); + col_nb->set_align(Label::ALIGN_RIGHT); + col_nb->set("custom_constants/margin_right", 0); + col_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); text_editor->connect("gui_input", this, "_text_editor_gui_input"); text_editor->connect("cursor_changed", this, "_line_col_changed"); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 0305013776..ca68d84abd 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -168,8 +168,11 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p item->set_custom_color(0, get_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } else { + bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type); + String to_select_type = *to_select ? (*to_select)->get_text(0) : ""; + bool current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type); - if ((!*to_select && (search_box->get_text().is_subsequence_ofi(p_type))) || search_box->get_text() == p_type) { + if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) { *to_select = item; } } @@ -361,6 +364,19 @@ void CreateDialog::set_base_type(const String &p_base) { _update_search(); } +String CreateDialog::get_base_type() const { + + return base_type; +} + +void CreateDialog::set_preferred_search_result_type(const String &p_preferred_type) { + preferred_search_result_type = p_preferred_type; +} + +String CreateDialog::get_preferred_search_result_type() { + + return preferred_search_result_type; +} String CreateDialog::get_selected_type() { TreeItem *selected = search_options->get_selected(); @@ -411,11 +427,6 @@ Object *CreateDialog::instance_selected() { return NULL; } -String CreateDialog::get_base_type() const { - - return base_type; -} - void CreateDialog::_item_selected() { TreeItem *item = search_options->get_selected(); @@ -654,6 +665,7 @@ CreateDialog::CreateDialog() { search_options->connect("cell_selected", this, "_item_selected"); //search_options->set_hide_root(true); base_type = "Object"; + preferred_search_result_type = ""; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); diff --git a/editor/create_dialog.h b/editor/create_dialog.h index a523539ba0..2e4ce9b277 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -53,7 +53,7 @@ class CreateDialog : public ConfirmationDialog { LineEdit *search_box; Tree *search_options; String base_type; - + String preferred_search_result_type; EditorHelpBit *help_bit; void _item_selected(); @@ -93,6 +93,9 @@ public: void set_base_type(const String &p_base); String get_base_type() const; + void set_preferred_search_result_type(const String &p_preferred_type); + String get_preferred_search_result_type(); + void popup_create(bool p_dontclear); CreateDialog(); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 54bf31cd62..5305c4f256 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -409,17 +409,22 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) { void DependencyRemoveDialog::ok_pressed() { - DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + bool changed = false; + for (Map<String, TreeItem *>::Element *E = files.front(); E; E = E->next()) { if (ResourceCache::has(E->key())) { Resource *res = ResourceCache::get(E->key()); res->set_path(""); //clear reference to path } - da->remove(E->key()); - EditorFileSystem::get_singleton()->update_file(E->key()); + String fpath = OS::get_singleton()->get_resource_dir() + E->key().replace_first("res://", "/"); + OS::get_singleton()->move_to_trash(fpath); + changed = true; + } + + if (changed) { + EditorFileSystem::get_singleton()->scan_changes(); } - memdelete(da); } DependencyRemoveDialog::DependencyRemoveDialog() { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index bdd297b56c..de64c11308 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -405,7 +405,6 @@ void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) { Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); bus_popup->set_position(get_global_position() + pos); - bus_popup->set_item_disabled(1, get_index() == 0); bus_popup->popup(); } } @@ -755,8 +754,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { bus_popup = bus_options->get_popup(); bus_popup->add_item(TTR("Duplicate")); - if (!is_master) - bus_popup->add_item(TTR("Delete")); + bus_popup->add_item(TTR("Delete")); + bus_popup->set_item_disabled(1, is_master); bus_popup->add_item(TTR("Reset Volume")); bus_popup->connect("index_pressed", this, "_bus_popup_pressed"); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 8d13153128..b980c4f0ec 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -56,15 +56,15 @@ void EditorFileDialog::_notification(int p_what) { //_update_icons mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons")); mode_list->set_icon(get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons")); - dir_next->set_icon(get_icon("ArrowRight", "EditorIcons")); + dir_prev->set_icon(get_icon("Back", "EditorIcons")); + dir_next->set_icon(get_icon("Forward", "EditorIcons")); dir_up->set_icon(get_icon("ArrowUp", "EditorIcons")); refresh->set_icon(get_icon("Reload", "EditorIcons")); favorite->set_icon(get_icon("Favorites", "EditorIcons")); fav_up->set_icon(get_icon("MoveUp", "EditorIcons")); fav_down->set_icon(get_icon("MoveDown", "EditorIcons")); - fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons")); + fav_rm->set_icon(get_icon("Remove", "EditorIcons")); } else if (p_what == NOTIFICATION_PROCESS) { @@ -97,15 +97,15 @@ void EditorFileDialog::_notification(int p_what) { //_update_icons mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons")); mode_list->set_icon(get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons")); - dir_next->set_icon(get_icon("ArrowRight", "EditorIcons")); + dir_prev->set_icon(get_icon("Back", "EditorIcons")); + dir_next->set_icon(get_icon("Forward", "EditorIcons")); dir_up->set_icon(get_icon("ArrowUp", "EditorIcons")); refresh->set_icon(get_icon("Reload", "EditorIcons")); favorite->set_icon(get_icon("Favorites", "EditorIcons")); fav_up->set_icon(get_icon("MoveUp", "EditorIcons")); fav_down->set_icon(get_icon("MoveDown", "EditorIcons")); - fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons")); + fav_rm->set_icon(get_icon("Remove", "EditorIcons")); update_file_list(); } @@ -1281,6 +1281,7 @@ EditorFileDialog::EditorFileDialog() { dir_prev = memnew(ToolButton); dir_next = memnew(ToolButton); dir_up = memnew(ToolButton); + dir_up->set_tooltip(TTR("Go to parent folder")); pathhb->add_child(dir_prev); pathhb->add_child(dir_next); @@ -1290,6 +1291,8 @@ EditorFileDialog::EditorFileDialog() { dir_next->connect("pressed", this, "_go_forward"); dir_up->connect("pressed", this, "_go_up"); + pathhb->add_child(memnew(Label(TTR("Path:")))); + dir = memnew(LineEdit); pathhb->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1330,9 +1333,9 @@ EditorFileDialog::EditorFileDialog() { makedir->connect("pressed", this, "_make_dir"); pathhb->add_child(makedir); - list_hb = memnew(HBoxContainer); + list_hb = memnew(HSplitContainer); - vbc->add_margin_child(TTR("Path:"), pathhb); + vbc->add_child(pathhb); vbc->add_child(list_hb); list_hb->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 3b22189014..4dc2947292 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -36,6 +36,7 @@ #include "scene/gui/item_list.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" +#include "scene/gui/split_container.h" #include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" /** @@ -92,7 +93,7 @@ private: ItemList *item_list; TextureRect *preview; VBoxContainer *preview_vb; - HBoxContainer *list_hb; + HSplitContainer *list_hb; LineEdit *file; AcceptDialog *mkdirerr; AcceptDialog *exterr; diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 110b2a6a8c..05f9da03e1 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -122,7 +122,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size); //dfd->set_force_autohinter(true); //just looks better..i think? - MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/font_size")) * EDSCALE); + MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/editor/font_size")) * EDSCALE); p_theme->set_default_theme_font(df); @@ -142,7 +142,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { Ref<DynamicFont> df_code; df_code.instance(); - df_code->set_size(int(EditorSettings::get_singleton()->get("interface/source_font_size")) * EDSCALE); + df_code->set_size(int(EditorSettings::get_singleton()->get("interface/editor/source_font_size")) * EDSCALE); df_code->set_font_data(dfmono); MAKE_FALLBACKS(df_code); @@ -168,6 +168,15 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("output_source", "EditorFonts", df_output_code); + Ref<DynamicFont> df_text_editor_status_code; + df_output_code.instance(); + df_output_code->set_size(14 * EDSCALE); + df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); + df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); + df_output_code->set_font_data(dfmono); + MAKE_FALLBACKS(df_output_code); + p_theme->set_font("status_source", "EditorFonts", df_output_code); + //replace default theme Ref<Texture> di; Ref<StyleBox> ds; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f2452df9f0..cb94ea72d1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -650,8 +650,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { // Colors const Color title_color = get_color("accent_color", "Editor"); - const Color text_color = get_color("font_color", "RichTextLabel"); - const Color highlight_color = get_color("highlight_color", "RichTextLabel"); + const Color text_color = get_color("default_color", "RichTextLabel"); + const Color headline_color = get_color("headline_color", "EditorHelp"); const Color base_type_color = title_color.linear_interpolate(text_color, 0.5); const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6); const Color symbol_color = comment_color; @@ -669,7 +669,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_font(doc_title_font); class_desc->push_color(title_color); class_desc->add_text(TTR("Class:") + " "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(p_class); class_desc->pop(); class_desc->pop(); @@ -812,7 +812,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { } class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.properties[i].name); if (describe) { @@ -883,7 +883,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { method_descr = true; class_desc->push_meta("@" + methods[i].name); } - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(methods[i].name); class_desc->pop(); if (methods[i].description != "") @@ -969,7 +969,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_cell(); class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.theme_properties[i].name); class_desc->pop(); class_desc->pop(); @@ -1015,7 +1015,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_font(doc_code_font); // monofont //_add_type("void"); //class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.signals[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1102,7 +1102,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { e = e.get_slice(".", 1); } - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); class_desc->add_text(e); class_desc->pop(); class_desc->pop(); @@ -1117,7 +1117,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { for (int i = 0; i < enum_list.size(); i++) { class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(enum_list[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1165,7 +1165,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { constant_line[constants[i].name] = class_desc->get_line_count() - 2; class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(constants[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1235,7 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { _add_type(cd.properties[i].type, cd.properties[i].enumeration); class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.properties[i].name); class_desc->pop(); //color @@ -1324,7 +1324,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { _add_type(methods[i].return_type, methods[i].return_enum); class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(methods[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1456,7 +1456,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); - Color font_color_hl = p_rt->get_color("highlight_color", "RichTextLabel"); + Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8); String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges(); @@ -1695,9 +1695,6 @@ void EditorHelp::_notification(int p_what) { //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); - class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel")); - class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel")); - } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 21520875cd..a04ded7b5b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -114,7 +114,7 @@ EditorNode *EditorNode::singleton = NULL; void EditorNode::_update_scene_tabs() { - bool show_rb = EditorSettings::get_singleton()->get("interface/show_script_in_scene_tabs"); + bool show_rb = EditorSettings::get_singleton()->get("interface/editor/show_script_in_scene_tabs"); scene_tabs->clear_tabs(); Ref<Texture> script_icon = gui_base->get_icon("Script", "EditorIcons"); @@ -282,8 +282,8 @@ 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/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/capitalize_properties", true))); + 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()); theme_base->set_theme(theme); @@ -308,6 +308,10 @@ void EditorNode::_notification(int p_what) { } _update_scene_tabs(); + // debugger area + if (ScriptEditor::get_singleton()->get_debugger()->is_visible()) + bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + //_update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")); @@ -2240,10 +2244,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case RUN_PROJECT_MANAGER: { if (!p_confirmed) { - bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true); + bool save_each = EDITOR_DEF("interface/editor/save_each_scene_on_quit", true); if (_next_unsaved_scene(!save_each) == -1) { - bool confirm = EDITOR_DEF("interface/quit_confirmation", true); + bool confirm = EDITOR_DEF("interface/editor/quit_confirmation", true); if (confirm) { confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes")); @@ -2568,7 +2572,7 @@ void EditorNode::_editor_select(int p_which) { editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name()); } - if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) { + if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) { if (p_which == EDITOR_SCRIPT) { set_distraction_free_mode(script_distraction); } else { @@ -4062,29 +4066,25 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { ERR_FAIL_INDEX(p_idx, bottom_panel_items.size()); if (p_enable) { - // this is the debug panel wich uses tabs, so the top section should be smaller - if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { - Ref<StyleBoxFlat> style_panel_invisible_top = gui_base->get_stylebox("debugger_panel", "EditorStyles"); - bottom_panel->add_style_override("panel", style_panel_invisible_top); - } else { - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); - } for (int i = 0; i < bottom_panel_items.size(); i++) { bottom_panel_items[i].button->set_pressed(i == p_idx); bottom_panel_items[i].control->set_visible(i == p_idx); } + if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { // this is the debug panel wich uses tabs, so the top section should be smaller + bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + } else { + bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); + } center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE); center_split->set_collapsed(false); } else { bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); - for (int i = 0; i < bottom_panel_items.size(); i++) { bottom_panel_items[i].button->set_pressed(false); bottom_panel_items[i].control->set_visible(false); } - center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); center_split->set_collapsed(true); } @@ -4101,7 +4101,7 @@ bool EditorNode::get_docks_visible() const { void EditorNode::_toggle_distraction_free_mode() { - if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) { + if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) { int screen = -1; for (int i = 0; i < editor_table.size(); i++) { if (editor_plugin_screen == editor_table[i]) { @@ -4385,7 +4385,7 @@ void EditorNode::_open_imported() { void EditorNode::dim_editor(bool p_dimming) { static int dim_count = 0; - bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup"); + bool dim_ui = EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup"); if (p_dimming) { if (dim_ui) { if (dim_count == 0) { @@ -4412,9 +4412,9 @@ void EditorNode::_start_dimming(bool p_dimming) { void EditorNode::_dim_timeout() { _dim_time += _dim_timer->get_wait_time(); - float wait_time = EditorSettings::get_singleton()->get("interface/dim_transition_time"); + float wait_time = EditorSettings::get_singleton()->get("interface/editor/dim_transition_time"); - float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/dim_amount"); + float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/editor/dim_amount"); Color base = _dimming ? Color(1, 1, 1) : Color(c, c, c); Color final = _dimming ? Color(c, c, c) : Color(1, 1, 1); @@ -4586,7 +4586,7 @@ EditorNode::EditorNode() { EditorSettings::create(); { - int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode"); + int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode"); if (dpi_mode == 0) { editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0); } else if (dpi_mode == 1) { @@ -4623,6 +4623,10 @@ EditorNode::EditorNode() { import_wav.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_wav); + Ref<ResourceImporterOBJ> import_obj; + import_obj.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_obj); + Ref<ResourceImporterScene> import_scene; import_scene.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_scene); @@ -4837,7 +4841,7 @@ EditorNode::EditorNode() { scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles")); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_LEFT); - scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY)); + 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)); scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE); scene_tabs->connect("tab_changed", this, "_scene_tab_changed"); scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited"); @@ -5291,7 +5295,7 @@ EditorNode::EditorNode() { property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); property_editor->set_use_doc_hints(true); property_editor->set_hide_script(false); - property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true))); + property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true))); property_editor->hide_top_label(); property_editor->register_text_enter(search_box); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 246599be11..b4460c5619 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -112,8 +112,10 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh> Rect3 rot_aabb = xform.xform(aabb); print_line("rot_aabb: " + rot_aabb); float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5; - if (m == 0) + if (m == 0) { + textures.push_back(Ref<Texture>()); continue; + } m = 1.0 / m; m *= 0.5; print_line("scale: " + rtos(m)); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 325f30a453..1b6b66c198 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -453,7 +453,7 @@ String EditorSettings::get_settings_path() const { void EditorSettings::setup_language() { - String lang = get("interface/editor_language"); + String lang = get("interface/editor/editor_language"); if (lang == "en") return; //none to do @@ -555,32 +555,32 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { best = "en"; } - _initial_set("interface/editor_language", best); - hints["interface/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/editor_language", best); + hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); } - _initial_set("interface/hidpi_mode", 0); - hints["interface/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/show_script_in_scene_tabs", false); - _initial_set("interface/font_size", 14); - hints["interface/font_size"] = PropertyInfo(Variant::INT, "interface/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/source_font_size", 14); - hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/custom_font", ""); - hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/dim_editor_on_dialog_popup", true); - _initial_set("interface/dim_amount", 0.6f); - hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); - _initial_set("interface/dim_transition_time", 0.08f); - hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT); - - _initial_set("interface/separate_distraction_mode", false); - - _initial_set("interface/save_each_scene_on_quit", true); // Regression - _initial_set("interface/quit_confirmation", true); + _initial_set("interface/editor/hidpi_mode", 0); + hints["interface/editor/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/editor/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/show_script_in_scene_tabs", false); + _initial_set("interface/editor/font_size", 14); + hints["interface/editor/font_size"] = PropertyInfo(Variant::INT, "interface/editor/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/source_font_size", 14); + hints["interface/editor/source_font_size"] = PropertyInfo(Variant::INT, "interface/editor/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/custom_font", ""); + hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/dim_editor_on_dialog_popup", true); + _initial_set("interface/editor/dim_amount", 0.6f); + hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); + _initial_set("interface/editor/dim_transition_time", 0.08f); + hints["interface/editor/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/editor/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT); + + _initial_set("interface/editor/separate_distraction_mode", false); + + _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression + _initial_set("interface/editor/quit_confirmation", true); _initial_set("interface/theme/preset", 0); - hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Alien,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/theme/icon_and_font_color", 0); hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/theme/base_color", Color::html("#323b4f")); @@ -610,7 +610,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR); _initial_set("filesystem/directories/default_project_export_path", ""); hints["global/default_project_export_path"] = PropertyInfo(Variant::STRING, "global/default_project_export_path", PROPERTY_HINT_GLOBAL_DIR); - _initial_set("interface/show_script_in_scene_tabs", false); + _initial_set("interface/editor/show_script_in_scene_tabs", false); _initial_set("text_editor/theme/color_theme", "Adaptive"); hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default"); @@ -668,7 +668,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/grid_map/pick_distance", 5000.0); _initial_set("editors/3d/grid_color", Color::html("808080")); - hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("editors/3d/default_fov", 55.0); _initial_set("editors/3d/default_z_near", 0.1); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index b33c36867a..b51fc7c362 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -37,9 +37,9 @@ #include "modules/svg/image_loader_svg.h" #include "time.h" -static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) { +static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) { Ref<StyleBoxTexture> style(memnew(StyleBoxTexture)); - style->set_texture(texture); + style->set_texture(p_texture); style->set_margin_size(MARGIN_LEFT, p_left * EDSCALE); style->set_margin_size(MARGIN_RIGHT, p_right * EDSCALE); style->set_margin_size(MARGIN_BOTTOM, p_botton * EDSCALE); @@ -61,9 +61,9 @@ static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_ return style; } -static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) { +static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) { Ref<StyleBoxFlat> style(memnew(StyleBoxFlat)); - style->set_bg_color(color); + style->set_bg_color(p_color); style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE); style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE); style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE); @@ -71,12 +71,12 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = - return style; } -static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, float grow = 1, bool vertical = false) { +static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1, float p_grow = 1, bool p_vertical = false) { Ref<StyleBoxLine> style(memnew(StyleBoxLine)); - style->set_color(color); - style->set_grow(grow); - style->set_thickness(thickness); - style->set_vertical(vertical); + style->set_color(p_color); + style->set_grow(p_grow); + style->set_thickness(p_thickness); + style->set_vertical(p_vertical); return style; } @@ -86,7 +86,7 @@ static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_ return style; } -Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_scale = EDSCALE, bool force_filter = false) { +Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) { Ref<ImageTexture> icon = memnew(ImageTexture); Ref<Image> img = memnew(Image); @@ -94,9 +94,9 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_ // dumb gizmo check bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo"); - ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, convert_color); + ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, p_convert_color); - if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || force_filter) + if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || p_force_filter) icon->create_from_image(img); // in this case filter really helps else icon->create_from_image(img, 0); @@ -108,11 +108,11 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_ #define ADD_CONVERT_COLOR(dictionary, old_color, new_color) dictionary[Color::html(old_color)] = Color::html(new_color) #endif -void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = true, int p_thumb_size = 32, bool only_thumbs = false) { +void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) { #ifdef SVG_ENABLED Dictionary dark_icon_color_dictionary; - if (!dark_theme) { + if (!p_dark_theme) { //convert color: FROM TO ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e0e0e0", "#4f4f4f"); // common icon color ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffffff", "#000000"); // white @@ -179,7 +179,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary); // generate icons - if (!only_thumbs) + if (!p_only_thumbs) for (int i = 0; i < editor_icons_count; i++) { List<String>::Element *is_exception = exceptions.find(editor_icons_names[i]); if (is_exception) exceptions.erase(is_exception); @@ -195,7 +195,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr int index = editor_bg_thumbs_indices[i]; List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]); if (is_exception) exceptions.erase(is_exception); - Ref<ImageTexture> icon = editor_generate_icon(index, !dark_theme && !is_exception, scale, force_filter); + Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter); p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); } } else { @@ -204,7 +204,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr int index = editor_md_thumbs_indices[i]; List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]); if (is_exception) exceptions.erase(is_exception); - Ref<ImageTexture> icon = editor_generate_icon(index, !dark_theme && !is_exception, scale, force_filter); + Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter); p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); } } @@ -250,7 +250,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { preset_contrast = default_contrast; } break; case 1: { // Grey - preset_accent_color = Color::html("#3e3e3e"); + preset_accent_color = Color::html("#b8e4ff"); preset_base_color = Color::html("#3d3d3d"); preset_contrast = 0.2; } break; @@ -269,6 +269,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { preset_base_color = Color::html("#ffffff"); preset_contrast = 0.08; } break; + case 5: { // Alien + preset_accent_color = Color::html("#1bfe99"); + preset_base_color = Color::html("#2f373f"); + preset_contrast = 0.25; + } default: { // Custom accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#699ce8")); base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f")); @@ -276,7 +281,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { } } - if (preset != 5) { + if (preset != 6) { accent_color = preset_accent_color; base_color = preset_base_color; contrast = preset_contrast; @@ -331,7 +336,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("mono_color", "Editor", mono_color); Color success_color = accent_color.linear_interpolate(Color(0.2, 1, 0.2), 0.6) * 1.2; - Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7); + Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7) * 1.2; Color error_color = accent_color.linear_interpolate(Color(1, 0, 0), 0.8) * 1.7; if (!dark_theme) { // yellow on white themes is a P.I.T.A. @@ -413,32 +418,38 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // style for windows, popups, etc.. Ref<StyleBoxFlat> style_popup = style_default->duplicate(); - style_popup->set_default_margin(MARGIN_LEFT, default_margin_size * EDSCALE * 2); - style_popup->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE * 2); - style_popup->set_default_margin(MARGIN_RIGHT, default_margin_size * EDSCALE * 2); - style_popup->set_default_margin(MARGIN_BOTTOM, default_margin_size * EDSCALE * 2); + const int popup_margin_size = default_margin_size * EDSCALE * 2; + style_popup->set_default_margin(MARGIN_LEFT, popup_margin_size); + style_popup->set_default_margin(MARGIN_TOP, popup_margin_size); + style_popup->set_default_margin(MARGIN_RIGHT, popup_margin_size); + style_popup->set_default_margin(MARGIN_BOTTOM, popup_margin_size); style_popup->set_border_color_all(contrast_color_1); style_popup->set_border_width_all(MAX(EDSCALE, border_width)); const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1); style_popup->set_shadow_color(shadow_color); style_popup->set_shadow_size(4 * EDSCALE); + Ref<StyleBoxLine> style_popup_separator(memnew(StyleBoxLine)); + style_popup_separator->set_color(separator_color); + style_popup_separator->set_grow(popup_margin_size - MAX(EDSCALE, border_width)); + style_popup_separator->set_thickness(MAX(EDSCALE, border_width)); + Ref<StyleBoxEmpty> style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size); // Tabs - const int tab_default_margin_side = 10 * EDSCALE; Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate(); + style_tab_selected->set_border_width_all(border_width); style_tab_selected->set_border_width(MARGIN_BOTTOM, 0); style_tab_selected->set_border_color_all(dark_color_3); style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width); - style_tab_selected->set_default_margin(MARGIN_LEFT, tab_default_margin_side); - style_tab_selected->set_default_margin(MARGIN_RIGHT, tab_default_margin_side); + style_tab_selected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE); + style_tab_selected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE); style_tab_selected->set_bg_color(tab_color); Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate(); - style_tab_unselected->set_bg_color(Color(0.0, 0.0, 0.0, 0.0)); - style_tab_unselected->set_border_color_all(Color(0.0, 0.0, 0.0, 0.0)); + style_tab_unselected->set_draw_center(false); + style_tab_unselected->set_border_width_all(0); // Editor background theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size)); @@ -461,7 +472,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0)); // Play button group - theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4)); + theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //MenuButton Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate(); @@ -556,7 +567,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // PopupMenu Ref<StyleBoxFlat> style_popup_menu = style_popup; theme->set_stylebox("panel", "PopupMenu", style_popup_menu); - theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, MAX(EDSCALE, border_width), 8 - MAX(EDSCALE, border_width))); + theme->set_stylebox("separator", "PopupMenu", style_popup_separator); theme->set_color("font_color", "PopupMenu", font_color); theme->set_color("font_color_hover", "PopupMenu", font_color_hl); theme->set_color("font_color_accel", "PopupMenu", font_color_disabled); @@ -574,23 +585,32 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_tree_bg->set_border_color_all(dark_color_3); theme->set_stylebox("bg", "Tree", style_tree_bg); + const Color guide_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.05); // Tree theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons")); theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons")); + theme->set_icon("select_option", "Tree", theme->get_icon("GuiTreeOption", "EditorIcons")); theme->set_stylebox("bg_focus", "Tree", style_focus); 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_widget); theme->set_color("custom_button_font_highlight", "Tree", font_color_hl); theme->set_color("font_color", "Tree", font_color); - theme->set_color("font_color_selected", "Tree", font_color); + theme->set_color("font_color_selected", "Tree", mono_color); theme->set_color("title_button_color", "Tree", font_color); - theme->set_color("guide_color", "Tree", Color(mono_color.r, mono_color.g, mono_color.b, 0.05)); + theme->set_color("guide_color", "Tree", guide_color); theme->set_color("drop_position_color", "Tree", accent_color); theme->set_constant("vseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE); + theme->set_constant("hseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE); + theme->set_constant("guide_width", "Tree", border_width); + theme->set_constant("item_margin", "Tree", 3 * default_margin_size * EDSCALE); + theme->set_constant("button_margin", "Tree", default_margin_size * EDSCALE); + theme->set_constant("draw_relationship_lines", "Tree", 0); + theme->set_constant("scroll_border", "Tree", default_margin_size * EDSCALE); + theme->set_constant("scroll_speed", "Tree", 12); Ref<StyleBoxFlat> style_tree_btn = style_default->duplicate(); style_tree_btn->set_bg_color(contrast_color_1); @@ -643,8 +663,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("selected", "ItemList", style_tree_selected); theme->set_stylebox("bg_focus", "ItemList", style_focus); theme->set_stylebox("bg", "ItemList", style_itemlist_bg); - theme->set_constant("vseparation", "ItemList", (extra_spacing + default_margin_size) * EDSCALE); theme->set_color("font_color", "ItemList", font_color); + theme->set_color("font_color_selected", "ItemList", mono_color); + theme->set_color("guide_color", "ItemList", guide_color); + theme->set_constant("vseparation", "ItemList", 2); + theme->set_constant("hseparation", "ItemList", 2); + theme->set_constant("icon_margin", "ItemList", default_margin_size * EDSCALE); + theme->set_constant("line_separation", "ItemList", 2 * EDSCALE); // Tabs & TabContainer theme->set_stylebox("tab_fg", "TabContainer", style_tab_selected); @@ -684,33 +709,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("panel", "TabContainer", style_content_panel); theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp); - // Separators (no separators) + // Separators theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width)); theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true)); - // HACK Debuger panel + // Debugger + Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate(); - const int v_offset = theme->get_font("font", "Tabs")->get_height() + style_tab_selected->get_minimum_size().height + default_margin_size * EDSCALE; - style_panel_debugger->set_expand_margin_size(MARGIN_TOP, -v_offset); - theme->set_stylebox("debugger_panel", "EditorStyles", style_panel_debugger); + style_panel_debugger->set_border_width(MARGIN_BOTTOM, 0); + theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); + theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_selected); + theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_unselected); - // Debugger - Ref<StyleBoxFlat> style_debugger_contents = style_content_panel->duplicate(); - style_debugger_contents->set_default_margin(MARGIN_LEFT, 0); - style_debugger_contents->set_default_margin(MARGIN_BOTTOM, 0); - style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0); - style_debugger_contents->set_border_width_all(0); - style_debugger_contents->set_expand_margin_size(MARGIN_TOP, -v_offset); - theme->set_constant("extra_margin", "DebuggerPanel", default_margin_size * EDSCALE + border_width); - theme->set_stylebox("DebuggerPanel", "EditorStyles", style_debugger_contents); - Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab_selected->duplicate(); - style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); - style_tab_fg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE); - theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger); - Ref<StyleBoxFlat> style_tab_bg_debugger = style_tab_unselected->duplicate(); - style_tab_bg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); - style_tab_bg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE); - theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger); + Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate(); + int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height() + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(MARGIN_TOP); + style_panel_invisible_top->set_expand_margin_size(MARGIN_TOP, -stylebox_offset); + theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top); // LineEdit theme->set_stylebox("normal", "LineEdit", style_widget); @@ -809,27 +823,23 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0)); //RichTextLabel - Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a); - Color rtl_mono_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 1.5) ? Color(0, 0, 0) : Color(1, 1, 1); - Color rtl_font_color = rtl_mono_color.linear_interpolate(rtl_combined_bg_color, 0.25); - theme->set_color("default_color", "RichTextLabel", rtl_font_color); + theme->set_color("default_color", "RichTextLabel", font_color); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); - Ref<StyleBoxFlat> style_code = style_tree_bg->duplicate(); - style_code->set_bg_color(rtl_combined_bg_color); - theme->set_stylebox("code_normal", "RichTextLabel", style_code); - Ref<StyleBoxFlat> style_code_focus = style_tree_focus->duplicate(); - style_code_focus->set_bg_color(rtl_combined_bg_color); - theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus); - theme->set_color("font_color", "RichTextLabel", rtl_font_color); - theme->set_color("highlight_color", "RichTextLabel", rtl_mono_color); + theme->set_color("headline_color", "EditorHelp", mono_color); // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); // Label + theme->set_stylebox("normal", "Label", style_empty); theme->set_color("font_color", "Label", font_color); + theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0)); + theme->set_constant("shadow_offset_x", "Label", 1 * EDSCALE); + theme->set_constant("shadow_offset_y", "Label", 1 * EDSCALE); + theme->set_constant("shadow_as_outline", "Label", 0 * EDSCALE); + theme->set_constant("line_spacing", "Label", 3 * EDSCALE); // TooltipPanel Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate(); @@ -868,7 +878,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), gn_margin_side, 24, gn_margin_side, 5); graphsb->set_border_width_all(border_width); graphsb->set_border_color_all(Color(1, 1, 1, 0.9)); - Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), gn_margin_side, 24, gn_margin_side, 5); + Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.6), gn_margin_side, 24, gn_margin_side, 5); graphsbselected->set_border_width_all(border_width); graphsbselected->set_border_color_all(Color(accent_color.r, accent_color.g, accent_color.b, 0.9)); graphsbselected->set_shadow_size(8 * EDSCALE); @@ -879,6 +889,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), gn_margin_side, 24, gn_margin_side, 5); graphsbcommentselected->set_border_width_all(border_width); graphsbcommentselected->set_border_color_all(Color(1, 1, 1, 0.9)); + Ref<StyleBoxFlat> graphsbbreakpoint = graphsbselected->duplicate(); + graphsbbreakpoint->set_draw_center(false); + graphsbbreakpoint->set_border_color_all(warning_color); + graphsbbreakpoint->set_shadow_color(warning_color * Color(1.0, 1.0, 1.0, 0.1)); + Ref<StyleBoxFlat> graphsbposition = graphsbselected->duplicate(); + graphsbposition->set_draw_center(false); + graphsbposition->set_border_color_all(error_color); + graphsbposition->set_shadow_color(error_color * Color(1.0, 1.0, 1.0, 0.2)); if (use_gn_headers) { graphsb->set_border_width(MARGIN_TOP, 24 * EDSCALE); @@ -891,6 +909,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("selectedframe", "GraphNode", graphsbselected); theme->set_stylebox("comment", "GraphNode", graphsbcomment); theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected); + theme->set_stylebox("breakpoint", "GraphNode", graphsbbreakpoint); + theme->set_stylebox("position", "GraphNode", graphsbposition); theme->set_constant("port_offset", "GraphNode", 14 * EDSCALE); theme->set_constant("title_h_offset", "GraphNode", -16 * EDSCALE); theme->set_constant("close_h_offset", "GraphNode", 20 * EDSCALE); @@ -903,8 +923,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("vseperation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE); // FileDialog + theme->set_icon("folder", "FileDialog", theme->get_icon("Folder", "EditorIcons")); theme->set_color("files_disabled", "FileDialog", font_color_disabled); + // color picker + theme->set_constant("margin", "ColorPicker", popup_margin_size); + theme->set_constant("sv_width", "ColorPicker", 256 * EDSCALE); + theme->set_constant("sv_height", "ColorPicker", 256 * EDSCALE); + theme->set_constant("h_width", "ColorPicker", 30 * EDSCALE); + theme->set_constant("label_width", "ColorPicker", 10 * EDSCALE); + theme->set_icon("screen_picker", "ColorPicker", theme->get_icon("ColorPick", "EditorIcons")); + theme->set_icon("add_preset", "ColorPicker", theme->get_icon("Add", "EditorIcons")); + theme->set_icon("preset_bg", "ColorPicker", theme->get_icon("GuiMiniCheckerboard", "EditorIcons")); + + theme->set_icon("bg", "ColorPickerButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons")); + // adaptive script theme constants // for comments and elements with lower relevance const Color dim_color = Color(font_color.r, font_color.g, font_color.b, 0.5); @@ -990,7 +1023,7 @@ Ref<Theme> create_custom_theme() { theme = ResourceLoader::load(custom_theme); } - String global_font = EditorSettings::get_singleton()->get("interface/custom_font"); + String global_font = EditorSettings::get_singleton()->get("interface/editor/custom_font"); if (global_font != "") { Ref<Font> fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 5f9f109a2e..a9d72607b4 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1002,7 +1002,7 @@ void FileSystemDock::_file_option(int p_option) { for (int i = 0; i < files->get_item_count(); i++) { String path = files->get_item_metadata(i); - if (path.ends_with("/") || !files->is_selected(i)) + if (!files->is_selected(i)) continue; torem.push_back(path); } @@ -1466,6 +1466,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) { bool all_scenes = true; bool all_can_reimport = true; + bool is_dir = false; Set<String> types; for (int i = 0; i < files->get_item_count(); i++) { @@ -1481,8 +1482,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) { } if (path.ends_with("/")) { - //no operate on dirs - return; + is_dir = true; } int pos; @@ -1513,17 +1513,19 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) { file_options->add_separator(); - if (filenames.size() == 1) { + if (filenames.size() == 1 && !is_dir) { file_options->add_item(TTR("Edit Dependencies.."), FILE_DEPENDENCIES); file_options->add_item(TTR("View Owners.."), FILE_OWNERS); file_options->add_separator(); } - if (filenames.size() == 1) { - file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH); - file_options->add_item(TTR("Rename or Move.."), FILE_MOVE); - } else { - file_options->add_item(TTR("Move To.."), FILE_MOVE); + if (!is_dir) { + if (filenames.size() == 1) { + file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH); + file_options->add_item(TTR("Rename or Move.."), FILE_MOVE); + } else { + file_options->add_item(TTR("Move To.."), FILE_MOVE); + } } file_options->add_item(TTR("Delete"), FILE_REMOVE); diff --git a/editor/icons/icon_2_d.svg b/editor/icons/icon_2_d.svg index b77c330bff..dcc22a579e 100644 --- a/editor/icons/icon_2_d.svg +++ b/editor/icons/icon_2_d.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m3.9844 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-6.5859v-6.5859l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> -</g> +<path d="m3.9844 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-6.5859v-6.5859l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </svg> diff --git a/editor/icons/icon_3_d.svg b/editor/icons/icon_3_d.svg index 91d3abf60d..2b89b0fbbe 100644 --- a/editor/icons/icon_3_d.svg +++ b/editor/icons/icon_3_d.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m3.9902 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.72266 -0.29102 1 1 0 0 0 -0.69141 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-5.1719l5.5859-5.5859v0.41602a1 1 0 0 0 1 1 1 1 0 0 0 1 -1v-2.8301a1.0001 1.0001 0 0 0 -1 -1h-2.8301a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h0.41602l-5.5859 5.5859v-5.1719l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> -</g> +<path d="m3.9902 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.72266 -0.29102 1 1 0 0 0 -0.69141 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-5.1719l5.5859-5.5859v0.41602a1 1 0 0 0 1 1 1 1 0 0 0 1 -1v-2.8301a1.0001 1.0001 0 0 0 -1 -1h-2.8301a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h0.41602l-5.5859 5.5859v-5.1719l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </svg> diff --git a/editor/icons/icon_GUI_h_tick.svg b/editor/icons/icon_GUI_h_tick.svg new file mode 100644 index 0000000000..5aa799deb0 --- /dev/null +++ b/editor/icons/icon_GUI_h_tick.svg @@ -0,0 +1,3 @@ +<svg width="4" height="16" version="1.1" viewBox="0 0 4 15.999999" xmlns="http://www.w3.org/2000/svg"> +<circle cx="2" cy="2" r="1" fill="#fff" fill-opacity=".39216"/> +</svg> diff --git a/editor/icons/icon_mini_checkerboard.svg b/editor/icons/icon_GUI_mini_checkerboard.svg index e740113b2d..e740113b2d 100644 --- a/editor/icons/icon_mini_checkerboard.svg +++ b/editor/icons/icon_GUI_mini_checkerboard.svg diff --git a/editor/icons/icon_GUI_tree_option.svg b/editor/icons/icon_GUI_tree_option.svg new file mode 100644 index 0000000000..4200745a78 --- /dev/null +++ b/editor/icons/icon_GUI_tree_option.svg @@ -0,0 +1,5 @@ +<svg width="14" height="14" version="1.1" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -1038.4)"> +<path transform="translate(0 1038.4)" d="m7.5 1a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm0 5a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm0 5a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5z" fill="#fff" fill-opacity=".58824" stroke-linejoin="round" stroke-opacity=".39216" stroke-width="2"/> +</g> +</svg> diff --git a/editor/icons/icon_GUI_v_tick.svg b/editor/icons/icon_GUI_v_tick.svg new file mode 100644 index 0000000000..87b5656927 --- /dev/null +++ b/editor/icons/icon_GUI_v_tick.svg @@ -0,0 +1,5 @@ +<svg width="16" height="4" version="1.1" viewBox="0 0 16 3.9999998" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0,-12)"> +<circle cx="2" cy="14" r="1" fill="#fff" fill-opacity=".39216"/> +</g> +</svg> diff --git a/editor/icons/icon_accept_dialog.svg b/editor/icons/icon_accept_dialog.svg index 331b88dd74..b65f58b35e 100644 --- a/editor/icons/icon_accept_dialog.svg +++ b/editor/icons/icon_accept_dialog.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.8954-2 2v1h14v-1c0-1.1046-0.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#a5efac"/> -</g> +<path d="m3 1c-1.1046 0-2 0.8954-2 2v1h14v-1c0-1.1046-0.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#a5efac"/> </svg> diff --git a/editor/icons/icon_add.svg b/editor/icons/icon_add.svg index 685e6e82e8..3b7e9b8fc1 100644 --- a/editor/icons/icon_add.svg +++ b/editor/icons/icon_add.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6h-2z" fill="#e0e0e0"/> -</g> +<path d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6h-2z" fill="#e0e0e0"/> </svg> diff --git a/editor/icons/icon_node_warning.svg b/editor/icons/icon_node_warning.svg index 66663f7d62..8a1a3bd2ea 100644 --- a/editor/icons/icon_node_warning.svg +++ b/editor/icons/icon_node_warning.svg @@ -1,7 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<g transform="translate(0 -1.6949e-5)"> -<path transform="translate(0 1036.4)" d="m8.0293 2.002a1.0001 1.0001 0 0 0 -0.88672 0.48438l-6 10a1.0001 1.0001 0 0 0 0.85742 1.5137h12a1.0001 1.0001 0 0 0 0.85742 -1.5137l-6-10a1.0001 1.0001 0 0 0 -0.82812 -0.48438zm-1.0293 2.998h2v5h-2v-5zm0 6h2v2h-2v-2z" color="#000000" color-rendering="auto" fill="#ffdd65" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="block-progression:tb;isolation:auto;mix-blend-mode:normal;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/> -</g> -</g> +<path d="m8.0293 2.002a1.0001 1.0001 0 0 0 -0.88672 0.48438l-6 10a1.0001 1.0001 0 0 0 0.85742 1.5137h12a1.0001 1.0001 0 0 0 0.85742 -1.5137l-6-10a1.0001 1.0001 0 0 0 -0.82812 -0.48438zm-1.0293 2.998h2v5h-2v-5zm0 6h2v2h-2v-2z" color="#000000" color-rendering="auto" fill="#ffdd65" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="block-progression:tb;isolation:auto;mix-blend-mode:normal;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/> </svg> diff --git a/editor/icons/icon_status_error.svg b/editor/icons/icon_status_error.svg index 4da9471835..072964b02d 100644 --- a/editor/icons/icon_status_error.svg +++ b/editor/icons/icon_status_error.svg @@ -1,7 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<g transform="translate(0 -1.6949e-5)"> -<path transform="translate(0 1036.4)" d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm-2.8281 2.7578l2.8281 2.8281 2.8281-2.8281 1.4141 1.4141-2.8281 2.8281 2.8281 2.8281-1.4141 1.4141-2.8281-2.8281-2.8281 2.8281-1.4141-1.4141 2.8281-2.8281-2.8281-2.8281 1.4141-1.4141z" fill="#ff5d5d"/> -</g> -</g> +<path d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm-2.8281 2.7578l2.8281 2.8281 2.8281-2.8281 1.4141 1.4141-2.8281 2.8281 2.8281 2.8281-1.4141 1.4141-2.8281-2.8281-2.8281 2.8281-1.4141-1.4141 2.8281-2.8281-2.8281-2.8281 1.4141-1.4141z" fill="#ff5d5d"/> </svg> diff --git a/editor/icons/icon_status_success.svg b/editor/icons/icon_status_success.svg index 6a6e2d6d30..d1ddc08579 100644 --- a/editor/icons/icon_status_success.svg +++ b/editor/icons/icon_status_success.svg @@ -1,7 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<g transform="translate(0 -1.6949e-5)"> -<path transform="translate(0 1036.4)" d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm3.293 3.877 1.4141 1.4141-5.707 5.709-3.707-3.709 1.4141-1.4141 2.293 2.293z" fill="#45ff8b"/> -</g> -</g> +<path d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm3.293 3.877 1.4141 1.4141-5.707 5.709-3.707-3.709 1.4141-1.4141 2.293 2.293z" fill="#45ff8b"/> </svg> diff --git a/editor/icons/icon_status_warning.svg b/editor/icons/icon_status_warning.svg index f92021379d..28364bb274 100644 --- a/editor/icons/icon_status_warning.svg +++ b/editor/icons/icon_status_warning.svg @@ -1,7 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<g transform="translate(0 -1.6949e-5)"> -<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 2h2v7h-2v-7zm0 8h2v2h-2v-2z" fill="#ffdd65"/> -</g> -</g> +<path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 2h2v7h-2v-7zm0 8h2v2h-2v-2z" fill="#ffdd65"/> </svg> diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 6a936649c3..4541c77085 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -40,12 +40,8 @@ uint32_t EditorOBJImporter::get_import_flags() const { return IMPORT_SCENE; } -void EditorOBJImporter::get_extensions(List<String> *r_extensions) const { - r_extensions->push_back("obj"); -} - -Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) { +static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); @@ -134,7 +130,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } @@ -149,7 +145,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } @@ -164,7 +160,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } } else if (l.begins_with("map_bump ")) { @@ -179,7 +175,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true); current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } } else if (f->eof_reached()) { @@ -190,28 +186,16 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin return OK; } -Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - if (r_err) { - *r_err = ERR_CANT_OPEN; - } - - ERR_FAIL_COND_V(!f, NULL); - - if (r_err) { - *r_err = OK; - } - - Spatial *scene = memnew(Spatial); + ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); Ref<ArrayMesh> mesh; mesh.instance(); - Map<String, Ref<Material> > name_map; - - bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS; + bool generate_tangents = p_generate_tangents; bool flip_faces = false; //bool flip_faces = p_options["force/flip_faces"]; //bool force_smooth = p_options["force/smooth_shading"]; @@ -239,7 +223,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in if (l.begins_with("v ")) { //vertex Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); Vector3 vtx; vtx.x = v[1].to_float(); vtx.y = v[2].to_float(); @@ -248,7 +232,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } else if (l.begins_with("vt ")) { //uv Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 3, NULL); + ERR_FAIL_COND_V(v.size() < 3, ERR_FILE_CORRUPT); Vector2 uv; uv.x = v[1].to_float(); uv.y = 1.0 - v[2].to_float(); @@ -257,7 +241,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } else if (l.begins_with("vn ")) { //normal Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); Vector3 nrm; nrm.x = v[1].to_float(); nrm.y = v[2].to_float(); @@ -267,19 +251,19 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in //vertex Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); //not very fast, could be sped up Vector<String> face[3]; face[0] = v[1].split("/"); face[1] = v[2].split("/"); - ERR_FAIL_COND_V(face[0].size() == 0, NULL); - ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL); + ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_FILE_CORRUPT); for (int i = 2; i < v.size() - 1; i++) { face[2] = v[i + 1].split("/"); - ERR_FAIL_COND_V(face[0].size() != face[2].size(), NULL); + ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT); for (int j = 0; j < 3; j++) { int idx = j; @@ -292,7 +276,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in int norm = face[idx][2].to_int() - 1; if (norm < 0) norm += normals.size() + 1; - ERR_FAIL_INDEX_V(norm, normals.size(), NULL); + ERR_FAIL_INDEX_V(norm, normals.size(), ERR_FILE_CORRUPT); surf_tool->add_normal(normals[norm]); } @@ -300,14 +284,14 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in int uv = face[idx][1].to_int() - 1; if (uv < 0) uv += uvs.size() + 1; - ERR_FAIL_INDEX_V(uv, uvs.size(), NULL); + ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_FILE_CORRUPT); surf_tool->add_uv(uvs[uv]); } int vtx = face[idx][0].to_int() - 1; if (vtx < 0) vtx += vertices.size() + 1; - ERR_FAIL_INDEX_V(vtx, vertices.size(), NULL); + ERR_FAIL_INDEX_V(vtx, vertices.size(), ERR_FILE_CORRUPT); Vector3 vertex = vertices[vtx]; //if (weld_vertices) @@ -359,16 +343,13 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in if (l.begins_with("o ") || f->eof_reached()) { - MeshInstance *mi = memnew(MeshInstance); - mi->set_name(name); - mi->set_mesh(mesh); - - scene->add_child(mi); - mi->set_owner(scene); - - mesh.instance(); - current_group = ""; - current_material = ""; + if (!p_single_mesh) { + mesh->set_name(name); + r_meshes.push_back(mesh); + mesh.instance(); + current_group = ""; + current_material = ""; + } } if (f->eof_reached()) { @@ -406,16 +387,40 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } } - /* - TODO, check existing materials and merge? - //re-apply materials if exist - for(int i=0;i<mesh->get_surface_count();i++) { + if (p_single_mesh) { + + r_meshes.push_back(mesh); + } + + return OK; +} + +Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { + + List<Ref<Mesh> > meshes; + + Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, r_missing_deps); + + if (err != OK) { + if (r_err) { + *r_err = err; + } + return NULL; + } + + Spatial *scene = memnew(Spatial); + + for (List<Ref<Mesh> >::Element *E = meshes.front(); E; E = E->next()) { + + MeshInstance *mi = memnew(MeshInstance); + mi->set_name(E->get()->get_name()); + scene->add_child(mi); + mi->set_owner(scene); + } - String n = mesh->surface_get_name(i); - if (name_map.has(n)) - mesh->surface_set_material(i,name_map[n]); + if (r_err) { + *r_err = OK; } -*/ return scene; } @@ -423,5 +428,68 @@ Ref<Animation> EditorOBJImporter::import_animation(const String &p_path, uint32_ return Ref<Animation>(); } + +void EditorOBJImporter::get_extensions(List<String> *r_extensions) const { + + r_extensions->push_back("obj"); +} + EditorOBJImporter::EditorOBJImporter() { } +//////////////////////////////////////////////////// + +String ResourceImporterOBJ::get_importer_name() const { + return "wavefront_obj"; +} +String ResourceImporterOBJ::get_visible_name() const { + return "OBJ As Mesh"; +} +void ResourceImporterOBJ::get_recognized_extensions(List<String> *p_extensions) const { + + p_extensions->push_back("obj"); +} +String ResourceImporterOBJ::get_save_extension() const { + return "mesh"; +} +String ResourceImporterOBJ::get_resource_type() const { + return "Mesh"; +} + +int ResourceImporterOBJ::get_preset_count() const { + return 0; +} +String ResourceImporterOBJ::get_preset_name(int p_idx) const { + return ""; +} + +void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options, int p_preset) const { + + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true)); +} +bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { + + return true; +} + +Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) { + + List<Ref<Mesh> > meshes; + + Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], NULL); + + ERR_FAIL_COND_V(err != OK, err); + ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG); + + String save_path = p_save_path + ".mesh"; + + err = ResourceSaver::save(save_path, meshes.front()->get()); + + ERR_FAIL_COND_V(err != OK, err); + + r_gen_files->push_back(save_path); + + return OK; +} + +ResourceImporterOBJ::ResourceImporterOBJ() { +} diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index 247d58e148..7eeceeabbe 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -36,8 +36,6 @@ class EditorOBJImporter : public EditorSceneImporter { GDCLASS(EditorOBJImporter, EditorSceneImporter); - Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps); - public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; @@ -47,4 +45,24 @@ public: EditorOBJImporter(); }; +class ResourceImporterOBJ : public ResourceImporter { + GDCLASS(ResourceImporterOBJ, ResourceImporter) +public: + virtual String get_importer_name() const; + virtual String get_visible_name() const; + virtual void get_recognized_extensions(List<String> *p_extensions) const; + virtual String get_save_extension() const; + virtual String get_resource_type() const; + + virtual int get_preset_count() const; + virtual String get_preset_name(int p_idx) const; + + virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; + virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; + + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL); + + ResourceImporterOBJ(); +}; + #endif // RESOURCEIMPORTEROBJ_H diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ff9cef6218..1aa24c8172 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1219,50 +1219,26 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event) if (b->get_button_index() == BUTTON_WHEEL_DOWN) { // Scroll or pan down if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) { - v_scroll->set_value(v_scroll->get_value() + int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor()); - + _update_scroll(0); + viewport->update(); } else { - - if (zoom < MIN_ZOOM) - return; - - float prev_zoom = zoom; - zoom = zoom * (1 - (0.05 * b->get_factor())); - { - Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()); - ofs = ofs / prev_zoom - ofs / zoom; - h_scroll->set_value(h_scroll->get_value() + ofs.x); - v_scroll->set_value(v_scroll->get_value() + ofs.y); - } + _zoom_on_position(zoom * (1 - (0.05 * b->get_factor())), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position())); } - _update_scroll(0); - viewport->update(); return; } if (b->get_button_index() == BUTTON_WHEEL_UP) { // Scroll or pan up if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) { - v_scroll->set_value(v_scroll->get_value() - int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor()); - + _update_scroll(0); + viewport->update(); } else { - if (zoom > MAX_ZOOM) return; - - float prev_zoom = zoom; - zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95); - { - Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()); - ofs = ofs / prev_zoom - ofs / zoom; - h_scroll->set_value(h_scroll->get_value() + ofs.x); - v_scroll->set_value(v_scroll->get_value() + ofs.y); - } + _zoom_on_position(zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position())); } - _update_scroll(0); - viewport->update(); return; } @@ -2668,13 +2644,13 @@ void CanvasItemEditor::_draw_viewport() { all_group = false; } else { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_lock_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) { all_locked = false; break; } } for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_group_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) { all_group = false; break; } @@ -2704,6 +2680,7 @@ void CanvasItemEditor::_draw_viewport() { over_plugin_list->forward_draw_over_canvas(transform, viewport); } _draw_focus(); + _draw_bones(); } void CanvasItemEditor::_notification(int p_what) { @@ -3068,31 +3045,32 @@ void CanvasItemEditor::_set_full_rect() { undo_redo->commit_action(); } -void CanvasItemEditor::_zoom_minus() { - if (zoom < MIN_ZOOM) +void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) { + if (p_zoom < MIN_ZOOM || p_zoom > MAX_ZOOM) return; - zoom /= 2.0; + + float prev_zoom = zoom; + zoom = p_zoom; + Point2 ofs = p_position; + ofs = ofs / prev_zoom - ofs / zoom; + h_scroll->set_value(h_scroll->get_value() + ofs.x); + v_scroll->set_value(v_scroll->get_value() + ofs.y); _update_scroll(0); viewport->update(); viewport_base->update(); } +void CanvasItemEditor::_zoom_minus() { + _zoom_on_position(zoom / 2.0, viewport_scrollable->get_size() / 2.0); +} + void CanvasItemEditor::_zoom_reset() { - zoom = 1; - _update_scroll(0); - viewport->update(); - viewport_base->update(); + _zoom_on_position(1.0, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_zoom_plus() { - if (zoom > MAX_ZOOM) - return; - - zoom *= 2.0; - _update_scroll(0); - viewport->update(); - viewport_base->update(); + _zoom_on_position(zoom * 2.0, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_toggle_snap(bool p_status) { @@ -4181,7 +4159,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_property(child, property, texture); // make visible for certain node type - if (default_type == "Patch9Rect") { + if (default_type == "NinePatchRect") { editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size); } else if (default_type == "Polygon2D") { PoolVector<Vector2> list; @@ -4199,7 +4177,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & } Transform2D trans = canvas->get_canvas_transform(); Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos; - if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") { + if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") { target_position -= texture_size / 2; } // there's nothing to be used as source position so snapping will work as absolute if enabled @@ -4275,7 +4253,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { child = memnew(TouchScreenButton); else if (default_type == "TextureRect") child = memnew(TextureRect); - else if (default_type == "Patch9Rect") + else if (default_type == "NinePatchRect") child = memnew(NinePatchRect); else child = memnew(Sprite); // default @@ -4437,7 +4415,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TouchScreenButton"); // Control types.push_back("TextureRect"); - types.push_back("Patch9Rect"); + types.push_back("NinePatchRect"); target_node = NULL; editor = p_node; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index af834507e0..bb4e584f2a 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -387,6 +387,7 @@ class CanvasItemEditor : public VBoxContainer { void _set_anchors_preset(Control::LayoutPreset p_preset); void _set_full_rect(); + void _zoom_on_position(float p_zoom, Point2 p_position = Point2()); void _zoom_minus(); void _zoom_reset(); void _zoom_plus(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 47443b81ce..b66e9598f9 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1557,11 +1557,7 @@ ScriptTextEditor::ScriptTextEditor() { static ScriptEditorBase *create_editor(const Ref<Script> &p_script) { - if (p_script->has_source_code()) { - return memnew(ScriptTextEditor); - } - - return NULL; + return memnew(ScriptTextEditor); } void ScriptTextEditor::register_editor() { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 3370ce51fd..0a7f3ff8f9 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -907,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) { } bool TextureRegionEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); + return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index c679b44342..1a767dad05 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1418,7 +1418,7 @@ ProjectManager::ProjectManager() { EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came { - int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode"); + int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode"); if (dpi_mode == 0) { editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0); } else if (dpi_mode == 1) { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 7697e2deb6..47ebf49c43 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -3538,14 +3538,14 @@ void PropertyEditor::_draw_transparency(Object *t, const Rect2 &p_rect) { return; Color color = obj->get(ti->get_metadata(1)); - Ref<Texture> arrow = tree->get_icon("select_arrow"); + Ref<Texture> arrow = tree->get_icon("select_option"); // make a little space between consecutive color fields Rect2 area = p_rect; area.position.y += 1; area.size.height -= 2; area.size.width -= arrow->get_size().width + 5; - tree->draw_texture_rect(get_icon("Transparent", "EditorIcons"), area, true); + tree->draw_texture_rect(get_icon("GuiMiniCheckerboard", "EditorIcons"), area, true); tree->draw_rect(area, color); } @@ -4257,7 +4257,7 @@ PropertyEditor::PropertyEditor() { use_filter = false; subsection_selectable = false; property_selectable = false; - show_type_icons = EDITOR_DEF("interface/show_type_icons", false); + show_type_icons = EDITOR_DEF("interface/editor/show_type_icons", false); } PropertyEditor::~PropertyEditor() { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2fcba7e3c0..f3e59932c4 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -270,6 +270,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { switch (p_tool) { case TOOL_NEW: { + + String preferred = ""; + Node *current_edited_scene_root = EditorNode::get_singleton()->get_edited_scene(); + + if (current_edited_scene_root) { + + if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Node2D")) + preferred = "Node2D"; + else if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Spatial")) + preferred = "Spatial"; + } + create_dialog->set_preferred_search_result_type(preferred); create_dialog->popup_create(true); } break; case TOOL_INSTANCE: { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 5ca20f6235..5ad4674f7f 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1045,6 +1045,8 @@ void ScriptEditorDebugger::_notification(int p_what) { tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles")); tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles")); + tabs->set_margin(MARGIN_LEFT, -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + tabs->set_margin(MARGIN_RIGHT, EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); } break; } } @@ -1622,7 +1624,10 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles")); tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles")); + tabs->set_anchors_and_margins_preset(Control::PRESET_WIDE); + tabs->set_margin(MARGIN_LEFT, -editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + tabs->set_margin(MARGIN_RIGHT, editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); add_child(tabs); { //debugger diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index aada90173a..5f6ffcb14e 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -59,7 +59,7 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) { if (full_name == "text_editor/theme/color_theme") { property_editor->get_property_editor()->update_tree(); } else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") { - EditorSettings::get_singleton()->set_manually("interface/theme/preset", 5); // set preset to Custom + EditorSettings::get_singleton()->set_manually("interface/theme/preset", 6); // set preset to Custom } } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 450c9f4b3c..3c1889e829 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -744,7 +744,7 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vec } //min_p = p_arc_xform.affine_inverse().xform(min_p); - float a = Vector2(min_p.x, -min_p.z).angle(); + float a = (Math_PI * 0.5) - Vector2(min_p.x, -min_p.z).angle(); return a * 180.0 / Math_PI; } @@ -893,7 +893,7 @@ void LightSpatialGizmo::redraw() { if (Object::cast_to<SpotLight>(light)) { - Ref<Material> material = create_material("light_spot_material", gizmo_color, true); + Ref<Material> material = create_material("light_spot_material", gizmo_color); Ref<Material> icon = create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_icon("GizmoSpotLight", "EditorIcons")); clear(); |