diff options
Diffstat (limited to 'editor')
92 files changed, 681 insertions, 603 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 604758300d..4c7ebca299 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -211,11 +211,11 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V void AnimationBezierTrackEdit::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_ENTER_TREE: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 8a2d23d32d..44ecda103e 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1487,7 +1487,7 @@ void AnimationTimelineEdit::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); add_track->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons"))); time_icon->set_texture(get_theme_icon(SNAME("Time"), SNAME("EditorIcons"))); @@ -1505,7 +1505,7 @@ void AnimationTimelineEdit::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_RESIZED: { @@ -4753,11 +4753,11 @@ MenuButton *AnimationTrackEditor::get_edit_menu() { void AnimationTrackEditor::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_ENTER_TREE: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index e328f76545..212a46cb62 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1009,50 +1009,50 @@ void CodeTextEditor::update_editor_settings() { completion_comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); // Appearance: Caret - text_editor->set_caret_type((TextEdit::CaretType)EditorSettings::get_singleton()->get("text_editor/appearance/caret/type").operator int()); - text_editor->set_caret_blink_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/caret/caret_blink")); - text_editor->set_caret_blink_interval(EditorSettings::get_singleton()->get("text_editor/appearance/caret/caret_blink_interval")); - text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/appearance/caret/highlight_current_line")); - text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/appearance/caret/highlight_all_occurrences")); + text_editor->set_caret_type((TextEdit::CaretType)EDITOR_GET("text_editor/appearance/caret/type").operator int()); + text_editor->set_caret_blink_enabled(EDITOR_GET("text_editor/appearance/caret/caret_blink")); + text_editor->set_caret_blink_interval(EDITOR_GET("text_editor/appearance/caret/caret_blink_interval")); + text_editor->set_highlight_current_line(EDITOR_GET("text_editor/appearance/caret/highlight_current_line")); + text_editor->set_highlight_all_occurrences(EDITOR_GET("text_editor/appearance/caret/highlight_all_occurrences")); // Appearance: Gutters - text_editor->set_draw_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/show_line_numbers")); - text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/line_numbers_zero_padded")); - text_editor->set_draw_bookmarks_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/show_bookmark_gutter")); + text_editor->set_draw_line_numbers(EDITOR_GET("text_editor/appearance/gutters/show_line_numbers")); + text_editor->set_line_numbers_zero_padded(EDITOR_GET("text_editor/appearance/gutters/line_numbers_zero_padded")); + text_editor->set_draw_bookmarks_gutter(EDITOR_GET("text_editor/appearance/gutters/show_bookmark_gutter")); // Appearance: Minimap - text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/appearance/minimap/show_minimap")); - text_editor->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/appearance/minimap/minimap_width") * EDSCALE); + text_editor->set_draw_minimap(EDITOR_GET("text_editor/appearance/minimap/show_minimap")); + text_editor->set_minimap_width((int)EDITOR_GET("text_editor/appearance/minimap/minimap_width") * EDSCALE); // Appearance: Lines - text_editor->set_line_folding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/lines/code_folding")); - text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/lines/code_folding")); - text_editor->set_line_wrapping_mode((TextEdit::LineWrappingMode)EditorSettings::get_singleton()->get("text_editor/appearance/lines/word_wrap").operator int()); + text_editor->set_line_folding_enabled(EDITOR_GET("text_editor/appearance/lines/code_folding")); + text_editor->set_draw_fold_gutter(EDITOR_GET("text_editor/appearance/lines/code_folding")); + text_editor->set_line_wrapping_mode((TextEdit::LineWrappingMode)EDITOR_GET("text_editor/appearance/lines/word_wrap").operator int()); // Appearance: Whitespace - text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/appearance/whitespace/draw_tabs")); - text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/appearance/whitespace/draw_spaces")); + text_editor->set_draw_tabs(EDITOR_GET("text_editor/appearance/whitespace/draw_tabs")); + text_editor->set_draw_spaces(EDITOR_GET("text_editor/appearance/whitespace/draw_spaces")); // Behavior: Navigation - text_editor->set_scroll_past_end_of_file_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/scroll_past_end_of_file")); - text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/smooth_scrolling")); - text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/v_scroll_speed")); - text_editor->set_drag_and_drop_selection_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/drag_and_drop_selection")); + text_editor->set_scroll_past_end_of_file_enabled(EDITOR_GET("text_editor/behavior/navigation/scroll_past_end_of_file")); + text_editor->set_smooth_scroll_enabled(EDITOR_GET("text_editor/behavior/navigation/smooth_scrolling")); + text_editor->set_v_scroll_speed(EDITOR_GET("text_editor/behavior/navigation/v_scroll_speed")); + text_editor->set_drag_and_drop_selection_enabled(EDITOR_GET("text_editor/behavior/navigation/drag_and_drop_selection")); // Behavior: indent - text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/behavior/indent/type")); - text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/behavior/indent/size")); - text_editor->set_auto_indent_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/indent/auto_indent")); + text_editor->set_indent_using_spaces(EDITOR_GET("text_editor/behavior/indent/type")); + text_editor->set_indent_size(EDITOR_GET("text_editor/behavior/indent/size")); + text_editor->set_auto_indent_enabled(EDITOR_GET("text_editor/behavior/indent/auto_indent")); // Completion - text_editor->set_auto_brace_completion_enabled(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); + text_editor->set_auto_brace_completion_enabled(EDITOR_GET("text_editor/completion/auto_brace_complete")); // Appearance: Guidelines - if (EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/show_line_length_guidelines")) { + if (EDITOR_GET("text_editor/appearance/guidelines/show_line_length_guidelines")) { TypedArray<int> guideline_cols; - guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_hard_column")); - if (EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_soft_column") != guideline_cols[0]) { - guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_soft_column")); + guideline_cols.append(EDITOR_GET("text_editor/appearance/guidelines/line_length_guideline_hard_column")); + if (EDITOR_GET("text_editor/appearance/guidelines/line_length_guideline_soft_column") != guideline_cols[0]) { + guideline_cols.append(EDITOR_GET("text_editor/appearance/guidelines/line_length_guideline_soft_column")); } text_editor->set_line_length_guidelines(guideline_cols); } else { @@ -1126,7 +1126,7 @@ void CodeTextEditor::insert_final_newline() { } void CodeTextEditor::convert_indent_to_spaces() { - int indent_size = EditorSettings::get_singleton()->get("text_editor/behavior/indent/size"); + int indent_size = EDITOR_GET("text_editor/behavior/indent/size"); String indent = ""; for (int i = 0; i < indent_size; i++) { @@ -1178,7 +1178,7 @@ void CodeTextEditor::convert_indent_to_spaces() { } void CodeTextEditor::convert_indent_to_tabs() { - int indent_size = EditorSettings::get_singleton()->get("text_editor/behavior/indent/size"); + int indent_size = EDITOR_GET("text_editor/behavior/indent/size"); indent_size -= 1; Vector<int> cursor_columns; @@ -1848,8 +1848,8 @@ void CodeTextEditor::_on_settings_change() { void CodeTextEditor::_apply_settings_change() { _update_text_editor_theme(); - font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); - int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); + font_size = EDITOR_GET("interface/editor/code_font_size"); + int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures"); Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font")); if (fc.is_valid()) { @@ -1860,7 +1860,7 @@ void CodeTextEditor::_apply_settings_change() { fc->set_opentype_features(ftrs); } break; case 2: { // Custom. - Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Vector<String> subtag = String(EDITOR_GET("interface/editor/code_font_custom_opentype_features")).split(","); Dictionary ftrs; for (int i = 0; i < subtag.size(); i++) { Vector<String> subtag_a = subtag[i].split("="); @@ -2084,7 +2084,7 @@ CodeTextEditor::CodeTextEditor() { add_child(text_editor); text_editor->set_v_size_flags(SIZE_EXPAND_FILL); - int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); + int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures"); Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font")); if (fc.is_valid()) { switch (ot_mode) { @@ -2094,7 +2094,7 @@ CodeTextEditor::CodeTextEditor() { fc->set_opentype_features(ftrs); } break; case 2: { // Custom. - Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Vector<String> subtag = String(EDITOR_GET("interface/editor/code_font_custom_opentype_features")).split(","); Dictionary ftrs; for (int i = 0; i < subtag.size(); i++) { Vector<String> subtag_a = subtag[i].split("="); @@ -2202,7 +2202,7 @@ CodeTextEditor::CodeTextEditor() { code_complete_timer->connect("timeout", callable_mp(this, &CodeTextEditor::_code_complete_timer_timeout)); font_resize_val = 0; - font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); + font_size = EDITOR_GET("interface/editor/code_font_size"); font_resize_timer = memnew(Timer); add_child(font_resize_timer); font_resize_timer->set_one_shot(true); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 7a4e58c6f9..6142856f75 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -307,7 +307,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String // Don't collapse the root node or an abstract node on the first tree level. bool should_collapse = p_type != base_type && (r_item->get_parent()->get_text(0) != base_type || can_instantiate); - if (should_collapse && bool(EditorSettings::get_singleton()->get("docks/scene_tree/start_create_dialog_fully_expanded"))) { + if (should_collapse && bool(EDITOR_GET("docks/scene_tree/start_create_dialog_fully_expanded"))) { should_collapse = false; // Collapse all nodes anyway. } r_item->set_collapsed(should_collapse); diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index 37da64beae..2e2361889d 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -62,8 +62,8 @@ void DebugAdapterServer::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout"); - protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints"); + protocol._request_timeout = EDITOR_GET("network/debug_adapter/request_timeout"); + protocol._sync_breakpoints = EDITOR_GET("network/debug_adapter/sync_breakpoints"); int port = (int)_EDITOR_GET("network/debug_adapter/remote_port"); if (port != remote_port) { stop(); diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 06b73cf296..edcbcaf963 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -77,6 +77,7 @@ EditorDebuggerNode::EditorDebuggerNode() { remote_scene_tree = memnew(EditorDebuggerTree); remote_scene_tree->connect("object_selected", callable_mp(this, &EditorDebuggerNode::_remote_object_requested)); remote_scene_tree->connect("save_node", callable_mp(this, &EditorDebuggerNode::_save_node_requested)); + remote_scene_tree->connect("button_clicked", callable_mp(this, &EditorDebuggerNode::_remote_tree_button_pressed)); SceneTreeDock::get_singleton()->add_remote_tree_editor(remote_scene_tree); SceneTreeDock::get_singleton()->connect("remote_tree_selected", callable_mp(this, &EditorDebuggerNode::request_remote_tree)); @@ -277,7 +278,7 @@ void EditorDebuggerNode::_notification(int p_what) { // Remote scene tree update remote_scene_tree_timeout -= get_process_delta_time(); if (remote_scene_tree_timeout < 0) { - remote_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval"); + remote_scene_tree_timeout = EDITOR_GET("debugger/remote_scene_tree_refresh_interval"); if (remote_scene_tree->is_visible_in_tree()) { get_current_debugger()->request_remote_tree(); } @@ -286,7 +287,7 @@ void EditorDebuggerNode::_notification(int p_what) { // Remote inspector update inspect_edited_object_timeout -= get_process_delta_time(); if (inspect_edited_object_timeout < 0) { - inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval"); + inspect_edited_object_timeout = EDITOR_GET("debugger/remote_inspect_refresh_interval"); if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) { get_current_debugger()->request_remote_object(obj->remote_object_id); } @@ -313,7 +314,7 @@ void EditorDebuggerNode::_notification(int p_what) { EditorNode::get_singleton()->get_pause_button()->set_disabled(false); // Switch to remote tree view if so desired. - auto_switch_remote_scene_tree = (bool)EditorSettings::get_singleton()->get("debugger/auto_switch_to_remote_scene_tree"); + auto_switch_remote_scene_tree = (bool)EDITOR_GET("debugger/auto_switch_to_remote_scene_tree"); if (auto_switch_remote_scene_tree) { SceneTreeDock::get_singleton()->show_remote_tree(); } @@ -573,6 +574,24 @@ void EditorDebuggerNode::_remote_tree_updated(int p_debugger) { remote_scene_tree->update_scene_tree(get_current_debugger()->get_remote_tree(), p_debugger); } +void EditorDebuggerNode::_remote_tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + + TreeItem *item = Object::cast_to<TreeItem>(p_item); + ERR_FAIL_COND(!item); + + if (p_id == EditorDebuggerTree::BUTTON_SUBSCENE) { + remote_scene_tree->emit_signal(SNAME("open"), item->get_meta("scene_file_path")); + } else if (p_id == EditorDebuggerTree::BUTTON_VISIBILITY) { + ObjectID obj_id = item->get_metadata(0); + ERR_FAIL_COND(obj_id.is_null()); + get_current_debugger()->update_remote_object(obj_id, "visible", !item->get_meta("visible")); + get_current_debugger()->request_remote_tree(); + } +} + void EditorDebuggerNode::_remote_object_updated(ObjectID p_id, int p_debugger) { if (p_debugger != tabs->get_current_tab()) { return; diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index e79e60b180..305f18a652 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -129,6 +129,7 @@ protected: void _debugger_wants_stop(int p_id); void _debugger_changed(int p_tab); void _remote_tree_updated(int p_debugger); + void _remote_tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button); void _remote_object_updated(ObjectID p_id, int p_debugger); void _remote_object_property_updated(ObjectID p_id, const String &p_property, int p_debugger); void _remote_object_requested(ObjectID p_id, int p_debugger); diff --git a/editor/debugger/editor_debugger_server.cpp b/editor/debugger/editor_debugger_server.cpp index 63390825c6..dba0491cfc 100644 --- a/editor/debugger/editor_debugger_server.cpp +++ b/editor/debugger/editor_debugger_server.cpp @@ -72,8 +72,8 @@ String EditorDebuggerServerTCP::get_uri() const { Error EditorDebuggerServerTCP::start(const String &p_uri) { // Default host and port - String bind_host = (String)EditorSettings::get_singleton()->get("network/debug/remote_host"); - int bind_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); + String bind_host = (String)EDITOR_GET("network/debug/remote_host"); + int bind_port = (int)EDITOR_GET("network/debug/remote_port"); // Optionally override if (!p_uri.is_empty() && p_uri != "tcp://") { diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 76efcd7190..4168efda26 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -65,6 +65,7 @@ void EditorDebuggerTree::_notification(int p_what) { void EditorDebuggerTree::_bind_methods() { ADD_SIGNAL(MethodInfo("object_selected", PropertyInfo(Variant::INT, "object_id"), PropertyInfo(Variant::INT, "debugger"))); ADD_SIGNAL(MethodInfo("save_node", PropertyInfo(Variant::INT, "object_id"), PropertyInfo(Variant::STRING, "filename"), PropertyInfo(Variant::INT, "debugger"))); + ADD_SIGNAL(MethodInfo("open")); } void EditorDebuggerTree::_scene_tree_selected() { @@ -162,7 +163,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int } item->set_metadata(0, node.id); - // Set current item as collapsed if necessary (root is never collapsed) + // Set current item as collapsed if necessary (root is never collapsed). if (parent) { if (!unfold_cache.has(node.id)) { item->set_collapsed(true); @@ -178,7 +179,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int } } else { // Must use path if (last_path == _get_path(item)) { - updating_scene_tree = false; // Force emission of new selection + updating_scene_tree = false; // Force emission of new selection. item->select(0); if (filter_changed) { scroll_item = item; @@ -187,6 +188,33 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int } } + // Add buttons. + const Color remote_button_color = Color(1, 1, 1, 0.8); + if (!node.scene_file_path.is_empty()) { + String node_scene_file_path = node.scene_file_path; + Ref<Texture2D> button_icon = get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")); + String tooltip = vformat(TTR("This node has been instantiated from a PackedScene file:\n%s\nClick to open the original file in the Editor."), node_scene_file_path); + + item->set_meta("scene_file_path", node_scene_file_path); + item->add_button(0, button_icon, BUTTON_SUBSCENE, false, tooltip); + item->set_button_color(0, item->get_button_count(0) - 1, remote_button_color); + } + + if (node.view_flags & SceneDebuggerTree::RemoteNode::VIEW_HAS_VISIBLE_METHOD) { + bool node_visible = node.view_flags & SceneDebuggerTree::RemoteNode::VIEW_VISIBLE; + bool node_visible_in_tree = node.view_flags & SceneDebuggerTree::RemoteNode::VIEW_VISIBLE_IN_TREE; + Ref<Texture2D> button_icon = get_theme_icon(node_visible ? SNAME("GuiVisibilityVisible") : SNAME("GuiVisibilityHidden"), SNAME("EditorIcons")); + String tooltip = TTR("Toggle Visibility"); + + item->set_meta("visible", node_visible); + item->add_button(0, button_icon, BUTTON_VISIBILITY, false, tooltip); + if (ClassDB::is_parent_class(node.type_name, "CanvasItem") || ClassDB::is_parent_class(node.type_name, "Node3D")) { + item->set_button_color(0, item->get_button_count(0) - 1, node_visible_in_tree ? remote_button_color : Color(1, 1, 1, 0.6)); + } else { + item->set_button_color(0, item->get_button_count(0) - 1, remote_button_color); + } + } + // Add in front of the parents stack if children are expected. if (node.child_count) { parents.push_front(Pair<TreeItem *, int>(item, node.child_count)); diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index 5af3a0d84a..6d590cdb7a 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -65,6 +65,11 @@ protected: void _notification(int p_what); public: + enum Button { + BUTTON_SUBSCENE = 0, + BUTTON_VISIBILITY = 1, + }; + virtual Variant get_drag_data(const Point2 &p_point) override; String get_selected_path(); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index dfa2b8e70f..35666a5566 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -85,7 +85,7 @@ void EditorProfiler::add_frame_metric(const Metric &p_metric, bool p_final) { } void EditorProfiler::clear() { - int metric_size = EditorSettings::get_singleton()->get("debugger/profiler_frame_history_size"); + int metric_size = EDITOR_GET("debugger/profiler_frame_history_size"); metric_size = CLAMP(metric_size, 60, 10000); frame_metrics.clear(); frame_metrics.resize(metric_size); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 8552c8e9ef..b8bc712ba6 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -92,7 +92,7 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { } void EditorVisualProfiler::clear() { - int metric_size = EditorSettings::get_singleton()->get("debugger/profiler_frame_history_size"); + int metric_size = EDITOR_GET("debugger/profiler_frame_history_size"); metric_size = CLAMP(metric_size, 60, 10000); frame_metrics.clear(); frame_metrics.resize(metric_size); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index f1fc1019b9..f1f34b8ebb 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -995,7 +995,7 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable, int p_type) { profiler_signature.clear(); // Add max funcs options to request. Array opts; - int max_funcs = EditorSettings::get_singleton()->get("debugger/profiler_frame_max_functions"); + int max_funcs = EDITOR_GET("debugger/profiler_frame_max_functions"); opts.push_back(CLAMP(max_funcs, 16, 512)); msg_data.push_back(opts); } diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 9064329d1f..959c4ab92c 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -430,7 +430,7 @@ void DependencyRemoveDialog::_find_localization_remaps_of_removed_files(Vector<R // Look for dependencies in the translation remaps. if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")) { - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); if (remaps.has(path)) { RemovedDependency dep; @@ -544,28 +544,28 @@ void DependencyRemoveDialog::ok_pressed() { // If the file we are deleting for e.g. the main scene, default environment, // or audio bus layout, we must clear its definition in Project Settings. - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/config/icon"))) { + if (files_to_delete[i] == String(GLOBAL_GET("application/config/icon"))) { ProjectSettings::get_singleton()->set("application/config/icon", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/run/main_scene"))) { + if (files_to_delete[i] == String(GLOBAL_GET("application/run/main_scene"))) { ProjectSettings::get_singleton()->set("application/run/main_scene", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("application/boot_splash/image"))) { + if (files_to_delete[i] == String(GLOBAL_GET("application/boot_splash/image"))) { ProjectSettings::get_singleton()->set("application/boot_splash/image", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("rendering/environment/defaults/default_environment"))) { + if (files_to_delete[i] == String(GLOBAL_GET("rendering/environment/defaults/default_environment"))) { ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image"))) { + if (files_to_delete[i] == String(GLOBAL_GET("display/mouse_cursor/custom_image"))) { ProjectSettings::get_singleton()->set("display/mouse_cursor/custom_image", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("gui/theme/custom"))) { + if (files_to_delete[i] == String(GLOBAL_GET("gui/theme/custom"))) { ProjectSettings::get_singleton()->set("gui/theme/custom", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("gui/theme/custom_font"))) { + if (files_to_delete[i] == String(GLOBAL_GET("gui/theme/custom_font"))) { ProjectSettings::get_singleton()->set("gui/theme/custom_font", ""); } - if (files_to_delete[i] == String(ProjectSettings::get_singleton()->get("audio/buses/default_bus_layout"))) { + if (files_to_delete[i] == String(GLOBAL_GET("audio/buses/default_bus_layout"))) { ProjectSettings::get_singleton()->set("audio/buses/default_bus_layout", ""); } diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 83deff1469..46df618d57 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1036,7 +1036,7 @@ void EditorAudioBuses::_notification(int p_what) { case NOTIFICATION_DRAG_END: { if (drop_end) { - drop_end->queue_delete(); + drop_end->queue_free(); drop_end = nullptr; } } break; @@ -1208,7 +1208,7 @@ void EditorAudioBuses::_load_layout() { } void EditorAudioBuses::_load_default_layout() { - String layout_path = ProjectSettings::get_singleton()->get("audio/buses/default_bus_layout"); + String layout_path = GLOBAL_GET("audio/buses/default_bus_layout"); Ref<AudioBusLayout> state = ResourceLoader::load(layout_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE); if (state.is_null()) { @@ -1273,7 +1273,7 @@ EditorAudioBuses::EditorAudioBuses() { add_child(top_hb); file = memnew(Label); - String layout_path = ProjectSettings::get_singleton()->get("audio/buses/default_bus_layout"); + String layout_path = GLOBAL_GET("audio/buses/default_bus_layout"); file->set_text(String(TTR("Layout:")) + " " + layout_path.get_file()); file->set_clip_text(true); file->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1328,7 +1328,7 @@ EditorAudioBuses::EditorAudioBuses() { set_v_size_flags(SIZE_EXPAND_FILL); - edited_path = ProjectSettings::get_singleton()->get("audio/buses/default_bus_layout"); + edited_path = GLOBAL_GET("audio/buses/default_bus_layout"); file_dialog = memnew(EditorFileDialog); List<String> ext; diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 98f21bda7a..90310bb43c 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -222,7 +222,7 @@ void EditorAutoloadSettings::_autoload_edited() { name = "autoload/" + name; int order = ProjectSettings::get_singleton()->get_order(selected_autoload); - String scr_path = ProjectSettings::get_singleton()->get(selected_autoload); + String scr_path = GLOBAL_GET(selected_autoload); undo_redo->create_action(TTR("Rename Autoload")); @@ -250,7 +250,7 @@ void EditorAutoloadSettings::_autoload_edited() { String base = "autoload/" + ti->get_text(0); int order = ProjectSettings::get_singleton()->get_order(base); - String scr_path = ProjectSettings::get_singleton()->get(base); + String scr_path = GLOBAL_GET(base); if (scr_path.begins_with("*")) { scr_path = scr_path.substr(1, scr_path.length()); @@ -264,7 +264,7 @@ void EditorAutoloadSettings::_autoload_edited() { undo_redo->create_action(TTR("Toggle Autoload Globals")); undo_redo->add_do_property(ProjectSettings::get_singleton(), base, scr_path); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), base, ProjectSettings::get_singleton()->get(base)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), base, GLOBAL_GET(base)); undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", base, order); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", base, order); @@ -337,7 +337,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu undo_redo->add_do_property(ProjectSettings::get_singleton(), name, Variant()); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, GLOBAL_GET(name)); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_persisting", name, true); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", order); @@ -453,7 +453,7 @@ void EditorAutoloadSettings::update_autoload() { } String name = pi.name.get_slice("/", 1); - String scr_path = ProjectSettings::get_singleton()->get(pi.name); + String scr_path = GLOBAL_GET(pi.name); if (name.is_empty()) { continue; @@ -527,7 +527,7 @@ void EditorAutoloadSettings::update_autoload() { } if (info.node) { - info.node->queue_delete(); + info.node->queue_free(); info.node = nullptr; } @@ -764,7 +764,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_ undo_redo->add_do_property(ProjectSettings::get_singleton(), name, "*" + p_path); if (ProjectSettings::get_singleton()->has_setting(name)) { - undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, GLOBAL_GET(name)); } else { undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, Variant()); } @@ -791,7 +791,7 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) { undo_redo->add_do_property(ProjectSettings::get_singleton(), name, Variant()); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, GLOBAL_GET(name)); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_persisting", name, true); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", order); @@ -828,7 +828,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { } String name = pi.name.get_slice("/", 1); - String scr_path = ProjectSettings::get_singleton()->get(pi.name); + String scr_path = GLOBAL_GET(pi.name); if (name.is_empty()) { continue; diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index d1ea0f2814..6d8f0df452 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -1008,7 +1008,7 @@ void EditorData::script_class_save_icon_paths() { Dictionary old; if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { - old = ProjectSettings::get_singleton()->get("_global_script_class_icons"); + old = GLOBAL_GET("_global_script_class_icons"); } if ((!old.is_empty() || d.is_empty()) && d.hash() == old.hash()) { return; @@ -1028,7 +1028,7 @@ void EditorData::script_class_load_icon_paths() { script_class_clear_icon_paths(); if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { - Dictionary d = ProjectSettings::get_singleton()->get("_global_script_class_icons"); + Dictionary d = GLOBAL_GET("_global_script_class_icons"); List<Variant> keys; d.get_key_list(&keys); diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index f464ca3b3c..0c5c15a0ed 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -57,7 +57,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p } //this should be handled by EditorFileSystem already - //bool show_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"); + //bool show_hidden = EDITOR_GET("filesystem/file_dialog/show_hidden_files"); updating = false; for (int i = 0; i < p_dir->get_subdir_count(); i++) { TreeItem *ti = tree->create_item(p_item); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index ab252a7ff1..ee02916a5f 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -131,11 +131,11 @@ void EditorFileDialog::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - bool is_showing_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"); + bool is_showing_hidden = EDITOR_GET("filesystem/file_dialog/show_hidden_files"); if (show_hidden_files != is_showing_hidden) { set_show_hidden_files(is_showing_hidden); } - set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); + set_display_mode((DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); // DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD invalidate(); @@ -740,7 +740,7 @@ void EditorFileDialog::update_file_name() { // DO NOT USE THIS FUNCTION UNLESS NEEDED, CALL INVALIDATE() INSTEAD. void EditorFileDialog::update_file_list() { - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; Ref<Texture2D> folder_thumbnail; Ref<Texture2D> file_thumbnail; diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index c28bb18891..ce06631fdd 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1888,7 +1888,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String if (load_default && ProjectSettings::get_singleton()->has_setting("importer_defaults/" + importer->get_importer_name())) { //use defaults if exist - Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name()); + Dictionary d = GLOBAL_GET("importer_defaults/" + importer->get_importer_name()); List<Variant> v; d.get_key_list(&v); @@ -2388,7 +2388,7 @@ void EditorFileSystem::_update_extensions() { valid_extensions.insert(E); } - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { if (valid_extensions.has(E)) { continue; diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 0262284cdf..90f3f8d2f5 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -91,9 +91,9 @@ Ref<FontVariation> make_bold_font(const Ref<Font> &p_font, double p_embolden, Ty void editor_register_fonts(Ref<Theme> p_theme) { Ref<DirAccess> dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - TextServer::FontAntialiasing font_antialiasing = (TextServer::FontAntialiasing)(int)EditorSettings::get_singleton()->get("interface/editor/font_antialiasing"); - int font_hinting_setting = (int)EditorSettings::get_singleton()->get("interface/editor/font_hinting"); - TextServer::SubpixelPositioning font_subpixel_positioning = (TextServer::SubpixelPositioning)(int)EditorSettings::get_singleton()->get("interface/editor/font_subpixel_positioning"); + TextServer::FontAntialiasing font_antialiasing = (TextServer::FontAntialiasing)(int)EDITOR_GET("interface/editor/font_antialiasing"); + int font_hinting_setting = (int)EDITOR_GET("interface/editor/font_hinting"); + TextServer::SubpixelPositioning font_subpixel_positioning = (TextServer::SubpixelPositioning)(int)EDITOR_GET("interface/editor/font_subpixel_positioning"); TextServer::Hinting font_hinting; TextServer::Hinting font_mono_hinting; @@ -173,9 +173,9 @@ void editor_register_fonts(Ref<Theme> p_theme) { default_font_mono->set_fallbacks(fallbacks); // Init base font configs and load custom fonts. - String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font"); - String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold"); - String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font"); + String custom_font_path = EDITOR_GET("interface/editor/main_font"); + String custom_font_path_bold = EDITOR_GET("interface/editor/main_font_bold"); + String custom_font_path_source = EDITOR_GET("interface/editor/code_font"); Ref<FontVariation> default_fc; default_fc.instantiate(); @@ -283,7 +283,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { Ref<FontVariation> mono_other_fc = mono_fc->duplicate(); // Enable contextual alternates (coding ligatures) and custom features for the source editor font. - int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); + int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures"); switch (ot_mode) { case 1: { // Disable ligatures. Dictionary ftrs; @@ -291,7 +291,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { mono_fc->set_opentype_features(ftrs); } break; case 2: { // Custom. - Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Vector<String> subtag = String(EDITOR_GET("interface/editor/code_font_custom_opentype_features")).split(","); Dictionary ftrs; for (int i = 0; i < subtag.size(); i++) { Vector<String> subtag_a = subtag[i].split("="); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5192680787..ddb9bb30f1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -368,8 +368,29 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview class_desc->pop(); if (!p_method.qualifiers.is_empty()) { class_desc->push_color(qualifier_color); - class_desc->add_text(" "); - _add_text(p_method.qualifiers); + + PackedStringArray qualifiers = p_method.qualifiers.split_spaces(); + for (const String &qualifier : qualifiers) { + String hint; + if (qualifier == "vararg") { + hint = TTR("This method supports a variable number of arguments."); + } else if (qualifier == "virtual") { + hint = TTR("This method is called by the engine.\nIt can be overriden to customise built-in behavior."); + } else if (qualifier == "const") { + hint = TTR("This method has no side effects.\nIt does not modify the object in any way."); + } else if (qualifier == "static") { + hint = TTR("This method does not need an instance to be called.\nIt can be called directly using the class name."); + } + + class_desc->add_text(" "); + if (!hint.is_empty()) { + class_desc->push_hint(hint); + class_desc->add_text(qualifier); + class_desc->pop(); + } else { + class_desc->add_text(qualifier); + } + } class_desc->pop(); } @@ -927,7 +948,7 @@ void EditorHelp::_update_doc() { bool constructor_descriptions = false; bool method_descriptions = false; bool operator_descriptions = false; - bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically"); + bool sort_methods = EDITOR_GET("text_editor/help/sort_functions_alphabetically"); Vector<DocData::MethodDoc> methods; @@ -2304,7 +2325,6 @@ EditorHelpBit::EditorHelpBit() { rich_text = memnew(RichTextLabel); add_child(rich_text); rich_text->connect("meta_clicked", callable_mp(this, &EditorHelpBit::_meta_clicked)); - rich_text->set_override_selected_font_color(false); rich_text->set_fit_content_height(true); set_custom_minimum_size(Size2(0, 50 * EDSCALE)); } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 3856423fc4..94dd4d0606 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1062,10 +1062,8 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St bool EditorInspectorPlugin::can_handle(Object *p_object) { bool success = false; - if (GDVIRTUAL_CALL(_can_handle, p_object, success)) { - return success; - } - return false; + GDVIRTUAL_CALL(_can_handle, p_object, success); + return success; } void EditorInspectorPlugin::parse_begin(Object *p_object) { @@ -1082,10 +1080,8 @@ void EditorInspectorPlugin::parse_group(Object *p_object, const String &p_group) bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) { bool ret = false; - if (GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret)) { - return ret; - } - return false; + GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret); + return ret; } void EditorInspectorPlugin::parse_end(Object *p_object) { @@ -2527,7 +2523,7 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, EditorIn if (ep) { ep->object = object; - ep->connect("property_changed", callable_mp(this, &EditorInspector::_property_changed)); + ep->connect("property_changed", callable_mp(this, &EditorInspector::_property_changed).bind(false)); ep->connect("property_keyed", callable_mp(this, &EditorInspector::_property_keyed)); ep->connect("property_deleted", callable_mp(this, &EditorInspector::_property_deleted), CONNECT_DEFERRED); ep->connect("property_keyed_with_value", callable_mp(this, &EditorInspector::_property_keyed_with_value)); @@ -3876,7 +3872,7 @@ void EditorInspector::_notification(int p_what) { update_scroll_request = -1; } if (update_tree_pending) { - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } else if (refresh_countdown > 0) { refresh_countdown -= get_process_delta_time(); if (refresh_countdown <= 0) { @@ -3889,7 +3885,7 @@ void EditorInspector::_notification(int p_what) { } } } - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } } @@ -4095,7 +4091,7 @@ EditorInspector::EditorInspector() { get_v_scroll_bar()->connect("value_changed", callable_mp(this, &EditorInspector::_vscroll_changed)); update_scroll_request = -1; if (EditorSettings::get_singleton()) { - refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval")); + refresh_countdown = float(EDITOR_GET("docks/property_editor/auto_refresh_interval")); } else { //used when class is created by the docgen to dump default values of everything bindable, editorsettings may not be created refresh_countdown = 0.33; diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp index 953358b23e..106cc61947 100644 --- a/editor/editor_locale_dialog.cpp +++ b/editor/editor_locale_dialog.cpp @@ -123,7 +123,7 @@ void EditorLocaleDialog::_filter_lang_option_changed() { Array f_lang_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/language_filter")) { - f_lang_all = ProjectSettings::get_singleton()->get("internationalization/locale/language_filter"); + f_lang_all = GLOBAL_GET("internationalization/locale/language_filter"); prev = f_lang_all; } @@ -156,7 +156,7 @@ void EditorLocaleDialog::_filter_script_option_changed() { Array f_script_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/script_filter")) { - f_script_all = ProjectSettings::get_singleton()->get("internationalization/locale/script_filter"); + f_script_all = GLOBAL_GET("internationalization/locale/script_filter"); prev = f_script_all; } @@ -189,7 +189,7 @@ void EditorLocaleDialog::_filter_cnt_option_changed() { Array f_cnt_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/country_filter")) { - f_cnt_all = ProjectSettings::get_singleton()->get("internationalization/locale/country_filter"); + f_cnt_all = GLOBAL_GET("internationalization/locale/country_filter"); prev = f_cnt_all; } @@ -218,7 +218,7 @@ void EditorLocaleDialog::_filter_mode_changed(int p_mode) { Variant prev; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/locale_filter_mode")) { - prev = ProjectSettings::get_singleton()->get("internationalization/locale/locale_filter_mode"); + prev = GLOBAL_GET("internationalization/locale/locale_filter_mode"); } undo_redo->create_action(TTR("Changed Locale Filter Mode")); @@ -238,19 +238,19 @@ void EditorLocaleDialog::_update_tree() { int filter = SHOW_ALL_LOCALES; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/locale_filter_mode")) { - filter = ProjectSettings::get_singleton()->get("internationalization/locale/locale_filter_mode"); + filter = GLOBAL_GET("internationalization/locale/locale_filter_mode"); } Array f_lang_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/language_filter")) { - f_lang_all = ProjectSettings::get_singleton()->get("internationalization/locale/language_filter"); + f_lang_all = GLOBAL_GET("internationalization/locale/language_filter"); } Array f_cnt_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/country_filter")) { - f_cnt_all = ProjectSettings::get_singleton()->get("internationalization/locale/country_filter"); + f_cnt_all = GLOBAL_GET("internationalization/locale/country_filter"); } Array f_script_all; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/script_filter")) { - f_script_all = ProjectSettings::get_singleton()->get("internationalization/locale/script_filter"); + f_script_all = GLOBAL_GET("internationalization/locale/script_filter"); } bool is_edit_mode = edit_filters->is_pressed(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 8ee82888f3..bbb7fb384a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -335,7 +335,7 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto // TODO: This REALLY should be done in a better way than replacing all tabs after almost EVERY action. void EditorNode::_update_scene_tabs() { - bool show_rb = EditorSettings::get_singleton()->get("interface/scene_tabs/show_script_button"); + bool show_rb = EDITOR_GET("interface/scene_tabs/show_script_button"); if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_GLOBAL_MENU)) { DisplayServer::get_singleton()->global_menu_clear("_dock"); @@ -428,7 +428,7 @@ void EditorNode::_version_control_menu_option(int p_idx) { } void EditorNode::_update_title() { - const String appname = ProjectSettings::get_singleton()->get("application/config/name"); + const String appname = GLOBAL_GET("application/config/name"); String title = (appname.is_empty() ? TTR("Unnamed Project") : appname); const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_scene_file_path() : String(); if (!edited.is_empty()) { @@ -635,7 +635,7 @@ void EditorNode::_notification(int p_what) { update_spinner_step_frame = frame + 1; // Update the icon itself only when the spinner is visible. - if (EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")) { + if (EDITOR_GET("interface/editor/show_update_spinner")) { update_spinner->set_icon(gui_base->get_theme_icon("Progress" + itos(update_spinner_step + 1), SNAME("EditorIcons"))); } } @@ -700,7 +700,7 @@ void EditorNode::_notification(int p_what) { _initializing_plugins = true; Vector<String> addons; if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { - addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); + addons = GLOBAL_GET("editor_plugins/enabled"); } for (int i = 0; i < addons.size(); i++) { @@ -847,7 +847,7 @@ void EditorNode::_notification(int p_what) { HashSet<String> updated_textfile_extensions; bool extensions_match = true; - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { updated_textfile_extensions.insert(E); if (extensions_match && !textfile_extensions.has(E)) { @@ -866,9 +866,9 @@ void EditorNode::_notification(int p_what) { } void EditorNode::_update_update_spinner() { - update_spinner->set_visible(EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")); + update_spinner->set_visible(EDITOR_GET("interface/editor/show_update_spinner")); - const bool update_continuously = EditorSettings::get_singleton()->get("interface/editor/update_continuously"); + const bool update_continuously = EDITOR_GET("interface/editor/update_continuously"); PopupMenu *update_popup = update_spinner->get_popup(); update_popup->set_item_checked(update_popup->get_item_index(SETTINGS_UPDATE_CONTINUOUSLY), update_continuously); update_popup->set_item_checked(update_popup->get_item_index(SETTINGS_UPDATE_WHEN_CHANGED), !update_continuously); @@ -1273,7 +1273,7 @@ void EditorNode::edit_node(Node *p_node) { void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path) { editor_data.apply_changes_in_editors(); int flg = 0; - if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) { + if (EDITOR_GET("filesystem/on_save/compress_binary_resources")) { flg |= ResourceSaver::FLAG_COMPRESS; } @@ -1640,7 +1640,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { save.step(TTR("Creating Thumbnail"), 2); save.step(TTR("Creating Thumbnail"), 3); - int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int preview_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); preview_size *= EDSCALE; // Consider a square region. @@ -1701,7 +1701,7 @@ int EditorNode::_save_external_resources() { // Save external resources and its subresources if any was modified. int flg = 0; - if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) { + if (EDITOR_GET("filesystem/on_save/compress_binary_resources")) { flg |= ResourceSaver::FLAG_COMPRESS; } flg |= ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; @@ -1807,7 +1807,7 @@ void EditorNode::_save_scene(String p_file, int idx) { } int flg = 0; - if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) { + if (EDITOR_GET("filesystem/on_save/compress_binary_resources")) { flg |= ResourceSaver::FLAG_COMPRESS; } flg |= ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; @@ -2407,7 +2407,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { if (main_plugin && !skip_main_plugin) { // Special case if use of external editor is true. Resource *current_res = Object::cast_to<Resource>(current_obj); - if (main_plugin->get_name() == "Script" && !current_obj->is_class("VisualScript") && current_res && !current_res->is_built_in() && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) { + if (main_plugin->get_name() == "Script" && !current_obj->is_class("VisualScript") && current_res && !current_res->is_built_in() && (bool(EDITOR_GET("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) { if (!changing_scene) { main_plugin->edit(current_obj); } @@ -3105,7 +3105,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } String EditorNode::adjust_scene_name_casing(const String &root_name) { - switch (ProjectSettings::get_singleton()->get("editor/scene/scene_naming").operator int()) { + switch (GLOBAL_GET("editor/scene/scene_naming").operator int()) { case SCENE_NAME_CASING_AUTO: // Use casing of the root node. break; @@ -3125,7 +3125,7 @@ void EditorNode::_screenshot(bool p_use_utc) { String name = "editor_screenshot_" + Time::get_singleton()->get_datetime_string_from_system(p_use_utc).replace(":", "") + ".png"; NodePath path = String("user://") + name; _save_screenshot(path); - if (EditorSettings::get_singleton()->get("interface/editor/automatically_open_screenshots")) { + if (EDITOR_GET("interface/editor/automatically_open_screenshots")) { OS::get_singleton()->shell_open(String("file://") + ProjectSettings::get_singleton()->globalize_path(path)); } } @@ -3370,7 +3370,7 @@ void EditorNode::editor_select(int p_which) { editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name()); } - if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) { + if (EDITOR_GET("interface/editor/separate_distraction_mode")) { if (p_which == EDITOR_SCRIPT) { set_distraction_free_mode(script_distraction_free); } else { @@ -4392,6 +4392,27 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p return nullptr; } +bool EditorNode::is_object_of_custom_type(const Object *p_object, const StringName &p_class) { + ERR_FAIL_COND_V(!p_object, false); + + Ref<Script> scr = p_object->get_script(); + if (scr.is_null() && Object::cast_to<Script>(p_object)) { + scr = p_object; + } + + if (scr.is_valid()) { + Ref<Script> base_script = scr; + while (base_script.is_valid()) { + StringName name = EditorNode::get_editor_data().script_class_get_name(base_script->get_path()); + if (name == p_class) { + return true; + } + base_script = base_script->get_base_script(); + } + } + return false; +} + void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { if (singleton->cmdline_export_mode) { print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps)); @@ -4534,7 +4555,7 @@ void EditorNode::_dock_floating_close_request(Control *p_control) { dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count())); dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index")); - window->queue_delete(); + window->queue_free(); _update_dock_containers(); @@ -5538,7 +5559,7 @@ bool EditorNode::get_docks_visible() const { } void EditorNode::_toggle_distraction_free_mode() { - if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) { + if (EDITOR_GET("interface/editor/separate_distraction_mode")) { int screen = -1; for (int i = 0; i < editor_table.size(); i++) { if (editor_plugin_screen == editor_table[i]) { @@ -6147,7 +6168,7 @@ EditorNode::EditorNode() { FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename")); { - int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale"); + int display_scale = EDITOR_GET("interface/editor/display_scale"); switch (display_scale) { case 0: @@ -6173,7 +6194,7 @@ EditorNode::EditorNode() { editor_set_scale(2.0); break; default: - editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale")); + editor_set_scale(EDITOR_GET("interface/editor/custom_display_scale")); break; } } @@ -6181,9 +6202,9 @@ EditorNode::EditorNode() { // Define a minimum window size to prevent UI elements from overlapping or being cut off. DisplayServer::get_singleton()->window_set_min_size(Size2(1024, 600) * EDSCALE); - FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); + FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); int swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons"); if (swap_cancel_ok != 0) { // 0 is auto, set in register_scene based on DisplayServer. @@ -6352,7 +6373,7 @@ EditorNode::EditorNode() { ED_SHORTCUT("canvas_item_editor/pan_view", TTR("Pan View"), Key::SPACE); - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { textfile_extensions.insert(E); } diff --git a/editor/editor_node.h b/editor/editor_node.h index 9452425dc8..b5d844558e 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -827,6 +827,8 @@ public: Ref<Texture2D> get_object_icon(const Object *p_object, const String &p_fallback = "Object"); Ref<Texture2D> get_class_icon(const String &p_class, const String &p_fallback = "Object") const; + bool is_object_of_custom_type(const Object *p_object, const StringName &p_class); + void show_accept(const String &p_text, const String &p_title); void show_save_accept(const String &p_text, const String &p_title); void show_warning(const String &p_text, const String &p_title = TTR("Warning!")); diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp index 54d4660cb6..f55c530ffb 100644 --- a/editor/editor_paths.cpp +++ b/editor/editor_paths.cpp @@ -83,7 +83,7 @@ String EditorPaths::get_script_templates_dir() const { } String EditorPaths::get_project_script_templates_dir() const { - return ProjectSettings::get_singleton()->get("editor/script/templates_search_path"); + return GLOBAL_GET("editor/script/templates_search_path"); } String EditorPaths::get_feature_profiles_dir() const { diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 4fdf669121..e852100555 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -571,10 +571,8 @@ void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) { bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) { bool success = false; - if (GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success)) { - return success; - } - return false; + GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success); + return success; } void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) { @@ -606,12 +604,8 @@ int EditorPlugin::update_overlays() const { EditorPlugin::AfterGUIInput EditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { int success = EditorPlugin::AFTER_GUI_INPUT_PASS; - - if (GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success)) { - return static_cast<EditorPlugin::AfterGUIInput>(success); - } - - return EditorPlugin::AFTER_GUI_INPUT_PASS; + GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success); + return static_cast<EditorPlugin::AfterGUIInput>(success); } void EditorPlugin::forward_3d_draw_over_viewport(Control *p_overlay) { @@ -624,29 +618,20 @@ void EditorPlugin::forward_3d_force_draw_over_viewport(Control *p_overlay) { String EditorPlugin::get_name() const { String name; - if (GDVIRTUAL_CALL(_get_plugin_name, name)) { - return name; - } - - return String(); + GDVIRTUAL_CALL(_get_plugin_name, name); + return name; } const Ref<Texture2D> EditorPlugin::get_icon() const { Ref<Texture2D> icon; - if (GDVIRTUAL_CALL(_get_plugin_icon, icon)) { - return icon; - } - - return Ref<Texture2D>(); + GDVIRTUAL_CALL(_get_plugin_icon, icon); + return icon; } bool EditorPlugin::has_main_screen() const { - bool success; - if (GDVIRTUAL_CALL(_has_main_screen, success)) { - return success; - } - - return false; + bool success = false; + GDVIRTUAL_CALL(_has_main_screen, success); + return success; } void EditorPlugin::make_visible(bool p_visible) { @@ -663,20 +648,14 @@ void EditorPlugin::edit(Object *p_object) { bool EditorPlugin::handles(Object *p_object) const { bool success = false; - if (GDVIRTUAL_CALL(_handles, p_object, success)) { - return success; - } - - return false; + GDVIRTUAL_CALL(_handles, p_object, success); + return success; } Dictionary EditorPlugin::get_state() const { Dictionary state; - if (GDVIRTUAL_CALL(_get_state, state)) { - return state; - } - - return Dictionary(); + GDVIRTUAL_CALL(_get_state, state); + return state; } void EditorPlugin::set_state(const Dictionary &p_state) { @@ -822,11 +801,9 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) { } bool EditorPlugin::build() { - bool success; - if (GDVIRTUAL_CALL(_build, success)) { - return success; - } - return true; + bool success = true; + GDVIRTUAL_CALL(_build, success); + return success; } void EditorPlugin::queue_save_layout() { diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 899fa69be1..84caed9db5 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1242,7 +1242,7 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) { String name; if (ProjectSettings::get_singleton()->has_setting(basename + vformat("/layer_%d", i + 1))) { - name = ProjectSettings::get_singleton()->get(basename + vformat("/layer_%d", i + 1)); + name = GLOBAL_GET(basename + vformat("/layer_%d", i + 1)); } if (name.is_empty()) { @@ -1270,7 +1270,7 @@ void EditorPropertyLayers::set_layer_name(int p_index, const String &p_name) { String EditorPropertyLayers::get_layer_name(int p_index) const { const String property_name = basename + vformat("/layer_%d", p_index + 1); if (ProjectSettings::get_singleton()->has_setting(property_name)) { - return ProjectSettings::get_singleton()->get(property_name); + return GLOBAL_GET(property_name); } return String(); } @@ -3699,7 +3699,8 @@ bool EditorPropertyNodePath::is_drop_valid(const Dictionary &p_drag_data) const } for (const StringName &E : valid_types) { - if (dropped_node->is_class(E)) { + if (dropped_node->is_class(E) || + EditorNode::get_singleton()->is_object_of_custom_type(dropped_node, E)) { return true; } } diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 7cc42f4d24..bec05a0cd6 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -293,7 +293,7 @@ void EditorPropertyArray::update_property() { continue; // Don't remove the property that the user is moving. } - child->queue_delete(); // Button still needed after pressed is called. + child->queue_free(); // Button still needed after pressed is called. property_vbox->remove_child(child); } } @@ -861,7 +861,7 @@ void EditorPropertyDictionary::update_property() { } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = property_vbox->get_child_count() - 1; i >= 0; i--) { - property_vbox->get_child(i)->queue_delete(); + property_vbox->get_child(i)->queue_free(); } } @@ -1349,7 +1349,7 @@ void EditorPropertyLocalizableString::update_property() { } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = property_vbox->get_child_count() - 1; i >= 0; i--) { - property_vbox->get_child(i)->queue_delete(); + property_vbox->get_child(i)->queue_free(); } } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 5545dc4ee2..7c1e3e63ef 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -111,7 +111,7 @@ void EditorResourcePicker::_update_resource_preview(const String &p_path, const assign_button->set_custom_minimum_size(assign_button_min_size); } else { preview_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; assign_button->set_custom_minimum_size(Size2(MAX(1, assign_button_min_size.x), MAX(thumbnail_size, assign_button_min_size.y))); } @@ -512,12 +512,9 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) { } bool EditorResourcePicker::handle_menu_selected(int p_which) { - bool success; - if (GDVIRTUAL_CALL(_handle_menu_selected, p_which, success)) { - return success; - } - - return false; + bool success = false; + GDVIRTUAL_CALL(_handle_menu_selected, p_which, success); + return success; } void EditorResourcePicker::_button_draw() { diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 33de63e63d..083b382521 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -71,20 +71,14 @@ Ref<Texture2D> EditorResourcePreviewGenerator::generate_from_path(const String & bool EditorResourcePreviewGenerator::generate_small_preview_automatically() const { bool success = false; - if (GDVIRTUAL_CALL(_generate_small_preview_automatically, success)) { - return success; - } - - return false; + GDVIRTUAL_CALL(_generate_small_preview_automatically, success); + return success; } bool EditorResourcePreviewGenerator::can_generate_small_preview() const { bool success = false; - if (GDVIRTUAL_CALL(_can_generate_small_preview, success)) { - return success; - } - - return false; + GDVIRTUAL_CALL(_can_generate_small_preview, success); + return success; } void EditorResourcePreviewGenerator::_bind_methods() { @@ -148,7 +142,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< return; //could not guess type } - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; r_texture = Ref<ImageTexture>(); @@ -232,7 +226,7 @@ void EditorResourcePreview::_iterate() { Ref<ImageTexture> texture; Ref<ImageTexture> small_texture; - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; if (item.resource.is_valid()) { diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index 99c8481d33..599df12bd3 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -88,7 +88,7 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) { } } - int screen = EditorSettings::get_singleton()->get("run/window_placement/screen"); + int screen = EDITOR_GET("run/window_placement/screen"); if (screen == 0) { // Same as editor screen = DisplayServer::get_singleton()->window_get_current_screen(); @@ -114,21 +114,21 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) { screen_rect.position = DisplayServer::get_singleton()->screen_get_position(screen); screen_rect.size = DisplayServer::get_singleton()->screen_get_size(screen); - int window_placement = EditorSettings::get_singleton()->get("run/window_placement/rect"); + int window_placement = EDITOR_GET("run/window_placement/rect"); if (screen_rect != Rect2()) { Size2 window_size; - window_size.x = ProjectSettings::get_singleton()->get("display/window/size/viewport_width"); - window_size.y = ProjectSettings::get_singleton()->get("display/window/size/viewport_height"); + window_size.x = GLOBAL_GET("display/window/size/viewport_width"); + window_size.y = GLOBAL_GET("display/window/size/viewport_height"); Size2 desired_size; - desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/window_width_override"); - desired_size.y = ProjectSettings::get_singleton()->get("display/window/size/window_height_override"); + desired_size.x = GLOBAL_GET("display/window/size/window_width_override"); + desired_size.y = GLOBAL_GET("display/window/size/window_height_override"); if (desired_size.x > 0 && desired_size.y > 0) { window_size = desired_size; } if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_HIDPI)) { - bool hidpi_proj = ProjectSettings::get_singleton()->get("display/window/dpi/allow_hidpi"); + bool hidpi_proj = GLOBAL_GET("display/window/dpi/allow_hidpi"); int display_scale = 1; if (OS::get_singleton()->is_hidpi_allowed()) { @@ -159,7 +159,7 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) { args.push_back(itos(pos.x) + "," + itos(pos.y)); } break; case 2: { // custom pos - Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position"); + Vector2 pos = EDITOR_GET("run/window_placement/rect_custom_position"); pos += screen_rect.position; args.push_back("--position"); args.push_back(itos(pos.x) + "," + itos(pos.y)); @@ -215,7 +215,7 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) { String exec = OS::get_singleton()->get_executable_path(); - const String raw_custom_args = ProjectSettings::get_singleton()->get("editor/run/main_run_args"); + const String raw_custom_args = GLOBAL_GET("editor/run/main_run_args"); if (!raw_custom_args.is_empty()) { // Allow the user to specify a command to run, similar to Steam's launch options. // In this case, Godot will no longer be run directly; it's up to the underlying command diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5bdfd8d377..409ef95fb0 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -777,7 +777,7 @@ void EditorSettings::_load_godot2_text_editor_theme() { _initial_set("text_editor/theme/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6)); _initial_set("text_editor/theme/highlighting/caret_color", Color(0.67, 0.67, 0.67)); _initial_set("text_editor/theme/highlighting/caret_background_color", Color(0, 0, 0)); - _initial_set("text_editor/theme/highlighting/text_selected_color", Color(0, 0, 0)); + _initial_set("text_editor/theme/highlighting/text_selected_color", Color(0, 0, 0, 0)); _initial_set("text_editor/theme/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35)); _initial_set("text_editor/theme/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); _initial_set("text_editor/theme/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); @@ -1060,7 +1060,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re Variant ret = p_default; if (EditorSettings::get_singleton()->has_setting(p_setting)) { - ret = EditorSettings::get_singleton()->get(p_setting); + ret = EDITOR_GET(p_setting); } else { EditorSettings::get_singleton()->set_manually(p_setting, p_default); EditorSettings::get_singleton()->set_restart_if_changed(p_setting, p_restart_if_changed); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 1d9e320be1..17b5eb3314 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1801,7 +1801,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color safe_line_number_color = dark_theme ? (dim_color * Color(1, 1.2, 1, 1.5)) : Color(0, 0.4, 0, 0.75); const Color caret_color = mono_color; const Color caret_background_color = mono_color.inverted(); - const Color text_selected_color = dark_color_3; + const Color text_selected_color = Color(0, 0, 0, 0); const Color brace_mismatch_color = dark_theme ? error_color : Color(1, 0.08, 0, 1); const Color current_line_color = alpha1; const Color line_length_guideline_color = dark_theme ? base_color : background_color; @@ -1907,7 +1907,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) { Ref<Theme> theme = create_editor_theme(p_theme); - const String custom_theme_path = EditorSettings::get_singleton()->get("interface/theme/custom_theme"); + const String custom_theme_path = EDITOR_GET("interface/theme/custom_theme"); if (!custom_theme_path.is_empty()) { Ref<Theme> custom_theme = ResourceLoader::load(custom_theme_path); if (custom_theme.is_valid()) { diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 6b2cc99df9..504c8f0432 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -231,7 +231,7 @@ void EditorToaster::_auto_hide_or_free_toasts() { // Delete the control right away (removed as child) as it might cause issues otherwise when iterative over the vbox_container children. for (unsigned int i = 0; i < to_delete.size(); i++) { vbox_container->remove_child(to_delete[i]); - to_delete[i]->queue_delete(); + to_delete[i]->queue_free(); toasts.erase(to_delete[i]); } diff --git a/editor/export/editor_export.cpp b/editor/export/editor_export.cpp index 29b6a5e546..c2aa27b34d 100644 --- a/editor/export/editor_export.cpp +++ b/editor/export/editor_export.cpp @@ -124,7 +124,7 @@ void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, in } String EditorExportPlatform::test_etc2() const { - const bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2"); + const bool etc2_supported = GLOBAL_GET("rendering/textures/vram_compression/import_etc2"); if (!etc2_supported) { return TTR("Target platform requires 'ETC2' texture compression. Enable 'Import Etc 2' in Project Settings."); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index c86114a140..7c5c7da2ef 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -136,16 +136,16 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err) } void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) { - String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); - int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); + String host = EDITOR_GET("network/debug/remote_host"); + int remote_port = (int)EDITOR_GET("network/debug/remote_port"); if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) { host = "localhost"; } if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { - int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); - String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); + int port = EDITOR_GET("filesystem/file_server/port"); + String passwd = EDITOR_GET("filesystem/file_server/password"); r_flags.push_back("--remote-fs"); r_flags.push_back(host + ":" + itos(port)); if (!passwd.is_empty()) { @@ -813,7 +813,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & continue; } - String autoload_path = ProjectSettings::get_singleton()->get(pi.name); + String autoload_path = GLOBAL_GET(pi.name); if (autoload_path.begins_with("*")) { autoload_path = autoload_path.substr(1); @@ -1241,8 +1241,8 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } // Store icon and splash images directly, they need to bypass the import system and be loaded as images - String icon = ProjectSettings::get_singleton()->get("application/config/icon"); - String splash = ProjectSettings::get_singleton()->get("application/boot_splash/image"); + String icon = GLOBAL_GET("application/config/icon"); + String splash = GLOBAL_GET("application/boot_splash/image"); if (!icon.is_empty() && FileAccess::exists(icon)) { Vector<uint8_t> array = FileAccess::get_file_as_array(icon); err = p_func(p_udata, icon, array, idx, total, enc_in_filters, enc_ex_filters, key); @@ -1277,7 +1277,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & // Store text server data if it is supported. if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) { - bool use_data = ProjectSettings::get_singleton()->get("internationalization/locale/include_text_server_data"); + bool use_data = GLOBAL_GET("internationalization/locale/include_text_server_data"); if (use_data) { // Try using user provided data file. String ts_data = "res://" + TS->get_support_data_filename(); @@ -1569,16 +1569,16 @@ Error EditorExportPlatform::export_zip(const Ref<EditorExportPreset> &p_preset, } void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) { - String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); - int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); + String host = EDITOR_GET("network/debug/remote_host"); + int remote_port = (int)EDITOR_GET("network/debug/remote_port"); if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) { host = "localhost"; } if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { - int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); - String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); + int port = EDITOR_GET("filesystem/file_server/port"); + String passwd = EDITOR_GET("filesystem/file_server/password"); r_flags.push_back("--remote-fs"); r_flags.push_back(host + ":" + itos(port)); if (!passwd.is_empty()) { diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp index 971ea579cc..78d4f93dfe 100644 --- a/editor/export/editor_export_plugin.cpp +++ b/editor/export/editor_export_plugin.cpp @@ -142,10 +142,8 @@ void EditorExportPlugin::_export_end_script() { bool EditorExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const { bool ret = false; - if (GDVIRTUAL_CALL(_begin_customize_resources, p_platform, p_features, ret)) { - return ret; - } - return false; + GDVIRTUAL_CALL(_begin_customize_resources, p_platform, p_features, ret); + return ret; } Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_resource, const String &p_path) { @@ -158,10 +156,8 @@ Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_res bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const { bool ret = false; - if (GDVIRTUAL_CALL(_begin_customize_scenes, p_platform, p_features, ret)) { - return ret; - } - return false; + GDVIRTUAL_CALL(_begin_customize_scenes, p_platform, p_features, ret); + return ret; } Node *EditorExportPlugin::_customize_scene(Node *p_root, const String &p_path) { diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 9b5e76bcd7..6ff3539708 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -1290,7 +1290,7 @@ ProjectExportDialog::ProjectExportDialog() { // If no default set, use project name if (default_filename.is_empty()) { // If no project name defined, use a sane default - default_filename = ProjectSettings::get_singleton()->get("application/config/name"); + default_filename = GLOBAL_GET("application/config/name"); if (default_filename.is_empty()) { default_filename = "UnnamedProject"; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index d37f2aab43..608e7ce3cb 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -106,7 +106,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory // Create all items for the files in the subdirectory. if (display_mode == DISPLAY_MODE_TREE_ONLY) { - String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene"); + String main_scene = GLOBAL_GET("application/run/main_scene"); // Build the list of the files to display. List<FileInfo> file_list; @@ -383,7 +383,7 @@ void FileSystemDock::_notification(int p_what) { current_path->connect("text_submitted", callable_mp(this, &FileSystemDock::_navigate_to_path).bind(false)); - always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders")); + always_show_folders = bool(EDITOR_GET("docks/filesystem/always_show_folders")); set_file_list_display_mode(FileSystemDock::FILE_LIST_DISPLAY_LIST); @@ -464,7 +464,7 @@ void FileSystemDock::_notification(int p_what) { file_list_button_sort->set_icon(get_theme_icon(SNAME("Sort"), SNAME("EditorIcons"))); // Update always show folders. - bool new_always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders")); + bool new_always_show_folders = bool(EDITOR_GET("docks/filesystem/always_show_folders")); if (new_always_show_folders != always_show_folders) { always_show_folders = new_always_show_folders; _update_file_list(true); @@ -743,7 +743,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { String directory = path; String file = ""; - int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size"); + int thumbnail_size = EDITOR_GET("docks/filesystem/thumbnail_size"); thumbnail_size *= EDSCALE; Ref<Texture2D> folder_thumbnail; Ref<Texture2D> file_thumbnail; @@ -893,7 +893,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { _sort_file_info_list(file_list); // Fills the ItemList control node from the FileInfos. - String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene"); + String main_scene = GLOBAL_GET("application/run/main_scene"); for (FileInfo &E : file_list) { FileInfo *finfo = &(E); String fname = finfo->name; @@ -2500,7 +2500,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str if (filenames.size() == 1) { p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open Scene"), FILE_OPEN); p_popup->add_icon_item(get_theme_icon(SNAME("CreateNewSceneFrom"), SNAME("EditorIcons")), TTR("New Inherited Scene"), FILE_INHERIT); - if (ProjectSettings::get_singleton()->get("application/run/main_scene") != filenames[0]) { + if (GLOBAL_GET("application/run/main_scene") != filenames[0]) { p_popup->add_icon_item(get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")), TTR("Set As Main Scene"), FILE_MAIN_SCENE); } } else { diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index a0f4ade182..a2bd1223a9 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -464,9 +464,9 @@ void FindInFilesDialog::_notification(int p_what) { _search_text_line_edit->select_all(); // Extensions might have changed in the meantime, we clean them and instance them again. for (int i = 0; i < _filters_container->get_child_count(); i++) { - _filters_container->get_child(i)->queue_delete(); + _filters_container->get_child(i)->queue_free(); } - Array exts = ProjectSettings::get_singleton()->get("editor/script/search_in_file_extensions"); + Array exts = GLOBAL_GET("editor/script/search_in_file_extensions"); for (int i = 0; i < exts.size(); ++i) { CheckBox *cb = memnew(CheckBox); cb->set_text(exts[i]); diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index e1df78e741..ab15aa4fdc 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -135,7 +135,7 @@ String ResourceImporterLayeredTexture::get_preset_name(int p_idx) const { } void ResourceImporterLayeredTexture::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const { - r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Lossless (PNG),Lossy (WebP),Video RAM (S3TC/ETC/BPTC),Uncompressed,Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 1)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Lossless,Lossy,VRAM Compressed,VRAM Uncompressed,Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 1)); r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "compress/lossy_quality", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.7)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/hdr_compression", PROPERTY_HINT_ENUM, "Disabled,Opaque Only,Always"), 1)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Disabled,Enabled,RGBA Only"), 0)); @@ -418,7 +418,7 @@ String ResourceImporterLayeredTexture::get_import_settings_string() const { int index = 0; while (compression_formats[index]) { String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]); - bool test = ProjectSettings::get_singleton()->get(setting_path); + bool test = GLOBAL_GET(setting_path); if (test) { s += String(compression_formats[index]); } @@ -450,7 +450,7 @@ bool ResourceImporterLayeredTexture::are_import_settings_valid(const String &p_p bool valid = true; while (compression_formats[index]) { String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]); - bool test = ProjectSettings::get_singleton()->get(setting_path); + bool test = GLOBAL_GET(setting_path); if (test) { if (!formats_imported.has(compression_formats[index])) { valid = false; @@ -484,7 +484,7 @@ void ResourceImporterLayeredTexture::_check_compress_ctex(const String &p_source // Must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc). // Android, GLES 2.x - bool can_bptc = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_bptc"); + bool can_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_bptc"); if (can_bptc) { r_texture_import->formats_imported.push_back("bptc"); // BPTC needs to be added anyway. } @@ -492,7 +492,7 @@ void ResourceImporterLayeredTexture::_check_compress_ctex(const String &p_source ERR_FAIL_NULL(r_texture_import->image); bool is_hdr = (r_texture_import->image->get_format() >= Image::FORMAT_RF && r_texture_import->image->get_format() <= Image::FORMAT_RGBE9995); bool is_ldr = (r_texture_import->image->get_format() >= Image::FORMAT_L8 && r_texture_import->image->get_format() <= Image::FORMAT_RGB565); - bool can_s3tc = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_s3tc"); + bool can_s3tc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc"); ERR_FAIL_NULL(r_texture_import->slices); // Can compress hdr, but hdr with alpha is not compressible. if (r_texture_import->hdr_compression == 2) { @@ -530,7 +530,7 @@ void ResourceImporterLayeredTexture::_check_compress_ctex(const String &p_source } } if (!(r_texture_import->used_channels == Image::USED_CHANNELS_LA || r_texture_import->used_channels == Image::USED_CHANNELS_RGBA)) { - if (ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2")) { + if (GLOBAL_GET("rendering/textures/vram_compression/import_etc2")) { _save_tex(*r_texture_import->slices, r_texture_import->save_path + ".etc2." + extension, r_texture_import->compress_mode, r_texture_import->lossy, Image::COMPRESS_ETC2, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, true); r_texture_import->platform_variants->push_back("etc2"); r_texture_import->formats_imported.push_back("etc2"); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 756d61f712..8ede88a888 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1373,7 +1373,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap< } for (int i = 0; i < post_importer_plugins.size(); i++) { - post_importer_plugins.write[i]->internal_process(EditorScenePostImportPlugin::INTERNAL_IMPORT_CATEGORY_ANIMATION, p_root, p_node, anim, node_settings); + post_importer_plugins.write[i]->internal_process(EditorScenePostImportPlugin::INTERNAL_IMPORT_CATEGORY_ANIMATION, p_root, p_node, anim, anim_settings); } } } diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index ed3f1ff489..54ad840f3d 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -192,7 +192,7 @@ bool ResourceImporterTexture::get_option_visibility(const String &p_path, const if (compress_mode < COMPRESS_VRAM_COMPRESSED) { return false; } - if (!ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_bptc")) { + if (!GLOBAL_GET("rendering/textures/vram_compression/import_bptc")) { return false; } } @@ -246,7 +246,7 @@ void ResourceImporterTexture::get_import_options(const String &p_path, List<Impo void ResourceImporterTexture::save_to_ctex_format(Ref<FileAccess> f, const Ref<Image> &p_image, CompressMode p_compress_mode, Image::UsedChannels p_channels, Image::CompressMode p_compress_format, float p_lossy_quality) { switch (p_compress_mode) { case COMPRESS_LOSSLESS: { - bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png") || + bool lossless_force_png = GLOBAL_GET("rendering/textures/lossless_compression/force_png") || !Image::_webp_mem_loader_func; // WebP module disabled. bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit f->store_32(use_webp ? CompressedTexture2D::DATA_FORMAT_WEBP : CompressedTexture2D::DATA_FORMAT_PNG); @@ -599,8 +599,8 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String const bool is_hdr = (image->get_format() >= Image::FORMAT_RF && image->get_format() <= Image::FORMAT_RGBE9995); bool is_ldr = (image->get_format() >= Image::FORMAT_L8 && image->get_format() <= Image::FORMAT_RGB565); - const bool can_bptc = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_bptc"); - const bool can_s3tc = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_s3tc"); + const bool can_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_bptc"); + const bool can_s3tc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc"); if (can_bptc) { // Add to the list anyway. @@ -645,13 +645,13 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String formats_imported.push_back("s3tc"); } - if (ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2")) { + if (GLOBAL_GET("rendering/textures/vram_compression/import_etc2")) { _save_ctex(image, p_save_path + ".etc2.ctex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel); r_platform_variants->push_back("etc2"); formats_imported.push_back("etc2"); } - if (ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc")) { + if (GLOBAL_GET("rendering/textures/vram_compression/import_etc")) { _save_ctex(image, p_save_path + ".etc.ctex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel); r_platform_variants->push_back("etc"); formats_imported.push_back("etc"); @@ -704,7 +704,7 @@ String ResourceImporterTexture::get_import_settings_string() const { int index = 0; while (compression_formats[index]) { String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]); - bool test = ProjectSettings::get_singleton()->get(setting_path); + bool test = GLOBAL_GET(setting_path); if (test) { s += String(compression_formats[index]); } @@ -745,7 +745,7 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co bool valid = true; while (compression_formats[index]) { String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]); - bool test = ProjectSettings::get_singleton()->get(setting_path); + bool test = GLOBAL_GET(setting_path); if (test) { if (!formats_imported.has(compression_formats[index])) { valid = false; diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp index a70f5225e9..a801a678fc 100644 --- a/editor/import_defaults_editor.cpp +++ b/editor/import_defaults_editor.cpp @@ -140,7 +140,7 @@ void ImportDefaultsEditor::_update_importer() { importer->get_import_options("", &options); Dictionary d; if (ProjectSettings::get_singleton()->has_setting("importer_defaults/" + importer->get_importer_name())) { - d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name()); + d = GLOBAL_GET("importer_defaults/" + importer->get_importer_name()); } for (const ResourceImporter::ImportOption &E : options) { diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 4732268256..e6ba19172f 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -384,7 +384,7 @@ void ImportDock::_preset_selected(int p_idx) { case ITEM_LOAD_DEFAULT: { ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("importer_defaults/" + params->importer->get_importer_name())); - Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + params->importer->get_importer_name()); + Dictionary d = GLOBAL_GET("importer_defaults/" + params->importer->get_importer_name()); List<Variant> v; d.get_key_list(&v); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index d8b75db30f..27b261f320 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -227,7 +227,7 @@ void InspectorDock::_load_resource(const String &p_type) { load_resource_dialog->add_filter("*." + extensions[i], extensions[i].to_upper()); } - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (int i = 0; i < textfile_ext.size(); i++) { load_resource_dialog->add_filter("*." + textfile_ext[i], textfile_ext[i].to_upper()); } @@ -240,7 +240,7 @@ void InspectorDock::_resource_file_selected(String p_file) { if (ResourceLoader::exists(p_file, "")) { res = ResourceLoader::load(p_file); } else { - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); if (textfile_ext.has(p_file.get_extension())) { res = ScriptEditor::get_singleton()->open_file(p_file); } diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index 683481ecc1..7727ff31e4 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -73,7 +73,7 @@ void LocalizationEditor::add_translation(const String &p_translation) { } void LocalizationEditor::_translation_add(const PackedStringArray &p_paths) { - PackedStringArray translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations"); + PackedStringArray translations = GLOBAL_GET("internationalization/locale/translations"); for (int i = 0; i < p_paths.size(); i++) { if (!translations.has(p_paths[i])) { // Don't add duplicate translation paths. @@ -83,7 +83,7 @@ void LocalizationEditor::_translation_add(const PackedStringArray &p_paths) { undo_redo->create_action(vformat(TTR("Add %d Translations"), p_paths.size())); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", translations); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", ProjectSettings::get_singleton()->get("internationalization/locale/translations")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", GLOBAL_GET("internationalization/locale/translations")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -105,7 +105,7 @@ void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p int idx = ti->get_metadata(0); - PackedStringArray translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations"); + PackedStringArray translations = GLOBAL_GET("internationalization/locale/translations"); ERR_FAIL_INDEX(idx, translations.size()); @@ -113,7 +113,7 @@ void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p undo_redo->create_action(TTR("Remove Translation")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", translations); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", ProjectSettings::get_singleton()->get("internationalization/locale/translations")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations", GLOBAL_GET("internationalization/locale/translations")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -130,7 +130,7 @@ void LocalizationEditor::_translation_res_add(const PackedStringArray &p_paths) Dictionary remaps; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")) { - remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); prev = remaps; } @@ -158,7 +158,7 @@ void LocalizationEditor::_translation_res_option_file_open() { void LocalizationEditor::_translation_res_option_add(const PackedStringArray &p_paths) { ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")); - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -174,7 +174,7 @@ void LocalizationEditor::_translation_res_option_add(const PackedStringArray &p_ undo_redo->create_action(vformat(TTR("Translation Resource Remap: Add %d Remap(s)"), p_paths.size())); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", remaps); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", GLOBAL_GET("internationalization/locale/translation_remaps")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -216,7 +216,7 @@ void LocalizationEditor::_translation_res_option_changed() { return; } - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -236,7 +236,7 @@ void LocalizationEditor::_translation_res_option_changed() { updating_translations = true; undo_redo->create_action(TTR("Change Resource Remap Language")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", remaps); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", GLOBAL_GET("internationalization/locale/translation_remaps")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -258,7 +258,7 @@ void LocalizationEditor::_translation_res_delete(Object *p_item, int p_column, i return; } - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); TreeItem *k = Object::cast_to<TreeItem>(p_item); @@ -269,7 +269,7 @@ void LocalizationEditor::_translation_res_delete(Object *p_item, int p_column, i undo_redo->create_action(TTR("Remove Resource Remap")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", remaps); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", GLOBAL_GET("internationalization/locale/translation_remaps")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -290,7 +290,7 @@ void LocalizationEditor::_translation_res_option_delete(Object *p_item, int p_co return; } - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -308,7 +308,7 @@ void LocalizationEditor::_translation_res_option_delete(Object *p_item, int p_co undo_redo->create_action(TTR("Remove Resource Remap Option")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", remaps); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translation_remaps", GLOBAL_GET("internationalization/locale/translation_remaps")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -317,7 +317,7 @@ void LocalizationEditor::_translation_res_option_delete(Object *p_item, int p_co } void LocalizationEditor::_pot_add(const PackedStringArray &p_paths) { - PackedStringArray pot_translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files"); + PackedStringArray pot_translations = GLOBAL_GET("internationalization/locale/translations_pot_files"); for (int i = 0; i < p_paths.size(); i++) { if (!pot_translations.has(p_paths[i])) { pot_translations.push_back(p_paths[i]); @@ -326,7 +326,7 @@ void LocalizationEditor::_pot_add(const PackedStringArray &p_paths) { undo_redo->create_action(vformat(TTR("Add %d file(s) for POT generation"), p_paths.size())); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", pot_translations); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", GLOBAL_GET("internationalization/locale/translations_pot_files")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -344,7 +344,7 @@ void LocalizationEditor::_pot_delete(Object *p_item, int p_column, int p_button, int idx = ti->get_metadata(0); - PackedStringArray pot_translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files"); + PackedStringArray pot_translations = GLOBAL_GET("internationalization/locale/translations_pot_files"); ERR_FAIL_INDEX(idx, pot_translations.size()); @@ -352,7 +352,7 @@ void LocalizationEditor::_pot_delete(Object *p_item, int p_column, int p_button, undo_redo->create_action(TTR("Remove file from POT generation")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", pot_translations); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files")); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/translations_pot_files", GLOBAL_GET("internationalization/locale/translations_pot_files")); undo_redo->add_do_method(this, "update_translations"); undo_redo->add_undo_method(this, "update_translations"); undo_redo->add_do_method(this, "emit_signal", localization_changed); @@ -392,7 +392,7 @@ void LocalizationEditor::_filesystem_files_moved(const String &p_old_file, const bool remaps_changed = false; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")) { - remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); } // Check for the keys. @@ -442,7 +442,7 @@ void LocalizationEditor::_filesystem_file_removed(const String &p_file) { Dictionary remaps; if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")) { - remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); } bool remaps_changed = remaps.has(p_file); @@ -481,7 +481,7 @@ void LocalizationEditor::update_translations() { TreeItem *root = translation_list->create_item(nullptr); translation_list->set_hide_root(true); if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translations")) { - PackedStringArray translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations"); + PackedStringArray translations = GLOBAL_GET("internationalization/locale/translations"); for (int i = 0; i < translations.size(); i++) { TreeItem *t = translation_list->create_item(root); t->set_editable(0, false); @@ -507,7 +507,7 @@ void LocalizationEditor::update_translations() { translation_res_option_add_button->set_disabled(true); if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translation_remaps")) { - Dictionary remaps = ProjectSettings::get_singleton()->get("internationalization/locale/translation_remaps"); + Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps"); List<Variant> rk; remaps.get_key_list(&rk); Vector<String> keys; @@ -568,7 +568,7 @@ void LocalizationEditor::update_translations() { root = translation_pot_list->create_item(nullptr); translation_pot_list->set_hide_root(true); if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/translations_pot_files")) { - PackedStringArray pot_translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files"); + PackedStringArray pot_translations = GLOBAL_GET("internationalization/locale/translations_pot_files"); for (int i = 0; i < pot_translations.size(); i++) { TreeItem *t = translation_pot_list->create_item(root); t->set_editable(0, false); diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 0e941ad433..f16a6bfa88 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -381,6 +381,8 @@ void AnimationNodeBlendSpace1DEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 765d85c1ac..6f206ff445 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -315,6 +315,8 @@ void AnimationNodeBlendSpace2DEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 067730a87a..e45081fd67 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -273,9 +273,9 @@ void AnimationNodeBlendTreeEditor::update_graph() { graph->connect_node(from, 0, to, to_idx); } - float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity"); + float graph_minimap_opacity = EDITOR_GET("editors/visual_editors/minimap_opacity"); graph->set_minimap_opacity(graph_minimap_opacity); - float graph_lines_curvature = EditorSettings::get_singleton()->get("editors/visual_editors/lines_curvature"); + float graph_lines_curvature = EDITOR_GET("editors/visual_editors/lines_curvature"); graph->set_connection_lines_curvature(graph_lines_curvature); } @@ -283,6 +283,8 @@ void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_node(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } @@ -795,8 +797,8 @@ void AnimationNodeBlendTreeEditor::_removed_from_graph() { } void AnimationNodeBlendTreeEditor::_update_editor_settings() { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning"))); } void AnimationNodeBlendTreeEditor::_update_theme() { @@ -1048,9 +1050,9 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { graph->connect("popup_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_popup_request)); graph->connect("connection_to_empty", callable_mp(this, &AnimationNodeBlendTreeEditor::_connection_to_empty)); graph->connect("connection_from_empty", callable_mp(this, &AnimationNodeBlendTreeEditor::_connection_from_empty)); - float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity"); + float graph_minimap_opacity = EDITOR_GET("editors/visual_editors/minimap_opacity"); graph->set_minimap_opacity(graph_minimap_opacity); - float graph_lines_curvature = EditorSettings::get_singleton()->get("editors/visual_editors/lines_curvature"); + float graph_lines_curvature = EDITOR_GET("editors/visual_editors/lines_curvature"); graph->set_connection_lines_curvature(graph_lines_curvature); VSeparator *vs = memnew(VSeparator); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 461326a47b..c32f9b1775 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -974,6 +974,8 @@ void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 2d1f4088a0..51b65e8eb0 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -460,7 +460,7 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) { void EditorAssetLibraryItemDownload::_close() { // Clean up downloaded file. DirAccess::remove_file_or_error(download->get_download_file()); - queue_delete(); + queue_free(); } bool EditorAssetLibraryItemDownload::can_install() const { @@ -832,7 +832,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons } } - image_queue[p_queue_id].request->queue_delete(); + image_queue[p_queue_id].request->queue_free(); image_queue.erase(p_queue_id); _update_image_queue(); @@ -868,7 +868,7 @@ void EditorAssetLibrary::_update_image_queue() { } while (to_delete.size()) { - image_queue[to_delete.front()->get()].request->queue_delete(); + image_queue[to_delete.front()->get()].request->queue_free(); image_queue.erase(to_delete.front()->get()); to_delete.pop_front(); } diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 60e8f5b44b..c834e0e93e 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -63,16 +63,16 @@ StringName BoneMapperButton::get_profile_bone_name() const { void BoneMapperButton::set_state(BoneMapState p_state) { switch (p_state) { case BONE_MAP_STATE_UNSET: { - circle->set_modulate(EditorSettings::get_singleton()->get("editors/bone_mapper/handle_colors/unset")); + circle->set_modulate(EDITOR_GET("editors/bone_mapper/handle_colors/unset")); } break; case BONE_MAP_STATE_SET: { - circle->set_modulate(EditorSettings::get_singleton()->get("editors/bone_mapper/handle_colors/set")); + circle->set_modulate(EDITOR_GET("editors/bone_mapper/handle_colors/set")); } break; case BONE_MAP_STATE_MISSING: { - circle->set_modulate(EditorSettings::get_singleton()->get("editors/bone_mapper/handle_colors/missing")); + circle->set_modulate(EDITOR_GET("editors/bone_mapper/handle_colors/missing")); } break; case BONE_MAP_STATE_ERROR: { - circle->set_modulate(EditorSettings::get_singleton()->get("editors/bone_mapper/handle_colors/error")); + circle->set_modulate(EDITOR_GET("editors/bone_mapper/handle_colors/error")); } break; default: { } break; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fe33a91a41..291b939fe9 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -116,6 +116,7 @@ public: grid_offset_x->set_allow_greater(true); grid_offset_x->set_suffix("px"); grid_offset_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); + grid_offset_x->set_select_all_on_focus(true); child_container->add_child(grid_offset_x); grid_offset_y = memnew(SpinBox); @@ -125,6 +126,7 @@ public: grid_offset_y->set_allow_greater(true); grid_offset_y->set_suffix("px"); grid_offset_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); + grid_offset_y->set_select_all_on_focus(true); child_container->add_child(grid_offset_y); label = memnew(Label); @@ -138,6 +140,7 @@ public: grid_step_x->set_allow_greater(true); grid_step_x->set_suffix("px"); grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); + grid_step_x->set_select_all_on_focus(true); child_container->add_child(grid_step_x); grid_step_y = memnew(SpinBox); @@ -146,6 +149,7 @@ public: grid_step_y->set_allow_greater(true); grid_step_y->set_suffix("px"); grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); + grid_step_y->set_select_all_on_focus(true); child_container->add_child(grid_step_y); child_container = memnew(GridContainer); @@ -164,6 +168,7 @@ public: primary_grid_steps->set_allow_greater(true); primary_grid_steps->set_suffix(TTR("steps")); primary_grid_steps->set_h_size_flags(Control::SIZE_EXPAND_FILL); + primary_grid_steps->set_select_all_on_focus(true); child_container->add_child(primary_grid_steps); container->add_child(memnew(HSeparator)); @@ -184,6 +189,7 @@ public: rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE); rotation_offset->set_suffix("deg"); rotation_offset->set_h_size_flags(Control::SIZE_EXPAND_FILL); + rotation_offset->set_select_all_on_focus(true); child_container->add_child(rotation_offset); label = memnew(Label); @@ -196,6 +202,7 @@ public: rotation_step->set_max(SPIN_BOX_ROTATION_RANGE); rotation_step->set_suffix("deg"); rotation_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); + rotation_step->set_select_all_on_focus(true); child_container->add_child(rotation_step); container->add_child(memnew(HSeparator)); @@ -214,6 +221,7 @@ public: scale_step->set_allow_greater(true); scale_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); scale_step->set_step(0.01f); + scale_step->set_select_all_on_focus(true); child_container->add_child(scale_step); } @@ -2534,7 +2542,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; bool release_lmb = (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT); // Required to properly release some stuff (e.g. selection box) while panning. - if (EditorSettings::get_singleton()->get("editors/panning/simple_panning") || !pan_pressed || release_lmb) { + if (EDITOR_GET("editors/panning/simple_panning") || !pan_pressed || release_lmb) { accepted = true; if (_gui_input_rulers_and_guides(p_event)) { // print_line("Rulers and guides"); @@ -2722,7 +2730,7 @@ void CanvasItemEditor::_draw_focus() { } void CanvasItemEditor::_draw_guides() { - Color guide_color = EditorSettings::get_singleton()->get("editors/2d/guides_color"); + Color guide_color = EDITOR_GET("editors/2d/guides_color"); Transform2D xform = viewport_scrollable->get_transform() * transform; // Guides already there. @@ -2771,7 +2779,7 @@ void CanvasItemEditor::_draw_guides() { } void CanvasItemEditor::_draw_smart_snapping() { - Color line_color = EditorSettings::get_singleton()->get("editors/2d/smart_snapping_line_color"); + Color line_color = EDITOR_GET("editors/2d/smart_snapping_line_color"); if (snap_target[0] != SNAP_TARGET_NONE && snap_target[0] != SNAP_TARGET_GRID) { viewport->draw_set_transform_matrix(viewport->get_transform() * transform * snap_transform); viewport->draw_line(Point2(0, -1.0e+10F), Point2(0, 1.0e+10F), line_color); @@ -2889,7 +2897,7 @@ void CanvasItemEditor::_draw_grid() { // Draw a "primary" line every several lines to make measurements easier. // The step is configurable in the Configure Snap dialog. - const Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/2d/grid_color"); + const Color secondary_grid_color = EDITOR_GET("editors/2d/grid_color"); const Color primary_grid_color = Color(secondary_grid_color.r, secondary_grid_color.g, secondary_grid_color.b, secondary_grid_color.a * 2.5); @@ -3565,9 +3573,9 @@ void CanvasItemEditor::_draw_axis() { if (show_viewport) { RID ci = viewport->get_canvas_item(); - Color area_axis_color = EditorSettings::get_singleton()->get("editors/2d/viewport_border_color"); + Color area_axis_color = EDITOR_GET("editors/2d/viewport_border_color"); - Size2 screen_size = Size2(ProjectSettings::get_singleton()->get("display/window/size/viewport_width"), ProjectSettings::get_singleton()->get("display/window/size/viewport_height")); + Size2 screen_size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); Vector2 screen_endpoints[4] = { transform.xform(Vector2(0, 0)), @@ -3871,9 +3879,9 @@ void CanvasItemEditor::_update_editor_settings() { context_menu_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("ContextualToolbar"), SNAME("EditorStyles"))); - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed")); - warped_panning = bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + pan_speed = int(EDITOR_GET("editors/panning/2d_editor_pan_speed")); + warped_panning = bool(EDITOR_GET("editors/panning/warped_mouse_panning")); } void CanvasItemEditor::_notification(int p_what) { @@ -4019,7 +4027,7 @@ void CanvasItemEditor::_update_scrollbars() { Size2 vmin = v_scroll->get_minimum_size(); // Get the visible frame. - Size2 screen_rect = Size2(ProjectSettings::get_singleton()->get("display/window/size/viewport_width"), ProjectSettings::get_singleton()->get("display/window/size/viewport_height")); + Size2 screen_rect = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height)); // Calculate scrollable area. @@ -4036,7 +4044,7 @@ void CanvasItemEditor::_update_scrollbars() { Size2 size = viewport->get_size(); Point2 begin = canvas_item_rect.position; Point2 end = canvas_item_rect.position + canvas_item_rect.size - local_rect.size / zoom; - bool constrain_editor_view = bool(EditorSettings::get_singleton()->get("editors/2d/constrain_editor_view")); + bool constrain_editor_view = bool(EDITOR_GET("editors/2d/constrain_editor_view")); if (canvas_item_rect.size.height <= (local_rect.size.y / zoom)) { real_t centered = -(size.y / 2) / zoom + screen_rect.y / 2; @@ -5543,7 +5551,7 @@ void CanvasItemEditorViewport::_remove_preview() { if (preview_node->get_parent()) { for (int i = preview_node->get_child_count() - 1; i >= 0; i--) { Node *node = preview_node->get_child(i); - node->queue_delete(); + node->queue_free(); preview_node->remove_child(node); } EditorNode::get_singleton()->get_scene_root()->remove_child(preview_node); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 434e6a92e3..4aee9b879e 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -799,7 +799,7 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons Curve &curve = **curve_ref; // FIXME: Should be ported to use p_size as done in b2633a97 - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; Ref<Image> img_ref; img_ref.instantiate(); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 836f76ac4f..997dc0b2b5 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -484,12 +484,12 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from, int thumbnail_size = MAX(p_size.x, p_size.y); Ref<Image> img = Image::create_empty(thumbnail_size, thumbnail_size, false, Image::FORMAT_RGBA8); - Color bg_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/background_color"); - Color keyword_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/keyword_color"); - Color control_flow_keyword_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/control_flow_keyword_color"); - Color text_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/text_color"); - Color symbol_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/symbol_color"); - Color comment_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/comment_color"); + Color bg_color = EDITOR_GET("text_editor/theme/highlighting/background_color"); + Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color"); + Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color"); + Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color"); + Color symbol_color = EDITOR_GET("text_editor/theme/highlighting/symbol_color"); + Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); if (bg_color.a == 0) { bg_color = Color(0, 0, 0, 0); diff --git a/editor/plugins/editor_resource_conversion_plugin.cpp b/editor/plugins/editor_resource_conversion_plugin.cpp index 2db860fd07..a5f12d1352 100644 --- a/editor/plugins/editor_resource_conversion_plugin.cpp +++ b/editor/plugins/editor_resource_conversion_plugin.cpp @@ -38,27 +38,18 @@ void EditorResourceConversionPlugin::_bind_methods() { String EditorResourceConversionPlugin::converts_to() const { String ret; - if (GDVIRTUAL_CALL(_converts_to, ret)) { - return ret; - } - - return ""; + GDVIRTUAL_CALL(_converts_to, ret); + return ret; } bool EditorResourceConversionPlugin::handles(const Ref<Resource> &p_resource) const { bool ret = false; - if (GDVIRTUAL_CALL(_handles, p_resource, ret)) { - return ret; - } - - return false; + GDVIRTUAL_CALL(_handles, p_resource, ret); + return ret; } Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<Resource> ret; - if (GDVIRTUAL_CALL(_convert, p_resource, ret)) { - return ret; - } - - return Ref<Resource>(); + GDVIRTUAL_CALL(_convert, p_resource, ret); + return ret; } diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index 58256ae549..33992314b0 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -260,7 +260,7 @@ void EditorPropertyFontMetaOverride::update_property() { } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = property_vbox->get_child_count() - 1; i >= 0; i--) { - property_vbox->get_child(i)->queue_delete(); + property_vbox->get_child(i)->queue_free(); } button_add = nullptr; } @@ -457,7 +457,7 @@ void EditorPropertyOTVariation::update_property() { } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = property_vbox->get_child_count() - 1; i >= 0; i--) { - property_vbox->get_child(i)->queue_delete(); + property_vbox->get_child(i)->queue_free(); } } @@ -662,7 +662,7 @@ void EditorPropertyOTFeatures::update_property() { } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = property_vbox->get_child_count() - 1; i >= 0; i--) { - property_vbox->get_child(i)->queue_delete(); + property_vbox->get_child(i)->queue_free(); } button_add = nullptr; } diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 420ebe5942..6654b03a0d 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -191,7 +191,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, } } - Vector<Ref<Texture2D>> textures = EditorInterface::get_singleton()->make_mesh_previews(meshes, &transforms, EditorSettings::get_singleton()->get("editors/grid_map/preview_size")); + Vector<Ref<Texture2D>> textures = EditorInterface::get_singleton()->make_mesh_previews(meshes, &transforms, EDITOR_GET("editors/grid_map/preview_size")); int j = 0; for (int i = 0; i < ids.size(); i++) { if (mesh_instances.find(ids[i])) { diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 26af5e3f2d..0f0d60c171 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -1078,11 +1078,9 @@ void EditorNode3DGizmoPlugin::_bind_methods() { } bool EditorNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - bool success; - if (GDVIRTUAL_CALL(_has_gizmo, p_spatial, success)) { - return success; - } - return false; + bool success = false; + GDVIRTUAL_CALL(_has_gizmo, p_spatial, success); + return success; } Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { @@ -1099,19 +1097,15 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) } bool EditorNode3DGizmoPlugin::can_be_hidden() const { - bool ret; - if (GDVIRTUAL_CALL(_can_be_hidden, ret)) { - return ret; - } - return true; + bool ret = true; + GDVIRTUAL_CALL(_can_be_hidden, ret); + return ret; } bool EditorNode3DGizmoPlugin::is_selectable_when_hidden() const { - bool ret; - if (GDVIRTUAL_CALL(_is_selectable_when_hidden, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_is_selectable_when_hidden, ret); + return ret; } void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { @@ -1120,26 +1114,20 @@ void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { bool EditorNode3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const { bool ret = false; - if (GDVIRTUAL_CALL(_is_handle_highlighted, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) { - return ret; - } - return false; + GDVIRTUAL_CALL(_is_handle_highlighted, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret); + return ret; } String EditorNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const { String ret; - if (GDVIRTUAL_CALL(_get_handle_name, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) { - return ret; - } - return ""; + GDVIRTUAL_CALL(_get_handle_name, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret); + return ret; } Variant EditorNode3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const { Variant ret; - if (GDVIRTUAL_CALL(_get_handle_value, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) { - return ret; - } - return Variant(); + GDVIRTUAL_CALL(_get_handle_value, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret); + return ret; } void EditorNode3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) { @@ -1152,33 +1140,25 @@ void EditorNode3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, in int EditorNode3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gizmo, Camera3D *p_camera, const Vector2 &p_point) const { int ret = -1; - if (GDVIRTUAL_CALL(_subgizmos_intersect_ray, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, p_point, ret)) { - return ret; - } - return -1; + GDVIRTUAL_CALL(_subgizmos_intersect_ray, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, p_point, ret); + return ret; } Vector<int> EditorNode3DGizmoPlugin::subgizmos_intersect_frustum(const EditorNode3DGizmo *p_gizmo, const Camera3D *p_camera, const Vector<Plane> &p_frustum) const { - TypedArray<Transform3D> frustum; + TypedArray<Plane> frustum; frustum.resize(p_frustum.size()); for (int i = 0; i < p_frustum.size(); i++) { frustum[i] = p_frustum[i]; } Vector<int> ret; - if (GDVIRTUAL_CALL(_subgizmos_intersect_frustum, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, frustum, ret)) { - return ret; - } - - return Vector<int>(); + GDVIRTUAL_CALL(_subgizmos_intersect_frustum, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, frustum, ret); + return ret; } Transform3D EditorNode3DGizmoPlugin::get_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id) const { Transform3D ret; - if (GDVIRTUAL_CALL(_get_subgizmo_transform, Ref<EditorNode3DGizmo>(p_gizmo), p_id, ret)) { - return ret; - } - - return Transform3D(); + GDVIRTUAL_CALL(_get_subgizmo_transform, Ref<EditorNode3DGizmo>(p_gizmo), p_id, ret); + return ret; } void EditorNode3DGizmoPlugin::set_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id, Transform3D p_transform) { @@ -1937,6 +1917,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { #undef ADD_QUAD p_gizmo->add_lines(lines, material); + p_gizmo->add_collision_segments(lines); p_gizmo->add_handles(handles, get_material("handles")); } @@ -2296,10 +2277,10 @@ void Label3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Marker3DGizmoPlugin::Marker3DGizmoPlugin() { pos3d_mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); - cursor_points = Vector<Vector3>(); + Vector<Vector3> cursor_points; Vector<Color> cursor_colors; - const float cs = 0.25; + const float cs = 1.0; // Add more points to create a "hard stop" in the color gradient. cursor_points.push_back(Vector3(+cs, 0, 0)); cursor_points.push_back(Vector3()); @@ -2367,9 +2348,22 @@ int Marker3DGizmoPlugin::get_priority() const { } void Marker3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { + const Marker3D *marker = Object::cast_to<Marker3D>(p_gizmo->get_node_3d()); + const real_t extents = marker->get_gizmo_extents(); + const Transform3D xform(Basis::from_scale(Vector3(extents, extents, extents))); + p_gizmo->clear(); - p_gizmo->add_mesh(pos3d_mesh); - p_gizmo->add_collision_segments(cursor_points); + p_gizmo->add_mesh(pos3d_mesh, Ref<Material>(), xform); + + const Vector<Vector3> points = { + Vector3(-extents, 0, 0), + Vector3(+extents, 0, 0), + Vector3(0, -extents, 0), + Vector3(0, +extents, 0), + Vector3(0, 0, -extents), + Vector3(0, 0, +extents), + }; + p_gizmo->add_collision_segments(points); } //// diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h index b642e1024a..d7e3e03f61 100644 --- a/editor/plugins/node_3d_editor_gizmos.h +++ b/editor/plugins/node_3d_editor_gizmos.h @@ -338,7 +338,6 @@ class Marker3DGizmoPlugin : public EditorNode3DGizmoPlugin { GDCLASS(Marker3DGizmoPlugin, EditorNode3DGizmoPlugin); Ref<ArrayMesh> pos3d_mesh; - Vector<Vector3> cursor_points; public: bool has_gizmo(Node3D *p_spatial) override; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 3c9d93f13a..5309a028a9 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -939,7 +939,7 @@ void Node3DEditorViewport::_compute_edit(const Point2 &p_point) { } static Key _get_key_modifier_setting(const String &p_property) { - switch (EditorSettings::get_singleton()->get(p_property).operator int()) { + switch (EDITOR_GET(p_property).operator int()) { case 0: return Key::NONE; case 1: @@ -1401,7 +1401,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } } break; case MouseButton::RIGHT: { - NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); if (b->is_pressed() && _edit.gizmo.is_valid()) { //restore @@ -1481,7 +1481,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { commit_transform(); break; // just commit the edit, stop processing the event so we don't deselect the object } - NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->is_alt_pressed()) { break; } @@ -1650,12 +1650,12 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } se->gizmo->commit_subgizmos(ids, restore, false); - spatial_editor->update_transform_gizmo(); } else { commit_transform(); } _edit.mode = TRANSFORM_NONE; set_message(""); + spatial_editor->update_transform_gizmo(); } surface->queue_redraw(); } @@ -1709,7 +1709,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { _transform_gizmo_select(_edit.mouse_pos, true); } - NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); NavigationMode nav_mode = NAVIGATION_NONE; if (_edit.gizmo.is_valid()) { @@ -1782,7 +1782,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { nav_mode = NAVIGATION_PAN; } } - } else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) { + } else if (EDITOR_GET("editors/3d/navigation/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case const Key mod = _get_key_modifier(m); @@ -1835,7 +1835,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { Ref<InputEventPanGesture> pan_gesture = p_event; if (pan_gesture.is_valid()) { - NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); NavigationMode nav_mode = NAVIGATION_NONE; if (nav_scheme == NAVIGATION_GODOT) { @@ -1889,7 +1889,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { return; } - if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_numpad")) { + if (EDITOR_GET("editors/3d/navigation/emulate_numpad")) { const Key code = k->get_physical_keycode(); if (code >= Key::KEY_0 && code <= Key::KEY_9) { k->set_keycode(code - Key::KEY_0 + Key::KP_0); @@ -2086,7 +2086,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative) { - const NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + const NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); real_t pan_speed = 1 / 150.0; if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { @@ -2098,8 +2098,8 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const camera_transform.translate_local(cursor.pos); camera_transform.basis.rotate(Vector3(1, 0, 0), -cursor.x_rot); camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot); - const bool invert_x_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_x_axis"); - const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis"); + const bool invert_x_axis = EDITOR_GET("editors/3d/navigation/invert_x_axis"); + const bool invert_y_axis = EDITOR_GET("editors/3d/navigation/invert_y_axis"); Vector3 translation( (invert_x_axis ? -1 : 1) * -p_relative.x * pan_speed, (invert_y_axis ? -1 : 1) * p_relative.y * pan_speed, @@ -2110,14 +2110,14 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const } void Node3DEditorViewport::_nav_zoom(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative) { - const NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + const NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); real_t zoom_speed = 1 / 80.0; if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { zoom_speed *= 10; } - NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/navigation/zoom_style").operator int(); + NavigationZoomStyle zoom_style = (NavigationZoomStyle)EDITOR_GET("editors/3d/navigation/zoom_style").operator int(); if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) { if (p_relative.x > 0) { scale_cursor_distance(1 - p_relative.x * zoom_speed); @@ -2143,10 +2143,10 @@ void Node3DEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, cons _menu_option(VIEW_PERSPECTIVE); } - const real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity"); + const real_t degrees_per_pixel = EDITOR_GET("editors/3d/navigation_feel/orbit_sensitivity"); const real_t radians_per_pixel = Math::deg_to_rad(degrees_per_pixel); - const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis"); - const bool invert_x_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_x_axis"); + const bool invert_y_axis = EDITOR_GET("editors/3d/navigation/invert_y_axis"); + const bool invert_x_axis = EDITOR_GET("editors/3d/navigation/invert_x_axis"); if (invert_y_axis) { cursor.x_rot -= p_relative.y * radians_per_pixel; @@ -2176,9 +2176,9 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const } // Scale mouse sensitivity with camera FOV scale when zoomed in to make it easier to point at things. - const real_t degrees_per_pixel = real_t(EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_sensitivity")) * MIN(1.0, cursor.fov_scale); + const real_t degrees_per_pixel = real_t(EDITOR_GET("editors/3d/freelook/freelook_sensitivity")) * MIN(1.0, cursor.fov_scale); const real_t radians_per_pixel = Math::deg_to_rad(degrees_per_pixel); - const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis"); + const bool invert_y_axis = EDITOR_GET("editors/3d/navigation/invert_y_axis"); // Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag". const Transform3D prev_camera_transform = to_camera_transform(cursor); @@ -2215,9 +2215,9 @@ void Node3DEditorViewport::set_freelook_active(bool active_now) { // Also sync the camera cursor, otherwise switching to freelook will be trippy if inertia is active camera_cursor.eye_pos = cursor.eye_pos; - if (EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_speed_zoom_link")) { + if (EDITOR_GET("editors/3d/freelook/freelook_speed_zoom_link")) { // Re-adjust freelook speed from the current zoom level - real_t base_speed = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_base_speed"); + real_t base_speed = EDITOR_GET("editors/3d/freelook/freelook_base_speed"); freelook_speed = base_speed * cursor.distance; } @@ -2299,7 +2299,7 @@ void Node3DEditorViewport::_update_freelook(real_t delta) { return; } - const FreelookNavigationScheme navigation_scheme = (FreelookNavigationScheme)EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_navigation_scheme").operator int(); + const FreelookNavigationScheme navigation_scheme = (FreelookNavigationScheme)EDITOR_GET("editors/3d/freelook/freelook_navigation_scheme").operator int(); Vector3 forward; if (navigation_scheme == FREELOOK_FULLY_AXIS_LOCKED) { @@ -2375,12 +2375,12 @@ void Node3DEditorPlugin::edited_scene_changed() { void Node3DEditorViewport::_project_settings_changed() { //update shadow atlas if changed - int shadowmap_size = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_size"); - bool shadowmap_16_bits = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_16_bits"); - int atlas_q0 = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_0_subdiv"); - int atlas_q1 = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_1_subdiv"); - int atlas_q2 = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_2_subdiv"); - int atlas_q3 = ProjectSettings::get_singleton()->get("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_3_subdiv"); + int shadowmap_size = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_size"); + bool shadowmap_16_bits = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_16_bits"); + int atlas_q0 = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_0_subdiv"); + int atlas_q1 = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_1_subdiv"); + int atlas_q2 = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_2_subdiv"); + int atlas_q3 = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_3_subdiv"); viewport->set_positional_shadow_atlas_size(shadowmap_size); viewport->set_positional_shadow_atlas_16_bits(shadowmap_16_bits); @@ -2393,7 +2393,7 @@ void Node3DEditorViewport::_project_settings_changed() { // Update MSAA, screen-space AA and debanding if changed - const int msaa_mode = ProjectSettings::get_singleton()->get("rendering/anti_aliasing/quality/msaa_3d"); + const int msaa_mode = GLOBAL_GET("rendering/anti_aliasing/quality/msaa_3d"); viewport->set_msaa_3d(Viewport::MSAA(msaa_mode)); const int ssaa_mode = GLOBAL_GET("rendering/anti_aliasing/quality/screen_space_aa"); viewport->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode)); @@ -2445,7 +2445,7 @@ void Node3DEditorViewport::_notification(int p_what) { set_freelook_active(false); } call_deferred(SNAME("update_transform_gizmo_view")); - rotation_control->set_visible(EditorSettings::get_singleton()->get("editors/3d/navigation/show_viewport_rotation_gizmo")); + rotation_control->set_visible(EDITOR_GET("editors/3d/navigation/show_viewport_rotation_gizmo")); } break; case NOTIFICATION_RESIZED: { @@ -2821,7 +2821,7 @@ void Node3DEditorViewport::_draw() { Math::round(2 * EDSCALE)); } if (previewing) { - Size2 ss = Size2(ProjectSettings::get_singleton()->get("display/window/size/viewport_width"), ProjectSettings::get_singleton()->get("display/window/size/viewport_height")); + Size2 ss = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); float aspect = ss.aspect(); Size2 s = get_size(); @@ -3464,7 +3464,7 @@ void Node3DEditorViewport::update_transform_gizmo_view() { const real_t d1 = camera->unproject_position(camera_xform.origin + camz * gizmo_d + camy).y; const real_t dd = MAX(Math::abs(d0 - d1), CMP_EPSILON); - const real_t gizmo_size = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_size"); + const real_t gizmo_size = EDITOR_GET("editors/3d/manipulator_gizmo_size"); // At low viewport heights, multiply the gizmo scale based on the viewport height. // This prevents the gizmo from growing very large and going outside the viewport. const int viewport_base_height = 400 * MAX(1, EDSCALE); @@ -3862,7 +3862,7 @@ void Node3DEditorViewport::_remove_preview_node() { if (preview_node->get_parent()) { for (int i = preview_node->get_child_count() - 1; i >= 0; i--) { Node *node = preview_node->get_child(i); - node->queue_delete(); + node->queue_free(); preview_node->remove_child(node); } EditorNode::get_singleton()->get_scene_root()->remove_child(preview_node); @@ -4938,7 +4938,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p accept = nullptr; freelook_active = false; - freelook_speed = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_base_speed"); + freelook_speed = EDITOR_GET("editors/3d/freelook/freelook_base_speed"); selection_menu = memnew(PopupMenu); add_child(selection_menu); @@ -6191,9 +6191,9 @@ void fragment() { grid_mat[i]->set_shader(grid_shader); } - grid_enable[0] = EditorSettings::get_singleton()->get("editors/3d/grid_xy_plane"); - grid_enable[1] = EditorSettings::get_singleton()->get("editors/3d/grid_yz_plane"); - grid_enable[2] = EditorSettings::get_singleton()->get("editors/3d/grid_xz_plane"); + grid_enable[0] = EDITOR_GET("editors/3d/grid_xy_plane"); + grid_enable[1] = EDITOR_GET("editors/3d/grid_yz_plane"); + grid_enable[2] = EDITOR_GET("editors/3d/grid_xz_plane"); grid_visible[0] = grid_enable[0]; grid_visible[1] = grid_enable[1]; grid_visible[2] = grid_enable[2]; @@ -6243,7 +6243,7 @@ void fragment() { break; } - col.a = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity"); + col.a = EDITOR_GET("editors/3d/manipulator_gizmo_opacity"); move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh)); move_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh)); @@ -6659,23 +6659,23 @@ void Node3DEditor::_init_grid() { Vector<Vector3> grid_points[3]; Vector<Vector3> grid_normals[3]; - Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color"); - Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color"); - int grid_size = EditorSettings::get_singleton()->get("editors/3d/grid_size"); - int primary_grid_steps = EditorSettings::get_singleton()->get("editors/3d/primary_grid_steps"); + Color primary_grid_color = EDITOR_GET("editors/3d/primary_grid_color"); + Color secondary_grid_color = EDITOR_GET("editors/3d/secondary_grid_color"); + int grid_size = EDITOR_GET("editors/3d/grid_size"); + int primary_grid_steps = EDITOR_GET("editors/3d/primary_grid_steps"); // Which grid planes are enabled? Which should we generate? - grid_enable[0] = grid_visible[0] = EditorSettings::get_singleton()->get("editors/3d/grid_xy_plane"); - grid_enable[1] = grid_visible[1] = EditorSettings::get_singleton()->get("editors/3d/grid_yz_plane"); - grid_enable[2] = grid_visible[2] = EditorSettings::get_singleton()->get("editors/3d/grid_xz_plane"); + grid_enable[0] = grid_visible[0] = EDITOR_GET("editors/3d/grid_xy_plane"); + grid_enable[1] = grid_visible[1] = EDITOR_GET("editors/3d/grid_yz_plane"); + grid_enable[2] = grid_visible[2] = EDITOR_GET("editors/3d/grid_xz_plane"); // Offsets division_level for bigger or smaller grids. // Default value is -0.2. -1.0 gives Blender-like behavior, 0.5 gives huge grids. - real_t division_level_bias = EditorSettings::get_singleton()->get("editors/3d/grid_division_level_bias"); + real_t division_level_bias = EDITOR_GET("editors/3d/grid_division_level_bias"); // Default largest grid size is 8^2 when primary_grid_steps is 8 (64m apart, so primary grid lines are 512m apart). - int division_level_max = EditorSettings::get_singleton()->get("editors/3d/grid_division_level_max"); + int division_level_max = EDITOR_GET("editors/3d/grid_division_level_max"); // Default smallest grid size is 1cm, 10^-2 (default value is -2). - int division_level_min = EditorSettings::get_singleton()->get("editors/3d/grid_division_level_min"); + int division_level_min = EDITOR_GET("editors/3d/grid_division_level_min"); ERR_FAIL_COND_MSG(division_level_max < division_level_min, "The 3D grid's maximum division level cannot be lower than its minimum division level."); if (primary_grid_steps != 10) { // Log10 of 10 is 1. @@ -8046,12 +8046,15 @@ Node3DEditor::Node3DEditor() { snap_dialog->add_child(snap_dialog_vbc); snap_translate = memnew(LineEdit); + snap_translate->set_select_all_on_focus(true); snap_dialog_vbc->add_margin_child(TTR("Translate Snap:"), snap_translate); snap_rotate = memnew(LineEdit); + snap_rotate->set_select_all_on_focus(true); snap_dialog_vbc->add_margin_child(TTR("Rotate Snap (deg.):"), snap_rotate); snap_scale = memnew(LineEdit); + snap_scale->set_select_all_on_focus(true); snap_dialog_vbc->add_margin_child(TTR("Scale Snap (%):"), snap_scale); _snap_update(); @@ -8070,6 +8073,7 @@ Node3DEditor::Node3DEditor() { settings_fov->set_min(MIN_FOV); settings_fov->set_step(0.1); settings_fov->set_value(EDITOR_GET("editors/3d/default_fov")); + settings_fov->set_select_all_on_focus(true); settings_vbc->add_margin_child(TTR("Perspective FOV (deg.):"), settings_fov); settings_znear = memnew(SpinBox); @@ -8077,6 +8081,7 @@ Node3DEditor::Node3DEditor() { settings_znear->set_min(MIN_Z); settings_znear->set_step(0.01); settings_znear->set_value(EDITOR_GET("editors/3d/default_z_near")); + settings_znear->set_select_all_on_focus(true); settings_vbc->add_margin_child(TTR("View Z-Near:"), settings_znear); settings_zfar = memnew(SpinBox); @@ -8084,6 +8089,7 @@ Node3DEditor::Node3DEditor() { settings_zfar->set_min(MIN_Z); settings_zfar->set_step(0.1); settings_zfar->set_value(EDITOR_GET("editors/3d/default_z_far")); + settings_zfar->set_select_all_on_focus(true); settings_vbc->add_margin_child(TTR("View Z-Far:"), settings_zfar); for (uint32_t i = 0; i < VIEWPORTS_COUNT; ++i) { @@ -8109,6 +8115,7 @@ Node3DEditor::Node3DEditor() { for (int i = 0; i < 3; i++) { xform_translate[i] = memnew(LineEdit); xform_translate[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_translate[i]->set_select_all_on_focus(true); xform_hbc->add_child(xform_translate[i]); } @@ -8122,6 +8129,7 @@ Node3DEditor::Node3DEditor() { for (int i = 0; i < 3; i++) { xform_rotate[i] = memnew(LineEdit); xform_rotate[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_rotate[i]->set_select_all_on_focus(true); xform_hbc->add_child(xform_rotate[i]); } @@ -8135,6 +8143,7 @@ Node3DEditor::Node3DEditor() { for (int i = 0; i < 3; i++) { xform_scale[i] = memnew(LineEdit); xform_scale[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_scale[i]->set_select_all_on_focus(true); xform_hbc->add_child(xform_scale[i]); } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 58a3a07c43..3f8ca825c0 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -67,7 +67,7 @@ void Polygon2DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_READY: { @@ -299,7 +299,7 @@ void Polygon2DEditor::_menu_option(int p_option) { } if (EditorSettings::get_singleton()->has_setting("interface/dialogs/uv_editor_bounds")) { - uv_edit->popup(EditorSettings::get_singleton()->get("interface/dialogs/uv_editor_bounds")); + uv_edit->popup(EDITOR_GET("interface/dialogs/uv_editor_bounds")); } else { uv_edit->popup_centered_ratio(0.85); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 876ef3bae9..e4f0192c64 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -59,19 +59,15 @@ /*** SYNTAX HIGHLIGHTER ****/ String EditorSyntaxHighlighter::_get_name() const { - String ret; - if (GDVIRTUAL_CALL(_get_name, ret)) { - return ret; - } - return "Unnamed"; + String ret = "Unnamed"; + GDVIRTUAL_CALL(_get_name, ret); + return ret; } PackedStringArray EditorSyntaxHighlighter::_get_supported_languages() const { PackedStringArray ret; - if (GDVIRTUAL_CALL(_get_supported_languages, ret)) { - return ret; - } - return PackedStringArray(); + GDVIRTUAL_CALL(_get_supported_languages, ret); + return ret; } Ref<EditorSyntaxHighlighter> EditorSyntaxHighlighter::_create() const { @@ -405,7 +401,7 @@ String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) { } void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) { - if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { + if (bool(EDITOR_GET("text_editor/external/use_external_editor"))) { return; } @@ -1488,7 +1484,7 @@ void ScriptEditor::_show_save_theme_as_dialog() { file_dialog_option = THEME_SAVE_AS; file_dialog->clear_filters(); file_dialog->add_filter("*.tet"); - file_dialog->set_current_path(EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))); + file_dialog->set_current_path(EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(EDITOR_GET("text_editor/theme/color_theme"))); file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("Save Theme As...")); } @@ -1734,7 +1730,7 @@ void ScriptEditor::ensure_select_current() { if (tab_container->get_tab_count() && tab_container->get_current_tab() >= 0) { ScriptEditorBase *se = _get_current_editor(); if (se) { - se->enable_editor(); + se->enable_editor(this); if (!grab_focus_block && is_visible_in_tree()) { se->ensure_focus(); @@ -1823,7 +1819,7 @@ void ScriptEditor::_update_members_overview() { } Vector<String> functions = se->get_functions(); - if (EditorSettings::get_singleton()->get("text_editor/script_list/sort_members_outline_alphabetically")) { + if (EDITOR_GET("text_editor/script_list/sort_members_outline_alphabetically")) { functions.sort(); } @@ -1890,9 +1886,9 @@ void ScriptEditor::_update_help_overview() { } void ScriptEditor::_update_script_colors() { - bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_enabled"); + bool script_temperature_enabled = EDITOR_GET("text_editor/script_list/script_temperature_enabled"); - int hist_size = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_history_size"); + int hist_size = EDITOR_GET("text_editor/script_list/script_temperature_history_size"); Color hot_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); hot_color.set_s(hot_color.get_s() * 0.9); Color cold_color = get_theme_color(SNAME("font_color"), SNAME("Editor")); @@ -1936,9 +1932,9 @@ void ScriptEditor::_update_script_names() { } script_list->clear(); - bool split_script_help = EditorSettings::get_singleton()->get("text_editor/script_list/group_help_pages"); - ScriptSortBy sort_by = (ScriptSortBy)(int)EditorSettings::get_singleton()->get("text_editor/script_list/sort_scripts_by"); - ScriptListName display_as = (ScriptListName)(int)EditorSettings::get_singleton()->get("text_editor/script_list/list_script_names_as"); + bool split_script_help = EDITOR_GET("text_editor/script_list/group_help_pages"); + ScriptSortBy sort_by = (ScriptSortBy)(int)EDITOR_GET("text_editor/script_list/sort_scripts_by"); + ScriptListName display_as = (ScriptListName)(int)EDITOR_GET("text_editor/script_list/list_script_names_as"); Vector<_ScriptEditorItemData> sedata; @@ -2006,7 +2002,7 @@ void ScriptEditor::_update_script_names() { Vector<String> full_script_paths; for (int j = 0; j < sedata.size(); j++) { String name = sedata[j].name.replace("(*)", ""); - ScriptListName script_display = (ScriptListName)(int)EditorSettings::get_singleton()->get("text_editor/script_list/list_script_names_as"); + ScriptListName script_display = (ScriptListName)(int)EDITOR_GET("text_editor/script_list/list_script_names_as"); switch (script_display) { case DISPLAY_NAME: { name = name.get_file(); @@ -2108,7 +2104,7 @@ void ScriptEditor::_update_script_names() { ScriptEditorBase *se = _get_current_editor(); if (se) { - se->enable_editor(); + se->enable_editor(this); _update_selected_editor_menu(); } } @@ -2188,10 +2184,10 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col, // Don't open dominant script if using an external editor. bool use_external_editor = - EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") || + EDITOR_GET("text_editor/external/use_external_editor") || (scr.is_valid() && scr->get_language()->overrides_external_editor()); use_external_editor = use_external_editor && !(scr.is_valid() && scr->is_built_in()); // Ignore external editor for built-in scripts. - const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/behavior/files/open_dominant_script_on_scene_change"); + const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change"); const bool should_open = (open_dominant && !use_external_editor) || !EditorNode::get_singleton()->is_changing_scene(); @@ -2209,8 +2205,8 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col, (EditorDebuggerNode::get_singleton()->get_dump_stack_script() != p_resource || EditorDebuggerNode::get_singleton()->get_debug_with_external_editor()) && p_resource->get_path().is_resource_file() && !p_resource->is_class("VisualScript")) { - String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path"); - String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); + String path = EDITOR_GET("text_editor/external/exec_path"); + String flags = EDITOR_GET("text_editor/external/exec_flags"); List<String> args; bool has_file_flag = false; @@ -2273,7 +2269,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col, if ((scr != nullptr && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) { if (should_open) { - se->enable_editor(); + se->enable_editor(this); if (tab_container->get_current_tab() != i) { _go_to_tab(i); @@ -2329,7 +2325,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col, tab_container->add_child(se); if (p_grab_focus) { - se->enable_editor(); + se->enable_editor(this); } // If we delete a script within the filesystem, the original resource path @@ -2658,26 +2654,26 @@ void ScriptEditor::_save_layout() { void ScriptEditor::_editor_settings_changed() { textfile_extensions.clear(); - const Vector<String> textfile_ext = ((String)(EditorSettings::get_singleton()->get("docks/filesystem/textfile_extensions"))).split(",", false); + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { textfile_extensions.insert(E); } - trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/behavior/files/trim_trailing_whitespace_on_save"); - convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/behavior/files/convert_indent_on_save"); - use_space_indentation = EditorSettings::get_singleton()->get("text_editor/behavior/indent/type"); + trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save"); + convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save"); + use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type"); - members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/show_members_overview"); - help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index"); + members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview"); + help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index"); _update_members_overview_visibility(); _update_help_overview_visibility(); _update_autosave_timer(); if (current_theme.is_empty()) { - current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme"); - } else if (current_theme != String(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))) { - current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme"); + current_theme = EDITOR_GET("text_editor/theme/color_theme"); + } else if (current_theme != String(EDITOR_GET("text_editor/theme/color_theme"))) { + current_theme = EDITOR_GET("text_editor/theme/color_theme"); EditorSettings::get_singleton()->load_text_editor_theme(); } @@ -2760,7 +2756,7 @@ void ScriptEditor::_update_autosave_timer() { return; } - float autosave_time = EditorSettings::get_singleton()->get("text_editor/behavior/files/autosave_interval_secs"); + float autosave_time = EDITOR_GET("text_editor/behavior/files/autosave_interval_secs"); if (autosave_time > 0) { autosave_timer->set_wait_time(autosave_time); autosave_timer->start(); @@ -3438,10 +3434,10 @@ TypedArray<ScriptEditorBase> ScriptEditor::_get_open_script_editors() const { void ScriptEditor::set_scene_root_script(Ref<Script> p_script) { // Don't open dominant script if using an external editor. bool use_external_editor = - EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") || + EDITOR_GET("text_editor/external/use_external_editor") || (p_script.is_valid() && p_script->get_language()->overrides_external_editor()); use_external_editor = use_external_editor && !(p_script.is_valid() && p_script->is_built_in()); // Ignore external editor for built-in scripts. - const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/behavior/files/open_dominant_script_on_scene_change"); + const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change"); if (open_dominant && !use_external_editor && p_script.is_valid()) { edit(p_script); @@ -3632,8 +3628,8 @@ ScriptEditor::ScriptEditor() { waiting_update_names = false; pending_auto_reload = false; auto_reload_running_scripts = true; - members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/show_members_overview"); - help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index"); + members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview"); + help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index"); VBoxContainer *main_container = memnew(VBoxContainer); add_child(main_container); @@ -3692,7 +3688,7 @@ ScriptEditor::ScriptEditor() { members_overview_alphabeta_sort_button->set_flat(true); members_overview_alphabeta_sort_button->set_tooltip_text(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); - members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/script_list/sort_members_outline_alphabetically")); + members_overview_alphabeta_sort_button->set_pressed(EDITOR_GET("text_editor/script_list/sort_members_outline_alphabetically")); members_overview_alphabeta_sort_button->connect("toggled", callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort)); buttons_hbox->add_child(members_overview_alphabeta_sort_button); @@ -3934,9 +3930,9 @@ ScriptEditor::ScriptEditor() { history_pos = -1; edit_pass = 0; - trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/behavior/files/trim_trailing_whitespace_on_save"); - convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/behavior/files/convert_indent_on_save"); - use_space_indentation = EditorSettings::get_singleton()->get("text_editor/behavior/indent/type"); + trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save"); + convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save"); + use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type"); ScriptServer::edit_request_func = _open_script_request; diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index e69b8f8f82..a45ce4cc22 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -139,7 +139,7 @@ public: virtual Ref<Resource> get_edited_resource() const = 0; virtual Vector<String> get_functions() = 0; virtual void set_edited_resource(const Ref<Resource> &p_res) = 0; - virtual void enable_editor() = 0; + virtual void enable_editor(Control *p_shortcut_context = nullptr) = 0; virtual void reload_text() = 0; virtual String get_name() = 0; virtual Ref<Texture2D> get_theme_icon() = 0; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 7d7ef9245f..0d12d07aa7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -151,7 +151,7 @@ void ScriptTextEditor::set_edited_resource(const Ref<Resource> &p_res) { code_editor->update_line_and_column(); } -void ScriptTextEditor::enable_editor() { +void ScriptTextEditor::enable_editor(Control *p_shortcut_context) { if (editor_enabled) { return; } @@ -161,6 +161,15 @@ void ScriptTextEditor::enable_editor() { _enable_code_editor(); _validate_script(); + + if (p_shortcut_context) { + for (int i = 0; i < edit_hb->get_child_count(); ++i) { + Control *c = cast_to<Control>(edit_hb->get_child(i)); + if (c) { + c->set_shortcut_context(p_shortcut_context); + } + } + } } void ScriptTextEditor::_load_theme_settings() { @@ -316,7 +325,7 @@ bool ScriptTextEditor::show_members_overview() { } void ScriptTextEditor::update_settings() { - code_editor->get_text_editor()->set_gutter_draw(connection_gutter, EditorSettings::get_singleton()->get("text_editor/appearance/gutters/show_info_gutter")); + code_editor->get_text_editor()->set_gutter_draw(connection_gutter, EDITOR_GET("text_editor/appearance/gutters/show_info_gutter")); code_editor->update_editor_settings(); } @@ -689,7 +698,7 @@ static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_curr } void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) { - if (!bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { + if (!bool(EDITOR_GET("text_editor/external/use_external_editor"))) { return; } @@ -1784,7 +1793,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { int row = pos.y; int col = pos.x; - tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/move_caret_on_right_click")); + tx->set_move_caret_on_right_click_enabled(EDITOR_GET("text_editor/behavior/navigation/move_caret_on_right_click")); if (tx->is_move_caret_on_right_click_enabled()) { tx->remove_secondary_carets(); if (tx->has_selection()) { @@ -2130,7 +2139,7 @@ ScriptTextEditor::ScriptTextEditor() { update_settings(); - code_editor->get_text_editor()->set_code_hint_draw_below(EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line")); + code_editor->get_text_editor()->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line")); code_editor->get_text_editor()->set_symbol_lookup_on_click_enabled(true); code_editor->get_text_editor()->set_context_menu_enabled(false); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index c165295a8e..5fd12674b3 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -206,7 +206,7 @@ public: virtual void apply_code() override; virtual Ref<Resource> get_edited_resource() const override; virtual void set_edited_resource(const Ref<Resource> &p_res) override; - virtual void enable_editor() override; + virtual void enable_editor(Control *p_shortcut_context = nullptr) override; virtual Vector<String> get_functions() override; virtual void reload_text() override; virtual String get_name() override; diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 83245366f9..7922a768ec 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -1082,7 +1082,7 @@ void Skeleton3DEditor::select_bone(int p_idx) { Skeleton3DEditor::~Skeleton3DEditor() { singleton = nullptr; - handles_mesh_instance->queue_delete(); + handles_mesh_instance->queue_free(); Node3DEditor *ne = Node3DEditor::get_singleton(); @@ -1355,10 +1355,10 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { selected = se->get_selected_bone(); } - Color bone_color = EditorSettings::get_singleton()->get("editors/3d_gizmos/gizmo_colors/skeleton"); - Color selected_bone_color = EditorSettings::get_singleton()->get("editors/3d_gizmos/gizmo_colors/selected_bone"); - real_t bone_axis_length = EditorSettings::get_singleton()->get("editors/3d_gizmos/gizmo_settings/bone_axis_length"); - int bone_shape = EditorSettings::get_singleton()->get("editors/3d_gizmos/gizmo_settings/bone_shape"); + Color bone_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/skeleton"); + Color selected_bone_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/selected_bone"); + real_t bone_axis_length = EDITOR_GET("editors/3d_gizmos/gizmo_settings/bone_axis_length"); + int bone_shape = EDITOR_GET("editors/3d_gizmos/gizmo_settings/bone_shape"); LocalVector<Color> axis_colors; axis_colors.push_back(Node3DEditor::get_singleton()->get_theme_color(SNAME("axis_x_color"), SNAME("Editor"))); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 5dac66d3e1..d3ab5b6f77 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -67,14 +67,18 @@ int SpriteFramesEditor::_sheet_preview_position_to_frame_index(const Point2 &p_p const Size2i block_size = frame_size + separation; const Point2i position = p_position / sheet_zoom - offset; - if (position.x % block_size.x > frame_size.x || position.y % block_size.y > frame_size.y) { + if (position.x < 0 || position.y < 0) { + return -1; // Out of bounds. + } + + if (position.x % block_size.x >= frame_size.x || position.y % block_size.y >= frame_size.y) { return -1; // Gap between frames. } const Point2i frame = position / block_size; const Size2i frame_count = _get_frame_count(); - if (frame.x < 0 || frame.y < 0 || frame.x >= frame_count.x || frame.y >= frame_count.y) { - return -1; // Out of bound. + if (frame.x >= frame_count.x || frame.y >= frame_count.y) { + return -1; // Out of bounds. } return frame_count.x * frame.y + frame.x; diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 07f0819c7f..03cff74bdb 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -108,7 +108,7 @@ void TextEditor::set_edited_resource(const Ref<Resource> &p_res) { code_editor->update_line_and_column(); } -void TextEditor::enable_editor() { +void TextEditor::enable_editor(Control *p_shortcut_context) { if (editor_enabled) { return; } @@ -116,6 +116,15 @@ void TextEditor::enable_editor() { editor_enabled = true; _load_theme_settings(); + + if (p_shortcut_context) { + for (int i = 0; i < edit_hb->get_child_count(); ++i) { + Control *c = cast_to<Control>(edit_hb->get_child(i)); + if (c) { + c->set_shortcut_context(p_shortcut_context); + } + } + } } void TextEditor::add_callback(const String &p_function, PackedStringArray p_args) { @@ -440,7 +449,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { int row = pos.y; int col = pos.x; - tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/move_caret_on_right_click")); + tx->set_move_caret_on_right_click_enabled(EDITOR_GET("text_editor/behavior/navigation/move_caret_on_right_click")); bool can_fold = tx->can_fold_line(row); bool is_folded = tx->is_line_folded(row); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index a7a640247f..486a0f2c23 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -111,7 +111,7 @@ public: virtual Ref<Texture2D> get_theme_icon() override; virtual Ref<Resource> get_edited_resource() const override; virtual void set_edited_resource(const Ref<Resource> &p_res) override; - virtual void enable_editor() override; + virtual void enable_editor(Control *p_shortcut_context = nullptr) override; virtual void reload_text() override; virtual void apply_code() override; virtual bool is_unsaved() override; diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index 48086bf235..767eeaefc5 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -724,7 +724,7 @@ void TextShaderEditor::_notification(int p_what) { void TextShaderEditor::_editor_settings_changed() { shader_editor->update_editor_settings(); - shader_editor->get_text_editor()->add_theme_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/appearance/whitespace/line_spacing")); + shader_editor->get_text_editor()->add_theme_constant_override("line_spacing", EDITOR_GET("text_editor/appearance/whitespace/line_spacing")); shader_editor->get_text_editor()->set_draw_breakpoints_gutter(false); shader_editor->get_text_editor()->set_draw_executing_lines_gutter(false); } @@ -955,7 +955,7 @@ void TextShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { Point2i pos = tx->get_line_column_at_pos(mb->get_global_position() - tx->get_global_position()); int row = pos.y; int col = pos.x; - tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/move_caret_on_right_click")); + tx->set_move_caret_on_right_click_enabled(EDITOR_GET("text_editor/behavior/navigation/move_caret_on_right_click")); if (tx->is_move_caret_on_right_click_enabled()) { tx->remove_secondary_carets(); @@ -1068,7 +1068,7 @@ TextShaderEditor::TextShaderEditor() { EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &TextShaderEditor::_editor_settings_changed)); ProjectSettingsEditor::get_singleton()->connect("confirmed", callable_mp(this, &TextShaderEditor::_project_settings_changed)); - shader_editor->get_text_editor()->set_code_hint_draw_below(EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line")); + shader_editor->get_text_editor()->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line")); shader_editor->get_text_editor()->set_symbol_lookup_on_click_enabled(true); shader_editor->get_text_editor()->set_context_menu_enabled(false); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 8e04391a94..f0a08cb4f5 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -835,7 +835,7 @@ void TextureRegionEditor::_notification(int p_what) { [[fallthrough]]; } case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index e2ed8e44c4..5d02e4e437 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -2481,7 +2481,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = color_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = color_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); color_items_list->remove_child(node); } @@ -2510,7 +2510,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = constant_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = constant_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); constant_items_list->remove_child(node); } @@ -2543,7 +2543,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = font_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = font_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); font_items_list->remove_child(node); } @@ -2581,7 +2581,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = font_size_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = font_size_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); font_size_items_list->remove_child(node); } @@ -2614,7 +2614,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = icon_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = icon_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); icon_items_list->remove_child(node); } @@ -2652,7 +2652,7 @@ void ThemeTypeEditor::_update_type_items() { { for (int i = stylebox_items_list->get_child_count() - 1; i >= 0; i--) { Node *node = stylebox_items_list->get_child(i); - node->queue_delete(); + node->queue_free(); stylebox_items_list->remove_child(node); } diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 8cc96201e7..fdd8a80ad3 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -459,7 +459,7 @@ void SceneThemeEditorPreview::_reload_scene() { for (int i = preview_content->get_child_count() - 1; i >= 0; i--) { Node *node = preview_content->get_child(i); - node->queue_delete(); + node->queue_free(); preview_content->remove_child(node); } diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 502c34459a..69104cadec 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -298,7 +298,7 @@ void TileAtlasView::_draw_base_tiles_texture_grid() { void TileAtlasView::_draw_base_tiles_shape_grid() { // Draw the shapes. - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Vector2i tile_shape_size = tile_set->get_tile_size(); for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) { Vector2i tile_id = tile_set_atlas_source->get_tile_id(i); @@ -509,7 +509,7 @@ void TileAtlasView::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_READY: { diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 17b9035121..a7d90856ac 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -128,7 +128,7 @@ void GenericTilePolygonEditor::_base_control_draw() { real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); const Ref<Texture2D> handle = get_theme_icon(SNAME("EditorPathSharpHandle"), SNAME("EditorIcons")); const Ref<Texture2D> add_handle = get_theme_icon(SNAME("EditorHandleAdd"), SNAME("EditorIcons")); const Ref<StyleBox> focus_stylebox = get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles")); @@ -885,7 +885,7 @@ void TileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_s void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { if (drag_type == DRAG_TYPE_PAINT_RECT) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); p_canvas_item->draw_set_transform_matrix(p_transform); @@ -1117,7 +1117,7 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2 Color color = Color(1, 1, 1); if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); selection_color.set_v(0.9); color = selection_color; @@ -1141,7 +1141,7 @@ void TileDataDefaultEditor::setup_property_editor(Variant::Type p_type, String p // Update everything. if (property_editor) { - property_editor->queue_delete(); + property_editor->queue_free(); } // Update the dummy object. @@ -1200,7 +1200,7 @@ TileDataDefaultEditor::TileDataDefaultEditor() { } TileDataDefaultEditor::~TileDataDefaultEditor() { - toolbar->queue_delete(); + toolbar->queue_free(); memdelete(dummy_object); } @@ -1211,7 +1211,7 @@ void TileDataTextureOffsetEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran Vector2i tile_set_tile_size = tile_set->get_tile_size(); Color color = Color(1.0, 0.0, 0.0); if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } @@ -1233,7 +1233,7 @@ void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform Color color = Color(1.0, 1.0, 1.0); if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } @@ -1247,7 +1247,7 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D Color color = Color(1.0, 1.0, 1.0); if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } @@ -1259,7 +1259,7 @@ void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Tra TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_COND(!tile_data); - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color color = grid_color.darkened(0.2); if (p_selected) { @@ -1403,11 +1403,11 @@ void TileDataCollisionEditor::_polygons_changed() { dummy_object->remove_dummy_property(vformat("polygon_%d_one_way_margin", i)); } for (int i = polygon_editor->get_polygon_count(); property_editors.has(vformat("polygon_%d_one_way", i)); i++) { - property_editors[vformat("polygon_%d_one_way", i)]->queue_delete(); + property_editors[vformat("polygon_%d_one_way", i)]->queue_free(); property_editors.erase(vformat("polygon_%d_one_way", i)); } for (int i = polygon_editor->get_polygon_count(); property_editors.has(vformat("polygon_%d_one_way_margin", i)); i++) { - property_editors[vformat("polygon_%d_one_way_margin", i)]->queue_delete(); + property_editors[vformat("polygon_%d_one_way_margin", i)]->queue_free(); property_editors.erase(vformat("polygon_%d_one_way_margin", i)); } } @@ -1578,7 +1578,7 @@ void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfor // Draw all shapes. Vector<Color> color; if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); selection_color.a = 0.7; color.push_back(selection_color); @@ -1751,7 +1751,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET_RECT) { // Draw selection rectangle. - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); p_canvas_item->draw_set_transform_matrix(p_transform); @@ -2658,7 +2658,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() { } TileDataTerrainsEditor::~TileDataTerrainsEditor() { - toolbar->queue_delete(); + toolbar->queue_free(); memdelete(dummy_object); } @@ -2753,7 +2753,7 @@ void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfo color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color(); #endif // DEBUG_ENABLED if (p_selected) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); selection_color.a = 0.7; color = selection_color; diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index b9436e17f0..57416ff55f 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -396,7 +396,7 @@ void TileMapEditorTilesPlugin::_update_scenes_collection_view() { } // Icon size update. - int int_size = int(EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size")) * EDSCALE; + int int_size = int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE; scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); } @@ -739,7 +739,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) { // Do nothing } else { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); tile_map->draw_cells_outline(p_overlay, tile_map_selection, selection_color, xform); } @@ -844,9 +844,9 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over const int fading = 5; // Draw the lines of the grid behind the preview. - bool display_grid = EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid"); + bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); if (display_grid) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) { drawn_grid_rect = drawn_grid_rect.grow(fading); for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) { @@ -1682,7 +1682,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() { } // Draw the selection. - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); for (const TileMapCell &E : tile_set_selection) { if (E.source_id == source_id && E.alternative_tile == 0) { @@ -3023,9 +3023,9 @@ void TileMapEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control *p_o const int fading = 5; // Draw the lines of the grid behind the preview. - bool display_grid = EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid"); + bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); if (display_grid) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) { drawn_grid_rect = drawn_grid_rect.grow(fading); for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) { @@ -3420,7 +3420,7 @@ void TileMapEditor::_notification(int p_what) { warning_pattern_texture = get_theme_icon(SNAME("WarningPattern"), SNAME("EditorIcons")); advanced_menu_button->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons"))); toggle_grid_button->set_icon(get_theme_icon(SNAME("Grid"), SNAME("EditorIcons"))); - toggle_grid_button->set_pressed(EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid")); + toggle_grid_button->set_pressed(EDITOR_GET("editors/tiles_editor/display_grid")); toggle_highlight_selected_layer_button->set_icon(get_theme_icon(SNAME("TileMapHighlightSelected"), SNAME("EditorIcons"))); } break; @@ -3435,7 +3435,7 @@ void TileMapEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - toggle_grid_button->set_pressed(EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid")); + toggle_grid_button->set_pressed(EDITOR_GET("editors/tiles_editor/display_grid")); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -3878,9 +3878,9 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } // Draw the grid. - bool display_grid = EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid"); + bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); if (display_grid) { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); for (int x = displayed_rect.position.x; x < (displayed_rect.position.x + displayed_rect.size.x); x++) { for (int y = displayed_rect.position.y; y < (displayed_rect.position.y + displayed_rect.size.y); y++) { Vector2i pos_in_rect = Vector2i(x, y) - displayed_rect.position; diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 1857606f00..f1dfba6f35 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -671,7 +671,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() { } } for (int i = tile_set->get_occlusion_layers_count(); tile_data_editors.has(vformat("occlusion_layer_%d", i)); i++) { - tile_data_editors[vformat("occlusion_layer_%d", i)]->queue_delete(); + tile_data_editors[vformat("occlusion_layer_%d", i)]->queue_free(); tile_data_editors.erase(vformat("occlusion_layer_%d", i)); } @@ -710,7 +710,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() { } } for (int i = tile_set->get_physics_layers_count(); tile_data_editors.has(vformat("physics_layer_%d", i)); i++) { - tile_data_editors[vformat("physics_layer_%d", i)]->queue_delete(); + tile_data_editors[vformat("physics_layer_%d", i)]->queue_free(); tile_data_editors.erase(vformat("physics_layer_%d", i)); } @@ -728,7 +728,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() { } } for (int i = tile_set->get_navigation_layers_count(); tile_data_editors.has(vformat("navigation_layer_%d", i)); i++) { - tile_data_editors[vformat("navigation_layer_%d", i)]->queue_delete(); + tile_data_editors[vformat("navigation_layer_%d", i)]->queue_free(); tile_data_editors.erase(vformat("navigation_layer_%d", i)); } @@ -750,7 +750,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() { } } for (int i = tile_set->get_custom_data_layers_count(); tile_data_editors.has(vformat("custom_data_%d", i)); i++) { - tile_data_editors[vformat("custom_data_%d", i)]->queue_delete(); + tile_data_editors[vformat("custom_data_%d", i)]->queue_free(); tile_data_editors.erase(vformat("custom_data_%d", i)); } @@ -884,7 +884,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() { // Create a bunch of buttons to add alternative tiles. for (int i = 0; i < alternative_tiles_control->get_child_count(); i++) { - alternative_tiles_control->get_child(i)->queue_delete(); + alternative_tiles_control->get_child(i)->queue_free(); } Vector2i pos; @@ -1667,7 +1667,7 @@ Array TileSetAtlasSourceEditor::_get_selection_as_array() { void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { // Colors. - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); // Draw the selected tile. @@ -1958,7 +1958,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_mouse_exited() { } void TileSetAtlasSourceEditor::_tile_alternatives_control_draw() { - Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); + Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); // Update the hovered alternative tile. diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 3b057b7631..5e25d343b0 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -808,9 +808,3 @@ TileSetEditor::TileSetEditor() { EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(SNAME("TileSet"), callable_mp(this, &TileSetEditor::_move_tile_set_array_element)); EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &TileSetEditor::_undo_redo_inspector_callback)); } - -TileSetEditor::~TileSetEditor() { - if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileSetEditor::_tile_set_changed)); - } -} diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h index 290c53b109..76a471db74 100644 --- a/editor/plugins/tiles/tile_set_editor.h +++ b/editor/plugins/tiles/tile_set_editor.h @@ -109,7 +109,6 @@ public: void edit(Ref<TileSet> p_tile_set); TileSetEditor(); - ~TileSetEditor(); }; #endif // TILE_SET_EDITOR_H diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index f7622e68ab..ef69326686 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -323,7 +323,7 @@ void TileSetScenesCollectionSourceEditor::_update_scenes_list() { } // Icon size update. - int int_size = int(EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size")) * EDSCALE; + int int_size = int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE; scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); } diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 6fdc9a80e8..5b54062632 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -73,7 +73,7 @@ void TilesEditorPlugin::_thread() { pattern_preview_queue.pop_front(); pattern_preview_mutex.unlock(); - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; Vector2 thumbnail_size2 = Vector2(thumbnail_size, thumbnail_size); @@ -131,7 +131,7 @@ void TilesEditorPlugin::_thread() { Callable::CallError error; item.callback.callp(args_ptr, 2, r, error); - viewport->queue_delete(); + viewport->queue_free(); } } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d9f8d28067..9b6ff894b9 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -87,10 +87,8 @@ void VisualShaderNodePlugin::set_editor(VisualShaderEditor *p_editor) { Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node) { Object *ret = nullptr; - if (GDVIRTUAL_CALL(_create_editor, p_parent_resource, p_node, ret)) { - return Object::cast_to<Control>(ret); - } - return nullptr; + GDVIRTUAL_CALL(_create_editor, p_parent_resource, p_node, ret); + return Object::cast_to<Control>(ret); } void VisualShaderNodePlugin::_bind_methods() { @@ -1358,7 +1356,7 @@ void VisualShaderEditor::_update_options_menu() { Color unsupported_color = get_theme_color(SNAME("error_color"), SNAME("Editor")); Color supported_color = get_theme_color(SNAME("warning_color"), SNAME("Editor")); - static bool low_driver = ProjectSettings::get_singleton()->get("rendering/renderer/rendering_method") == "gl_compatibility"; + static bool low_driver = GLOBAL_GET("rendering/renderer/rendering_method") == "gl_compatibility"; HashMap<String, TreeItem *> folders; @@ -1733,9 +1731,9 @@ void VisualShaderEditor::_update_graph() { graph->connect_node(itos(from), from_idx, itos(to), to_idx); } - float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity"); + float graph_minimap_opacity = EDITOR_GET("editors/visual_editors/minimap_opacity"); graph->set_minimap_opacity(graph_minimap_opacity); - float graph_lines_curvature = EditorSettings::get_singleton()->get("editors/visual_editors/lines_curvature"); + float graph_lines_curvature = EDITOR_GET("editors/visual_editors/lines_curvature"); graph->set_connection_lines_curvature(graph_lines_curvature); } @@ -3679,10 +3677,10 @@ void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) { void VisualShaderEditor::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); - graph->set_minimap_opacity(EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity")); - graph->set_connection_lines_curvature(EditorSettings::get_singleton()->get("editors/visual_editors/lines_curvature")); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning"))); + graph->set_minimap_opacity(EDITOR_GET("editors/visual_editors/minimap_opacity")); + graph->set_connection_lines_curvature(EDITOR_GET("editors/visual_editors/lines_curvature")); _update_graph(); } break; @@ -3702,8 +3700,8 @@ void VisualShaderEditor::_notification(int p_what) { category = category->get_next(); } - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning"))); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { @@ -4686,9 +4684,9 @@ VisualShaderEditor::VisualShaderEditor() { graph->set_show_zoom_label(true); add_child(graph); graph->set_drag_forwarding(this); - float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity"); + float graph_minimap_opacity = EDITOR_GET("editors/visual_editors/minimap_opacity"); graph->set_minimap_opacity(graph_minimap_opacity); - float graph_lines_curvature = EditorSettings::get_singleton()->get("editors/visual_editors/lines_curvature"); + float graph_lines_curvature = EDITOR_GET("editors/visual_editors/lines_curvature"); graph->set_connection_lines_curvature(graph_lines_curvature); graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR); graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR_INT); @@ -6271,7 +6269,7 @@ void VisualShaderNodePortPreview::setup(const Ref<VisualShader> &p_shader, Visua } Size2 VisualShaderNodePortPreview::get_minimum_size() const { - int port_preview_size = EditorSettings::get_singleton()->get("editors/visual_editors/visual_shader/port_preview_size"); + int port_preview_size = EDITOR_GET("editors/visual_editors/visual_shader/port_preview_size"); return Size2(port_preview_size, port_preview_size) * EDSCALE; } diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp index a00df0ef40..d6b69e10db 100644 --- a/editor/pot_generator.cpp +++ b/editor/pot_generator.cpp @@ -63,7 +63,7 @@ void POTGenerator::generate_pot(const String &p_file) { // Clear all_translation_strings of the previous round. all_translation_strings.clear(); - Vector<String> files = ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files"); + Vector<String> files = GLOBAL_GET("internationalization/locale/translations_pot_files"); // Collect all translatable strings according to files order in "POT Generation" setting. for (int i = 0; i < files.size(); i++) { @@ -99,8 +99,8 @@ void POTGenerator::_write_to_pot(const String &p_file) { return; } - String project_name = ProjectSettings::get_singleton()->get("application/config/name"); - Vector<String> files = ProjectSettings::get_singleton()->get("internationalization/locale/translations_pot_files"); + String project_name = GLOBAL_GET("application/config/name"); + Vector<String> files = GLOBAL_GET("internationalization/locale/translations_pot_files"); String extracted_files = ""; for (int i = 0; i < files.size(); i++) { extracted_files += "# " + files[i] + "\n"; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 5a1eedd8a2..588746bf64 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -714,7 +714,7 @@ public: create_dir->hide(); } else { - fav_dir = EditorSettings::get_singleton()->get("filesystem/directories/default_project_path"); + fav_dir = EDITOR_GET("filesystem/directories/default_project_path"); if (!fav_dir.is_empty()) { project_path->set_text(fav_dir); fdialog->set_current_dir(fav_dir); @@ -1265,7 +1265,7 @@ void ProjectList::migrate_config() { continue; } - String path = EditorSettings::get_singleton()->get(property_key); + String path = EDITOR_GET(property_key); String favoriteKey = "favorite_projects/" + property_key.get_slice("/", 1); bool favorite = EditorSettings::get_singleton()->has_setting(favoriteKey); add_project(path, favorite); @@ -1916,7 +1916,7 @@ void ProjectManager::_notification(int p_what) { } break; case NOTIFICATION_READY: { - int default_sorting = (int)EditorSettings::get_singleton()->get("project_manager/sorting_order"); + int default_sorting = (int)EDITOR_GET("project_manager/sorting_order"); filter_option->select(default_sorting); _project_list->set_order_option(default_sorting); @@ -2561,7 +2561,7 @@ ProjectManager::ProjectManager() { EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came { - int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale"); + int display_scale = EDITOR_GET("interface/editor/display_scale"); switch (display_scale) { case 0: @@ -2587,7 +2587,7 @@ ProjectManager::ProjectManager() { editor_set_scale(2.0); break; default: - editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale")); + editor_set_scale(EDITOR_GET("interface/editor/custom_display_scale")); break; } EditorFileDialog::get_icon_func = &ProjectManager::_file_dialog_get_icon; @@ -2596,7 +2596,7 @@ ProjectManager::ProjectManager() { // TRANSLATORS: This refers to the application where users manage their Godot projects. DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + TTR("Project Manager", "Application")); - EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); int swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons"); if (swap_cancel_ok != 0) { // 0 is auto, set in register_scene based on DisplayServer. @@ -2815,7 +2815,7 @@ ProjectManager::ProjectManager() { } } - String current_lang = EditorSettings::get_singleton()->get("interface/editor/editor_language"); + String current_lang = EDITOR_GET("interface/editor/editor_language"); language_btn->set_text(current_lang); for (int i = 0; i < editor_languages.size(); i++) { @@ -2854,7 +2854,7 @@ ProjectManager::ProjectManager() { scan_dir->set_access(EditorFileDialog::ACCESS_FILESYSTEM); scan_dir->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden - scan_dir->set_current_dir(EditorSettings::get_singleton()->get("filesystem/directories/default_project_path")); + scan_dir->set_current_dir(EDITOR_GET("filesystem/directories/default_project_path")); add_child(scan_dir); scan_dir->connect("dir_selected", callable_mp(this, &ProjectManager::_scan_begin)); @@ -2936,7 +2936,7 @@ ProjectManager::ProjectManager() { Ref<DirAccess> dir_access = DirAccess::create(DirAccess::AccessType::ACCESS_FILESYSTEM); - String default_project_path = EditorSettings::get_singleton()->get("filesystem/directories/default_project_path"); + String default_project_path = EDITOR_GET("filesystem/directories/default_project_path"); if (!dir_access->dir_exists(default_project_path)) { Error error = dir_access->make_dir_recursive(default_project_path); if (error != OK) { @@ -2944,7 +2944,7 @@ ProjectManager::ProjectManager() { } } - String autoscan_path = EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path"); + String autoscan_path = EDITOR_GET("filesystem/directories/autoscan_project_path"); if (!autoscan_path.is_empty()) { if (dir_access->dir_exists(autoscan_path)) { _scan_begin(autoscan_path); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 8175f356c7..f23b08409e 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -352,7 +352,7 @@ void ProjectSettingsEditor::_action_added(const String &p_name) { void ProjectSettingsEditor::_action_edited(const String &p_name, const Dictionary &p_action) { const String property_name = "input/" + p_name; - Dictionary old_val = ProjectSettings::get_singleton()->get(property_name); + Dictionary old_val = GLOBAL_GET(property_name); if (old_val["deadzone"] != p_action["deadzone"]) { // Deadzone Changed @@ -387,7 +387,7 @@ void ProjectSettingsEditor::_action_edited(const String &p_name, const Dictionar void ProjectSettingsEditor::_action_removed(const String &p_name) { const String property_name = "input/" + p_name; - Dictionary old_val = ProjectSettings::get_singleton()->get(property_name); + Dictionary old_val = GLOBAL_GET(property_name); int order = ProjectSettings::get_singleton()->get_order(property_name); undo_redo->create_action(TTR("Erase Input Action")); @@ -410,7 +410,7 @@ void ProjectSettingsEditor::_action_renamed(const String &p_old_name, const Stri "An action with this name already exists."); int order = ProjectSettings::get_singleton()->get_order(old_property_name); - Dictionary action = ProjectSettings::get_singleton()->get(old_property_name); + Dictionary action = GLOBAL_GET(old_property_name); undo_redo->create_action(TTR("Rename Input Action Event")); // Do: clear old, set new @@ -505,7 +505,7 @@ void ProjectSettingsEditor::_update_action_map_editor() { // Strip the "input/" from the left. String display_name = property_name.substr(String("input/").size() - 1); - Dictionary action = ProjectSettings::get_singleton()->get(property_name); + Dictionary action = GLOBAL_GET(property_name); ActionMapEditor::ActionInfo action_info; action_info.action = action; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index ee358a8064..6a935b4f7b 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -946,7 +946,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); } break; case TOOL_AUTO_EXPAND: { - scene_tree->set_auto_expand_selected(!EditorSettings::get_singleton()->get("docks/scene_tree/auto_expand_to_selected"), true); + scene_tree->set_auto_expand_selected(!EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), true); } break; case TOOL_SCENE_EDITABLE_CHILDREN: { if (!profile_allow_editing) { @@ -1237,14 +1237,14 @@ void SceneTreeDock::_notification(int p_what) { CanvasItemEditorPlugin *canvas_item_plugin = Object::cast_to<CanvasItemEditorPlugin>(editor_data->get_editor("2D")); if (canvas_item_plugin) { - canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree)); - canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree)); + canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); + canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); scene_tree->connect("node_changed", callable_mp((CanvasItem *)canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), &CanvasItem::queue_redraw)); } Node3DEditorPlugin *spatial_editor_plugin = Object::cast_to<Node3DEditorPlugin>(editor_data->get_editor("3D")); - spatial_editor_plugin->get_spatial_editor()->connect("item_lock_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree)); - spatial_editor_plugin->get_spatial_editor()->connect("item_group_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree)); + spatial_editor_plugin->get_spatial_editor()->connect("item_lock_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); + spatial_editor_plugin->get_spatial_editor()->connect("item_group_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); button_instance->set_icon(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); @@ -1325,7 +1325,7 @@ void SceneTreeDock::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { clear_inherit_confirm->connect("confirmed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM, false)); - scene_tree->set_auto_expand_selected(EditorSettings::get_singleton()->get("docks/scene_tree/auto_expand_to_selected"), false); + scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); } break; case NOTIFICATION_EXIT_TREE: { @@ -1333,7 +1333,7 @@ void SceneTreeDock::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - scene_tree->set_auto_expand_selected(EditorSettings::get_singleton()->get("docks/scene_tree/auto_expand_to_selected"), false); + scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); button_instance->set_icon(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); button_create_script->set_icon(get_theme_icon(SNAME("ScriptCreate"), SNAME("EditorIcons"))); @@ -1401,6 +1401,7 @@ void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root void SceneTreeDock::_load_request(const String &p_path) { EditorNode::get_singleton()->open_request(p_path); + _local_tree_selected(); } void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) { @@ -2447,7 +2448,7 @@ void SceneTreeDock::_new_scene_from(String p_file) { } int flg = 0; - if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) { + if (EDITOR_GET("filesystem/on_save/compress_binary_resources")) { flg |= ResourceSaver::FLAG_COMPRESS; } @@ -2894,7 +2895,7 @@ void SceneTreeDock::_update_tree_menu() { tree_menu->add_separator(); tree_menu->add_check_item(TTR("Auto Expand to Selected"), TOOL_AUTO_EXPAND); - tree_menu->set_item_checked(tree_menu->get_item_index(TOOL_AUTO_EXPAND), EditorSettings::get_singleton()->get("docks/scene_tree/auto_expand_to_selected")); + tree_menu->set_item_checked(tree_menu->get_item_index(TOOL_AUTO_EXPAND), EDITOR_GET("docks/scene_tree/auto_expand_to_selected")); } void SceneTreeDock::_update_filter_menu() { @@ -3218,6 +3219,7 @@ void SceneTreeDock::add_remote_tree_editor(Control *p_remote) { add_child(p_remote); remote_tree = p_remote; remote_tree->hide(); + remote_tree->connect("open", callable_mp(this, &SceneTreeDock::_load_request)); } void SceneTreeDock::show_remote_tree() { @@ -3264,7 +3266,7 @@ void SceneTreeDock::_update_create_root_dialog() { EditorSettings::get_singleton()->save(); if (node_shortcuts_toggle->is_pressed()) { for (int i = 0; i < favorite_node_shortcuts->get_child_count(); i++) { - favorite_node_shortcuts->get_child(i)->queue_delete(); + favorite_node_shortcuts->get_child(i)->queue_free(); } Ref<FileAccess> f = FileAccess::open(EditorPaths::get_singleton()->get_project_settings_dir().path_join("favorites.Node"), FileAccess::READ); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index da727a127a..c8bc189106 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -483,8 +483,9 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (valid_types.size()) { bool valid = false; - for (int i = 0; i < valid_types.size(); i++) { - if (p_node->is_class(valid_types[i])) { + for (const StringName &E : valid_types) { + if (p_node->is_class(E) || + EditorNode::get_singleton()->is_object_of_custom_type(p_node, E)) { valid = true; break; } diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index 473bbd69d9..6967536692 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -107,7 +107,7 @@ protected: String path = "shader_globals/" + String(p_name); undo_redo->add_do_property(ProjectSettings::get_singleton(), path, gv); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), path, ProjectSettings::get_singleton()->get(path)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), path, GLOBAL_GET(path)); undo_redo->add_do_method(this, "_var_changed"); undo_redo->add_undo_method(this, "_var_changed"); block_update = true; @@ -420,7 +420,7 @@ void ShaderGlobalsEditor::_variable_deleted(const String &p_variable) { undo_redo->add_undo_method(RS::get_singleton(), "global_shader_parameter_add", p_variable, RS::get_singleton()->global_shader_parameter_get_type(p_variable), RS::get_singleton()->global_shader_parameter_get(p_variable)); undo_redo->add_do_property(ProjectSettings::get_singleton(), "shader_globals/" + p_variable, Variant()); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "shader_globals/" + p_variable, ProjectSettings::get_singleton()->get("shader_globals/" + p_variable)); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "shader_globals/" + p_variable, GLOBAL_GET("shader_globals/" + p_variable)); undo_redo->add_do_method(this, "_changed"); undo_redo->add_undo_method(this, "_changed"); undo_redo->commit_action(); |