diff options
Diffstat (limited to 'editor')
23 files changed, 555 insertions, 359 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index e36d0b846b..2f33619a52 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1723,15 +1723,15 @@ void AnimationTimelineEdit::update_values() { switch (animation->get_loop_mode()) { case Animation::LoopMode::LOOP_NONE: { - loop->set_icon(get_theme_icon("Loop", "EditorIcons")); + loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons"))); loop->set_pressed(false); } break; case Animation::LoopMode::LOOP_LINEAR: { - loop->set_icon(get_theme_icon("Loop", "EditorIcons")); + loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons"))); loop->set_pressed(true); } break; case Animation::LoopMode::LOOP_PINGPONG: { - loop->set_icon(get_theme_icon("PingPongLoop", "EditorIcons")); + loop->set_icon(get_theme_icon(SNAME("PingPongLoop"), SNAME("EditorIcons"))); loop->set_pressed(true); } break; default: @@ -4516,7 +4516,7 @@ void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { zoom_icon->set_texture(get_theme_icon(SNAME("Zoom"), SNAME("EditorIcons"))); snap->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); - view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); + view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons"))); selected_filter->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons"))); imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons"))); main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); @@ -5493,8 +5493,8 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { String text; Ref<Texture2D> icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons")); if (node) { - if (has_theme_icon(node->get_class(), "EditorIcons")) { - icon = get_theme_icon(node->get_class(), "EditorIcons"); + if (has_theme_icon(node->get_class(), SNAME("EditorIcons"))) { + icon = get_theme_icon(node->get_class(), SNAME("EditorIcons")); } text = node->get_name(); @@ -5907,7 +5907,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) { void AnimationTrackEditor::_view_group_toggle() { _update_tracks(); - view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); + view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons"))); } bool AnimationTrackEditor::is_grouping_tracks() { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 967f7e0d1f..2627baaea8 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -884,8 +884,8 @@ Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp Ref<Texture2D> tex; switch (p_option.kind) { case ScriptCodeCompletionOption::KIND_CLASS: { - if (has_theme_icon(p_option.display, "EditorIcons")) { - tex = get_theme_icon(p_option.display, "EditorIcons"); + if (has_theme_icon(p_option.display, SNAME("EditorIcons"))) { + tex = get_theme_icon(p_option.display, SNAME("EditorIcons")); } else { tex = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 7c54558cd0..8efcd60210 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -988,8 +988,8 @@ void ConnectionsDock::update_tree() { name = scr->get_class(); } - if (has_theme_icon(scr->get_class(), "EditorIcons")) { - icon = get_theme_icon(scr->get_class(), "EditorIcons"); + if (has_theme_icon(scr->get_class(), SNAME("EditorIcons"))) { + icon = get_theme_icon(scr->get_class(), SNAME("EditorIcons")); } } } else { diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 79853b6809..4b6a11f388 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -500,7 +500,7 @@ void EditorDebuggerNode::set_breakpoint(const String &p_path, int p_line, bool p dbg->set_breakpoint(p_path, p_line, p_enabled); }); - emit_signal("breakpoint_toggled", p_path, p_line, p_enabled); + emit_signal(SNAME("breakpoint_toggled"), p_path, p_line, p_enabled); } void EditorDebuggerNode::set_breakpoints(const String &p_path, Array p_lines) { diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index ee844fff64..6aedfa6ccb 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -497,7 +497,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da TreeItem *error = error_tree->create_item(r); error->set_collapsed(true); - error->set_icon(0, get_theme_icon(oe.warning ? "Warning" : "Error", "EditorIcons")); + error->set_icon(0, get_theme_icon(oe.warning ? SNAME("Warning") : SNAME("Error"), SNAME("EditorIcons"))); error->set_text(0, time); error->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT); @@ -888,12 +888,12 @@ void ScriptEditorDebugger::_clear_execution() { void ScriptEditorDebugger::_set_breakpoint(const String &p_file, const int &p_line, const bool &p_enabled) { Ref<Script> script = ResourceLoader::load(p_file); - emit_signal("set_breakpoint", script, p_line - 1, p_enabled); + emit_signal(SNAME("set_breakpoint"), script, p_line - 1, p_enabled); script.unref(); } void ScriptEditorDebugger::_clear_breakpoints() { - emit_signal("clear_breakpoints"); + emit_signal(SNAME("clear_breakpoints")); } void ScriptEditorDebugger::_breakpoint_tree_clicked() { diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 9bdfb66235..632d67c061 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -404,9 +404,9 @@ Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const { Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme(); ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>()); if (EditorNode::get_singleton()->get_main_control()->is_layout_rtl()) { - return theme->get_icon("PlayBackwards", "EditorIcons"); + return theme->get_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")); } else { - return theme->get_icon("Play", "EditorIcons"); + return theme->get_icon(SNAME("Play"), SNAME("EditorIcons")); } } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 96c0f3a209..e80e9c43b0 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -45,19 +45,19 @@ DocTools *EditorHelp::doc = nullptr; void EditorHelp::_update_theme() { - text_color = get_theme_color("text_color", "EditorHelp"); - title_color = get_theme_color("title_color", "EditorHelp"); - headline_color = get_theme_color("headline_color", "EditorHelp"); - comment_color = get_theme_color("comment_color", "EditorHelp"); - symbol_color = get_theme_color("symbol_color", "EditorHelp"); - value_color = get_theme_color("value_color", "EditorHelp"); - qualifier_color = get_theme_color("qualifier_color", "EditorHelp"); - type_color = get_theme_color("type_color", "EditorHelp"); - - class_desc->add_theme_color_override("selection_color", get_theme_color("selection_color", "EditorHelp")); - class_desc->add_theme_constant_override("line_separation", get_theme_constant("line_separation", "EditorHelp")); - class_desc->add_theme_constant_override("table_hseparation", get_theme_constant("table_hseparation", "EditorHelp")); - class_desc->add_theme_constant_override("table_vseparation", get_theme_constant("table_vseparation", "EditorHelp")); + text_color = get_theme_color(SNAME("text_color"), SNAME("EditorHelp")); + title_color = get_theme_color(SNAME("title_color"), SNAME("EditorHelp")); + headline_color = get_theme_color(SNAME("headline_color"), SNAME("EditorHelp")); + comment_color = get_theme_color(SNAME("comment_color"), SNAME("EditorHelp")); + symbol_color = get_theme_color(SNAME("symbol_color"), SNAME("EditorHelp")); + value_color = get_theme_color(SNAME("value_color"), SNAME("EditorHelp")); + qualifier_color = get_theme_color(SNAME("qualifier_color"), SNAME("EditorHelp")); + type_color = get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); + + class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("selection_color"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("line_separation", get_theme_constant(SNAME("line_separation"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("table_hseparation", get_theme_constant(SNAME("table_hseparation"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("table_vseparation", get_theme_constant(SNAME("table_vseparation"), SNAME("EditorHelp"))); doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 19da6686a5..36d3ac9e66 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -529,8 +529,8 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_ TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) { Ref<Texture2D> icon = empty_icon; - if (ui_service->has_theme_icon(p_doc->name, "EditorIcons")) { - icon = ui_service->get_theme_icon(p_doc->name, "EditorIcons"); + if (ui_service->has_theme_icon(p_doc->name, SNAME("EditorIcons"))) { + icon = ui_service->get_theme_icon(p_doc->name, SNAME("EditorIcons")); } else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object")) { icon = ui_service->get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 425b1fc98d..29d1752578 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1441,11 +1441,11 @@ void EditorInspectorArray::_add_button_pressed() { } void EditorInspectorArray::_first_page_button_pressed() { - emit_signal("page_change_request", 0); + emit_signal(SNAME("page_change_request"), 0); } void EditorInspectorArray::_prev_page_button_pressed() { - emit_signal("page_change_request", MAX(0, page - 1)); + emit_signal(SNAME("page_change_request"), MAX(0, page - 1)); } void EditorInspectorArray::_page_line_edit_text_submitted(String p_text) { @@ -1453,18 +1453,18 @@ void EditorInspectorArray::_page_line_edit_text_submitted(String p_text) { int new_page = p_text.to_int() - 1; new_page = MIN(MAX(0, new_page), max_page); page_line_edit->set_text(Variant(new_page)); - emit_signal("page_change_request", new_page); + emit_signal(SNAME("page_change_request"), new_page); } else { page_line_edit->set_text(Variant(page)); } } void EditorInspectorArray::_next_page_button_pressed() { - emit_signal("page_change_request", MIN(max_page, page + 1)); + emit_signal(SNAME("page_change_request"), MIN(max_page, page + 1)); } void EditorInspectorArray::_last_page_button_pressed() { - emit_signal("page_change_request", max_page); + emit_signal(SNAME("page_change_request"), max_page); } void EditorInspectorArray::_rmb_popup_id_pressed(int p_id) { @@ -1532,7 +1532,7 @@ void EditorInspectorArray::_vbox_visibility_changed() { void EditorInspectorArray::_panel_draw(int p_index) { ERR_FAIL_INDEX(p_index, (int)array_elements.size()); - Ref<StyleBox> style = get_theme_stylebox("Focus", "EditorStyles"); + Ref<StyleBox> style = get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles")); if (!style.is_valid()) { return; } @@ -1636,12 +1636,12 @@ void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) { // Handle page change and update counts. if (p_element_index < 0) { int added_index = p_to_pos < 0 ? count : p_to_pos; - emit_signal("page_change_request", added_index / page_lenght); + emit_signal(SNAME("page_change_request"), added_index / page_lenght); count += 1; } else if (p_to_pos < 0) { count -= 1; if (page == max_page && (MAX(0, count - 1) / page_lenght != max_page)) { - emit_signal("page_change_request", max_page - 1); + emit_signal(SNAME("page_change_request"), max_page - 1); } } begin_array_index = page * page_lenght; @@ -1689,7 +1689,7 @@ void EditorInspectorArray::_clear_array() { undo_redo->commit_action(); // Handle page change and update counts. - emit_signal("page_change_request", 0); + emit_signal(SNAME("page_change_request"), 0); count = 0; begin_array_index = 0; end_array_index = 0; @@ -1762,7 +1762,7 @@ void EditorInspectorArray::_resize_array(int p_size) { undo_redo->commit_action(); // Handle page change and update counts. - emit_signal("page_change_request", 0); + emit_signal(SNAME("page_change_request"), 0); /* count = 0; begin_array_index = 0; @@ -1889,7 +1889,7 @@ void EditorInspectorArray::_setup() { ae.margin = memnew(MarginContainer); ae.margin->set_mouse_filter(MOUSE_FILTER_PASS); if (is_inside_tree()) { - Size2 min_size = get_theme_stylebox("Focus", "EditorStyles")->get_minimum_size(); + Size2 min_size = get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles"))->get_minimum_size(); ae.margin->add_theme_constant_override("margin_left", min_size.x / 2); ae.margin->add_theme_constant_override("margin_top", min_size.y / 2); ae.margin->add_theme_constant_override("margin_right", min_size.x / 2); @@ -1988,7 +1988,7 @@ void EditorInspectorArray::_notification(int p_what) { ArrayElement &ae = array_elements[i]; ae.move_texture_rect->set_texture(get_theme_icon(SNAME("TripleBar"), SNAME("EditorIcons"))); - Size2 min_size = get_theme_stylebox("Focus", "EditorStyles")->get_minimum_size(); + Size2 min_size = get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles"))->get_minimum_size(); ae.margin->add_theme_constant_override("margin_left", min_size.x / 2); ae.margin->add_theme_constant_override("margin_top", min_size.y / 2); ae.margin->add_theme_constant_override("margin_right", min_size.x / 2); @@ -2903,7 +2903,7 @@ void EditorInspector::edit(Object *p_object) { object->connect("property_list_changed", callable_mp(this, &EditorInspector::_changed_callback)); update_tree(); } - emit_signal("edited_object_changed"); + emit_signal(SNAME("edited_object_changed")); } void EditorInspector::set_keying(bool p_active) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c9417ee57c..bf7e463559 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -726,8 +726,8 @@ void EditorNode::_notification(int p_what) { if (icon.is_valid()) { tb->set_icon(icon); - } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) { - tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), "EditorIcons")); + } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))) { + tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))); } } @@ -747,11 +747,11 @@ void EditorNode::_notification(int p_what) { // clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons")); don't have access to that node. needs to become a class property if (gui_base->is_layout_rtl()) { - dock_tab_move_left->set_icon(theme->get_icon("Forward", "EditorIcons")); - dock_tab_move_right->set_icon(theme->get_icon("Back", "EditorIcons")); + dock_tab_move_left->set_icon(theme->get_icon(SNAME("Forward"), SNAME("EditorIcons"))); + dock_tab_move_right->set_icon(theme->get_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); - dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); + dock_tab_move_left->set_icon(theme->get_icon(SNAME("Back"), SNAME("EditorIcons"))); + dock_tab_move_right->set_icon(theme->get_icon(SNAME("Forward"), SNAME("EditorIcons"))); } PopupMenu *p = help_menu->get_popup(); @@ -3180,8 +3180,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed Ref<Texture2D> icon = p_editor->get_icon(); if (icon.is_valid()) { tb->set_icon(icon); - } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) { - tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), "EditorIcons")); + } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))) { + tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))); } tb->add_theme_font_override("font", singleton->gui_base->get_theme_font(SNAME("main_button_font"), SNAME("EditorFonts"))); @@ -4032,8 +4032,8 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String return p_object->get_meta("_editor_icon"); } - if (gui_base->has_theme_icon(p_object->get_class(), "EditorIcons")) { - return gui_base->get_theme_icon(p_object->get_class(), "EditorIcons"); + if (gui_base->has_theme_icon(p_object->get_class(), SNAME("EditorIcons"))) { + return gui_base->get_theme_icon(p_object->get_class(), SNAME("EditorIcons")); } if (p_fallback.length()) { @@ -4062,7 +4062,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p } if (icon.is_null()) { - icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(name), "EditorIcons"); + icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(name), SNAME("EditorIcons")); } } @@ -5604,7 +5604,7 @@ void EditorNode::_update_rendering_driver_color() { if (rendering_driver->get_text() == "opengl3") { rendering_driver->add_theme_color_override("font_color", Color::hex(0x5586a4ff)); } else if (rendering_driver->get_text() == "vulkan") { - rendering_driver->add_theme_color_override("font_color", theme_base->get_theme_color("vulkan_color", "Editor")); + rendering_driver->add_theme_color_override("font_color", theme_base->get_theme_color(SNAME("vulkan_color"), SNAME("Editor"))); } } @@ -6147,9 +6147,9 @@ EditorNode::EditorNode() { dock_tab_move_left = memnew(Button); dock_tab_move_left->set_flat(true); if (gui_base->is_layout_rtl()) { - dock_tab_move_left->set_icon(theme->get_icon("Forward", "EditorIcons")); + dock_tab_move_left->set_icon(theme->get_icon(SNAME("Forward"), SNAME("EditorIcons"))); } else { - dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); + dock_tab_move_left->set_icon(theme->get_icon(SNAME("Back"), SNAME("EditorIcons"))); } dock_tab_move_left->set_focus_mode(Control::FOCUS_NONE); dock_tab_move_left->connect("pressed", callable_mp(this, &EditorNode::_dock_move_left)); @@ -6164,9 +6164,9 @@ EditorNode::EditorNode() { dock_tab_move_right = memnew(Button); dock_tab_move_right->set_flat(true); if (gui_base->is_layout_rtl()) { - dock_tab_move_right->set_icon(theme->get_icon("Back", "EditorIcons")); + dock_tab_move_right->set_icon(theme->get_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); + dock_tab_move_right->set_icon(theme->get_icon(SNAME("Forward"), SNAME("EditorIcons"))); } dock_tab_move_right->set_focus_mode(Control::FOCUS_NONE); dock_tab_move_right->connect("pressed", callable_mp(this, &EditorNode::_dock_move_right)); @@ -6637,8 +6637,8 @@ EditorNode::EditorNode() { rendering_driver->set_flat(true); rendering_driver->set_focus_mode(Control::FOCUS_NONE); rendering_driver->connect("item_selected", callable_mp(this, &EditorNode::_rendering_driver_selected)); - rendering_driver->add_theme_font_override("font", gui_base->get_theme_font("bold", "EditorFonts")); - rendering_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size("bold_size", "EditorFonts")); + rendering_driver->add_theme_font_override("font", gui_base->get_theme_font(SNAME("bold"), SNAME("EditorFonts"))); + rendering_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"))); right_menu_hb->add_child(rendering_driver); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 308a268e42..2a5fefda20 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -280,9 +280,9 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = } // These ones should be converted even if we are using a dark theme. - const Color error_color = p_theme->get_color("error_color", "Editor"); - const Color success_color = p_theme->get_color("success_color", "Editor"); - const Color warning_color = p_theme->get_color("warning_color", "Editor"); + const Color error_color = p_theme->get_color(SNAME("error_color"), SNAME("Editor")); + const Color success_color = p_theme->get_color(SNAME("success_color"), SNAME("Editor")); + const Color warning_color = p_theme->get_color(SNAME("warning_color"), SNAME("Editor")); dark_icon_color_dictionary[Color::html("#ff5f5f")] = error_color; dark_icon_color_dictionary[Color::html("#5fff97")] = success_color; dark_icon_color_dictionary[Color::html("#ffdd65")] = warning_color; @@ -299,7 +299,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = const int is_exception = exceptions.has(editor_icons_names[i]); const Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception, EDSCALE, saturation, dark_icon_color_dictionary); - p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon); + p_theme->set_icon(editor_icons_names[i], SNAME("EditorIcons"), icon); } } @@ -313,7 +313,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = const int is_exception = exceptions.has(editor_icons_names[index]); const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter, dark_icon_color_dictionary); - p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); + p_theme->set_icon(editor_icons_names[index], SNAME("EditorIcons"), icon); } } else { const float scale = (float)p_thumb_size / 32.0 * EDSCALE; @@ -322,7 +322,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = const bool is_exception = exceptions.has(editor_icons_names[index]); const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter, dark_icon_color_dictionary); - p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); + p_theme->set_icon(editor_icons_names[index], SNAME("EditorIcons"), icon); } } #else @@ -444,7 +444,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color highlight_color = Color(accent_color.r, accent_color.g, accent_color.b, 0.275); const Color disabled_highlight_color = highlight_color.lerp(dark_theme ? Color(0, 0, 0) : Color(1, 1, 1), 0.5); - float prev_icon_saturation = theme->has_color("icon_saturation", "Editor") ? theme->get_color("icon_saturation", "Editor").r : 1.0; + float prev_icon_saturation = theme->has_color(SNAME("icon_saturation"), SNAME("Editor")) ? theme->get_color(SNAME("icon_saturation"), SNAME("Editor")).r : 1.0; theme->set_color("icon_saturation", "Editor", Color(icon_saturation, icon_saturation, icon_saturation)); // can't save single float in theme, so using color theme->set_color("accent_color", "Editor", accent_color); @@ -502,16 +502,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Register icons + font // The resolution and the icon color (dark_theme bool) has not changed, so we do not regenerate the icons. - if (p_theme != nullptr && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme && prev_icon_saturation == icon_saturation) { + if (p_theme != nullptr && fabs(p_theme->get_constant(SNAME("scale"), SNAME("Editor")) - EDSCALE) < 0.00001 && (bool)p_theme->get_constant(SNAME("dark_theme"), SNAME("Editor")) == dark_theme && prev_icon_saturation == icon_saturation) { // Register already generated icons. for (int i = 0; i < editor_icons_count; i++) { - theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons")); + theme->set_icon(editor_icons_names[i], SNAME("EditorIcons"), p_theme->get_icon(editor_icons_names[i], SNAME("EditorIcons"))); } } else { editor_register_and_generate_icons(theme, dark_theme, thumb_size, false, icon_saturation); } // Thumbnail size has changed, so we regenerate the medium sizes - if (p_theme != nullptr && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) { + if (p_theme != nullptr && fabs((double)p_theme->get_constant(SNAME("thumb_size"), SNAME("Editor")) - thumb_size) > 0.00001) { editor_register_and_generate_icons(p_theme, dark_theme, thumb_size, true); } @@ -708,7 +708,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("font_disabled_color", "OptionButton", font_disabled_color); theme->set_color("icon_hover_color", "OptionButton", icon_hover_color); theme->set_color("icon_focus_color", "OptionButton", icon_focus_color); - theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons")); + theme->set_icon("arrow", "OptionButton", theme->get_icon(SNAME("GuiOptionArrow"), SNAME("EditorIcons"))); theme->set_constant("arrow_margin", "OptionButton", widget_default_margin.x - 2 * EDSCALE); theme->set_constant("modulate_arrow", "OptionButton", true); theme->set_constant("hseparation", "OptionButton", 4 * EDSCALE); @@ -719,15 +719,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("disabled", "CheckButton", style_menu); theme->set_stylebox("hover", "CheckButton", style_menu); - theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons")); - theme->set_icon("on_disabled", "CheckButton", theme->get_icon("GuiToggleOnDisabled", "EditorIcons")); - theme->set_icon("off", "CheckButton", theme->get_icon("GuiToggleOff", "EditorIcons")); - theme->set_icon("off_disabled", "CheckButton", theme->get_icon("GuiToggleOffDisabled", "EditorIcons")); + theme->set_icon("on", "CheckButton", theme->get_icon(SNAME("GuiToggleOn"), SNAME("EditorIcons"))); + theme->set_icon("on_disabled", "CheckButton", theme->get_icon(SNAME("GuiToggleOnDisabled"), SNAME("EditorIcons"))); + theme->set_icon("off", "CheckButton", theme->get_icon(SNAME("GuiToggleOff"), SNAME("EditorIcons"))); + theme->set_icon("off_disabled", "CheckButton", theme->get_icon(SNAME("GuiToggleOffDisabled"), SNAME("EditorIcons"))); - theme->set_icon("on_mirrored", "CheckButton", theme->get_icon("GuiToggleOnMirrored", "EditorIcons")); - theme->set_icon("on_disabled_mirrored", "CheckButton", theme->get_icon("GuiToggleOnDisabledMirrored", "EditorIcons")); - theme->set_icon("off_mirrored", "CheckButton", theme->get_icon("GuiToggleOffMirrored", "EditorIcons")); - theme->set_icon("off_disabled_mirrored", "CheckButton", theme->get_icon("GuiToggleOffDisabledMirrored", "EditorIcons")); + theme->set_icon("on_mirrored", "CheckButton", theme->get_icon(SNAME("GuiToggleOnMirrored"), SNAME("EditorIcons"))); + theme->set_icon("on_disabled_mirrored", "CheckButton", theme->get_icon(SNAME("GuiToggleOnDisabledMirrored"), SNAME("EditorIcons"))); + theme->set_icon("off_mirrored", "CheckButton", theme->get_icon(SNAME("GuiToggleOffMirrored"), SNAME("EditorIcons"))); + theme->set_icon("off_disabled_mirrored", "CheckButton", theme->get_icon(SNAME("GuiToggleOffDisabledMirrored"), SNAME("EditorIcons"))); theme->set_color("font_color", "CheckButton", font_color); theme->set_color("font_hover_color", "CheckButton", font_hover_color); @@ -751,14 +751,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("pressed", "CheckBox", sb_checkbox); theme->set_stylebox("disabled", "CheckBox", sb_checkbox); theme->set_stylebox("hover", "CheckBox", sb_checkbox); - theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons")); - theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons")); - theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons")); - theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); - theme->set_icon("checked_disabled", "CheckBox", theme->get_icon("GuiCheckedDisabled", "EditorIcons")); - theme->set_icon("unchecked_disabled", "CheckBox", theme->get_icon("GuiUncheckedDisabled", "EditorIcons")); - theme->set_icon("radio_checked_disabled", "CheckBox", theme->get_icon("GuiRadioCheckedDisabled", "EditorIcons")); - theme->set_icon("radio_unchecked_disabled", "CheckBox", theme->get_icon("GuiRadioUncheckedDisabled", "EditorIcons")); + theme->set_icon("checked", "CheckBox", theme->get_icon(SNAME("GuiChecked"), SNAME("EditorIcons"))); + theme->set_icon("unchecked", "CheckBox", theme->get_icon(SNAME("GuiUnchecked"), SNAME("EditorIcons"))); + theme->set_icon("radio_checked", "CheckBox", theme->get_icon(SNAME("GuiRadioChecked"), SNAME("EditorIcons"))); + theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon(SNAME("GuiRadioUnchecked"), SNAME("EditorIcons"))); + theme->set_icon("checked_disabled", "CheckBox", theme->get_icon(SNAME("GuiCheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("unchecked_disabled", "CheckBox", theme->get_icon(SNAME("GuiUncheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("radio_checked_disabled", "CheckBox", theme->get_icon(SNAME("GuiRadioCheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("radio_unchecked_disabled", "CheckBox", theme->get_icon(SNAME("GuiRadioUncheckedDisabled"), SNAME("EditorIcons"))); theme->set_color("font_color", "CheckBox", font_color); theme->set_color("font_hover_color", "CheckBox", font_hover_color); @@ -803,19 +803,19 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("font_accelerator_color", "PopupMenu", font_disabled_color); theme->set_color("font_disabled_color", "PopupMenu", font_disabled_color); theme->set_color("font_separator_color", "PopupMenu", font_disabled_color); - theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); - theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); - theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiRadioChecked", "EditorIcons")); - theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); - theme->set_icon("checked_disabled", "PopupMenu", theme->get_icon("GuiCheckedDisabled", "EditorIcons")); - theme->set_icon("unchecked_disabled", "PopupMenu", theme->get_icon("GuiUncheckedDisabled", "EditorIcons")); - theme->set_icon("radio_checked_disabled", "PopupMenu", theme->get_icon("GuiRadioCheckedDisabled", "EditorIcons")); - theme->set_icon("radio_unchecked_disabled", "PopupMenu", theme->get_icon("GuiRadioUncheckedDisabled", "EditorIcons")); - theme->set_icon("submenu", "PopupMenu", theme->get_icon("ArrowRight", "EditorIcons")); - theme->set_icon("submenu_mirrored", "PopupMenu", theme->get_icon("ArrowLeft", "EditorIcons")); - theme->set_icon("visibility_hidden", "PopupMenu", theme->get_icon("GuiVisibilityHidden", "EditorIcons")); - theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon("GuiVisibilityVisible", "EditorIcons")); - theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon("GuiVisibilityXray", "EditorIcons")); + theme->set_icon("checked", "PopupMenu", theme->get_icon(SNAME("GuiChecked"), SNAME("EditorIcons"))); + theme->set_icon("unchecked", "PopupMenu", theme->get_icon(SNAME("GuiUnchecked"), SNAME("EditorIcons"))); + theme->set_icon("radio_checked", "PopupMenu", theme->get_icon(SNAME("GuiRadioChecked"), SNAME("EditorIcons"))); + theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon(SNAME("GuiRadioUnchecked"), SNAME("EditorIcons"))); + theme->set_icon("checked_disabled", "PopupMenu", theme->get_icon(SNAME("GuiCheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("unchecked_disabled", "PopupMenu", theme->get_icon(SNAME("GuiUncheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("radio_checked_disabled", "PopupMenu", theme->get_icon(SNAME("GuiRadioCheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("radio_unchecked_disabled", "PopupMenu", theme->get_icon(SNAME("GuiRadioUncheckedDisabled"), SNAME("EditorIcons"))); + theme->set_icon("submenu", "PopupMenu", theme->get_icon(SNAME("ArrowRight"), SNAME("EditorIcons"))); + theme->set_icon("submenu_mirrored", "PopupMenu", theme->get_icon(SNAME("ArrowLeft"), SNAME("EditorIcons"))); + theme->set_icon("visibility_hidden", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons"))); + theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons"))); + theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityXray"), SNAME("EditorIcons"))); theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE); theme->set_constant("item_start_padding", "PopupMenu", popup_menu_margin_size * EDSCALE); @@ -888,14 +888,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("bg", "Tree", style_tree_bg); // Tree - theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons")); - theme->set_icon("indeterminate", "Tree", theme->get_icon("GuiIndeterminate", "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("arrow_collapsed_mirrored", "Tree", theme->get_icon("GuiTreeArrowLeft", "EditorIcons")); - theme->set_icon("updown", "Tree", theme->get_icon("GuiTreeUpdown", "EditorIcons")); - theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons")); + theme->set_icon("checked", "Tree", theme->get_icon(SNAME("GuiChecked"), SNAME("EditorIcons"))); + theme->set_icon("indeterminate", "Tree", theme->get_icon(SNAME("GuiIndeterminate"), SNAME("EditorIcons"))); + theme->set_icon("unchecked", "Tree", theme->get_icon(SNAME("GuiUnchecked"), SNAME("EditorIcons"))); + theme->set_icon("arrow", "Tree", theme->get_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons"))); + theme->set_icon("arrow_collapsed", "Tree", theme->get_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons"))); + theme->set_icon("arrow_collapsed_mirrored", "Tree", theme->get_icon(SNAME("GuiTreeArrowLeft"), SNAME("EditorIcons"))); + theme->set_icon("updown", "Tree", theme->get_icon(SNAME("GuiTreeUpdown"), SNAME("EditorIcons"))); + theme->set_icon("select_arrow", "Tree", theme->get_icon(SNAME("GuiDropdown"), SNAME("EditorIcons"))); theme->set_stylebox("bg_focus", "Tree", style_widget_focus); theme->set_stylebox("custom_button", "Tree", make_empty_stylebox()); theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox()); @@ -1012,21 +1012,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("font_unselected_color", "TabContainer", font_disabled_color); theme->set_color("font_selected_color", "TabBar", font_color); theme->set_color("font_unselected_color", "TabBar", font_disabled_color); - theme->set_icon("menu", "TabContainer", theme->get_icon("GuiTabMenu", "EditorIcons")); - theme->set_icon("menu_highlight", "TabContainer", theme->get_icon("GuiTabMenuHl", "EditorIcons")); + theme->set_icon("menu", "TabContainer", theme->get_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons"))); + theme->set_icon("menu_highlight", "TabContainer", theme->get_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); theme->set_stylebox("SceneTabFG", "EditorStyles", style_tab_selected); theme->set_stylebox("SceneTabBG", "EditorStyles", style_tab_unselected); - theme->set_icon("close", "TabBar", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_icon("close", "TabBar", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons"))); theme->set_stylebox("button_pressed", "TabBar", style_menu); theme->set_stylebox("button_highlight", "TabBar", style_menu); - theme->set_icon("increment", "TabContainer", theme->get_icon("GuiScrollArrowRight", "EditorIcons")); - theme->set_icon("decrement", "TabContainer", theme->get_icon("GuiScrollArrowLeft", "EditorIcons")); - theme->set_icon("increment", "TabBar", theme->get_icon("GuiScrollArrowRight", "EditorIcons")); - theme->set_icon("decrement", "TabBar", theme->get_icon("GuiScrollArrowLeft", "EditorIcons")); - theme->set_icon("increment_highlight", "TabBar", theme->get_icon("GuiScrollArrowRightHl", "EditorIcons")); - theme->set_icon("decrement_highlight", "TabBar", theme->get_icon("GuiScrollArrowLeftHl", "EditorIcons")); - theme->set_icon("increment_highlight", "TabContainer", theme->get_icon("GuiScrollArrowRightHl", "EditorIcons")); - theme->set_icon("decrement_highlight", "TabContainer", theme->get_icon("GuiScrollArrowLeftHl", "EditorIcons")); + theme->set_icon("increment", "TabContainer", theme->get_icon(SNAME("GuiScrollArrowRight"), SNAME("EditorIcons"))); + theme->set_icon("decrement", "TabContainer", theme->get_icon(SNAME("GuiScrollArrowLeft"), SNAME("EditorIcons"))); + theme->set_icon("increment", "TabBar", theme->get_icon(SNAME("GuiScrollArrowRight"), SNAME("EditorIcons"))); + theme->set_icon("decrement", "TabBar", theme->get_icon(SNAME("GuiScrollArrowLeft"), SNAME("EditorIcons"))); + theme->set_icon("increment_highlight", "TabBar", theme->get_icon(SNAME("GuiScrollArrowRightHl"), SNAME("EditorIcons"))); + theme->set_icon("decrement_highlight", "TabBar", theme->get_icon(SNAME("GuiScrollArrowLeftHl"), SNAME("EditorIcons"))); + theme->set_icon("increment_highlight", "TabContainer", theme->get_icon(SNAME("GuiScrollArrowRightHl"), SNAME("EditorIcons"))); + theme->set_icon("decrement_highlight", "TabContainer", theme->get_icon(SNAME("GuiScrollArrowLeftHl"), SNAME("EditorIcons"))); theme->set_constant("hseparation", "TabBar", 4 * EDSCALE); // Content of each tab @@ -1079,7 +1079,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate(); - int stylebox_offset = theme->get_font("tab_selected", "TabContainer")->get_height(theme->get_font_size("tab_selected", "TabContainer")) + theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height + theme->get_stylebox(SNAME("panel"), SNAME("TabContainer"))->get_default_margin(SIDE_TOP); + int stylebox_offset = theme->get_font(SNAME("tab_selected"), SNAME("TabContainer"))->get_height(theme->get_font_size(SNAME("tab_selected"), SNAME("TabContainer"))) + theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height + theme->get_stylebox(SNAME("panel"), SNAME("TabContainer"))->get_default_margin(SIDE_TOP); style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset); style_panel_invisible_top->set_default_margin(SIDE_TOP, 0); theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top); @@ -1105,7 +1105,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("normal", "LineEdit", style_line_edit); theme->set_stylebox("focus", "LineEdit", style_widget_focus); theme->set_stylebox("read_only", "LineEdit", style_line_edit_disabled); - theme->set_icon("clear", "LineEdit", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_icon("clear", "LineEdit", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons"))); theme->set_color("read_only", "LineEdit", font_disabled_color); theme->set_color("font_color", "LineEdit", font_color); theme->set_color("font_selected_color", "LineEdit", mono_color); @@ -1121,8 +1121,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("focus", "TextEdit", style_widget_focus); theme->set_stylebox("read_only", "TextEdit", style_line_edit_disabled); theme->set_constant("side_margin", "TabContainer", 0); - theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons")); - theme->set_icon("space", "TextEdit", theme->get_icon("GuiSpace", "EditorIcons")); + theme->set_icon("tab", "TextEdit", theme->get_icon(SNAME("GuiTab"), SNAME("EditorIcons"))); + theme->set_icon("space", "TextEdit", theme->get_icon(SNAME("GuiSpace"), SNAME("EditorIcons"))); theme->set_color("font_color", "TextEdit", font_color); theme->set_color("font_readonly_color", "TextEdit", font_readonly_color); theme->set_color("font_placeholder_color", "TextEdit", font_placeholder_color); @@ -1131,25 +1131,25 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE); // CodeEdit - theme->set_font("font", "CodeEdit", theme->get_font("source", "EditorFonts")); - theme->set_font_size("font_size", "CodeEdit", theme->get_font_size("source_size", "EditorFonts")); + theme->set_font("font", "CodeEdit", theme->get_font(SNAME("source"), SNAME("EditorFonts"))); + theme->set_font_size("font_size", "CodeEdit", theme->get_font_size(SNAME("source_size"), SNAME("EditorFonts"))); theme->set_stylebox("normal", "CodeEdit", style_widget); theme->set_stylebox("focus", "CodeEdit", style_widget_hover); theme->set_stylebox("read_only", "CodeEdit", style_widget_disabled); - theme->set_icon("tab", "CodeEdit", theme->get_icon("GuiTab", "EditorIcons")); - theme->set_icon("space", "CodeEdit", theme->get_icon("GuiSpace", "EditorIcons")); - theme->set_icon("folded", "CodeEdit", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); - theme->set_icon("can_fold", "CodeEdit", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); - theme->set_icon("executing_line", "CodeEdit", theme->get_icon("MainPlay", "EditorIcons")); - theme->set_icon("breakpoint", "CodeEdit", theme->get_icon("Breakpoint", "EditorIcons")); + theme->set_icon("tab", "CodeEdit", theme->get_icon(SNAME("GuiTab"), SNAME("EditorIcons"))); + theme->set_icon("space", "CodeEdit", theme->get_icon(SNAME("GuiSpace"), SNAME("EditorIcons"))); + theme->set_icon("folded", "CodeEdit", theme->get_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons"))); + theme->set_icon("can_fold", "CodeEdit", theme->get_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons"))); + theme->set_icon("executing_line", "CodeEdit", theme->get_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); + theme->set_icon("breakpoint", "CodeEdit", theme->get_icon(SNAME("Breakpoint"), SNAME("EditorIcons"))); theme->set_constant("line_spacing", "CodeEdit", EDITOR_DEF("text_editor/appearance/whitespace/line_spacing", 6)); // H/VSplitContainer - theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1)); - theme->set_stylebox("bg", "HSplitContainer", make_stylebox(theme->get_icon("GuiHsplitBg", "EditorIcons"), 1, 1, 1, 1)); + theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon(SNAME("GuiVsplitBg"), SNAME("EditorIcons")), 1, 1, 1, 1)); + theme->set_stylebox("bg", "HSplitContainer", make_stylebox(theme->get_icon(SNAME("GuiHsplitBg"), SNAME("EditorIcons")), 1, 1, 1, 1)); - theme->set_icon("grabber", "VSplitContainer", theme->get_icon("GuiVsplitter", "EditorIcons")); - theme->set_icon("grabber", "HSplitContainer", theme->get_icon("GuiHsplitter", "EditorIcons")); + theme->set_icon("grabber", "VSplitContainer", theme->get_icon(SNAME("GuiVsplitter"), SNAME("EditorIcons"))); + theme->set_icon("grabber", "HSplitContainer", theme->get_icon(SNAME("GuiHsplitter"), SNAME("EditorIcons"))); theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE); theme->set_constant("separation", "VSplitContainer", default_margin_size * 2 * EDSCALE); @@ -1187,14 +1187,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("embedded_border", "Window", style_window); theme->set_color("title_color", "Window", font_color); - theme->set_icon("close", "Window", theme->get_icon("GuiClose", "EditorIcons")); - theme->set_icon("close_pressed", "Window", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_icon("close", "Window", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons"))); + theme->set_icon("close_pressed", "Window", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons"))); theme->set_constant("close_h_ofs", "Window", 22 * EDSCALE); theme->set_constant("close_v_ofs", "Window", 20 * EDSCALE); theme->set_constant("title_height", "Window", 24 * EDSCALE); theme->set_constant("resize_margin", "Window", 4 * EDSCALE); - theme->set_font("title_font", "Window", theme->get_font("title", "EditorFonts")); - theme->set_font_size("title_font_size", "Window", theme->get_font_size("title_size", "EditorFonts")); + theme->set_font("title_font", "Window", theme->get_font(SNAME("title"), SNAME("EditorFonts"))); + theme->set_font_size("title_font_size", "Window", theme->get_font_size(SNAME("title_size"), SNAME("EditorFonts"))); // Complex window (currently only Editor Settings and Project Settings) Ref<StyleBoxFlat> style_complex_window = style_window->duplicate(); @@ -1210,11 +1210,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // HScrollBar Ref<Texture2D> empty_icon = memnew(ImageTexture); - theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); - theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); - theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); - theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2)); - theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); + theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2)); + theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_icon("increment", "HScrollBar", empty_icon); theme->set_icon("increment_highlight", "HScrollBar", empty_icon); @@ -1224,11 +1224,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("decrement_pressed", "HScrollBar", empty_icon); // VScrollBar - theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); - theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); - theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); - theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2)); - theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); + theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2)); + theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_icon("increment", "VScrollBar", empty_icon); theme->set_icon("increment_highlight", "VScrollBar", empty_icon); @@ -1238,15 +1238,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("decrement_pressed", "VScrollBar", empty_icon); // HSlider - theme->set_icon("grabber_highlight", "HSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); - theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); + theme->set_icon("grabber_highlight", "HSlider", theme->get_icon(SNAME("GuiSliderGrabberHl"), SNAME("EditorIcons"))); + theme->set_icon("grabber", "HSlider", theme->get_icon(SNAME("GuiSliderGrabber"), SNAME("EditorIcons"))); theme->set_stylebox("slider", "HSlider", make_flat_stylebox(dark_color_3, 0, default_margin_size / 2, 0, default_margin_size / 2, corner_width)); theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2, corner_width)); theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2)); // VSlider - theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); - theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); + theme->set_icon("grabber", "VSlider", theme->get_icon(SNAME("GuiSliderGrabber"), SNAME("EditorIcons"))); + theme->set_icon("grabber_highlight", "VSlider", theme->get_icon(SNAME("GuiSliderGrabberHl"), SNAME("EditorIcons"))); theme->set_stylebox("slider", "VSlider", make_flat_stylebox(dark_color_3, default_margin_size / 2, 0, default_margin_size / 2, 0, corner_width)); theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0, corner_width)); theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0)); @@ -1315,12 +1315,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("panel", "PopupPanel", style_popup); // SpinBox - theme->set_icon("updown", "SpinBox", theme->get_icon("GuiSpinboxUpdown", "EditorIcons")); - theme->set_icon("updown_disabled", "SpinBox", theme->get_icon("GuiSpinboxUpdownDisabled", "EditorIcons")); + theme->set_icon("updown", "SpinBox", theme->get_icon(SNAME("GuiSpinboxUpdown"), SNAME("EditorIcons"))); + theme->set_icon("updown_disabled", "SpinBox", theme->get_icon(SNAME("GuiSpinboxUpdownDisabled"), SNAME("EditorIcons"))); // ProgressBar - theme->set_stylebox("bg", "ProgressBar", make_stylebox(theme->get_icon("GuiProgressBar", "EditorIcons"), 4, 4, 4, 4, 0, 0, 0, 0)); - theme->set_stylebox("fg", "ProgressBar", make_stylebox(theme->get_icon("GuiProgressFill", "EditorIcons"), 6, 6, 6, 6, 2, 1, 2, 1)); + theme->set_stylebox("bg", "ProgressBar", make_stylebox(theme->get_icon(SNAME("GuiProgressBar"), SNAME("EditorIcons")), 4, 4, 4, 4, 0, 0, 0, 0)); + theme->set_stylebox("fg", "ProgressBar", make_stylebox(theme->get_icon(SNAME("GuiProgressFill"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 1, 2, 1)); theme->set_color("font_color", "ProgressBar", font_color); // GraphEdit @@ -1332,15 +1332,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("grid_major", "GraphEdit", Color(0.0, 0.0, 0.0, 0.15)); theme->set_color("grid_minor", "GraphEdit", Color(0.0, 0.0, 0.0, 0.07)); } - theme->set_color("selection_fill", "GraphEdit", theme->get_color("box_selection_fill_color", "Editor")); - theme->set_color("selection_stroke", "GraphEdit", theme->get_color("box_selection_stroke_color", "Editor")); + theme->set_color("selection_fill", "GraphEdit", theme->get_color(SNAME("box_selection_fill_color"), SNAME("Editor"))); + theme->set_color("selection_stroke", "GraphEdit", theme->get_color(SNAME("box_selection_stroke_color"), SNAME("Editor"))); theme->set_color("activity", "GraphEdit", accent_color); - theme->set_icon("minus", "GraphEdit", theme->get_icon("ZoomLess", "EditorIcons")); - theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons")); - theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons")); - theme->set_icon("snap", "GraphEdit", theme->get_icon("SnapGrid", "EditorIcons")); - theme->set_icon("minimap", "GraphEdit", theme->get_icon("GridMinimap", "EditorIcons")); - theme->set_icon("layout", "GraphEdit", theme->get_icon("GridLayout", "EditorIcons")); + theme->set_icon("minus", "GraphEdit", theme->get_icon(SNAME("ZoomLess"), SNAME("EditorIcons"))); + theme->set_icon("more", "GraphEdit", theme->get_icon(SNAME("ZoomMore"), SNAME("EditorIcons"))); + theme->set_icon("reset", "GraphEdit", theme->get_icon(SNAME("ZoomReset"), SNAME("EditorIcons"))); + theme->set_icon("snap", "GraphEdit", theme->get_icon(SNAME("SnapGrid"), SNAME("EditorIcons"))); + theme->set_icon("minimap", "GraphEdit", theme->get_icon(SNAME("GridMinimap"), SNAME("EditorIcons"))); + theme->set_icon("layout", "GraphEdit", theme->get_icon(SNAME("GridLayout"), SNAME("EditorIcons"))); theme->set_constant("bezier_len_pos", "GraphEdit", 80 * EDSCALE); theme->set_constant("bezier_len_neg", "GraphEdit", 160 * EDSCALE); @@ -1366,7 +1366,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera); theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node); - Ref<Texture2D> minimap_resizer_icon = theme->get_icon("GuiResizer", "EditorIcons"); + Ref<Texture2D> minimap_resizer_icon = theme->get_icon(SNAME("GuiResizer"), SNAME("EditorIcons")); Color minimap_resizer_color; if (dark_theme) { minimap_resizer_color = Color(1, 1, 1, 0.65); @@ -1435,20 +1435,20 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("close_offset", "GraphNode", 20 * EDSCALE); theme->set_constant("separation", "GraphNode", 1 * EDSCALE); - theme->set_icon("close", "GraphNode", theme->get_icon("GuiCloseCustomizable", "EditorIcons")); - theme->set_icon("resizer", "GraphNode", theme->get_icon("GuiResizer", "EditorIcons")); - theme->set_icon("port", "GraphNode", theme->get_icon("GuiGraphNodePort", "EditorIcons")); + theme->set_icon("close", "GraphNode", theme->get_icon(SNAME("GuiCloseCustomizable"), SNAME("EditorIcons"))); + theme->set_icon("resizer", "GraphNode", theme->get_icon(SNAME("GuiResizer"), SNAME("EditorIcons"))); + theme->set_icon("port", "GraphNode", theme->get_icon(SNAME("GuiGraphNodePort"), SNAME("EditorIcons"))); // GridContainer theme->set_constant("vseparation", "GridContainer", Math::round(widget_default_margin.y - 2 * EDSCALE)); // FileDialog - theme->set_icon("folder", "FileDialog", theme->get_icon("Folder", "EditorIcons")); - theme->set_icon("parent_folder", "FileDialog", theme->get_icon("ArrowUp", "EditorIcons")); - theme->set_icon("back_folder", "FileDialog", theme->get_icon("Back", "EditorIcons")); - theme->set_icon("forward_folder", "FileDialog", theme->get_icon("Forward", "EditorIcons")); - theme->set_icon("reload", "FileDialog", theme->get_icon("Reload", "EditorIcons")); - theme->set_icon("toggle_hidden", "FileDialog", theme->get_icon("GuiVisibilityVisible", "EditorIcons")); + theme->set_icon("folder", "FileDialog", theme->get_icon(SNAME("Folder"), SNAME("EditorIcons"))); + theme->set_icon("parent_folder", "FileDialog", theme->get_icon(SNAME("ArrowUp"), SNAME("EditorIcons"))); + theme->set_icon("back_folder", "FileDialog", theme->get_icon(SNAME("Back"), SNAME("EditorIcons"))); + theme->set_icon("forward_folder", "FileDialog", theme->get_icon(SNAME("Forward"), SNAME("EditorIcons"))); + theme->set_icon("reload", "FileDialog", theme->get_icon(SNAME("Reload"), SNAME("EditorIcons"))); + theme->set_icon("toggle_hidden", "FileDialog", theme->get_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons"))); // Use a different color for folder icons to make them easier to distinguish from files. // On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color. theme->set_color("folder_icon_modulate", "FileDialog", (dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(accent_color, 0.7)); @@ -1460,22 +1460,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { 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("sample_bg", "ColorPicker", theme->get_icon("GuiMiniCheckerboard", "EditorIcons")); - theme->set_icon("overbright_indicator", "ColorPicker", theme->get_icon("OverbrightIndicator", "EditorIcons")); - theme->set_icon("bar_arrow", "ColorPicker", theme->get_icon("ColorPickerBarArrow", "EditorIcons")); - theme->set_icon("picker_cursor", "ColorPicker", theme->get_icon("PickerCursor", "EditorIcons")); + theme->set_icon("screen_picker", "ColorPicker", theme->get_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); + theme->set_icon("add_preset", "ColorPicker", theme->get_icon(SNAME("Add"), SNAME("EditorIcons"))); + theme->set_icon("sample_bg", "ColorPicker", theme->get_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons"))); + theme->set_icon("overbright_indicator", "ColorPicker", theme->get_icon(SNAME("OverbrightIndicator"), SNAME("EditorIcons"))); + theme->set_icon("bar_arrow", "ColorPicker", theme->get_icon(SNAME("ColorPickerBarArrow"), SNAME("EditorIcons"))); + theme->set_icon("picker_cursor", "ColorPicker", theme->get_icon(SNAME("PickerCursor"), SNAME("EditorIcons"))); // ColorPickerButton - theme->set_icon("bg", "ColorPickerButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons")); + theme->set_icon("bg", "ColorPickerButton", theme->get_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons"))); // ColorPresetButton Ref<StyleBoxFlat> preset_sb = make_flat_stylebox(Color(1, 1, 1), 2, 2, 2, 2, 2); preset_sb->set_anti_aliased(false); theme->set_stylebox("preset_fg", "ColorPresetButton", preset_sb); - theme->set_icon("preset_bg", "ColorPresetButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons")); - theme->set_icon("overbright_indicator", "ColorPresetButton", theme->get_icon("OverbrightIndicator", "EditorIcons")); + theme->set_icon("preset_bg", "ColorPresetButton", theme->get_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons"))); + theme->set_icon("overbright_indicator", "ColorPresetButton", theme->get_icon(SNAME("OverbrightIndicator"), SNAME("EditorIcons"))); // Information on 3D viewport Ref<StyleBoxFlat> style_info_3d_viewport = style_default->duplicate(); @@ -1486,7 +1486,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Asset Library. theme->set_stylebox("panel", "AssetLib", style_content_panel); theme->set_color("status_color", "AssetLib", Color(0.5, 0.5, 0.5)); - theme->set_icon("dismiss", "AssetLib", theme->get_icon("Close", "EditorIcons")); + theme->set_icon("dismiss", "AssetLib", theme->get_icon(SNAME("Close"), SNAME("EditorIcons"))); // Theme editor. theme->set_color("preview_picker_overlay_color", "ThemeEditor", Color(0.1, 0.1, 0.1, 0.25)); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index d9448dd4a9..5d356604f4 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -258,8 +258,8 @@ String ResourceImporterScene::get_visible_name() const { } void ResourceImporterScene::get_recognized_extensions(List<String> *p_extensions) const { - for (Set<Ref<EditorSceneFormatImporter>>::Element *E = importers.front(); E; E = E->next()) { - E->get()->get_extensions(p_extensions); + for (Ref<EditorSceneFormatImporter> importer_elem : importers) { + importer_elem->get_extensions(p_extensions); } } @@ -1490,8 +1490,8 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import post_importer_plugins.write[i]->get_import_options(p_path, r_options); } - for (Ref<EditorSceneFormatImporter> importer : importers) { - importer->get_import_options(p_path, r_options); + for (Ref<EditorSceneFormatImporter> importer_elem : importers) { + importer_elem->get_import_options(p_path, r_options); } } @@ -1843,13 +1843,13 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file) { EditorProgress progress("pre-import", TTR("Pre-Import Scene"), 0); progress.step(TTR("Importing Scene..."), 0); - for (Set<Ref<EditorSceneFormatImporter>>::Element *E = importers.front(); E; E = E->next()) { + for (Ref<EditorSceneFormatImporter> importer_elem : importers) { List<String> extensions; - E->get()->get_extensions(&extensions); + importer_elem->get_extensions(&extensions); for (const String &F : extensions) { if (F.to_lower() == ext) { - importer = E->get(); + importer = importer_elem; break; } } @@ -1883,13 +1883,13 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p EditorProgress progress("import", TTR("Import Scene"), 104); progress.step(TTR("Importing Scene..."), 0); - for (Set<Ref<EditorSceneFormatImporter>>::Element *E = importers.front(); E; E = E->next()) { + for (Ref<EditorSceneFormatImporter> importer_elem : importers) { List<String> extensions; - E->get()->get_extensions(&extensions); + importer_elem->get_extensions(&extensions); for (const String &F : extensions) { if (F.to_lower() == ext) { - importer = E->get(); + importer = importer_elem; break; } } @@ -2088,6 +2088,24 @@ ResourceImporterScene::ResourceImporterScene() { singleton = this; } +void ResourceImporterScene::add_importer(Ref<EditorSceneFormatImporter> p_importer) { + ERR_FAIL_COND(p_importer.is_null()); + importers.insert(0, p_importer); +} + +void ResourceImporterScene::remove_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin) { + post_importer_plugins.erase(p_plugin); +} + +void ResourceImporterScene::add_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin) { + ERR_FAIL_COND(p_plugin.is_null()); + post_importer_plugins.insert(0, p_plugin); +} + +void ResourceImporterScene::remove_importer(Ref<EditorSceneFormatImporter> p_importer) { + importers.erase(p_importer); +} + /////////////////////////////////////// uint32_t EditorSceneFormatImporterESCN::get_import_flags() const { diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index 13b55b5754..a3aeac4022 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -153,7 +153,7 @@ VARIANT_ENUM_CAST(EditorScenePostImportPlugin::InternalImportCategory) class ResourceImporterScene : public ResourceImporter { GDCLASS(ResourceImporterScene, ResourceImporter); - Set<Ref<EditorSceneFormatImporter>> importers; + Vector<Ref<EditorSceneFormatImporter>> importers; static ResourceImporterScene *singleton; @@ -224,13 +224,13 @@ class ResourceImporterScene : public ResourceImporter { public: static ResourceImporterScene *get_singleton() { return singleton; } - void add_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin) { post_importer_plugins.push_back(p_plugin); } - void remove_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin) { post_importer_plugins.erase(p_plugin); } + void add_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin); + void remove_post_importer_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin); - const Set<Ref<EditorSceneFormatImporter>> &get_importers() const { return importers; } + const Vector<Ref<EditorSceneFormatImporter>> &get_importers() const { return importers; } - void add_importer(Ref<EditorSceneFormatImporter> p_importer) { importers.insert(p_importer); } - void remove_importer(Ref<EditorSceneFormatImporter> p_importer) { importers.erase(p_importer); } + void add_importer(Ref<EditorSceneFormatImporter> p_importer); + void remove_importer(Ref<EditorSceneFormatImporter> p_importer); virtual String get_importer_name() const override; virtual String get_visible_name() const override; diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 59ba49232e..88d2aee667 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -1627,7 +1627,7 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// AudioListener3DGizmoPlugin::AudioListener3DGizmoPlugin() { - create_icon_material("audio_listener_3d_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoAudioListener3D", "EditorIcons")); + create_icon_material("audio_listener_3d_icon", Node3DEditor::get_singleton()->get_theme_icon(SNAME("GizmoAudioListener3D"), SNAME("EditorIcons"))); } bool AudioListener3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 19ed11acb4..7b4ebbc6d8 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -398,10 +398,10 @@ Ref<Texture2D> ScriptTextEditor::get_theme_icon() { icon_name += "Internal"; } - if (get_parent_control()->has_theme_icon(icon_name, "EditorIcons")) { - return get_parent_control()->get_theme_icon(icon_name, "EditorIcons"); - } else if (get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) { - return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons"); + if (get_parent_control()->has_theme_icon(icon_name, SNAME("EditorIcons"))) { + return get_parent_control()->get_theme_icon(icon_name, SNAME("EditorIcons")); + } else if (get_parent_control()->has_theme_icon(script->get_class(), SNAME("EditorIcons"))) { + return get_parent_control()->get_theme_icon(script->get_class(), SNAME("EditorIcons")); } } diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 5dd24983ff..ac77f51812 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -821,7 +821,7 @@ void fragment() { } )"); handle_material->set_shader(handle_shader); - Ref<Texture2D> handle = editor->get_gui_base()->get_theme_icon("EditorBoneHandle", "EditorIcons"); + Ref<Texture2D> handle = editor->get_gui_base()->get_theme_icon(SNAME("EditorBoneHandle"), SNAME("EditorIcons")); handle_material->set_shader_param("point_size", handle->get_width()); handle_material->set_shader_param("texture_albedo", handle); diff --git a/editor/plugins/text_control_editor_plugin.cpp b/editor/plugins/text_control_editor_plugin.cpp index a51b5d3e03..87eff9c3e9 100644 --- a/editor/plugins/text_control_editor_plugin.cpp +++ b/editor/plugins/text_control_editor_plugin.cpp @@ -31,6 +31,7 @@ #include "text_control_editor_plugin.h" #include "editor/editor_scale.h" +#include "editor/multi_node_edit.h" void TextControlEditor::_notification(int p_notification) { switch (p_notification) { @@ -121,78 +122,162 @@ void TextControlEditor::_update_styles_menu() { } void TextControlEditor::_update_control() { - if (edited_control) { - // Get override names. - if (edited_control->is_class("RichTextLabel")) { - edited_color = "default_color"; - edited_font = "normal_font"; - edited_font_size = "normal_font_size"; - } else { - edited_color = "font_color"; - edited_font = "font"; - edited_font_size = "font_size"; - } - - // Get font override. - Ref<Font> font; - if (edited_control->has_theme_font_override(edited_font)) { - font = edited_control->get_theme_font(edited_font); - } - if (font.is_valid()) { - if (font->get_data_count() != 1) { - // Composite font, save it to "custom_font" to allow undoing font change. - custom_font = font; - _update_fonts_menu(); - font_list->select(FONT_INFO_USER_CUSTOM); - _update_styles_menu(); - font_style_list->select(0); + if (!edited_controls.is_empty()) { + int font_selected = 0; + bool same_font = true; + int style_selected = 0; + bool same_style = true; + int font_size = 0; + bool same_font_size = true; + int outline_size = 0; + bool same_outline_size = true; + Color font_color = Color{ 1.0f, 1.0f, 1.0f }; + bool same_font_color = true; + Color outline_color = Color{ 1.0f, 1.0f, 1.0f }; + bool same_outline_color = true; + + _update_fonts_menu(); + _update_styles_menu(); + + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + String edited_color; + String edited_font; + String edited_font_size; + + // Get override names. + if (edited_control->is_class("RichTextLabel")) { + edited_color = "default_color"; + edited_font = "normal_font"; + edited_font_size = "normal_font_size"; } else { - // Single face font, search for the font with matching name and style. - String name = font->get_data(0)->get_font_name(); - String style = font->get_data(0)->get_font_style_name(); - if (fonts.has(name) && fonts[name].has(style)) { - _update_fonts_menu(); - for (int i = 0; i < font_list->get_item_count(); i++) { - if (font_list->get_item_text(i) == name) { - font_list->select(i); - break; - } + edited_color = "font_color"; + edited_font = "font"; + edited_font_size = "font_size"; + } + + // Get font override. + Ref<Font> font; + if (edited_control->has_theme_font_override(edited_font)) { + font = edited_control->get_theme_font(edited_font); + } + + if (font.is_valid()) { + if (font->get_data_count() != 1) { + custom_font = font; + if (i > 0) { + same_font = same_font && (font_selected == FONT_INFO_USER_CUSTOM); + same_style = same_style && (style_selected == 0); } - _update_styles_menu(); - for (int i = 0; i < font_style_list->get_item_count(); i++) { - if (font_style_list->get_item_text(i) == style) { - font_style_list->select(i); - break; + + font_selected = FONT_INFO_USER_CUSTOM; + style_selected = 0; + } else { + String name = font->get_data(0)->get_font_name(); + String style = font->get_data(0)->get_font_style_name(); + if (fonts.has(name) && fonts[name].has(style)) { + for (int j = 0; j < font_list->get_item_count(); j++) { + if (font_list->get_item_text(j) == name) { + if (i > 0) { + same_font = same_font && (j == font_selected); + } + + font_selected = j; + break; + } } + for (int j = 0; j < font_style_list->get_item_count(); j++) { + if (font_style_list->get_item_text(j) == style) { + if (i > 0) { + same_style = same_style && (j == style_selected); + } + + style_selected = j; + break; + } + } + } else { + custom_font = font; + if (i > 0) { + same_font = same_font && (font_selected == FONT_INFO_USER_CUSTOM); + same_style = same_style && (style_selected == 0); + } + + font_selected = FONT_INFO_USER_CUSTOM; + style_selected = 0; } - } else { - // Unknown font, save it to "custom_font" to allow undoing font change. - custom_font = font; - _update_fonts_menu(); - font_list->select(FONT_INFO_USER_CUSTOM); - _update_styles_menu(); - font_style_list->select(0); } + } else { + if (i > 0) { + same_font = same_font && (font_selected == FONT_INFO_THEME_DEFAULT); + same_style = same_style && (style_selected == 0); + } + + font_selected = FONT_INFO_THEME_DEFAULT; + style_selected = 0; } + + int current_font_size = edited_control->get_theme_font_size(edited_font_size); + int current_outline_size = edited_control->get_theme_constant("outline_size"); + Color current_font_color = edited_control->get_theme_color(edited_color); + Color current_outline_color = edited_control->get_theme_color("font_outline_color"); + if (i > 0) { + same_font_size = same_font_size && (font_size == current_font_size); + same_outline_size = same_outline_size && (outline_size == current_outline_size); + same_font_color = same_font_color && (font_color == current_font_color); + same_outline_color = same_outline_color && (outline_color == current_outline_color); + } + + font_size = current_font_size; + outline_size = current_outline_size; + font_color = current_font_color; + outline_color = current_outline_color; + } + + _update_fonts_menu(); + if (same_font) { + font_list->select(font_selected); + } else { + font_list->select(-1); + } + + _update_styles_menu(); + if (same_style) { + font_style_list->select(style_selected); } else { - // No font override, select "Theme Default". - _update_fonts_menu(); - font_list->select(FONT_INFO_THEME_DEFAULT); - _update_styles_menu(); - font_style_list->select(0); + font_list->select(-1); } // Get other theme overrides. font_size_list->set_block_signals(true); - font_size_list->set_value(edited_control->get_theme_font_size(edited_font_size)); + if (same_font_size) { + font_size_list->get_line_edit()->set_text(String::num_uint64(font_size)); + font_size_list->set_value(font_size); + } else { + font_size_list->get_line_edit()->set_text(""); + } font_size_list->set_block_signals(false); outline_size_list->set_block_signals(true); - outline_size_list->set_value(edited_control->get_theme_constant("outline_size")); + if (same_outline_size) { + outline_size_list->get_line_edit()->set_text(String::num_uint64(outline_size)); + outline_size_list->set_value(outline_size); + } else { + outline_size_list->get_line_edit()->set_text(""); + } outline_size_list->set_block_signals(false); - font_color_picker->set_pick_color(edited_control->get_theme_color(edited_color)); - outline_color_picker->set_pick_color(edited_control->get_theme_color("font_outline_color")); + if (!same_font_color) { + font_color = Color{ 1.0f, 1.0f, 1.0f }; + } + font_color_picker->set_pick_color(font_color); + + if (!same_outline_color) { + outline_color = Color{ 1.0f, 1.0f, 1.0f }; + } + outline_color_picker->set_pick_color(outline_color); } } @@ -205,42 +290,54 @@ void TextControlEditor::_font_style_selected(int p_id) { } void TextControlEditor::_set_font() { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Set Font")); - if (font_list->get_selected_id() == FONT_INFO_THEME_DEFAULT) { - // Remove font override. - ur->add_do_method(edited_control, "remove_theme_font_override", edited_font); - } else if (font_list->get_selected_id() == FONT_INFO_USER_CUSTOM) { - // Restore "custom_font". - ur->add_do_method(edited_control, "add_theme_font_override", edited_font, custom_font); - } else { - // Load new font resource using selected name and style. - String name = font_list->get_item_text(font_list->get_selected()); - String style = font_style_list->get_item_text(font_style_list->get_selected()); - if (style.is_empty()) { - style = "Default"; + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + String edited_font; + if (edited_control->is_class("RichTextLabel")) { + edited_font = "normal_font"; + } else { + edited_font = "font"; } - if (fonts.has(name)) { - Ref<FontData> fd = ResourceLoader::load(fonts[name][style]); - if (fd.is_valid()) { - Ref<Font> font; - font.instantiate(); - font->add_data(fd); - ur->add_do_method(edited_control, "add_theme_font_override", edited_font, font); + if (font_list->get_selected_id() == FONT_INFO_THEME_DEFAULT) { + // Remove font override. + ur->add_do_method(edited_control, "remove_theme_font_override", edited_font); + } else if (font_list->get_selected_id() == FONT_INFO_USER_CUSTOM) { + // Restore "custom_font". + ur->add_do_method(edited_control, "add_theme_font_override", edited_font, custom_font); + } else { + // Load new font resource using selected name and style. + String name = font_list->get_item_text(font_list->get_selected()); + String style = font_style_list->get_item_text(font_style_list->get_selected()); + if (style.is_empty()) { + style = "Default"; + } + + if (fonts.has(name)) { + Ref<FontData> fd = ResourceLoader::load(fonts[name][style]); + if (fd.is_valid()) { + Ref<Font> font; + font.instantiate(); + font->add_data(fd); + ur->add_do_method(edited_control, "add_theme_font_override", edited_font, font); + } } } - } - if (edited_control->has_theme_font_override(edited_font)) { - ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font)); - } else { - ur->add_undo_method(edited_control, "remove_theme_font_override", edited_font); + if (edited_control->has_theme_font_override(edited_font)) { + ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font)); + } else { + ur->add_undo_method(edited_control, "remove_theme_font_override", edited_font); + } } ur->add_do_method(this, "_update_control"); @@ -250,18 +347,30 @@ void TextControlEditor::_set_font() { } void TextControlEditor::_font_size_selected(double p_size) { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Set Font Size")); - ur->add_do_method(edited_control, "add_theme_font_size_override", edited_font_size, p_size); - if (edited_control->has_theme_font_size_override(edited_font_size)) { - ur->add_undo_method(edited_control, "add_theme_font_size_override", edited_font_size, edited_control->get_theme_font_size(edited_font_size)); - } else { - ur->add_undo_method(edited_control, "remove_theme_font_size_override", edited_font_size); + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + String edited_font_size; + if (edited_control->is_class("RichTextLabel")) { + edited_font_size = "normal_font_size"; + } else { + edited_font_size = "font_size"; + } + + ur->add_do_method(edited_control, "add_theme_font_size_override", edited_font_size, p_size); + if (edited_control->has_theme_font_size_override(edited_font_size)) { + ur->add_undo_method(edited_control, "add_theme_font_size_override", edited_font_size, edited_control->get_theme_font_size(edited_font_size)); + } else { + ur->add_undo_method(edited_control, "remove_theme_font_size_override", edited_font_size); + } } ur->add_do_method(this, "_update_control"); @@ -271,18 +380,23 @@ void TextControlEditor::_font_size_selected(double p_size) { } void TextControlEditor::_outline_size_selected(double p_size) { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Set Font Outline Size")); - ur->add_do_method(edited_control, "add_theme_constant_override", "outline_size", p_size); - if (edited_control->has_theme_constant_override("outline_size")) { - ur->add_undo_method(edited_control, "add_theme_constant_override", "outline_size", edited_control->get_theme_constant("outline_size")); - } else { - ur->add_undo_method(edited_control, "remove_theme_constant_override", "outline_size"); + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + ur->add_do_method(edited_control, "add_theme_constant_override", "outline_size", p_size); + if (edited_control->has_theme_constant_override("outline_size")) { + ur->add_undo_method(edited_control, "add_theme_constant_override", "outline_size", edited_control->get_theme_constant("outline_size")); + } else { + ur->add_undo_method(edited_control, "remove_theme_constant_override", "outline_size"); + } } ur->add_do_method(this, "_update_control"); @@ -292,18 +406,30 @@ void TextControlEditor::_outline_size_selected(double p_size) { } void TextControlEditor::_font_color_changed(const Color &p_color) { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Set Font Color"), UndoRedo::MERGE_ENDS); - ur->add_do_method(edited_control, "add_theme_color_override", edited_color, p_color); - if (edited_control->has_theme_color_override(edited_color)) { - ur->add_undo_method(edited_control, "add_theme_color_override", edited_color, edited_control->get_theme_color(edited_color)); - } else { - ur->add_undo_method(edited_control, "remove_theme_color_override", edited_color); + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + String edited_color; + if (edited_control->is_class("RichTextLabel")) { + edited_color = "default_color"; + } else { + edited_color = "font_color"; + } + + ur->add_do_method(edited_control, "add_theme_color_override", edited_color, p_color); + if (edited_control->has_theme_color_override(edited_color)) { + ur->add_undo_method(edited_control, "add_theme_color_override", edited_color, edited_control->get_theme_color(edited_color)); + } else { + ur->add_undo_method(edited_control, "remove_theme_color_override", edited_color); + } } ur->add_do_method(this, "_update_control"); @@ -313,18 +439,23 @@ void TextControlEditor::_font_color_changed(const Color &p_color) { } void TextControlEditor::_outline_color_changed(const Color &p_color) { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Set Font Outline Color"), UndoRedo::MERGE_ENDS); - ur->add_do_method(edited_control, "add_theme_color_override", "font_outline_color", p_color); - if (edited_control->has_theme_color_override("font_outline_color")) { - ur->add_undo_method(edited_control, "add_theme_color_override", "font_outline_color", edited_control->get_theme_color("font_outline_color")); - } else { - ur->add_undo_method(edited_control, "remove_theme_color_override", "font_outline_color"); + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; + + ur->add_do_method(edited_control, "add_theme_color_override", "font_outline_color", p_color); + if (edited_control->has_theme_color_override("font_outline_color")) { + ur->add_undo_method(edited_control, "add_theme_color_override", "font_outline_color", edited_control->get_theme_color("font_outline_color")); + } else { + ur->add_undo_method(edited_control, "remove_theme_color_override", "font_outline_color"); + } } ur->add_do_method(this, "_update_control"); @@ -334,43 +465,63 @@ void TextControlEditor::_outline_color_changed(const Color &p_color) { } void TextControlEditor::_clear_formatting() { - if (!edited_control) { + if (edited_controls.is_empty()) { return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Clear Control Formatting")); - ur->add_do_method(edited_control, "begin_bulk_theme_override"); - ur->add_undo_method(edited_control, "begin_bulk_theme_override"); + int count = edited_controls.size(); + for (int i = 0; i < count; ++i) { + Control *edited_control = edited_controls[i]; - ur->add_do_method(edited_control, "remove_theme_font_override", edited_font); - if (edited_control->has_theme_font_override(edited_font)) { - ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font)); - } + String edited_color; + String edited_font; + String edited_font_size; - ur->add_do_method(edited_control, "remove_theme_font_size_override", edited_font_size); - if (edited_control->has_theme_font_size_override(edited_font_size)) { - ur->add_undo_method(edited_control, "add_theme_font_size_override", edited_font_size, edited_control->get_theme_font_size(edited_font_size)); - } + // Get override names. + if (edited_control->is_class("RichTextLabel")) { + edited_color = "default_color"; + edited_font = "normal_font"; + edited_font_size = "normal_font_size"; + } else { + edited_color = "font_color"; + edited_font = "font"; + edited_font_size = "font_size"; + } - ur->add_do_method(edited_control, "remove_theme_color_override", edited_color); - if (edited_control->has_theme_color_override(edited_color)) { - ur->add_undo_method(edited_control, "add_theme_color_override", edited_color, edited_control->get_theme_color(edited_color)); - } + ur->add_do_method(edited_control, "begin_bulk_theme_override"); + ur->add_undo_method(edited_control, "begin_bulk_theme_override"); - ur->add_do_method(edited_control, "remove_theme_color_override", "font_outline_color"); - if (edited_control->has_theme_color_override("font_outline_color")) { - ur->add_undo_method(edited_control, "add_theme_color_override", "font_outline_color", edited_control->get_theme_color("font_outline_color")); - } + ur->add_do_method(edited_control, "remove_theme_font_override", edited_font); + if (edited_control->has_theme_font_override(edited_font)) { + ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font)); + } - ur->add_do_method(edited_control, "remove_theme_constant_override", "outline_size"); - if (edited_control->has_theme_constant_override("outline_size")) { - ur->add_undo_method(edited_control, "add_theme_constant_override", "outline_size", edited_control->get_theme_constant("outline_size")); - } + ur->add_do_method(edited_control, "remove_theme_font_size_override", edited_font_size); + if (edited_control->has_theme_font_size_override(edited_font_size)) { + ur->add_undo_method(edited_control, "add_theme_font_size_override", edited_font_size, edited_control->get_theme_font_size(edited_font_size)); + } + + ur->add_do_method(edited_control, "remove_theme_color_override", edited_color); + if (edited_control->has_theme_color_override(edited_color)) { + ur->add_undo_method(edited_control, "add_theme_color_override", edited_color, edited_control->get_theme_color(edited_color)); + } + + ur->add_do_method(edited_control, "remove_theme_color_override", "font_outline_color"); + if (edited_control->has_theme_color_override("font_outline_color")) { + ur->add_undo_method(edited_control, "add_theme_color_override", "font_outline_color", edited_control->get_theme_color("font_outline_color")); + } + + ur->add_do_method(edited_control, "remove_theme_constant_override", "outline_size"); + if (edited_control->has_theme_constant_override("outline_size")) { + ur->add_undo_method(edited_control, "add_theme_constant_override", "outline_size", edited_control->get_theme_constant("outline_size")); + } - ur->add_do_method(edited_control, "end_bulk_theme_override"); - ur->add_undo_method(edited_control, "end_bulk_theme_override"); + ur->add_do_method(edited_control, "end_bulk_theme_override"); + ur->add_undo_method(edited_control, "end_bulk_theme_override"); + } ur->add_do_method(this, "_update_control"); ur->add_undo_method(this, "_update_control"); @@ -380,24 +531,54 @@ void TextControlEditor::_clear_formatting() { void TextControlEditor::edit(Object *p_object) { Control *ctrl = Object::cast_to<Control>(p_object); - if (!ctrl) { - edited_control = nullptr; - custom_font = Ref<Font>(); - } else { - edited_control = ctrl; - custom_font = Ref<Font>(); + MultiNodeEdit *multi_node = Object::cast_to<MultiNodeEdit>(p_object); + + edited_controls.clear(); + custom_font = Ref<Font>(); + if (ctrl) { + edited_controls.append(ctrl); + _update_control(); + } else if (multi_node && handles(multi_node)) { + int count = multi_node->get_node_count(); + Node *scene = EditorNode::get_singleton()->get_edited_scene(); + + for (int i = 0; i < count; ++i) { + Control *child = Object::cast_to<Control>(scene->get_node(multi_node->get_node(i))); + edited_controls.append(child); + } _update_control(); } } bool TextControlEditor::handles(Object *p_object) const { Control *ctrl = Object::cast_to<Control>(p_object); - if (!ctrl) { + MultiNodeEdit *multi_node = Object::cast_to<MultiNodeEdit>(p_object); + + if (!ctrl && !multi_node) { return false; - } else { + } else if (ctrl) { bool valid = false; ctrl->get("text", &valid); return valid; + } else { + bool valid = true; + int count = multi_node->get_node_count(); + Node *scene = EditorNode::get_singleton()->get_edited_scene(); + + for (int i = 0; i < count; ++i) { + bool temp_valid = false; + Control *child = Object::cast_to<Control>(scene->get_node(multi_node->get_node(i))); + if (child) { + child->get("text", &temp_valid); + } + valid = valid && temp_valid; + + if (!valid) { + break; + } + } + + return valid; } } diff --git a/editor/plugins/text_control_editor_plugin.h b/editor/plugins/text_control_editor_plugin.h index d284a30f16..5941c100ec 100644 --- a/editor/plugins/text_control_editor_plugin.h +++ b/editor/plugins/text_control_editor_plugin.h @@ -62,10 +62,7 @@ class TextControlEditor : public HBoxContainer { ColorPickerButton *outline_color_picker = nullptr; Button *clear_formatting = nullptr; - Control *edited_control = nullptr; - String edited_color; - String edited_font; - String edited_font_size; + Vector<Control *> edited_controls; Ref<Font> custom_font; protected: diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 12003738e7..ae921871c3 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -40,7 +40,7 @@ void TileDataEditor::_tile_set_changed_plan_update() { _tile_set_changed_update_needed = true; - call_deferred("_tile_set_changed_deferred_update"); + call_deferred(SNAME("_tile_set_changed_deferred_update")); } void TileDataEditor::_tile_set_changed_deferred_update() { diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index e708b83440..1bd1cd0219 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2593,7 +2593,7 @@ void EditorPropertyTilePolygon::_polygons_changed() { changed_properties.push_back(vformat(element_pattern, i)); values.push_back(generic_tile_polygon_editor->get_polygon(i)); } - emit_signal("multiple_properties_changed", changed_properties, values, false); + emit_signal(SNAME("multiple_properties_changed"), changed_properties, values, false); } } } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index c582582a7d..cfb42c0741 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1423,7 +1423,7 @@ void ProjectList::create_project_item_control(int p_index) { Button *show = memnew(Button); // Display a folder icon if the project directory can be opened, or a "broken file" icon if it can't. - show->set_icon(get_theme_icon(!item.missing ? "Load" : "FileBroken", "EditorIcons")); + show->set_icon(get_theme_icon(!item.missing ? SNAME("Load") : SNAME("FileBroken"), SNAME("EditorIcons"))); show->set_flat(true); if (!item.grayed) { // Don't make the icon less prominent if the parent is already grayed out. diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index fcb4f5b32e..e9aed53b4e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -365,9 +365,9 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll } else if (p_node->is_class("CanvasLayer")) { bool v = p_node->call("is_visible"); if (v) { - item->add_button(0, get_theme_icon("GuiVisibilityVisible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); } else { - item->add_button(0, get_theme_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons")), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); } if (!p_node->is_connected("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed))) { diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index cafa12c42e..b42d4a1d6d 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -656,7 +656,7 @@ void ScriptCreateDialog::_update_dialog() { if (is_new_script_created) { class_name->set_editable(true); class_name->set_placeholder(TTR("Allowed: a-z, A-Z, 0-9, _ and .")); - Color placeholder_color = class_name->get_theme_color("font_placeholder_color"); + Color placeholder_color = class_name->get_theme_color(SNAME("font_placeholder_color")); placeholder_color.a = 0.3; class_name->add_theme_color_override("font_placeholder_color", placeholder_color); } else { @@ -665,7 +665,7 @@ void ScriptCreateDialog::_update_dialog() { } else { class_name->set_editable(false); class_name->set_placeholder(TTR("N/A")); - Color placeholder_color = class_name->get_theme_color("font_placeholder_color"); + Color placeholder_color = class_name->get_theme_color(SNAME("font_placeholder_color")); placeholder_color.a = 1; class_name->add_theme_color_override("font_placeholder_color", placeholder_color); class_name->set_text(""); |