summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/action_map_editor.cpp7
-rw-r--r--editor/animation_bezier_editor.cpp4
-rw-r--r--editor/animation_track_editor.cpp10
-rw-r--r--editor/code_editor.cpp70
-rw-r--r--editor/connections_dialog.cpp7
-rw-r--r--editor/connections_dialog.h3
-rw-r--r--editor/create_dialog.cpp10
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_server.cpp4
-rw-r--r--editor/debugger/editor_debugger_node.cpp31
-rw-r--r--editor/debugger/editor_debugger_node.h1
-rw-r--r--editor/debugger/editor_debugger_server.cpp4
-rw-r--r--editor/debugger/editor_debugger_tree.cpp32
-rw-r--r--editor/debugger/editor_debugger_tree.h5
-rw-r--r--editor/debugger/editor_profiler.cpp2
-rw-r--r--editor/debugger/editor_visual_profiler.cpp2
-rw-r--r--editor/debugger/script_editor_debugger.cpp2
-rw-r--r--editor/dependency_editor.cpp18
-rw-r--r--editor/doc_tools.cpp2
-rw-r--r--editor/editor_audio_buses.cpp10
-rw-r--r--editor/editor_autoload_settings.cpp28
-rw-r--r--editor/editor_build_profile.cpp4
-rw-r--r--editor/editor_command_palette.cpp2
-rw-r--r--editor/editor_data.cpp6
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_feature_profile.cpp4
-rw-r--r--editor/editor_feature_profile.h1
-rw-r--r--editor/editor_file_dialog.cpp6
-rw-r--r--editor/editor_file_system.cpp4
-rw-r--r--editor/editor_fonts.cpp48
-rw-r--r--editor/editor_help.cpp28
-rw-r--r--editor/editor_inspector.cpp40
-rw-r--r--editor/editor_inspector.h8
-rw-r--r--editor/editor_locale_dialog.cpp22
-rw-r--r--editor/editor_locale_dialog.h3
-rw-r--r--editor/editor_log.cpp3
-rw-r--r--editor/editor_node.cpp114
-rw-r--r--editor/editor_node.h7
-rw-r--r--editor/editor_paths.cpp2
-rw-r--r--editor/editor_plugin.cpp72
-rw-r--r--editor/editor_plugin.h5
-rw-r--r--editor/editor_plugin_settings.h1
-rw-r--r--editor/editor_properties.cpp15
-rw-r--r--editor/editor_properties_array_dict.cpp14
-rw-r--r--editor/editor_resource_picker.cpp28
-rw-r--r--editor/editor_resource_preview.cpp18
-rw-r--r--editor/editor_run.cpp25
-rw-r--r--editor/editor_settings.cpp10
-rw-r--r--editor/editor_settings_dialog.cpp8
-rw-r--r--editor/editor_settings_dialog.h4
-rw-r--r--editor/editor_themes.cpp4
-rw-r--r--editor/editor_toaster.cpp2
-rw-r--r--editor/editor_undo_redo_manager.cpp62
-rw-r--r--editor/editor_undo_redo_manager.h4
-rw-r--r--editor/export/editor_export.cpp2
-rw-r--r--editor/export/editor_export_platform.cpp24
-rw-r--r--editor/export/editor_export_platform_pc.cpp7
-rw-r--r--editor/export/editor_export_plugin.cpp12
-rw-r--r--editor/export/project_export.cpp2
-rw-r--r--editor/filesystem_dock.cpp89
-rw-r--r--editor/find_in_files.cpp7
-rw-r--r--editor/groups_editor.cpp16
-rw-r--r--editor/groups_editor.h8
-rw-r--r--editor/history_dock.cpp251
-rw-r--r--editor/history_dock.h66
-rw-r--r--editor/import/collada.cpp2
-rw-r--r--editor/import/dynamic_font_import_settings.cpp24
-rw-r--r--editor/import/editor_import_collada.cpp6
-rw-r--r--editor/import/resource_importer_dynamic_font.cpp7
-rw-r--r--editor/import/resource_importer_layered_texture.cpp14
-rw-r--r--editor/import/resource_importer_scene.cpp4
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp16
-rw-r--r--editor/import_defaults_editor.cpp2
-rw-r--r--editor/import_dock.cpp2
-rw-r--r--editor/inspector_dock.cpp6
-rw-r--r--editor/localization_editor.cpp55
-rw-r--r--editor/localization_editor.h2
-rw-r--r--editor/node_dock.cpp2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp7
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h3
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp28
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h4
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp12
-rw-r--r--editor/plugins/animation_player_editor_plugin.h3
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp6
-rw-r--r--editor/plugins/bone_map_editor_plugin.cpp8
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp124
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h5
-rw-r--r--editor/plugins/control_editor_plugin.cpp13
-rw-r--r--editor/plugins/control_editor_plugin.h1
-rw-r--r--editor/plugins/curve_editor_plugin.cpp65
-rw-r--r--editor/plugins/editor_preview_plugins.cpp14
-rw-r--r--editor/plugins/editor_resource_conversion_plugin.cpp21
-rw-r--r--editor/plugins/font_config_plugin.cpp10
-rw-r--r--editor/plugins/gdextension_export_plugin.h2
-rw-r--r--editor/plugins/gradient_editor.cpp2
-rw-r--r--editor/plugins/gradient_texture_2d_editor_plugin.cpp16
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp5
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.cpp7
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp111
-rw-r--r--editor/plugins/node_3d_editor_gizmos.h1
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp211
-rw-r--r--editor/plugins/node_3d_editor_plugin.h7
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp12
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp86
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp19
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp3
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp10
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp10
-rw-r--r--editor/plugins/text_editor.cpp13
-rw-r--r--editor/plugins/text_editor.h2
-rw-r--r--editor/plugins/text_shader_editor.cpp6
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp87
-rw-r--r--editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp12
-rw-r--r--editor/plugins/theme_editor_preview.cpp2
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp56
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp30
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp56
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp29
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.h2
-rw-r--r--editor/plugins/tiles/tile_set_editor.cpp6
-rw-r--r--editor/plugins/tiles/tile_set_editor.h1
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp10
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.h4
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp4
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp170
-rw-r--r--editor/pot_generator.cpp6
-rw-r--r--editor/project_manager.cpp22
-rw-r--r--editor/project_settings_editor.cpp19
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/scene_tree_dock.cpp27
-rw-r--r--editor/scene_tree_editor.cpp17
-rw-r--r--editor/scene_tree_editor.h6
-rw-r--r--editor/script_create_dialog.cpp4
-rw-r--r--editor/shader_globals_editor.cpp6
146 files changed, 1766 insertions, 1138 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 9b1ff78727..3b9d6c18eb 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "editor/action_map_editor.h"
+
#include "editor/editor_scale.h"
#include "editor/event_listener_line_edit.h"
#include "editor/input_event_configuration_dialog.h"
@@ -395,15 +396,9 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
action_tree->clear();
TreeItem *root = action_tree->create_item();
- int uneditable_count = 0;
-
for (int i = 0; i < actions_cache.size(); i++) {
ActionInfo action_info = actions_cache[i];
- if (!action_info.editable) {
- uneditable_count++;
- }
-
const Array events = action_info.action["events"];
if (!_should_display_action(action_info.name, events)) {
continue;
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 5c4ef35f1c..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: {
@@ -6204,7 +6204,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
if (do_bake && !animation->track_is_compressed(i)) {
Animation::InterpolationType it = animation->track_get_interpolation_type(i);
if (it == Animation::INTERPOLATION_NEAREST) {
- continue; // Nearest and Angle interpolation cannot be baked.
+ continue; // Nearest interpolation cannot be baked.
}
// Special case for angle interpolation.
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/connections_dialog.cpp b/editor/connections_dialog.cpp
index de7f5c8b88..ed2044c117 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -684,6 +684,7 @@ void ConnectionsDock::_connect(ConnectDialog::ConnectionData p_cd) {
}
Callable callable = p_cd.get_callable();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"), String(p_cd.signal), String(p_cd.method)));
undo_redo->add_do_method(source, "connect", p_cd.signal, callable, p_cd.flags);
undo_redo->add_undo_method(source, "disconnect", p_cd.signal, callable);
@@ -704,6 +705,7 @@ void ConnectionsDock::_disconnect(TreeItem &p_item) {
ERR_FAIL_COND(cd.source != selected_node); // Shouldn't happen but... Bugcheck.
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), cd.signal, cd.method));
Callable callable = cd.get_callable();
@@ -730,6 +732,7 @@ void ConnectionsDock::_disconnect_all() {
TreeItem *child = item->get_first_child();
String signal_name = item->get_metadata(0).operator Dictionary()["name"];
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Disconnect all from signal: '%s'"), signal_name));
while (child) {
@@ -991,10 +994,6 @@ void ConnectionsDock::_bind_methods() {
ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree);
}
-void ConnectionsDock::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void ConnectionsDock::set_node(Node *p_node) {
selected_node = p_node;
update_tree();
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 126a0ca828..fcfc501386 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -47,7 +47,6 @@
#include "scene/gui/tree.h"
class ConnectDialogBinds;
-class EditorUndoRedoManager;
class ConnectDialog : public ConfirmationDialog {
GDCLASS(ConnectDialog, ConfirmationDialog);
@@ -197,7 +196,6 @@ class ConnectionsDock : public VBoxContainer {
Button *connect_button = nullptr;
PopupMenu *signal_menu = nullptr;
PopupMenu *slot_menu = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
LineEdit *search_box = nullptr;
HashMap<StringName, HashMap<StringName, String>> descr_cache;
@@ -231,7 +229,6 @@ protected:
static void _bind_methods();
public:
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
void set_node(Node *p_node);
void update_tree();
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 7a4e58c6f9..545b0895b0 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -284,12 +284,12 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String
bool can_instantiate = (p_type_category == TypeCategory::CPP_TYPE && ClassDB::can_instantiate(p_type)) ||
p_type_category == TypeCategory::OTHER_TYPE;
- if (!can_instantiate) {
- r_item->set_custom_color(0, search_options->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
+ if (can_instantiate && !ClassDB::is_virtual(p_type)) {
+ r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback));
+ } else {
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, "NodeDisabled"));
+ r_item->set_custom_color(0, search_options->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
r_item->set_selectable(0, false);
- } else {
- r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback));
}
bool is_deprecated = EditorHelp::get_doc_data()->class_list[p_type].is_deprecated;
@@ -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..68aff328ed 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));
@@ -228,6 +229,12 @@ void EditorDebuggerNode::stop() {
if (server.is_valid()) {
server->stop();
EditorNode::get_log()->add_message("--- Debugging process stopped ---", EditorLog::MSG_TYPE_EDITOR);
+
+ if (EditorNode::get_singleton()->is_movie_maker_enabled()) {
+ // Request attention in case the user was doing something else when movie recording is finished.
+ DisplayServer::get_singleton()->window_request_attention();
+ }
+
server.unref();
}
// Also close all debugging sessions.
@@ -277,7 +284,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 +293,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 +320,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 +580,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/doc_tools.cpp b/editor/doc_tools.cpp
index 7d6eb186dc..14a2640e63 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -335,7 +335,7 @@ static Variant get_documentation_default_value(const StringName &p_class_name, c
Variant default_value = Variant();
r_default_value_valid = false;
- if (ClassDB::can_instantiate(p_class_name)) {
+ if (ClassDB::can_instantiate(p_class_name) && !ClassDB::is_virtual(p_class_name)) { // Keep this condition in sync with ClassDB::class_get_default_property_value.
default_value = ClassDB::class_get_default_property_value(p_class_name, p_property_name, &r_default_value_valid);
} else {
// Cannot get default value of classes that can't be instantiated
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 83deff1469..24116a8053 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -338,7 +338,7 @@ float EditorAudioBus::_normalized_volume_to_scaled_db(float normalized) {
* values to relative decibal values.
* One formula is an exponential graph which intends to counteract
* the logarithmic nature of human hearing. This is an approximation
- * of the behaviour of a 'logarithmic potentiometer' found on most
+ * of the behavior of a 'logarithmic potentiometer' found on most
* musical instruments and also emulated in popular software.
* The other two equations are hand-tuned linear tapers that intend to
* try to ease the exponential equation in areas where it makes sense.*/
@@ -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..598bcdc639 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -194,7 +194,7 @@ void EditorAutoloadSettings::_autoload_edited() {
TreeItem *ti = tree->get_edited();
int column = tree->get_edited_column();
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (column == 0) {
String name = ti->get_text(0);
@@ -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);
@@ -289,7 +289,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu
String name = "autoload/" + ti->get_text(0);
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (p_button) {
case BUTTON_OPEN: {
@@ -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;
}
@@ -714,7 +714,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
orders.sort();
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Rearrange Autoloads"));
@@ -757,14 +757,14 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
name = "autoload/" + name;
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add Autoload"));
// Singleton autoloads are represented with a leading "*" in their path.
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());
}
@@ -783,7 +783,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
void EditorAutoloadSettings::autoload_remove(const String &p_name) {
String name = "autoload/" + p_name;
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
int order = ProjectSettings::get_singleton()->get_order(name);
@@ -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_build_profile.cpp b/editor/editor_build_profile.cpp
index 7fd27692b0..96c69c0bd1 100644
--- a/editor/editor_build_profile.cpp
+++ b/editor/editor_build_profile.cpp
@@ -875,7 +875,7 @@ EditorBuildProfileManager::EditorBuildProfileManager() {
import_profile = memnew(EditorFileDialog);
add_child(import_profile);
import_profile->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
- import_profile->add_filter("*.build", TTR("Egine Build Profile"));
+ import_profile->add_filter("*.build", TTR("Engine Build Profile"));
import_profile->connect("files_selected", callable_mp(this, &EditorBuildProfileManager::_import_profile));
import_profile->set_title(TTR("Load Profile"));
import_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
@@ -883,7 +883,7 @@ EditorBuildProfileManager::EditorBuildProfileManager() {
export_profile = memnew(EditorFileDialog);
add_child(export_profile);
export_profile->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
- export_profile->add_filter("*.build", TTR("Egine Build Profile"));
+ export_profile->add_filter("*.build", TTR("Engine Build Profile"));
export_profile->connect("file_selected", callable_mp(this, &EditorBuildProfileManager::_export_profile));
export_profile->set_title(TTR("Export Profile"));
export_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index a0913265eb..3f93fa1f41 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -226,7 +226,7 @@ void EditorCommandPalette::_add_command(String p_command_name, String p_key_name
void EditorCommandPalette::execute_command(String &p_command_key) {
ERR_FAIL_COND_MSG(!commands.has(p_command_key), p_command_key + " not found.");
commands[p_command_key].last_used = OS::get_singleton()->get_unix_time();
- commands[p_command_key].callable.call_deferredp(nullptr, 0);
+ commands[p_command_key].callable.call_deferred();
_save_history();
}
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index d1ea0f2814..a3dd19bb67 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -457,12 +457,10 @@ Callable EditorData::get_move_array_element_function(const StringName &p_class)
}
void EditorData::remove_editor_plugin(EditorPlugin *p_plugin) {
- p_plugin->undo_redo = Ref<EditorUndoRedoManager>();
editor_plugins.erase(p_plugin);
}
void EditorData::add_editor_plugin(EditorPlugin *p_plugin) {
- p_plugin->undo_redo = undo_redo_manager;
editor_plugins.push_back(p_plugin);
}
@@ -1008,7 +1006,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 +1026,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_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 9549ffb09b..49fb16a095 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -47,6 +47,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
TTRC("Node Dock"),
TTRC("FileSystem Dock"),
TTRC("Import Dock"),
+ TTRC("History Dock"),
};
const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
@@ -57,6 +58,7 @@ const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
TTRC("Allows to work with signals and groups of the node selected in the Scene dock."),
TTRC("Allows to browse the local file system via a dedicated dock."),
TTRC("Allows to configure import settings for individual assets. Requires the FileSystem dock to function."),
+ TTRC("Provides an overview of the editor's and each scene's undo history."),
};
const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
@@ -67,6 +69,7 @@ const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
"node_dock",
"filesystem_dock",
"import_dock",
+ "history_dock",
};
void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) {
@@ -302,6 +305,7 @@ void EditorFeatureProfile::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK);
BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK);
BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK);
+ BIND_ENUM_CONSTANT(FEATURE_HISTORY_DOCK);
BIND_ENUM_CONSTANT(FEATURE_MAX);
}
diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h
index dab6c951e4..6868c54146 100644
--- a/editor/editor_feature_profile.h
+++ b/editor/editor_feature_profile.h
@@ -52,6 +52,7 @@ public:
FEATURE_NODE_DOCK,
FEATURE_FILESYSTEM_DOCK,
FEATURE_IMPORT_DOCK,
+ FEATURE_HISTORY_DOCK,
FEATURE_MAX
};
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..51ebc31df3 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -57,6 +57,24 @@ Ref<FontFile> load_external_font(const String &p_path, TextServer::Hinting p_hin
return font;
}
+Ref<SystemFont> load_system_font(const PackedStringArray &p_names, TextServer::Hinting p_hinting, TextServer::FontAntialiasing p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_msdf = false, TypedArray<Font> *r_fallbacks = nullptr) {
+ Ref<SystemFont> font;
+ font.instantiate();
+
+ font->set_font_names(p_names);
+ font->set_multichannel_signed_distance_field(p_msdf);
+ font->set_antialiasing(p_aa);
+ font->set_hinting(p_hinting);
+ font->set_force_autohinter(p_autohint);
+ font->set_subpixel_positioning(p_font_subpixel_positioning);
+
+ if (r_fallbacks != nullptr) {
+ r_fallbacks->push_back(font);
+ }
+
+ return font;
+}
+
Ref<FontFile> load_internal_font(const uint8_t *p_data, size_t p_size, TextServer::Hinting p_hinting, TextServer::FontAntialiasing p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_msdf = false, TypedArray<Font> *r_fallbacks = nullptr) {
Ref<FontFile> font;
font.instantiate();
@@ -91,9 +109,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;
@@ -166,6 +184,20 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<FontFile> thai_font_bold = load_internal_font(_font_NotoSansThaiUI_Bold, _font_NotoSansThaiUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, false, &fallbacks_bold);
Ref<FontVariation> fallback_font_bold = make_bold_font(fallback_font, embolden_strength, &fallbacks_bold);
Ref<FontVariation> japanese_font_bold = make_bold_font(japanese_font, embolden_strength, &fallbacks_bold);
+
+ if (OS::get_singleton()->has_feature("system_fonts")) {
+ PackedStringArray emoji_font_names;
+ emoji_font_names.push_back("Apple Color Emoji");
+ emoji_font_names.push_back("Segoe UI Emoji");
+ emoji_font_names.push_back("Noto Color Emoji");
+ emoji_font_names.push_back("Twitter Color Emoji");
+ emoji_font_names.push_back("OpenMoji");
+ emoji_font_names.push_back("EmojiOne Color");
+ Ref<SystemFont> emoji_font = load_system_font(emoji_font_names, font_hinting, font_antialiasing, true, font_subpixel_positioning, false);
+ fallbacks.push_back(emoji_font);
+ fallbacks_bold.push_back(emoji_font);
+ }
+
default_font_bold->set_fallbacks(fallbacks_bold);
default_font_bold_msdf->set_fallbacks(fallbacks_bold);
@@ -173,9 +205,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 +315,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 +323,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..89398409a2 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 overridden to customize 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..6e18bde303 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -39,6 +39,7 @@
#include "editor/editor_property_name_processor.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/script_editor_plugin.h"
#include "multi_node_edit.h"
#include "scene/gui/center_container.h"
@@ -1062,10 +1063,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 +1081,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) {
@@ -1702,6 +1699,7 @@ void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) {
} else {
action_name = vformat("Move element %d to position %d in property array with prefix %s.", p_element_index, p_to_pos, array_element_prefix);
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(action_name);
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
// Call the function.
@@ -1845,6 +1843,7 @@ void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) {
}
void EditorInspectorArray::_clear_array() {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat("Clear property array with prefix %s.", array_element_prefix));
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
for (int i = count - 1; i >= 0; i--) {
@@ -1897,6 +1896,7 @@ void EditorInspectorArray::_resize_array(int p_size) {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat("Resize property array with prefix %s.", array_element_prefix));
if (p_size > count) {
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
@@ -2246,10 +2246,6 @@ void EditorInspectorArray::_bind_methods() {
ADD_SIGNAL(MethodInfo("page_change_request"));
}
-void EditorInspectorArray::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void EditorInspectorArray::setup_with_move_element_function(Object *p_object, String p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable, bool p_numbered, int p_page_length, const String &p_add_item_text) {
count_property = "";
mode = MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION;
@@ -2512,10 +2508,6 @@ Button *EditorInspector::create_inspector_action_button(const String &p_text) {
return button;
}
-void EditorInspector::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
String EditorInspector::get_selected_path() const {
return property_selected;
}
@@ -2527,7 +2519,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));
@@ -3081,7 +3073,6 @@ void EditorInspector::update_tree() {
int page = per_array_page.has(array_element_prefix) ? per_array_page[array_element_prefix] : 0;
editor_inspector_array->setup_with_move_element_function(object, array_label, array_element_prefix, page, c, use_folding);
editor_inspector_array->connect("page_change_request", callable_mp(this, &EditorInspector::_page_change_request).bind(array_element_prefix));
- editor_inspector_array->set_undo_redo(undo_redo);
} else if (p.type == Variant::INT) {
// Setup the array to use the count property and built-in functions to create/move/delete elements.
if (class_name_components.size() >= 2) {
@@ -3091,8 +3082,6 @@ void EditorInspector::update_tree() {
editor_inspector_array->setup_with_count_property(object, class_name_components[0], p.name, array_element_prefix, page, c, foldable, movable, numbered, page_size, add_button_text, swap_method);
editor_inspector_array->connect("page_change_request", callable_mp(this, &EditorInspector::_page_change_request).bind(array_element_prefix));
-
- editor_inspector_array->set_undo_redo(undo_redo);
}
}
@@ -3569,6 +3558,7 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
}
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (!undo_redo.is_valid() || bool(object->call("_dont_undo_redo"))) {
object->set(p_name, p_value);
if (p_refresh_all) {
@@ -3689,6 +3679,7 @@ void EditorInspector::_multiple_properties_changed(Vector<String> p_paths, Array
}
names += p_paths[i];
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Set Multiple:") + " " + names, UndoRedo::MERGE_ENDS);
for (int i = 0; i < p_paths.size(); i++) {
_edit_set(p_paths[i], p_values[i], false, "");
@@ -3723,6 +3714,7 @@ void EditorInspector::_property_deleted(const String &p_path) {
if (p_path.begins_with("metadata/")) {
String name = p_path.replace_first("metadata/", "");
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Remove metadata %s"), name));
undo_redo->add_do_method(object, "remove_meta", name);
undo_redo->add_undo_method(object, "set_meta", name, object->get_meta(name));
@@ -3788,6 +3780,7 @@ void EditorInspector::_property_pinned(const String &p_path, bool p_pinned) {
Node *node = Object::cast_to<Node>(object);
ERR_FAIL_COND(!node);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (undo_redo.is_valid()) {
undo_redo->create_action(vformat(p_pinned ? TTR("Pinned %s") : TTR("Unpinned %s"), p_path));
undo_redo->add_do_method(node, "_set_property_pinned", p_path, p_pinned);
@@ -3876,7 +3869,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 +3882,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"));
}
}
@@ -3985,6 +3978,7 @@ void EditorInspector::_add_meta_confirm() {
Variant defval;
Callable::CallError ce;
Variant::construct(Variant::Type(add_meta_type->get_selected_id()), defval, nullptr, 0, ce);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Add metadata %s"), name));
undo_redo->add_do_method(object, "set_meta", name, defval);
undo_redo->add_undo_method(object, "remove_meta", name);
@@ -4095,7 +4089,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_inspector.h b/editor/editor_inspector.h
index bada02e254..1b93b19845 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -31,7 +31,6 @@
#ifndef EDITOR_INSPECTOR_H
#define EDITOR_INSPECTOR_H
-#include "editor/editor_undo_redo_manager.h"
#include "editor_property_name_processor.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
@@ -305,8 +304,6 @@ public:
class EditorInspectorArray : public EditorInspectorSection {
GDCLASS(EditorInspectorArray, EditorInspectorSection);
- Ref<EditorUndoRedoManager> undo_redo;
-
enum Mode {
MODE_NONE,
MODE_USE_COUNT_PROPERTY,
@@ -401,8 +398,6 @@ protected:
static void _bind_methods();
public:
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
-
void setup_with_move_element_function(Object *p_object, String p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "");
void setup_with_count_property(Object *p_object, String p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = "");
VBoxContainer *get_vbox(int p_index);
@@ -441,7 +436,6 @@ public:
class EditorInspector : public ScrollContainer {
GDCLASS(EditorInspector, ScrollContainer);
- Ref<EditorUndoRedoManager> undo_redo;
enum {
MAX_PLUGINS = 1024
};
@@ -555,8 +549,6 @@ public:
static EditorProperty *instantiate_property_editor(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 = false);
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
-
String get_selected_path() const;
void update_tree();
diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp
index 953358b23e..a913fb2fd9 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;
}
@@ -141,6 +141,7 @@ void EditorLocaleDialog::_filter_lang_option_changed() {
f_lang_all.sort();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Changed Locale Language Filter"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/language_filter", f_lang_all);
undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/language_filter", prev);
@@ -156,7 +157,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;
}
@@ -174,6 +175,7 @@ void EditorLocaleDialog::_filter_script_option_changed() {
f_script_all.sort();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Changed Locale Script Filter"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/script_filter", f_script_all);
undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/script_filter", prev);
@@ -189,7 +191,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;
}
@@ -207,6 +209,7 @@ void EditorLocaleDialog::_filter_cnt_option_changed() {
f_cnt_all.sort();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Changed Locale Country Filter"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/country_filter", f_cnt_all);
undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/country_filter", prev);
@@ -218,9 +221,10 @@ 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");
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Changed Locale Filter Mode"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), "internationalization/locale/locale_filter_mode", f_mode);
undo_redo->add_undo_property(ProjectSettings::get_singleton(), "internationalization/locale/locale_filter_mode", prev);
@@ -238,19 +242,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();
@@ -385,8 +389,6 @@ void EditorLocaleDialog::popup_locale_dialog() {
}
EditorLocaleDialog::EditorLocaleDialog() {
- undo_redo = EditorNode::get_undo_redo();
-
set_title(TTR("Select a Locale"));
VBoxContainer *vb = memnew(VBoxContainer);
diff --git a/editor/editor_locale_dialog.h b/editor/editor_locale_dialog.h
index 8ac642a038..48f9edd4b0 100644
--- a/editor/editor_locale_dialog.h
+++ b/editor/editor_locale_dialog.h
@@ -40,7 +40,6 @@ class VBoxContainer;
class LineEdit;
class Tree;
class OptionButton;
-class EditorUndoRedoManager;
class EditorLocaleDialog : public ConfirmationDialog {
GDCLASS(EditorLocaleDialog, ConfirmationDialog);
@@ -63,8 +62,6 @@ class EditorLocaleDialog : public ConfirmationDialog {
Tree *script_list = nullptr;
Tree *cnt_list = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
-
bool locale_set = false;
bool updating_lists = false;
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 0f2543f708..84284a7f31 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -30,6 +30,7 @@
#include "editor_log.h"
+#include "core/object/undo_redo.h"
#include "core/os/keyboard.h"
#include "core/version.h"
#include "editor/editor_node.h"
@@ -226,7 +227,7 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
// Make text split by new lines their own message.
// See #41321 for reasoning. At time of writing, multiple print()'s in running projects
// get grouped together and sent to the editor log as one message. This can mess with the
- // search functionality (see the comments on the PR above for more details). This behaviour
+ // search functionality (see the comments on the PR above for more details). This behavior
// also matches that of other IDE's.
Vector<String> lines = p_msg.split("\n", true);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8ee82888f3..1bca1b3c87 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -110,6 +110,7 @@
#include "editor/export/export_template_manager.h"
#include "editor/export/project_export.h"
#include "editor/filesystem_dock.h"
+#include "editor/history_dock.h"
#include "editor/import/audio_stream_import_settings.h"
#include "editor/import/dynamic_font_import_settings.h"
#include "editor/import/editor_import_collada.h"
@@ -243,15 +244,11 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
String full_path = p_full_paths[set_idx];
// Get rid of file extensions and res:// prefixes.
- if (scene_name.rfind(".") >= 0) {
- scene_name = scene_name.substr(0, scene_name.rfind("."));
- }
+ scene_name = scene_name.get_basename();
if (full_path.begins_with("res://")) {
full_path = full_path.substr(6);
}
- if (full_path.rfind(".") >= 0) {
- full_path = full_path.substr(0, full_path.rfind("."));
- }
+ full_path = full_path.get_basename();
// Normalize trailing slashes when normalizing directory names.
scene_name = scene_name.trim_suffix("/");
@@ -269,7 +266,7 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
String parent = full_path.substr(0, difference);
int slash_idx = parent.rfind("/");
slash_idx = parent.rfind("/", slash_idx - 1);
- parent = slash_idx >= 0 ? parent.substr(slash_idx + 1) : parent;
+ parent = (slash_idx >= 0 && parent.length() > 1) ? parent.substr(slash_idx + 1) : parent;
r_filenames.write[set_idx] = parent + r_filenames[set_idx];
}
}
@@ -301,15 +298,11 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
String path = p_full_paths[E->get()];
// Get rid of file extensions and res:// prefixes.
- if (scene_name.rfind(".") >= 0) {
- scene_name = scene_name.substr(0, scene_name.rfind("."));
- }
+ scene_name = scene_name.get_basename();
if (path.begins_with("res://")) {
path = path.substr(6);
}
- if (path.rfind(".") >= 0) {
- path = path.substr(0, path.rfind("."));
- }
+ path = path.get_basename();
// Normalize trailing slashes when normalizing directory names.
scene_name = scene_name.trim_suffix("/");
@@ -335,7 +328,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 +421,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()) {
@@ -543,7 +536,7 @@ void EditorNode::_update_from_settings() {
RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(GLOBAL_GET("rendering/environment/volumetric_fog/use_filter")));
RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/2d/shadow_atlas/size"));
- bool use_half_res_gi = GLOBAL_DEF("rendering/global_illumination/gi/use_half_resolution", false);
+ bool use_half_res_gi = GLOBAL_GET("rendering/global_illumination/gi/use_half_resolution");
RS::get_singleton()->gi_set_use_half_resolution(use_half_res_gi);
bool snap_2d_transforms = GLOBAL_GET("rendering/2d/snap/snap_2d_transforms_to_pixel");
@@ -635,7 +628,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 +693,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 +840,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 +859,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 +1266,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 +1633,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 +1694,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 +1800,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 +2400,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 +3098,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 +3118,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 +3363,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 {
@@ -3560,6 +3553,14 @@ bool EditorNode::is_addon_plugin_enabled(const String &p_addon) const {
return addon_name_to_plugin.has("res://addons/" + p_addon + "/plugin.cfg");
}
+void EditorNode::set_movie_maker_enabled(bool p_enabled) {
+ write_movie_button->set_pressed(p_enabled);
+}
+
+bool EditorNode::is_movie_maker_enabled() const {
+ return write_movie_button->is_pressed();
+}
+
void EditorNode::_remove_edited_scene(bool p_change_tab) {
int new_index = editor_data.get_edited_scene();
int old_index = new_index;
@@ -3689,6 +3690,7 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
EditorDebuggerNode::get_singleton()->update_live_edit_root();
ScriptEditor::get_singleton()->set_scene_root_script(editor_data.get_scene_root_script(editor_data.get_edited_scene()));
editor_data.notify_edited_scene_changed();
+ emit_signal(SNAME("scene_changed"));
}
bool EditorNode::is_changing_scene() const {
@@ -4075,7 +4077,7 @@ void EditorNode::_quick_opened() {
List<String> scene_extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
- if (open_scene_dialog || scene_extensions.find(files[i].get_extension())) {
+ if (open_scene_dialog || scene_extensions.find(files[i].get_extension().to_lower())) {
open_request(res_path);
} else {
load_resource(res_path);
@@ -4392,6 +4394,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 +4557,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();
@@ -5111,7 +5134,7 @@ bool EditorNode::has_scenes_in_session() {
bool EditorNode::ensure_main_scene(bool p_from_native) {
pick_main_scene->set_meta("from_native", p_from_native); // Whether from play button or native run.
- String main_scene = GLOBAL_DEF_BASIC("application/run/main_scene", "");
+ String main_scene = GLOBAL_GET("application/run/main_scene");
if (main_scene.is_empty()) {
current_menu_option = -1;
@@ -5178,7 +5201,7 @@ bool EditorNode::is_run_playing() const {
String EditorNode::get_run_playing_scene() const {
String run_filename = editor_run.get_running_scene();
if (run_filename.is_empty() && is_run_playing()) {
- run_filename = GLOBAL_DEF_BASIC("application/run/main_scene", ""); // Must be the main scene then.
+ run_filename = GLOBAL_GET("application/run/main_scene"); // Must be the main scene then.
}
return run_filename;
@@ -5538,7 +5561,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]) {
@@ -5945,12 +5968,14 @@ void EditorNode::_feature_profile_changed() {
TabContainer *import_tabs = cast_to<TabContainer>(ImportDock::get_singleton()->get_parent());
TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
+ TabContainer *history_tabs = cast_to<TabContainer>(history_dock->get_parent());
if (profile.is_valid()) {
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
// The Import dock is useless without the FileSystem dock. Ensure the configuration is valid.
bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK);
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
+ history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_DOCK));
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
@@ -5966,6 +5991,8 @@ void EditorNode::_feature_profile_changed() {
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
+ history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), false);
+ history_dock->set_visible(true);
ImportDock::get_singleton()->set_visible(true);
NodeDock::get_singleton()->set_visible(true);
FileSystemDock::get_singleton()->set_visible(true);
@@ -6011,6 +6038,7 @@ void EditorNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj")));
ADD_SIGNAL(MethodInfo("scene_saved", PropertyInfo(Variant::STRING, "path")));
ADD_SIGNAL(MethodInfo("project_settings_changed"));
+ ADD_SIGNAL(MethodInfo("scene_changed"));
}
static Node *_resource_get_edited_scene() {
@@ -6147,7 +6175,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 +6201,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 +6209,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 +6380,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);
}
@@ -7076,6 +7104,8 @@ EditorNode::EditorNode() {
filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
get_project_settings()->connect_filesystem_dock_signals(filesystem_dock);
+ history_dock = memnew(HistoryDock);
+
// Scene: Top left.
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(SceneTreeDock::get_singleton());
dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(dock_slot[DOCK_SLOT_LEFT_UR]->get_tab_idx_from_control(SceneTreeDock::get_singleton()), TTR("Scene"));
@@ -7096,6 +7126,10 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(NodeDock::get_singleton());
dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(NodeDock::get_singleton()), TTR("Node"));
+ // History: Full height right, behind Node.
+ dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(history_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(history_dock), TTR("History"));
+
// Hide unused dock slots and vsplits.
dock_slot[DOCK_SLOT_LEFT_UL]->hide();
dock_slot[DOCK_SLOT_LEFT_BL]->hide();
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 9452425dc8..f27fe429b9 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -77,6 +77,7 @@ class EditorUndoRedoManager;
class ExportTemplateManager;
class FileDialog;
class FileSystemDock;
+class HistoryDock;
class HSplitContainer;
class ImportDock;
class LinkButton;
@@ -274,6 +275,7 @@ private:
EditorRunNative *run_native = nullptr;
EditorSelection *editor_selection = nullptr;
EditorSettingsDialog *editor_settings_dialog = nullptr;
+ HistoryDock *history_dock = nullptr;
ProjectExportDialog *project_export = nullptr;
ProjectSettingsEditor *project_settings_editor = nullptr;
@@ -770,6 +772,9 @@ public:
void set_addon_plugin_enabled(const String &p_addon, bool p_enabled, bool p_config_changed = false);
bool is_addon_plugin_enabled(const String &p_addon) const;
+ void set_movie_maker_enabled(bool p_enabled);
+ bool is_movie_maker_enabled() const;
+
void edit_node(Node *p_node);
void edit_resource(const Ref<Resource> &p_resource) { InspectorDock::get_singleton()->edit_resource(p_resource); };
@@ -827,6 +832,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..8fca21ae7b 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -289,6 +289,14 @@ bool EditorInterface::is_plugin_enabled(const String &p_plugin) const {
return EditorNode::get_singleton()->is_addon_plugin_enabled(p_plugin);
}
+void EditorInterface::set_movie_maker_enabled(bool p_enabled) {
+ EditorNode::get_singleton()->set_movie_maker_enabled(p_enabled);
+}
+
+bool EditorInterface::is_movie_maker_enabled() const {
+ return EditorNode::get_singleton()->is_movie_maker_enabled();
+}
+
EditorInspector *EditorInterface::get_inspector() const {
return InspectorDock::get_inspector_singleton();
}
@@ -364,6 +372,9 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_plugin_enabled", "plugin", "enabled"), &EditorInterface::set_plugin_enabled);
ClassDB::bind_method(D_METHOD("is_plugin_enabled", "plugin"), &EditorInterface::is_plugin_enabled);
+ ClassDB::bind_method(D_METHOD("set_movie_maker_enabled", "enabled"), &EditorInterface::set_movie_maker_enabled);
+ ClassDB::bind_method(D_METHOD("is_movie_maker_enabled"), &EditorInterface::is_movie_maker_enabled);
+
ClassDB::bind_method(D_METHOD("get_inspector"), &EditorInterface::get_inspector);
ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene);
@@ -571,10 +582,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 +615,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 +629,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 +659,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 +812,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() {
@@ -979,7 +967,7 @@ void EditorPlugin::_bind_methods() {
}
Ref<EditorUndoRedoManager> EditorPlugin::get_undo_redo() {
- return undo_redo;
+ return EditorNode::get_undo_redo();
}
EditorPluginCreateFunc EditorPlugins::creation_funcs[MAX_CREATE_FUNCS];
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 1211bcf53c..753ccedf70 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -32,7 +32,6 @@
#define EDITOR_PLUGIN_H
#include "core/io/config_file.h"
-#include "core/object/undo_redo.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_inspector.h"
#include "editor/editor_translation_parser.h"
@@ -113,6 +112,9 @@ public:
void set_plugin_enabled(const String &p_plugin, bool p_enabled);
bool is_plugin_enabled(const String &p_plugin) const;
+ void set_movie_maker_enabled(bool p_enabled);
+ bool is_movie_maker_enabled() const;
+
EditorInspector *get_inspector() const;
Error save_scene();
@@ -131,7 +133,6 @@ public:
class EditorPlugin : public Node {
GDCLASS(EditorPlugin, Node);
friend class EditorData;
- Ref<EditorUndoRedoManager> undo_redo;
bool input_event_forwarding_always_enabled = false;
bool force_draw_over_forwarding_enabled = false;
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index 9c619066f2..829135b544 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -31,7 +31,6 @@
#ifndef EDITOR_PLUGIN_SETTINGS_H
#define EDITOR_PLUGIN_SETTINGS_H
-#include "core/object/undo_redo.h"
#include "editor/editor_data.h"
#include "editor/plugin_config_dialog.h"
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 899fa69be1..d71976a1af 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1045,7 +1045,6 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
const int vofs = (grid_size.height - h) / 2;
int layer_index = 0;
- int block_index = 0;
Point2 arrow_pos;
@@ -1112,8 +1111,6 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
break;
}
}
-
- ++block_index;
}
if ((expansion_rows != prev_expansion_rows) && expanded) {
@@ -1242,7 +1239,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 +1267,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();
}
@@ -2688,7 +2685,7 @@ void EditorPropertyQuaternion::_custom_value_changed(double val) {
v.y = Math::deg_to_rad(edit_euler.y);
v.z = Math::deg_to_rad(edit_euler.z);
- Quaternion temp_q = Quaternion(v);
+ Quaternion temp_q = Quaternion::from_euler(v);
spin[0]->set_value(temp_q.x);
spin[1]->set_value(temp_q.y);
spin[2]->set_value(temp_q.z);
@@ -2725,7 +2722,7 @@ void EditorPropertyQuaternion::update_property() {
spin[2]->set_value(val.z);
spin[3]->set_value(val.w);
if (!is_grabbing_euler()) {
- Vector3 v = val.normalized().get_euler_yxz();
+ Vector3 v = val.normalized().get_euler();
edit_euler.x = Math::rad_to_deg(v.x);
edit_euler.y = Math::rad_to_deg(v.y);
edit_euler.z = Math::rad_to_deg(v.z);
@@ -3699,7 +3696,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;
}
}
@@ -4096,7 +4094,6 @@ void EditorPropertyResource::update_property() {
sub_inspector->set_keying(is_keying());
sub_inspector->set_read_only(is_read_only());
sub_inspector->set_use_folding(is_using_folding());
- sub_inspector->set_undo_redo(EditorNode::get_undo_redo());
sub_inspector_vbox = memnew(VBoxContainer);
add_child(sub_inspector_vbox);
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index d98ad117d7..659221ee0b 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);
}
}
@@ -466,7 +466,7 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
Variant array = object->get_array();
- // Handle the case where array is not initialised yet.
+ // Handle the case where array is not initialized yet.
if (!array.is_array()) {
Callable::CallError ce;
Variant::construct(array_type, array, nullptr, 0, ce);
@@ -510,7 +510,7 @@ void EditorPropertyArray::_notification(int p_what) {
change_type->add_separator();
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
- if (Object::cast_to<Button>(button_add_item)) {
+ if (button_add_item) {
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
@@ -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();
}
}
@@ -1205,7 +1205,7 @@ void EditorPropertyDictionary::_notification(int p_what) {
change_type->add_separator();
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
- if (Object::cast_to<Button>(button_add_item)) {
+ if (button_add_item) {
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
@@ -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();
}
}
@@ -1431,7 +1431,7 @@ void EditorPropertyLocalizableString::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
- if (Object::cast_to<Button>(button_add_item)) {
+ if (button_add_item) {
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 01816b7205..0b38996b2d 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() {
@@ -573,13 +570,17 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<Strin
for (int i = 0; i < size; i++) {
String base = allowed_types[i].strip_edges();
- p_vector->insert(base);
+ if (!ClassDB::is_virtual(base)) {
+ p_vector->insert(base);
+ }
// If we hit a familiar base type, take all the data from cache.
if (allowed_types_cache.has(base)) {
List<StringName> allowed_subtypes = allowed_types_cache[base];
for (const StringName &subtype_name : allowed_subtypes) {
- p_vector->insert(subtype_name);
+ if (!ClassDB::is_virtual(subtype_name)) {
+ p_vector->insert(subtype_name);
+ }
}
} else {
List<StringName> allowed_subtypes;
@@ -589,13 +590,17 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<Strin
ClassDB::get_inheriters_from_class(base, &inheriters);
}
for (const StringName &subtype_name : inheriters) {
- p_vector->insert(subtype_name);
+ if (!ClassDB::is_virtual(subtype_name)) {
+ p_vector->insert(subtype_name);
+ }
allowed_subtypes.push_back(subtype_name);
}
for (const StringName &subtype_name : global_classes) {
if (EditorNode::get_editor_data().script_class_is_parent(subtype_name, base)) {
- p_vector->insert(subtype_name);
+ if (!ClassDB::is_virtual(subtype_name)) {
+ p_vector->insert(subtype_name);
+ }
allowed_subtypes.push_back(subtype_name);
}
}
@@ -958,6 +963,7 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) {
preview_rect->set_offset(SIDE_TOP, 1);
preview_rect->set_offset(SIDE_BOTTOM, -1);
preview_rect->set_offset(SIDE_RIGHT, -1);
+ preview_rect->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
assign_button->add_child(preview_rect);
}
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..41d5d1b0d2 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -57,8 +57,11 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) {
args.push_back(resource_path.replace(" ", "%20"));
}
- args.push_back("--remote-debug");
- args.push_back(EditorDebuggerNode::get_singleton()->get_server_uri());
+ const String debug_uri = EditorDebuggerNode::get_singleton()->get_server_uri();
+ if (debug_uri.size()) {
+ args.push_back("--remote-debug");
+ args.push_back(debug_uri);
+ }
args.push_back("--editor-pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));
@@ -88,7 +91,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 +117,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 +162,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 +218,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..a4e907b46f 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -159,7 +159,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
if (!sc->has_meta("original")) {
// Getting the meta when it doesn't exist will return an empty array. If the 'shortcut_events' have been cleared,
- // we still want save the shortcut in this case so that shortcuts that the user has customised are not reset,
+ // we still want save the shortcut in this case so that shortcuts that the user has customized are not reset,
// even if the 'original' has not been populated yet. This can happen when calling save() from the Project Manager.
save_array.push_back(dict);
continue;
@@ -415,13 +415,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/code_font_contextual_ligatures", 0, "Default,Disable Contextual Alternates (Coding Ligatures),Use Custom OpenType Feature Set")
_initial_set("interface/editor/code_font_custom_opentype_features", "");
_initial_set("interface/editor/code_font_custom_variations", "");
- EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_antialiasing", 1, "None,Grayscale,LCD sub-pixel")
+ EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_antialiasing", 1, "None,Grayscale,LCD Subpixel")
#ifdef MACOS_ENABLED
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_hinting", 0, "Auto (None),None,Light,Normal")
#else
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_hinting", 0, "Auto (Light),None,Light,Normal")
#endif
- EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_subpixel_positioning", 1, "Disabled,Auto,One half of a pixel,One quarter of a pixel")
+ EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_subpixel_positioning", 1, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
@@ -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_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index db501aac03..a72c545b2f 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -132,6 +132,7 @@ void EditorSettingsDialog::_notification(int p_what) {
} break;
case NOTIFICATION_READY: {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
@@ -158,9 +159,9 @@ void EditorSettingsDialog::_notification(int p_what) {
void EditorSettingsDialog::shortcut_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
const Ref<InputEventKey> k = p_event;
-
if (k.is_valid() && k->is_pressed()) {
bool handled = false;
@@ -229,6 +230,7 @@ void EditorSettingsDialog::_event_config_confirmed() {
void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Array &p_events) {
Array old_input_array = EditorSettings::get_singleton()->get_builtin_action_overrides(p_name);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Edit Built-in Action") + " '" + p_name + "'");
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
@@ -244,6 +246,7 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const Array &p_events) {
Ref<Shortcut> current_sc = EditorSettings::get_singleton()->get_shortcut(p_path);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Edit Shortcut") + " '" + p_path + "'");
undo_redo->add_do_method(current_sc.ptr(), "set_events", p_events);
undo_redo->add_undo_method(current_sc.ptr(), "set_events", current_sc->get_events());
@@ -697,8 +700,6 @@ void EditorSettingsDialog::_bind_methods() {
EditorSettingsDialog::EditorSettingsDialog() {
set_title(TTR("Editor Settings"));
- undo_redo = EditorNode::get_undo_redo();
-
tabs = memnew(TabContainer);
tabs->set_theme_type_variation("TabContainerOdd");
tabs->connect("tab_changed", callable_mp(this, &EditorSettingsDialog::_tabs_tab_changed));
@@ -723,7 +724,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
inspector->get_inspector()->set_use_filter(true);
inspector->register_search_box(search_box);
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- inspector->get_inspector()->set_undo_redo(undo_redo);
tab_general->add_child(inspector);
inspector->get_inspector()->connect("property_edited", callable_mp(this, &EditorSettingsDialog::_settings_property_edited));
inspector->get_inspector()->connect("restart_requested", callable_mp(this, &EditorSettingsDialog::_editor_restart_request));
diff --git a/editor/editor_settings_dialog.h b/editor/editor_settings_dialog.h
index 05424a64ed..a330de1e2c 100644
--- a/editor/editor_settings_dialog.h
+++ b/editor/editor_settings_dialog.h
@@ -40,8 +40,6 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
-class EditorUndoRedoManager;
-
class EditorSettingsDialog : public AcceptDialog {
GDCLASS(EditorSettingsDialog, AcceptDialog);
@@ -75,8 +73,6 @@ class EditorSettingsDialog : public AcceptDialog {
Timer *timer = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
-
virtual void cancel_pressed() override;
virtual void ok_pressed() override;
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/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp
index 064448fd96..09b567fc68 100644
--- a/editor/editor_undo_redo_manager.cpp
+++ b/editor/editor_undo_redo_manager.cpp
@@ -241,6 +241,7 @@ void EditorUndoRedoManager::commit_action(bool p_execute) {
history.undo_stack.push_back(pending_action);
pending_action = Action();
is_committing = false;
+ emit_signal(SNAME("history_changed"));
}
bool EditorUndoRedoManager::is_committing_action() const {
@@ -252,14 +253,14 @@ bool EditorUndoRedoManager::undo() {
return false;
}
- History *selected_history = nullptr;
+ int selected_history = INVALID_HISTORY;
double global_timestamp = 0;
// Pick the history with greatest last action timestamp (either global or current scene).
{
History &history = get_or_create_history(GLOBAL_HISTORY);
if (!history.undo_stack.is_empty()) {
- selected_history = &history;
+ selected_history = history.id;
global_timestamp = history.undo_stack.back()->get().timestamp;
}
}
@@ -267,32 +268,44 @@ bool EditorUndoRedoManager::undo() {
{
History &history = get_or_create_history(EditorNode::get_editor_data().get_current_edited_scene_history_id());
if (!history.undo_stack.is_empty() && history.undo_stack.back()->get().timestamp > global_timestamp) {
- selected_history = &history;
+ selected_history = history.id;
}
}
- if (selected_history) {
- Action action = selected_history->undo_stack.back()->get();
- selected_history->undo_stack.pop_back();
- selected_history->redo_stack.push_back(action);
- return selected_history->undo_redo->undo();
+ if (selected_history != INVALID_HISTORY) {
+ return undo_history(selected_history);
}
return false;
}
+bool EditorUndoRedoManager::undo_history(int p_id) {
+ ERR_FAIL_COND_V(p_id == INVALID_HISTORY, false);
+ History &history = get_or_create_history(p_id);
+
+ Action action = history.undo_stack.back()->get();
+ history.undo_stack.pop_back();
+ history.redo_stack.push_back(action);
+
+ bool success = history.undo_redo->undo();
+ if (success) {
+ emit_signal(SNAME("version_changed"));
+ }
+ return success;
+}
+
bool EditorUndoRedoManager::redo() {
if (!has_redo()) {
return false;
}
- History *selected_history = nullptr;
+ int selected_history = INVALID_HISTORY;
double global_timestamp = INFINITY;
// Pick the history with lowest last action timestamp (either global or current scene).
{
History &history = get_or_create_history(GLOBAL_HISTORY);
if (!history.redo_stack.is_empty()) {
- selected_history = &history;
+ selected_history = history.id;
global_timestamp = history.redo_stack.back()->get().timestamp;
}
}
@@ -300,19 +313,31 @@ bool EditorUndoRedoManager::redo() {
{
History &history = get_or_create_history(EditorNode::get_editor_data().get_current_edited_scene_history_id());
if (!history.redo_stack.is_empty() && history.redo_stack.back()->get().timestamp < global_timestamp) {
- selected_history = &history;
+ selected_history = history.id;
}
}
- if (selected_history) {
- Action action = selected_history->redo_stack.back()->get();
- selected_history->redo_stack.pop_back();
- selected_history->undo_stack.push_back(action);
- return selected_history->undo_redo->redo();
+ if (selected_history != INVALID_HISTORY) {
+ return redo_history(selected_history);
}
return false;
}
+bool EditorUndoRedoManager::redo_history(int p_id) {
+ ERR_FAIL_COND_V(p_id == INVALID_HISTORY, false);
+ History &history = get_or_create_history(p_id);
+
+ Action action = history.redo_stack.back()->get();
+ history.redo_stack.pop_back();
+ history.undo_stack.push_back(action);
+
+ bool success = history.undo_redo->redo();
+ if (success) {
+ emit_signal(SNAME("version_changed"));
+ }
+ return success;
+}
+
void EditorUndoRedoManager::set_history_as_saved(int p_id) {
History &history = get_or_create_history(p_id);
history.saved_version = history.undo_redo->get_version();
@@ -352,6 +377,7 @@ void EditorUndoRedoManager::clear_history(bool p_increase_version, int p_idx) {
if (!p_increase_version) {
set_history_as_saved(p_idx);
}
+ emit_signal(SNAME("history_changed"));
return;
}
@@ -359,6 +385,7 @@ void EditorUndoRedoManager::clear_history(bool p_increase_version, int p_idx) {
E.value.undo_redo->clear_history(p_increase_version);
set_history_as_saved(E.key);
}
+ emit_signal(SNAME("history_changed"));
}
String EditorUndoRedoManager::get_current_action_name() {
@@ -434,6 +461,9 @@ void EditorUndoRedoManager::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_object_history_id", "object"), &EditorUndoRedoManager::get_history_id_for_object);
ClassDB::bind_method(D_METHOD("get_history_undo_redo", "id"), &EditorUndoRedoManager::get_history_undo_redo);
+ ADD_SIGNAL(MethodInfo("history_changed"));
+ ADD_SIGNAL(MethodInfo("version_changed"));
+
BIND_ENUM_CONSTANT(GLOBAL_HISTORY);
BIND_ENUM_CONSTANT(INVALID_HISTORY);
}
diff --git a/editor/editor_undo_redo_manager.h b/editor/editor_undo_redo_manager.h
index c4d85daa22..60bcd059df 100644
--- a/editor/editor_undo_redo_manager.h
+++ b/editor/editor_undo_redo_manager.h
@@ -44,7 +44,6 @@ public:
INVALID_HISTORY = -99,
};
-private:
struct Action {
int history_id = INVALID_HISTORY;
double timestamp = 0;
@@ -60,6 +59,7 @@ private:
List<Action> redo_stack;
};
+private:
HashMap<int, History> history_map;
Action pending_action;
@@ -114,7 +114,9 @@ public:
bool is_committing_action() const;
bool undo();
+ bool undo_history(int p_id);
bool redo();
+ bool redo_history(int p_id);
void clear_history(bool p_increase_version = true, int p_idx = INVALID_HISTORY);
void set_history_as_saved(int p_idx);
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_platform_pc.cpp b/editor/export/editor_export_platform_pc.cpp
index c5b61e9b03..9de2f94900 100644
--- a/editor/export/editor_export_platform_pc.cpp
+++ b/editor/export/editor_export_platform_pc.cpp
@@ -146,9 +146,16 @@ Error EditorExportPlatformPC::prepare_template(const Ref<EditorExportPreset> &p_
return ERR_FILE_NOT_FOUND;
}
+ String wrapper_template_path = template_path.get_basename() + "_console.exe";
+ int con_wrapper_mode = p_preset->get("debug/export_console_script");
+ bool copy_wrapper = (con_wrapper_mode == 1 && p_debug) || (con_wrapper_mode == 2);
+
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
da->make_dir_recursive(p_path.get_base_dir());
Error err = da->copy(template_path, p_path, get_chmod_flags());
+ if (err == OK && copy_wrapper && FileAccess::exists(wrapper_template_path)) {
+ err = da->copy(wrapper_template_path, p_path.get_basename() + ".console.exe", get_chmod_flags());
+ }
if (err != OK) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Template"), TTR("Failed to copy export template."));
}
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..62bcf0b193 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;
@@ -1283,42 +1283,71 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
}
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- print_verbose("Duplicating " + old_path + " -> " + new_path);
- Error err = p_item.is_file ? da->copy(old_path, new_path) : da->copy_dir(old_path, new_path);
- if (err == OK) {
- // Move/Rename any corresponding import settings too.
- if (p_item.is_file && FileAccess::exists(old_path + ".import")) {
- err = da->copy(old_path + ".import", new_path + ".import");
+
+ if (p_item.is_file) {
+ print_verbose("Duplicating " + old_path + " -> " + new_path);
+
+ // Create the directory structure.
+ da->make_dir_recursive(new_path.get_base_dir());
+
+ if (FileAccess::exists(old_path + ".import")) {
+ Error err = da->copy(old_path, new_path);
if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ".import\n");
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ": " + error_names[err] + "\n");
+ return;
}
// Remove uid from .import file to avoid conflict.
Ref<ConfigFile> cfg;
cfg.instantiate();
- cfg->load(new_path + ".import");
+ cfg->load(old_path + ".import");
cfg->erase_section_key("remap", "uid");
- cfg->save(new_path + ".import");
- } else if (p_item.is_file && (old_path.get_extension() == "tscn" || old_path.get_extension() == "tres")) {
- // FIXME: Quick hack to fix text resources. This should be fixed properly.
- Ref<FileAccess> file = FileAccess::open(old_path, FileAccess::READ, &err);
- if (err == OK) {
- PackedStringArray lines = file->get_as_utf8_string().split("\n");
- String line = lines[0];
-
- if (line.contains("uid")) {
- line = line.substr(0, line.find(" uid")) + "]";
- lines.write[0] = line;
+ err = cfg->save(new_path + ".import");
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ".import: " + error_names[err] + "\n");
+ return;
+ }
+ } else {
+ // Files which do not use an uid can just be copied.
+ if (ResourceLoader::get_resource_uid(old_path) == ResourceUID::INVALID_ID) {
+ Error err = da->copy(old_path, new_path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ": " + error_names[err] + "\n");
+ }
+ return;
+ }
- Ref<FileAccess> file2 = FileAccess::open(new_path, FileAccess::WRITE, &err);
- if (err == OK) {
- file2->store_string(String("\n").join(lines));
- }
+ // Load the resource and save it again in the new location (this generates a new UID).
+ Error err;
+ Ref<Resource> res = ResourceLoader::load(old_path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
+ if (err == OK && res.is_valid()) {
+ err = ResourceSaver::save(res, new_path, ResourceSaver::FLAG_COMPRESS);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + " " + vformat(TTR("Failed to save resource at %s: %s"), new_path, error_names[err]));
}
+ } else if (err != OK) {
+ // When loading files like text files the error is OK but the resource is still null.
+ // We can ignore such files.
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + " " + vformat(TTR("Failed to load resource at %s: %s"), new_path, error_names[err]));
}
}
} else {
- EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + "\n");
+ // Recursively duplicate all files inside the folder.
+ Ref<DirAccess> old_dir = DirAccess::open(old_path);
+ Ref<FileAccess> file_access = FileAccess::create(FileAccess::ACCESS_RESOURCES);
+ old_dir->set_include_navigational(false);
+ old_dir->list_dir_begin();
+ for (String f = old_dir->_get_next(); !f.is_empty(); f = old_dir->_get_next()) {
+ if (f.get_extension() == "import") {
+ continue;
+ }
+ if (file_access->file_exists(old_path + f)) {
+ _try_duplicate_item(FileOrFolder(old_path + f, true), new_path + f);
+ } else if (da->dir_exists(old_path + f)) {
+ _try_duplicate_item(FileOrFolder(old_path + f, false), new_path + f);
+ }
+ }
+ old_dir->list_dir_end();
}
}
@@ -2500,7 +2529,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..b7605d8e2b 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -422,8 +422,7 @@ void FindInFilesDialog::set_find_in_files_mode(FindInFilesMode p_mode) {
}
String FindInFilesDialog::get_search_text() const {
- String text = _search_text_line_edit->get_text();
- return text.strip_edges();
+ return _search_text_line_edit->get_text();
}
String FindInFilesDialog::get_replace_text() const {
@@ -464,9 +463,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/groups_editor.cpp b/editor/groups_editor.cpp
index f11e328087..ab96caa88c 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -130,6 +130,7 @@ void GroupDialog::_add_pressed() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add to Group"));
while (selected) {
@@ -159,6 +160,7 @@ void GroupDialog::_removed_pressed() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Remove from Group"));
while (selected) {
@@ -246,6 +248,7 @@ void GroupDialog::_group_renamed() {
renamed_group->set_text(0, name); // Spaces trimmed.
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Rename Group"));
List<Node *> nodes;
@@ -322,6 +325,7 @@ void GroupDialog::_modify_group_pressed(Object *p_item, int p_column, int p_id,
case DELETE_GROUP: {
String name = ti->get_text(0);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Delete Group"));
List<Node *> nodes;
@@ -402,10 +406,6 @@ void GroupDialog::_notification(int p_what) {
}
}
-void GroupDialog::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void GroupDialog::edit() {
popup_centered();
@@ -597,6 +597,7 @@ void GroupsEditor::_add_group(const String &p_group) {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add to Group"));
undo_redo->add_do_method(node, "add_to_group", name, true);
@@ -651,6 +652,7 @@ void GroupsEditor::_group_renamed() {
ti->set_text(0, name); // Spaces trimmed.
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Rename Group"));
undo_redo->add_do_method(node, "remove_from_group", selected_group);
@@ -686,6 +688,7 @@ void GroupsEditor::_modify_group(Object *p_item, int p_column, int p_id, MouseBu
switch (p_id) {
case DELETE_GROUP: {
const String name = ti->get_text(0);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Remove from Group"));
undo_redo->add_do_method(node, "remove_from_group", name);
@@ -764,10 +767,6 @@ void GroupsEditor::update_tree() {
}
}
-void GroupsEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void GroupsEditor::set_current(Node *p_node) {
node = p_node;
update_tree();
@@ -775,7 +774,6 @@ void GroupsEditor::set_current(Node *p_node) {
void GroupsEditor::_show_group_dialog() {
group_dialog->edit();
- group_dialog->set_undo_redo(undo_redo);
}
void GroupsEditor::_bind_methods() {
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index 5d012a3501..3900e0e28c 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -39,8 +39,6 @@
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
-class EditorUndoRedoManager;
-
class GroupDialog : public AcceptDialog {
GDCLASS(GroupDialog, AcceptDialog);
@@ -69,8 +67,6 @@ class GroupDialog : public AcceptDialog {
String selected_group;
- Ref<EditorUndoRedoManager> undo_redo;
-
void _group_selected();
void _remove_filter_changed(const String &p_filter);
@@ -102,7 +98,6 @@ public:
};
void edit();
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
GroupDialog();
};
@@ -120,8 +115,6 @@ class GroupsEditor : public VBoxContainer {
Button *add = nullptr;
Tree *tree = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
-
String selected_group;
void update_tree();
@@ -143,7 +136,6 @@ public:
COPY_GROUP,
};
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
void set_current(Node *p_node);
GroupsEditor();
diff --git a/editor/history_dock.cpp b/editor/history_dock.cpp
new file mode 100644
index 0000000000..57088a76cb
--- /dev/null
+++ b/editor/history_dock.cpp
@@ -0,0 +1,251 @@
+/*************************************************************************/
+/* history_dock.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "history_dock.h"
+
+#include "editor/editor_node.h"
+#include "editor/editor_undo_redo_manager.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/item_list.h"
+
+struct SortActionsByTimestamp {
+ bool operator()(const EditorUndoRedoManager::Action &l, const EditorUndoRedoManager::Action &r) const {
+ return l.timestamp > r.timestamp;
+ }
+};
+
+void HistoryDock::on_history_changed() {
+ if (is_visible_in_tree()) {
+ refresh_history();
+ } else {
+ need_refresh = true;
+ }
+}
+
+void HistoryDock::refresh_history() {
+ action_list->clear();
+ bool include_scene = current_scene_checkbox->is_pressed();
+ bool include_global = global_history_checkbox->is_pressed();
+
+ if (!include_scene && !include_global) {
+ action_list->add_item(TTR("The Beginning"));
+ return;
+ }
+
+ const EditorUndoRedoManager::History &current_scene_history = ur_manager->get_or_create_history(EditorNode::get_editor_data().get_current_edited_scene_history_id());
+ const EditorUndoRedoManager::History &global_history = ur_manager->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY);
+
+ Vector<EditorUndoRedoManager::Action> full_history;
+ {
+ int full_size = 0;
+ if (include_scene) {
+ full_size += current_scene_history.redo_stack.size() + current_scene_history.undo_stack.size();
+ }
+ if (include_global) {
+ full_size += global_history.redo_stack.size() + global_history.undo_stack.size();
+ }
+ full_history.resize(full_size);
+ }
+
+ int i = 0;
+ if (include_scene) {
+ for (const EditorUndoRedoManager::Action &E : current_scene_history.redo_stack) {
+ full_history.write[i] = E;
+ i++;
+ }
+ for (const EditorUndoRedoManager::Action &E : current_scene_history.undo_stack) {
+ full_history.write[i] = E;
+ i++;
+ }
+ }
+ if (include_global) {
+ for (const EditorUndoRedoManager::Action &E : global_history.redo_stack) {
+ full_history.write[i] = E;
+ i++;
+ }
+ for (const EditorUndoRedoManager::Action &E : global_history.undo_stack) {
+ full_history.write[i] = E;
+ i++;
+ }
+ }
+
+ full_history.sort_custom<SortActionsByTimestamp>();
+ for (const EditorUndoRedoManager::Action &E : full_history) {
+ action_list->add_item(E.action_name);
+ if (E.history_id == EditorUndoRedoManager::GLOBAL_HISTORY) {
+ action_list->set_item_custom_fg_color(-1, get_theme_color(SNAME("accent_color"), SNAME("Editor")));
+ }
+ }
+
+ action_list->add_item(TTR("The Beginning"));
+ refresh_version();
+}
+
+void HistoryDock::on_version_changed() {
+ if (is_visible_in_tree()) {
+ refresh_version();
+ } else {
+ need_refresh = true;
+ }
+}
+
+void HistoryDock::refresh_version() {
+ int idx = 0;
+ bool include_scene = current_scene_checkbox->is_pressed();
+ bool include_global = global_history_checkbox->is_pressed();
+
+ if (!include_scene && !include_global) {
+ current_version = idx;
+ action_list->set_current(idx);
+ return;
+ }
+
+ const EditorUndoRedoManager::History &current_scene_history = ur_manager->get_or_create_history(EditorNode::get_editor_data().get_current_edited_scene_history_id());
+ const EditorUndoRedoManager::History &global_history = ur_manager->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY);
+ double newest_undo_timestamp = 0;
+
+ if (include_scene && !current_scene_history.undo_stack.is_empty()) {
+ newest_undo_timestamp = current_scene_history.undo_stack.front()->get().timestamp;
+ }
+
+ if (include_global && !global_history.undo_stack.is_empty()) {
+ double global_undo_timestamp = global_history.undo_stack.front()->get().timestamp;
+ if (global_undo_timestamp > newest_undo_timestamp) {
+ newest_undo_timestamp = global_undo_timestamp;
+ }
+ }
+
+ if (include_scene) {
+ int skip = 0;
+ for (const EditorUndoRedoManager::Action &E : current_scene_history.redo_stack) {
+ if (E.timestamp < newest_undo_timestamp) {
+ skip++;
+ } else {
+ break;
+ }
+ }
+ idx += current_scene_history.redo_stack.size() - skip;
+ }
+
+ if (include_global) {
+ int skip = 0;
+ for (const EditorUndoRedoManager::Action &E : global_history.redo_stack) {
+ if (E.timestamp < newest_undo_timestamp) {
+ skip++;
+ } else {
+ break;
+ }
+ }
+ idx += global_history.redo_stack.size() - skip;
+ }
+
+ current_version = idx;
+ action_list->set_current(idx);
+}
+
+void HistoryDock::seek_history(int p_index) {
+ bool include_scene = current_scene_checkbox->is_pressed();
+ bool include_global = global_history_checkbox->is_pressed();
+
+ if (!include_scene && !include_global) {
+ return;
+ }
+ int current_scene_id = EditorNode::get_editor_data().get_current_edited_scene_history_id();
+
+ while (current_version < p_index) {
+ if (include_scene) {
+ if (include_global) {
+ ur_manager->undo();
+ } else {
+ ur_manager->undo_history(current_scene_id);
+ }
+ } else {
+ ur_manager->undo_history(EditorUndoRedoManager::GLOBAL_HISTORY);
+ }
+ }
+
+ while (current_version > p_index) {
+ if (include_scene) {
+ if (include_global) {
+ ur_manager->redo();
+ } else {
+ ur_manager->redo_history(current_scene_id);
+ }
+ } else {
+ ur_manager->redo_history(EditorUndoRedoManager::GLOBAL_HISTORY);
+ }
+ }
+}
+
+void HistoryDock::_notification(int p_notification) {
+ switch (p_notification) {
+ case NOTIFICATION_ENTER_TREE: {
+ EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &HistoryDock::on_history_changed));
+ } break;
+
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (is_visible_in_tree() && need_refresh) {
+ refresh_history();
+ }
+ } break;
+ }
+}
+
+HistoryDock::HistoryDock() {
+ ur_manager = EditorNode::get_undo_redo();
+ ur_manager->connect("history_changed", callable_mp(this, &HistoryDock::on_history_changed));
+ ur_manager->connect("version_changed", callable_mp(this, &HistoryDock::on_version_changed));
+
+ HBoxContainer *mode_hb = memnew(HBoxContainer);
+ add_child(mode_hb);
+
+ current_scene_checkbox = memnew(CheckBox);
+ mode_hb->add_child(current_scene_checkbox);
+ current_scene_checkbox->set_flat(true);
+ current_scene_checkbox->set_pressed(true);
+ current_scene_checkbox->set_text(TTR("Scene"));
+ current_scene_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ current_scene_checkbox->set_clip_text(true);
+ current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
+
+ global_history_checkbox = memnew(CheckBox);
+ mode_hb->add_child(global_history_checkbox);
+ global_history_checkbox->set_flat(true);
+ global_history_checkbox->set_pressed(true);
+ global_history_checkbox->set_text(TTR("Global"));
+ global_history_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ global_history_checkbox->set_clip_text(true);
+ global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
+
+ action_list = memnew(ItemList);
+ add_child(action_list);
+ action_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ action_list->connect("item_selected", callable_mp(this, &HistoryDock::seek_history));
+}
diff --git a/editor/history_dock.h b/editor/history_dock.h
new file mode 100644
index 0000000000..9dda8165e6
--- /dev/null
+++ b/editor/history_dock.h
@@ -0,0 +1,66 @@
+/*************************************************************************/
+/* history_dock.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef HISTORY_DOCK_H
+#define HISTORY_DOCK_H
+
+#include "scene/gui/box_container.h"
+
+class CheckBox;
+class ItemList;
+class EditorUndoRedoManager;
+
+class HistoryDock : public VBoxContainer {
+ GDCLASS(HistoryDock, VBoxContainer);
+
+ Ref<EditorUndoRedoManager> ur_manager;
+ ItemList *action_list = nullptr;
+
+ CheckBox *current_scene_checkbox = nullptr;
+ CheckBox *global_history_checkbox = nullptr;
+
+ bool need_refresh = true;
+ int current_version = 0;
+
+ void on_history_changed();
+ void refresh_history();
+ void on_version_changed();
+ void refresh_version();
+
+protected:
+ void _notification(int p_notification);
+
+public:
+ void seek_history(int p_index);
+
+ HistoryDock();
+};
+
+#endif // HISTORY_DOCK_H
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index 7cf35c519b..c54b10842f 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -848,6 +848,8 @@ void Collada::_parse_curve_geometry(XMLParser &parser, String p_id, String p_nam
CurveData &curvedata = state.curve_data_map[p_id];
curvedata.name = p_name;
+ String closed = parser.get_attribute_value_safe("closed").to_lower();
+ curvedata.closed = closed == "true" || closed == "1";
COLLADA_PRINT("curve name: " + p_name);
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp
index 5585c8edd2..f61ff5182d 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -492,9 +492,9 @@ void DynamicFontImportSettings::_variation_add() {
TreeItem *vars_item = vars_list->create_item(vars_list_root);
ERR_FAIL_NULL(vars_item);
- vars_item->set_text(0, TTR("New configuration"));
+ vars_item->set_text(0, TTR("New Configuration"));
vars_item->set_editable(0, true);
- vars_item->add_button(1, vars_list->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_VAR, false, TTR("Remove Variation"));
+ vars_item->add_button(1, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_VAR, false, TTR("Remove Variation"));
vars_item->set_button_color(1, 0, Color(1, 1, 1, 0.75));
Ref<DynamicFontImportSettingsData> import_variation_data;
@@ -582,10 +582,10 @@ void DynamicFontImportSettings::_variations_validate() {
}
}
if ((TextServer::FontAntialiasing)(int)import_settings_data->get("antialiasing") == TextServer::FONT_ANTIALIASING_LCD) {
- warn += "\n" + TTR("Note: LCD sub-pixel anti-aliasing is selected, each of the glyphs will be pre-rendered for all supported sub-pixel layouts (5x).");
+ warn += "\n" + TTR("Note: LCD Subpixel antialiasing is selected, each of the glyphs will be pre-rendered for all supported subpixel layouts (5x).");
}
if ((TextServer::SubpixelPositioning)(int)import_settings_data->get("subpixel_positioning") != TextServer::SUBPIXEL_POSITIONING_DISABLED) {
- warn += "\n" + TTR("Note: Sub-pixel positioning is selected, each of the glyphs might be pre-rendered for multiple sub-pixel offsets (up to 4x).");
+ warn += "\n" + TTR("Note: Subpixel positioning is selected, each of the glyphs might be pre-rendered for multiple subpixel offsets (up to 4x).");
}
if (warn.is_empty()) {
label_warn->set_text("");
@@ -885,7 +885,7 @@ void DynamicFontImportSettings::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
- add_var->set_icon(add_var->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
+ add_var->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
} break;
}
}
@@ -1044,7 +1044,7 @@ void DynamicFontImportSettings::open_settings(const String &p_path) {
vars_item->set_text(0, cfg_name);
vars_item->set_editable(0, true);
- vars_item->add_button(1, vars_list->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_VAR, false, TTR("Remove Variation"));
+ vars_item->add_button(1, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_VAR, false, TTR("Remove Variation"));
vars_item->set_button_color(1, 0, Color(1, 1, 1, 0.75));
Ref<DynamicFontImportSettingsData> import_variation_data_custom;
@@ -1122,14 +1122,14 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::NIL, "Rendering", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP), Variant()));
- options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD sub-pixel"), 1));
+ options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD Subpixel"), 1));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_RANGE, "1,250,1"), 48));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "force_autohinter"), false));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), 1));
- options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One half of a pixel,One quarter of a pixel"), 1));
+ options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), 1));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), 0.0));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::NIL, "Metadata Overrides", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP), Variant()));
@@ -1219,7 +1219,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
// Page 2 layout: Configurations
VBoxContainer *page2_vb = memnew(VBoxContainer);
- page2_vb->set_name(TTR("Pre-render configurations"));
+ page2_vb->set_name(TTR("Pre-render Configurations"));
main_pages->add_child(page2_vb);
page2_description = memnew(Label);
@@ -1248,7 +1248,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
add_var = memnew(Button);
page2_hb_vars->add_child(add_var);
add_var->set_tooltip_text(TTR("Add configuration"));
- add_var->set_icon(add_var->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
+ add_var->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
add_var->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_variation_add));
vars_list = memnew(Tree);
@@ -1314,12 +1314,12 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
Button *btn_fill = memnew(Button);
text_hb->add_child(btn_fill);
- btn_fill->set_text(TTR("Shape text and add glyphs"));
+ btn_fill->set_text(TTR("Shape Text and Add Glyphs"));
btn_fill->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_glyph_text_selected));
Button *btn_clear = memnew(Button);
text_hb->add_child(btn_clear);
- btn_clear->set_text(TTR("Clear glyph list"));
+ btn_clear->set_text(TTR("Clear Glyph List"));
btn_clear->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_glyph_clear));
// Page 2.2 layout: Character map
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 8d44329022..6890a46193 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1090,6 +1090,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
c->set_point_tilt(i, tilts->array[i]);
}
}
+ if (cd.closed && pc > 1) {
+ Vector3 pos = c->get_point_position(0);
+ Vector3 in = c->get_point_in(0);
+ Vector3 out = c->get_point_out(0);
+ c->add_point(pos, in, out, -1);
+ }
curve_cache[ng->source] = c;
path->set_curve(c);
diff --git a/editor/import/resource_importer_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp
index c822cd0fec..a6ae832479 100644
--- a/editor/import/resource_importer_dynamic_font.cpp
+++ b/editor/import/resource_importer_dynamic_font.cpp
@@ -76,6 +76,9 @@ bool ResourceImporterDynamicFont::get_option_visibility(const String &p_path, co
if (p_option == "msdf_size" && !bool(p_options["multichannel_signed_distance_field"])) {
return false;
}
+ if (p_option == "antialiasing" && bool(p_options["multichannel_signed_distance_field"])) {
+ return false;
+ }
if (p_option == "oversampling" && bool(p_options["multichannel_signed_distance_field"])) {
return false;
}
@@ -105,7 +108,7 @@ void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<
r_options->push_back(ImportOption(PropertyInfo(Variant::NIL, "Rendering", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP), Variant()));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD sub-pixel"), 1));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD Subpixel"), 1));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), (msdf) ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8));
@@ -113,7 +116,7 @@ void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force_autohinter"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), 1));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One half of a pixel,One quarter of a pixel"), 1));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), 1));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), 0.0));
r_options->push_back(ImportOption(PropertyInfo(Variant::NIL, "Fallbacks", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP), Variant()));
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index e1df78e741..9adabfb5d1 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));
@@ -368,7 +368,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
for (int j = 0; j < hslices; j++) {
int x = slice_w * j;
int y = slice_h * i;
- Ref<Image> slice = image->get_rect(Rect2i(x, y, slice_w, slice_h));
+ Ref<Image> slice = image->get_region(Rect2i(x, y, slice_w, slice_h));
ERR_CONTINUE(slice.is_null() || slice->is_empty());
if (slice->get_width() != slice_w || slice->get_height() != slice_h) {
slice->resize(slice_w, slice_h);
@@ -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..a6a0eef11b 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1276,14 +1276,12 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
} break;
}
- int idx = 0;
for (const Ref<Shape3D> &E : shapes) {
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E);
base->add_child(cshape, true);
cshape->set_owner(base->get_owner());
- idx++;
}
}
}
@@ -1373,7 +1371,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_scene.h b/editor/import/resource_importer_scene.h
index 498e9f2964..5f64330453 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -474,7 +474,7 @@ Transform3D ResourceImporterScene::get_collision_shapes_transform(const M &p_opt
}
if (p_options.has(SNAME("primitive/rotation"))) {
- transform.basis.set_euler((p_options[SNAME("primitive/rotation")].operator Vector3() / 180.0) * Math_PI);
+ transform.basis = Basis::from_euler(p_options[SNAME("primitive/rotation")].operator Vector3() * (Math_PI / 180.0));
}
}
return transform;
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..bd2eb5fd9e 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/script_editor_plugin.h"
InspectorDock *InspectorDock::singleton = nullptr;
@@ -227,7 +228,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 +241,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);
}
@@ -769,7 +770,6 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) {
inspector->set_property_name_style(EditorPropertyNameProcessor::get_default_inspector_style());
inspector->set_use_folding(!bool(EDITOR_GET("interface/inspector/disable_folding")));
inspector->register_text_enter(search);
- inspector->set_undo_redo(editor_data->get_undo_redo());
inspector->set_use_filter(true); // TODO: check me
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index 683481ecc1..4b8257969c 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.
@@ -81,9 +81,10 @@ void LocalizationEditor::_translation_add(const PackedStringArray &p_paths) {
}
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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,15 +106,16 @@ 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());
translations.remove_at(idx);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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 +132,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;
}
@@ -141,6 +143,7 @@ void LocalizationEditor::_translation_res_add(const PackedStringArray &p_paths)
}
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(vformat(TTR("Translation Resource Remap: Add %d Path(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", prev);
@@ -158,7 +161,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);
@@ -172,9 +175,10 @@ void LocalizationEditor::_translation_res_option_add(const PackedStringArray &p_
}
remaps[key] = r;
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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 +220,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);
@@ -234,9 +238,11 @@ void LocalizationEditor::_translation_res_option_changed() {
remaps[key] = r;
updating_translations = true;
+
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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 +264,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);
@@ -267,9 +273,10 @@ void LocalizationEditor::_translation_res_delete(Object *p_item, int p_column, i
remaps.erase(key);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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 +297,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);
@@ -306,9 +313,10 @@ void LocalizationEditor::_translation_res_option_delete(Object *p_item, int p_co
r.remove_at(idx);
remaps[key] = r;
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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,16 +325,17 @@ 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]);
}
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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,15 +353,16 @@ 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());
pot_translations.remove_at(idx);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
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 +402,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 +452,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 +491,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 +517,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 +578,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);
@@ -592,7 +602,6 @@ void LocalizationEditor::_bind_methods() {
}
LocalizationEditor::LocalizationEditor() {
- undo_redo = EditorNode::get_undo_redo();
localization_changed = "localization_changed";
TabContainer *translations = memnew(TabContainer);
diff --git a/editor/localization_editor.h b/editor/localization_editor.h
index ecac171fe3..5fa6d9519a 100644
--- a/editor/localization_editor.h
+++ b/editor/localization_editor.h
@@ -31,7 +31,6 @@
#ifndef LOCALIZATION_EDITOR_H
#define LOCALIZATION_EDITOR_H
-#include "core/object/undo_redo.h"
#include "editor/editor_locale_dialog.h"
#include "scene/gui/tree.h"
@@ -56,7 +55,6 @@ class LocalizationEditor : public VBoxContainer {
EditorFileDialog *pot_file_open_dialog = nullptr;
EditorFileDialog *pot_generate_dialog = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
bool updating_translations = false;
String localization_changed;
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 55fa2f22dd..266b265819 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -117,13 +117,11 @@ NodeDock::NodeDock() {
groups_button->connect("pressed", callable_mp(this, &NodeDock::show_groups));
connections = memnew(ConnectionsDock);
- connections->set_undo_redo(EditorNode::get_undo_redo());
add_child(connections);
connections->set_v_size_flags(SIZE_EXPAND_FILL);
connections->hide();
groups = memnew(GroupsEditor);
- groups->set_undo_redo(EditorNode::get_undo_redo());
add_child(groups);
groups->set_v_size_flags(SIZE_EXPAND_FILL);
groups->hide();
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index cb07d8cf01..ecb4837695 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -91,6 +91,7 @@ void AbstractPolygon2DEditor::_set_polygon(int p_idx, const Variant &p_polygon)
void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
Node2D *node = _get_node();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(node, "set_polygon", p_polygon);
undo_redo->add_undo_method(node, "set_polygon", p_previous);
}
@@ -100,6 +101,7 @@ Vector2 AbstractPolygon2DEditor::_get_offset(int p_idx) const {
}
void AbstractPolygon2DEditor::_commit_action() {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
undo_redo->commit_action();
@@ -203,6 +205,7 @@ void AbstractPolygon2DEditor::_wip_close() {
if (_is_line()) {
_set_polygon(0, wip);
} else if (wip.size() >= (_is_line() ? 2 : 3)) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Create Polygon"));
_action_add_polygon(wip);
if (_has_uv()) {
@@ -254,6 +257,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return false;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
Ref<InputEventMouseButton> mb = p_event;
if (!_has_resource()) {
@@ -611,6 +615,7 @@ void AbstractPolygon2DEditor::_bind_methods() {
}
void AbstractPolygon2DEditor::remove_point(const Vertex &p_vertex) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
Vector<Vector2> vertices = _get_polygon(p_vertex.polygon);
if (vertices.size() > (_is_line() ? 2 : 3)) {
@@ -706,8 +711,6 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c
}
AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) {
- undo_redo = EditorNode::get_undo_redo();
-
edited_point = PosVertex();
wip_destructive = p_wip_destructive;
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
index 1fbbe67c8d..8a3db9d837 100644
--- a/editor/plugins/abstract_polygon_2d_editor.h
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -36,7 +36,6 @@
#include "scene/gui/box_container.h"
class CanvasItemEditor;
-class EditorUndoRedoManager;
class AbstractPolygon2DEditor : public HBoxContainer {
GDCLASS(AbstractPolygon2DEditor, HBoxContainer);
@@ -100,8 +99,6 @@ protected:
int mode = MODE_EDIT;
- Ref<EditorUndoRedoManager> undo_redo;
-
virtual void _menu_option(int p_option);
void _wip_changed();
void _wip_close();
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..6d00e77a4b 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -153,7 +153,8 @@ void AnimationNodeBlendTreeEditor::update_graph() {
node->add_child(name);
node->set_slot(0, false, 0, Color(), true, read_only ? -1 : 0, get_theme_color(SNAME("font_color"), SNAME("Label")));
name->connect("text_submitted", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed).bind(agnode), CONNECT_DEFERRED);
- name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out).bind(name, agnode), CONNECT_DEFERRED);
+ name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out).bind(agnode), CONNECT_DEFERRED);
+ name->connect("text_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed), CONNECT_DEFERRED);
base = 1;
node->set_show_close_button(true);
node->connect("close_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_request).bind(E), CONNECT_DEFERRED);
@@ -273,9 +274,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 +284,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 +798,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() {
@@ -991,13 +994,18 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
}
update_graph(); // Needed to update the signal connections with the new name.
+ current_node_rename_text = String();
}
-void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) {
- if (le == nullptr) {
+void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Ref<AnimationNode> p_node) {
+ if (current_node_rename_text.is_empty()) {
return; // The text_submitted signal triggered the graph update and freed the LineEdit.
}
- _node_renamed(le->call("get_text"), p_node);
+ _node_renamed(current_node_rename_text, p_node);
+}
+
+void AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed(const String &p_text) {
+ current_node_rename_text = p_text;
}
bool AnimationNodeBlendTreeEditor::can_edit(const Ref<AnimationNode> &p_node) {
@@ -1048,9 +1056,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_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index 46e0d18c69..b55fc3b617 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -92,9 +92,11 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
void _node_dragged(const Vector2 &p_from, const Vector2 &p_to, const StringName &p_which);
void _node_renamed(const String &p_text, Ref<AnimationNode> p_node);
- void _node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node);
+ void _node_renamed_focus_out(Ref<AnimationNode> p_node);
+ void _node_rename_lineedit_changed(const String &p_text);
void _node_changed(const StringName &p_node_name);
+ String current_node_rename_text;
bool updating;
void _connection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index b4737976d8..1ebe81c4b0 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -39,6 +39,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
#include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning.
#include "editor/scene_tree_dock.h"
@@ -167,6 +168,7 @@ void AnimationPlayerEditor::_autoplay_pressed() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
String current = animation->get_item_text(animation->get_selected());
if (player->get_autoplay() == current) {
//unset
@@ -383,6 +385,7 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
if (current.contains("/")) {
current = current.get_slice("/", 1);
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Remove Animation"));
if (player->get_autoplay() == current) {
undo_redo->add_do_method(player, "set_autoplay", "");
@@ -458,6 +461,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (name_dialog_op) {
case TOOL_RENAME_ANIM: {
String current = animation->get_item_text(animation->get_selected());
@@ -592,6 +596,7 @@ void AnimationPlayerEditor::_blend_editor_next_changed(const int p_idx) {
String current = animation->get_item_text(animation->get_selected());
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Blend Next Changed"));
undo_redo->add_do_method(player, "animation_set_next", current, blend_editor.next->get_item_text(p_idx));
undo_redo->add_undo_method(player, "animation_set_next", current, player->animation_get_next(current));
@@ -678,6 +683,7 @@ void AnimationPlayerEditor::_blend_edited() {
float blend_time = selected->get_range(1);
float prev_blend_time = player->get_blend_time(current, to);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Change Blend Time"));
undo_redo->add_do_method(player, "set_blend_time", current, to, blend_time);
undo_redo->add_undo_method(player, "set_blend_time", current, to, prev_blend_time);
@@ -984,10 +990,6 @@ void AnimationPlayerEditor::_update_name_dialog_library_dropdown() {
}
}
-void AnimationPlayerEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
if (player && pin->is_pressed()) {
return; // Ignore, pinned.
@@ -1894,7 +1896,6 @@ void AnimationPlayerEditorPlugin::_update_keying() {
}
void AnimationPlayerEditorPlugin::edit(Object *p_object) {
- anim_editor->set_undo_redo(get_undo_redo());
if (!p_object) {
return;
}
@@ -1915,7 +1916,6 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin() {
anim_editor = memnew(AnimationPlayerEditor(this));
- anim_editor->set_undo_redo(EditorNode::get_undo_redo());
EditorNode::get_singleton()->add_bottom_panel_item(TTR("Animation"), anim_editor);
}
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index ae570e53f3..6370b00ea8 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -41,7 +41,6 @@
#include "scene/gui/texture_button.h"
#include "scene/gui/tree.h"
-class EditorUndoRedoManager;
class AnimationPlayerEditorPlugin;
class AnimationPlayerEditor : public VBoxContainer {
@@ -101,7 +100,6 @@ class AnimationPlayerEditor : public VBoxContainer {
LineEdit *name = nullptr;
OptionButton *library = nullptr;
Label *name_title = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
Ref<Texture2D> autoplay_icon;
Ref<Texture2D> reset_icon;
@@ -237,7 +235,6 @@ public:
void ensure_visibility();
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
void edit(AnimationPlayer *p_player);
void forward_force_draw_over_viewport(Control *p_overlay);
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..baf335f5b4 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);
}
@@ -860,6 +868,7 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(action_name);
for (CanvasItem *ci : modified_canvas_items) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
@@ -919,13 +928,12 @@ void CanvasItemEditor::_add_node_pressed(int p_result) {
[[fallthrough]];
}
case ADD_MOVE: {
- if (p_result == ADD_MOVE) {
- nodes_to_move = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
- }
+ nodes_to_move = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
if (nodes_to_move.is_empty()) {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Move Node(s) to Position"));
for (Node *node : nodes_to_move) {
CanvasItem *ci = Object::cast_to<CanvasItem>(node);
@@ -1014,6 +1022,7 @@ void CanvasItemEditor::_on_grid_menu_id_pressed(int p_id) {
}
bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_event) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
Ref<InputEventMouseButton> b = p_event;
Ref<InputEventMouseMotion> m = p_event;
@@ -1720,22 +1729,16 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
drag_to = transform.affine_inverse().xform(m->get_position());
- Transform2D xform = ci->get_global_transform_with_canvas().affine_inverse();
+ Transform2D xform = ci->get_global_transform_with_canvas();
Point2 drag_to_snapped_begin;
Point2 drag_to_snapped_end;
- // last call decides which snapping lines are drawn
- if (drag_type == DRAG_LEFT || drag_type == DRAG_TOP || drag_type == DRAG_TOP_LEFT) {
- drag_to_snapped_end = snap_point(xform.affine_inverse().xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
- drag_to_snapped_begin = snap_point(xform.affine_inverse().xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
- } else {
- drag_to_snapped_begin = snap_point(xform.affine_inverse().xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
- drag_to_snapped_end = snap_point(xform.affine_inverse().xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
- }
+ drag_to_snapped_end = snap_point(xform.xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
+ drag_to_snapped_begin = snap_point(xform.xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, ci);
- Point2 drag_begin = xform.xform(drag_to_snapped_begin);
- Point2 drag_end = xform.xform(drag_to_snapped_end);
+ Point2 drag_begin = xform.affine_inverse().xform(drag_to_snapped_begin);
+ Point2 drag_end = xform.affine_inverse().xform(drag_to_snapped_end);
// Horizontal resize
if (drag_type == DRAG_LEFT || drag_type == DRAG_TOP_LEFT || drag_type == DRAG_BOTTOM_LEFT) {
@@ -2057,12 +2060,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
}
- int index = 0;
for (CanvasItem *ci : drag_selection) {
Transform2D xform = ci->get_global_transform_with_canvas().affine_inverse() * ci->get_transform();
-
ci->_edit_set_position(ci->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
- index++;
}
return true;
}
@@ -2180,12 +2180,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
new_pos = previous_pos + (drag_to - drag_from);
}
- int index = 0;
for (CanvasItem *ci : drag_selection) {
Transform2D xform = ci->get_global_transform_with_canvas().affine_inverse() * ci->get_transform();
-
ci->_edit_set_position(ci->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
- index++;
}
}
return true;
@@ -2534,7 +2531,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 +2719,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 +2768,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 +2886,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 +3562,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 +3868,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) {
@@ -3992,10 +3989,6 @@ void CanvasItemEditor::_selection_changed() {
selected_from_canvas = false;
}
-void CanvasItemEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
Array selection = editor_selection->get_selected_nodes();
if (selection.size() != 1 || Object::cast_to<Node>(selection[0]) != p_canvas_item) {
@@ -4019,7 +4012,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 +4029,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;
@@ -4270,6 +4263,7 @@ void CanvasItemEditor::_update_override_camera_button(bool p_game_running) {
}
void CanvasItemEditor::_popup_callback(int p_op) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
last_option = MenuOption(p_op);
switch (p_op) {
case SHOW_ORIGIN: {
@@ -4975,7 +4969,6 @@ CanvasItemEditor::CanvasItemEditor() {
snap_target[0] = SNAP_TARGET_NONE;
snap_target[1] = SNAP_TARGET_NONE;
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
editor_selection = EditorNode::get_singleton()->get_editor_selection();
editor_selection->add_editor_plugin(this);
editor_selection->connect("selection_changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
@@ -5426,7 +5419,6 @@ CanvasItemEditor::CanvasItemEditor() {
CanvasItemEditor *CanvasItemEditor::singleton = nullptr;
void CanvasItemEditorPlugin::edit(Object *p_object) {
- canvas_item_editor->set_undo_redo(EditorNode::get_undo_redo());
canvas_item_editor->edit(Object::cast_to<CanvasItem>(p_object));
}
@@ -5543,7 +5535,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);
@@ -5573,37 +5565,38 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
String name = path.get_file().get_basename();
child->set_name(Node::adjust_name_casing(name));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
Ref<Texture2D> texture = ResourceCache::get_ref(path);
if (parent) {
- editor_data->get_undo_redo()->add_do_method(parent, "add_child", child, true);
- editor_data->get_undo_redo()->add_do_method(child, "set_owner", EditorNode::get_singleton()->get_edited_scene());
- editor_data->get_undo_redo()->add_do_reference(child);
- editor_data->get_undo_redo()->add_undo_method(parent, "remove_child", child);
+ undo_redo->add_do_method(parent, "add_child", child, true);
+ undo_redo->add_do_method(child, "set_owner", EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_reference(child);
+ undo_redo->add_undo_method(parent, "remove_child", child);
} else { // If no parent is selected, set as root node of the scene.
- editor_data->get_undo_redo()->add_do_method(EditorNode::get_singleton(), "set_edited_scene", child);
- editor_data->get_undo_redo()->add_do_method(child, "set_owner", EditorNode::get_singleton()->get_edited_scene());
- editor_data->get_undo_redo()->add_do_reference(child);
- editor_data->get_undo_redo()->add_undo_method(EditorNode::get_singleton(), "set_edited_scene", (Object *)nullptr);
+ undo_redo->add_do_method(EditorNode::get_singleton(), "set_edited_scene", child);
+ undo_redo->add_do_method(child, "set_owner", EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_reference(child);
+ undo_redo->add_undo_method(EditorNode::get_singleton(), "set_edited_scene", (Object *)nullptr);
}
if (parent) {
String new_name = parent->validate_child_name(child);
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
- editor_data->get_undo_redo()->add_do_method(ed, "live_debug_create_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), child->get_class(), new_name);
- editor_data->get_undo_redo()->add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
+ undo_redo->add_do_method(ed, "live_debug_create_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), child->get_class(), new_name);
+ undo_redo->add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
}
if (Object::cast_to<TouchScreenButton>(child) || Object::cast_to<TextureButton>(child)) {
- editor_data->get_undo_redo()->add_do_property(child, "texture_normal", texture);
+ undo_redo->add_do_property(child, "texture_normal", texture);
} else {
- editor_data->get_undo_redo()->add_do_property(child, "texture", texture);
+ undo_redo->add_do_property(child, "texture", texture);
}
// make visible for certain node type
if (Object::cast_to<Control>(child)) {
Size2 texture_size = texture->get_size();
- editor_data->get_undo_redo()->add_do_property(child, "rect_size", texture_size);
+ undo_redo->add_do_property(child, "rect_size", texture_size);
} else if (Object::cast_to<Polygon2D>(child)) {
Size2 texture_size = texture->get_size();
Vector<Vector2> list = {
@@ -5612,7 +5605,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
Vector2(texture_size.width, texture_size.height),
Vector2(0, texture_size.height)
};
- editor_data->get_undo_redo()->add_do_property(child, "polygon", list);
+ undo_redo->add_do_property(child, "polygon", list);
}
// Compute the global position
@@ -5621,7 +5614,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
// there's nothing to be used as source position so snapping will work as absolute if enabled
target_position = canvas_item_editor->snap_point(target_position);
- editor_data->get_undo_redo()->add_do_method(child, "set_global_position", target_position);
+ undo_redo->add_do_method(child, "set_global_position", target_position);
}
bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, const Point2 &p_point) {
@@ -5646,15 +5639,16 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(path));
- editor_data->get_undo_redo()->add_do_method(parent, "add_child", instantiated_scene, true);
- editor_data->get_undo_redo()->add_do_method(instantiated_scene, "set_owner", edited_scene);
- editor_data->get_undo_redo()->add_do_reference(instantiated_scene);
- editor_data->get_undo_redo()->add_undo_method(parent, "remove_child", instantiated_scene);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->add_do_method(parent, "add_child", instantiated_scene, true);
+ undo_redo->add_do_method(instantiated_scene, "set_owner", edited_scene);
+ undo_redo->add_do_reference(instantiated_scene);
+ undo_redo->add_undo_method(parent, "remove_child", instantiated_scene);
String new_name = parent->validate_child_name(instantiated_scene);
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
- editor_data->get_undo_redo()->add_do_method(ed, "live_debug_instance_node", edited_scene->get_path_to(parent), path, new_name);
- editor_data->get_undo_redo()->add_undo_method(ed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name));
+ undo_redo->add_do_method(ed, "live_debug_instance_node", edited_scene->get_path_to(parent), path, new_name);
+ undo_redo->add_undo_method(ed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name));
CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instantiated_scene);
if (instance_ci) {
@@ -5668,7 +5662,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
// Preserve instance position of the original scene.
target_pos += instance_ci->_edit_get_position();
- editor_data->get_undo_redo()->add_do_method(instantiated_scene, "set_position", target_pos);
+ undo_redo->add_do_method(instantiated_scene, "set_position", target_pos);
}
return true;
@@ -5686,7 +5680,8 @@ void CanvasItemEditorViewport::_perform_drop_data() {
Vector<String> error_files;
- editor_data->get_undo_redo()->create_action(TTR("Create Node"));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(TTR("Create Node"));
for (int i = 0; i < selected_files.size(); i++) {
String path = selected_files[i];
@@ -5717,7 +5712,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
}
}
- editor_data->get_undo_redo()->commit_action();
+ undo_redo->commit_action();
if (error_files.size() > 0) {
String files_str;
@@ -5743,8 +5738,10 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
ResourceLoader::get_recognized_extensions_for_type("Texture2D", &texture_extensions);
for (int i = 0; i < files.size(); i++) {
+ String extension = files[i].get_extension().to_lower();
+
// Check if dragged files with texture or scene extension can be created at least once.
- if (texture_extensions.find(files[i].get_extension()) || scene_extensions.find(files[i].get_extension())) {
+ if (texture_extensions.find(extension) || scene_extensions.find(extension)) {
Ref<Resource> res = ResourceLoader::load(files[i]);
if (res.is_null()) {
continue;
@@ -5908,7 +5905,6 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(CanvasItemEditor *p_canvas_it
texture_node_types.push_back("NinePatchRect");
target_node = nullptr;
- editor_data = SceneTreeDock::get_singleton()->get_editor_data();
canvas_item_editor = p_canvas_item_editor;
preview_node = memnew(Control);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 3ade048e4b..ba193a67b8 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -45,7 +45,6 @@
class EditorData;
class CanvasItemEditorViewport;
class ViewPanner;
-class EditorUndoRedoManager;
class CanvasItemEditorSelectedItem : public Object {
GDCLASS(CanvasItemEditorSelectedItem, Object);
@@ -401,8 +400,6 @@ private:
void _prepare_grid_menu();
void _on_grid_menu_id_pressed(int p_id);
- Ref<EditorUndoRedoManager> undo_redo;
-
List<CanvasItem *> _get_edited_canvas_items(bool retrieve_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
@@ -548,7 +545,6 @@ public:
Tool get_current_tool() { return tool; }
void set_current_tool(Tool p_tool);
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
void edit(CanvasItem *p_canvas_item);
void focus_selection();
@@ -593,7 +589,6 @@ class CanvasItemEditorViewport : public Control {
Node *target_node = nullptr;
Point2 drop_pos;
- EditorData *editor_data = nullptr;
CanvasItemEditor *canvas_item_editor = nullptr;
Control *preview_node = nullptr;
AcceptDialog *accept = nullptr;
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index bb6092755e..1791f7b420 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -810,19 +810,6 @@ void ControlEditorToolbar::_container_flags_selected(int p_flags, bool p_vertica
undo_redo->commit_action();
}
-Vector2 ControlEditorToolbar::_anchor_to_position(const Control *p_control, Vector2 anchor) {
- ERR_FAIL_COND_V(!p_control, Vector2());
-
- Transform2D parent_transform = p_control->get_transform().affine_inverse();
- Rect2 parent_rect = p_control->get_parent_anchorable_rect();
-
- if (p_control->is_layout_rtl()) {
- return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x - parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y));
- } else {
- return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y));
- }
-}
-
Vector2 ControlEditorToolbar::_position_to_anchor(const Control *p_control, Vector2 position) {
ERR_FAIL_COND_V(!p_control, Vector2());
diff --git a/editor/plugins/control_editor_plugin.h b/editor/plugins/control_editor_plugin.h
index 22267cbc04..d78773a509 100644
--- a/editor/plugins/control_editor_plugin.h
+++ b/editor/plugins/control_editor_plugin.h
@@ -222,7 +222,6 @@ class ControlEditorToolbar : public HBoxContainer {
void _anchor_mode_toggled(bool p_status);
void _container_flags_selected(int p_flags, bool p_vertical);
- Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor);
Vector2 _position_to_anchor(const Control *p_control, Vector2 position);
bool _is_node_locked(const Node *p_node);
List<Control *> _get_edited_controls();
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 434e6a92e3..c7bb6b79ef 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
CurveEditor::CurveEditor() {
_selected_point = -1;
@@ -139,14 +140,13 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
if (!mb.is_pressed() && _dragging && mb.get_button_index() == MouseButton::LEFT) {
_dragging = false;
if (_has_undo_data) {
- Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
-
- ur->create_action(_selected_tangent == TANGENT_NONE ? TTR("Modify Curve Point") : TTR("Modify Curve Tangent"));
- ur->add_do_method(*_curve_ref, "_set_data", _curve_ref->get_data());
- ur->add_undo_method(*_curve_ref, "_set_data", _undo_data);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(_selected_tangent == TANGENT_NONE ? TTR("Modify Curve Point") : TTR("Modify Curve Tangent"));
+ undo_redo->add_do_method(*_curve_ref, "_set_data", _curve_ref->get_data());
+ undo_redo->add_undo_method(*_curve_ref, "_set_data", _undo_data);
// Note: this will trigger one more "changed" signal even if nothing changes,
// but it's ok since it would have fired every frame during the drag anyways
- ur->commit_action();
+ undo_redo->commit_action();
_has_undo_data = false;
}
@@ -301,13 +301,11 @@ void CurveEditor::on_preset_item_selected(int preset_id) {
break;
}
- Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
- ur->create_action(TTR("Load Curve Preset"));
-
- ur->add_do_method(&curve, "_set_data", curve.get_data());
- ur->add_undo_method(&curve, "_set_data", previous_data);
-
- ur->commit_action();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(TTR("Load Curve Preset"));
+ undo_redo->add_do_method(&curve, "_set_data", curve.get_data());
+ undo_redo->add_undo_method(&curve, "_set_data", previous_data);
+ undo_redo->commit_action();
}
void CurveEditor::_curve_changed() {
@@ -435,8 +433,8 @@ CurveEditor::TangentIndex CurveEditor::get_tangent_at(Vector2 pos) const {
void CurveEditor::add_point(Vector2 pos) {
ERR_FAIL_COND(_curve_ref.is_null());
- Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
- ur->create_action(TTR("Remove Curve Point"));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(TTR("Remove Curve Point"));
Vector2 point_pos = get_world_pos(pos);
if (point_pos.y < 0.0) {
@@ -449,22 +447,21 @@ void CurveEditor::add_point(Vector2 pos) {
int i = _curve_ref->add_point(point_pos);
_curve_ref->remove_point(i);
- ur->add_do_method(*_curve_ref, "add_point", point_pos);
- ur->add_undo_method(*_curve_ref, "remove_point", i);
-
- ur->commit_action();
+ undo_redo->add_do_method(*_curve_ref, "add_point", point_pos);
+ undo_redo->add_undo_method(*_curve_ref, "remove_point", i);
+ undo_redo->commit_action();
}
void CurveEditor::remove_point(int index) {
ERR_FAIL_COND(_curve_ref.is_null());
- Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
- ur->create_action(TTR("Remove Curve Point"));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(TTR("Remove Curve Point"));
Curve::Point p = _curve_ref->get_point(index);
- ur->add_do_method(*_curve_ref, "remove_point", index);
- ur->add_undo_method(*_curve_ref, "add_point", p.position, p.left_tangent, p.right_tangent, p.left_mode, p.right_mode);
+ undo_redo->add_do_method(*_curve_ref, "remove_point", index);
+ undo_redo->add_undo_method(*_curve_ref, "add_point", p.position, p.left_tangent, p.right_tangent, p.left_mode, p.right_mode);
if (index == _selected_point) {
set_selected_point(-1);
@@ -474,14 +471,14 @@ void CurveEditor::remove_point(int index) {
set_hover_point_index(-1);
}
- ur->commit_action();
+ undo_redo->commit_action();
}
void CurveEditor::toggle_linear(TangentIndex tangent) {
ERR_FAIL_COND(_curve_ref.is_null());
- Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
- ur->create_action(TTR("Toggle Curve Linear Tangent"));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->create_action(TTR("Toggle Curve Linear Tangent"));
if (tangent == TANGENT_NONE) {
tangent = _selected_tangent;
@@ -493,8 +490,8 @@ void CurveEditor::toggle_linear(TangentIndex tangent) {
Curve::TangentMode prev_mode = _curve_ref->get_point_left_mode(_selected_point);
Curve::TangentMode mode = is_linear ? Curve::TANGENT_FREE : Curve::TANGENT_LINEAR;
- ur->add_do_method(*_curve_ref, "set_point_left_mode", _selected_point, mode);
- ur->add_undo_method(*_curve_ref, "set_point_left_mode", _selected_point, prev_mode);
+ undo_redo->add_do_method(*_curve_ref, "set_point_left_mode", _selected_point, mode);
+ undo_redo->add_undo_method(*_curve_ref, "set_point_left_mode", _selected_point, prev_mode);
} else {
bool is_linear = _curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR;
@@ -502,11 +499,11 @@ void CurveEditor::toggle_linear(TangentIndex tangent) {
Curve::TangentMode prev_mode = _curve_ref->get_point_right_mode(_selected_point);
Curve::TangentMode mode = is_linear ? Curve::TANGENT_FREE : Curve::TANGENT_LINEAR;
- ur->add_do_method(*_curve_ref, "set_point_right_mode", _selected_point, mode);
- ur->add_undo_method(*_curve_ref, "set_point_right_mode", _selected_point, prev_mode);
+ undo_redo->add_do_method(*_curve_ref, "set_point_right_mode", _selected_point, mode);
+ undo_redo->add_undo_method(*_curve_ref, "set_point_right_mode", _selected_point, prev_mode);
}
- ur->commit_action();
+ undo_redo->commit_action();
}
void CurveEditor::set_selected_point(int index) {
@@ -755,10 +752,10 @@ void CurveEditor::_draw() {
float width = view_size.x - 60 * EDSCALE;
if (_selected_point > 0 && _selected_point + 1 < curve.get_point_count()) {
text_color.a *= 0.4;
- draw_multiline_string(font, Vector2(50 * EDSCALE, font_height), TTR("Hold Shift to edit tangents individually"), HORIZONTAL_ALIGNMENT_LEFT, width, -1, font_size, text_color);
+ draw_multiline_string(font, Vector2(50 * EDSCALE, font_height), TTR("Hold Shift to edit tangents individually"), HORIZONTAL_ALIGNMENT_LEFT, width, font_size, -1, text_color);
} else if (curve.get_point_count() == 0) {
text_color.a *= 0.4;
- draw_multiline_string(font, Vector2(50 * EDSCALE, font_height), TTR("Right click to add point"), HORIZONTAL_ALIGNMENT_LEFT, width, -1, font_size, text_color);
+ draw_multiline_string(font, Vector2(50 * EDSCALE, font_height), TTR("Right click to add point"), HORIZONTAL_ALIGNMENT_LEFT, width, font_size, -1, text_color);
}
}
@@ -799,7 +796,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..5f9446c3b1 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -93,7 +93,7 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
return Ref<Texture2D>();
}
- img = atlas->get_rect(atex->get_region());
+ img = atlas->get_region(atex->get_region());
} else {
Ref<Texture2D> tex = p_from;
if (tex.is_valid()) {
@@ -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 ba11479714..33992314b0 100644
--- a/editor/plugins/font_config_plugin.cpp
+++ b/editor/plugins/font_config_plugin.cpp
@@ -154,7 +154,7 @@ void EditorPropertyFontMetaOverride::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
- if (Object::cast_to<Button>(button_add)) {
+ if (button_add) {
button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
@@ -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();
}
}
@@ -549,7 +549,7 @@ void EditorPropertyOTFeatures::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
- if (Object::cast_to<Button>(button_add)) {
+ if (button_add) {
button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
@@ -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/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index e1d68d97b5..c5f7d2a047 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -107,7 +107,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
for (const String &E : p_features) {
tags.append(E);
}
- ERR_FAIL_MSG(vformat("Couldn't export extension: %s. No suitable library found for export flags: %s", p_path, String(", ").join(tags)));
+ ERR_FAIL_MSG(vformat("No suitable library found. The libraries' tags referred to an invalid feature flag. Possible feature flags for your platform: %s", p_path, String(", ").join(tags)));
}
List<String> dependencies;
diff --git a/editor/plugins/gradient_editor.cpp b/editor/plugins/gradient_editor.cpp
index 822f303d93..7039ada10a 100644
--- a/editor/plugins/gradient_editor.cpp
+++ b/editor/plugins/gradient_editor.cpp
@@ -99,7 +99,7 @@ void GradientEditor::_gradient_changed() {
void GradientEditor::_ramp_changed() {
editing = true;
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Gradient Edited"), UndoRedo::MERGE_ENDS);
undo_redo->add_do_method(gradient.ptr(), "set_offsets", get_offsets());
undo_redo->add_do_method(gradient.ptr(), "set_colors", get_colors());
diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp
index dc01a52bb3..561dca4fc6 100644
--- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp
+++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp
@@ -121,13 +121,12 @@ void GradientTexture2DEditorRect::_notification(int p_what) {
Size2 rect_size = get_size();
// Get the size and position to draw the texture and handles at.
- size = Size2(texture->get_width() * rect_size.height / texture->get_height(), rect_size.height);
- if (size.width > rect_size.width) {
- size.width = rect_size.width;
- size.height = texture->get_height() * size.width / texture->get_width();
- }
- offset = ((rect_size - size + handle_size) / 2).round();
- size -= handle_size;
+ // Subtract handle sizes so they stay inside the preview, but keep the texture's aspect ratio.
+ Size2 available_size = rect_size - handle_size;
+ Size2 ratio = available_size / texture->get_size();
+ size = MIN(ratio.x, ratio.y) * texture->get_size();
+ offset = ((rect_size - size) / 2).round();
+
checkerboard->set_rect(Rect2(offset, size));
draw_set_transform(offset);
@@ -180,8 +179,9 @@ GradientTexture2DEditorRect::GradientTexture2DEditorRect() {
checkerboard = memnew(TextureRect);
checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE);
+ checkerboard->set_ignore_texture_size(true);
checkerboard->set_draw_behind_parent(true);
- add_child(checkerboard);
+ add_child(checkerboard, false, INTERNAL_MODE_FRONT);
set_custom_minimum_size(Size2(0, 250 * EDSCALE));
}
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index e7ef65c32b..f2c46cc9e8 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "light_occluder_2d_editor_plugin.h"
+#include "editor/editor_node.h"
+#include "editor/editor_undo_redo_manager.h"
+
Ref<OccluderPolygon2D> LightOccluder2DEditor::_ensure_occluder() const {
Ref<OccluderPolygon2D> occluder = node->get_occluder_polygon();
if (!occluder.is_valid()) {
@@ -81,6 +84,7 @@ void LightOccluder2DEditor::_set_polygon(int p_idx, const Variant &p_polygon) co
void LightOccluder2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
Ref<OccluderPolygon2D> occluder = _ensure_occluder();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(occluder.ptr(), "set_polygon", p_polygon);
undo_redo->add_undo_method(occluder.ptr(), "set_polygon", p_previous);
}
@@ -94,6 +98,7 @@ void LightOccluder2DEditor::_create_resource() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Create Occluder Polygon"));
undo_redo->add_do_method(node, "set_occluder_polygon", Ref<OccluderPolygon2D>(memnew(OccluderPolygon2D)));
undo_redo->add_undo_method(node, "set_occluder_polygon", Variant(Ref<RefCounted>()));
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index d73761d770..9182b23867 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "line_2d_editor_plugin.h"
+#include "editor/editor_node.h"
+#include "editor/editor_undo_redo_manager.h"
+
Node2D *Line2DEditor::_get_node() const {
return node;
}
@@ -52,6 +55,7 @@ void Line2DEditor::_set_polygon(int p_idx, const Variant &p_polygon) const {
void Line2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
Node2D *_node = _get_node();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(_node, "set_points", p_polygon);
undo_redo->add_undo_method(_node, "set_points", p_previous);
}
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/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index 8f3553b8cf..664e18f555 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -30,6 +30,9 @@
#include "navigation_polygon_editor_plugin.h"
+#include "editor/editor_node.h"
+#include "editor/editor_undo_redo_manager.h"
+
Ref<NavigationPolygon> NavigationPolygonEditor::_ensure_navpoly() const {
Ref<NavigationPolygon> navpoly = node->get_navigation_polygon();
if (!navpoly.is_valid()) {
@@ -73,6 +76,7 @@ void NavigationPolygonEditor::_set_polygon(int p_idx, const Variant &p_polygon)
void NavigationPolygonEditor::_action_add_polygon(const Variant &p_polygon) {
Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(navpoly.ptr(), "add_outline", p_polygon);
undo_redo->add_undo_method(navpoly.ptr(), "remove_outline", navpoly->get_outline_count());
undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
@@ -81,6 +85,7 @@ void NavigationPolygonEditor::_action_add_polygon(const Variant &p_polygon) {
void NavigationPolygonEditor::_action_remove_polygon(int p_idx) {
Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(navpoly.ptr(), "remove_outline", p_idx);
undo_redo->add_undo_method(navpoly.ptr(), "add_outline_at_index", navpoly->get_outline(p_idx), p_idx);
undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
@@ -89,6 +94,7 @@ void NavigationPolygonEditor::_action_remove_polygon(int p_idx) {
void NavigationPolygonEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(navpoly.ptr(), "set_outline", p_idx, p_polygon);
undo_redo->add_undo_method(navpoly.ptr(), "set_outline", p_idx, p_previous);
undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
@@ -104,6 +110,7 @@ void NavigationPolygonEditor::_create_resource() {
return;
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Create Navigation Polygon"));
undo_redo->add_do_method(node, "set_navigation_polygon", Ref<NavigationPolygon>(memnew(NavigationPolygon)));
undo_redo->add_undo_method(node, "set_navigation_polygon", Variant(Ref<RefCounted>()));
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 26af5e3f2d..0af2a13df2 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -110,7 +110,9 @@ void EditorNode3DGizmo::clear() {
collision_mesh = Ref<TriangleMesh>();
instances.clear();
handles.clear();
+ handle_ids.clear();
secondary_handles.clear();
+ secondary_handle_ids.clear();
}
void EditorNode3DGizmo::redraw() {
@@ -406,12 +408,15 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
return;
}
- ERR_FAIL_COND(!spatial_node);
+ ERR_FAIL_NULL(spatial_node);
+
+ Vector<Vector3> &handle_list = p_secondary ? secondary_handles : handles;
+ Vector<int> &id_list = p_secondary ? secondary_handle_ids : handle_ids;
if (p_ids.is_empty()) {
- ERR_FAIL_COND_MSG((!handles.is_empty() && !handle_ids.is_empty()) || (!secondary_handles.is_empty() && !secondary_handle_ids.is_empty()), "Fail");
+ ERR_FAIL_COND_MSG(!id_list.is_empty(), "IDs must be provided for all handles, as handles with IDs already exist.");
} else {
- ERR_FAIL_COND_MSG(handles.size() != handle_ids.size() || secondary_handles.size() != secondary_handle_ids.size(), "Fail");
+ ERR_FAIL_COND_MSG(p_handles.size() != p_ids.size(), "The number of IDs should be the same as the number of handles.");
}
bool is_current_hover_gizmo = Node3DEditor::get_singleton()->get_current_hover_gizmo() == this;
@@ -464,19 +469,17 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
}
instances.push_back(ins);
- Vector<Vector3> &h = p_secondary ? secondary_handles : handles;
- int current_size = h.size();
- h.resize(current_size + p_handles.size());
+ int current_size = handle_list.size();
+ handle_list.resize(current_size + p_handles.size());
for (int i = 0; i < p_handles.size(); i++) {
- h.write[current_size + i] = p_handles[i];
+ handle_list.write[current_size + i] = p_handles[i];
}
if (!p_ids.is_empty()) {
- Vector<int> &ids = p_secondary ? secondary_handle_ids : handle_ids;
- current_size = ids.size();
- ids.resize(current_size + p_ids.size());
+ current_size = id_list.size();
+ id_list.resize(current_size + p_ids.size());
for (int i = 0; i < p_ids.size(); i++) {
- ids.write[current_size + i] = p_ids[i];
+ id_list.write[current_size + i] = p_ids[i];
}
}
}
@@ -1078,11 +1081,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 +1100,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 +1117,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 +1143,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 +1920,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 +2280,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 +2351,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 e5d4b262aa..7febb50f5c 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -40,6 +40,7 @@
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "editor/plugins/script_editor_plugin.h"
@@ -939,7 +940,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 +1402,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 +1482,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 +1651,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 +1710,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 +1783,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 +1836,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 +1890,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 +2087,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 +2099,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 +2111,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 +2144,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 +2177,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 +2216,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 +2300,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 +2376,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 +2394,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 +2446,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: {
@@ -2664,7 +2665,7 @@ void Node3DEditorViewport::_notification(int p_what) {
return;
}
if (preview_node->is_inside_tree()) {
- preview_node_pos = _get_instance_position(preview_node_viewport_pos);
+ preview_node_pos = spatial_editor->snap_point(_get_instance_position(preview_node_viewport_pos));
Transform3D preview_gl_transform = Transform3D(Basis(), preview_node_pos);
preview_node->set_global_transform(preview_gl_transform);
if (!preview_node->is_visible()) {
@@ -2821,7 +2822,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();
@@ -2898,6 +2899,7 @@ void Node3DEditorViewport::_draw() {
}
void Node3DEditorViewport::_menu_option(int p_option) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (p_option) {
case VIEW_TOP: {
cursor.y_rot = 0;
@@ -2986,7 +2988,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
Transform3D xform;
if (orthogonal) {
xform = sp->get_global_transform();
- xform.basis.set_euler(camera_transform.basis.get_euler());
+ xform.basis = Basis::from_euler(camera_transform.basis.get_euler());
} else {
xform = camera_transform;
xform.scale_basis(sp->get_scale());
@@ -3464,7 +3466,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);
@@ -3748,24 +3750,45 @@ void Node3DEditorViewport::assign_pending_data_pointers(Node3D *p_preview_node,
Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const {
const float MAX_DISTANCE = 50.0;
+ const float FALLBACK_DISTANCE = 5.0;
Vector3 world_ray = _get_ray(p_pos);
Vector3 world_pos = _get_ray_pos(p_pos);
- Vector3 point = world_pos + world_ray * MAX_DISTANCE;
-
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
PhysicsDirectSpaceState3D::RayParameters ray_params;
ray_params.from = world_pos;
- ray_params.to = world_pos + world_ray * MAX_DISTANCE;
+ ray_params.to = world_pos + world_ray * camera->get_far();
PhysicsDirectSpaceState3D::RayResult result;
if (ss->intersect_ray(ray_params, result)) {
- point = result.position;
+ return result.position;
+ }
+
+ const bool is_orthogonal = camera->get_projection() == Camera3D::PROJECTION_ORTHOGONAL;
+
+ // The XZ plane.
+ Vector3 intersection;
+ Plane plane(Vector3(0, 1, 0));
+ if (plane.intersects_ray(world_pos, world_ray, &intersection)) {
+ if (is_orthogonal || world_pos.distance_to(intersection) <= MAX_DISTANCE) {
+ return intersection;
+ }
+ }
+
+ // Plane facing the camera using fallback distance.
+ if (is_orthogonal) {
+ plane = Plane(world_ray, cursor.pos - world_ray * (cursor.distance - FALLBACK_DISTANCE));
+ } else {
+ plane = Plane(world_ray, world_pos + world_ray * FALLBACK_DISTANCE);
+ }
+ if (plane.intersects_ray(world_pos, world_ray, &intersection)) {
+ return intersection;
}
- return point;
+ // Not likely, but just in case...
+ return world_pos + world_ray * FALLBACK_DISTANCE;
}
AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, bool p_exclude_top_level_transform) {
@@ -3781,7 +3804,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo
if (child) {
AABB child_bounds = _calculate_spatial_bounds(child, false);
- if (bounds.size == Vector3() && Object::cast_to<Node3D>(p_parent)) {
+ if (bounds.size == Vector3() && p_parent) {
bounds = child_bounds;
} else {
bounds.merge_with(child_bounds);
@@ -3789,7 +3812,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo
}
}
- if (bounds.size == Vector3() && !Object::cast_to<Node3D>(p_parent)) {
+ if (bounds.size == Vector3() && !p_parent) {
bounds = AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
}
@@ -3862,7 +3885,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);
@@ -4027,15 +4050,16 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(path));
}
- editor_data->get_undo_redo()->add_do_method(parent, "add_child", instantiated_scene, true);
- editor_data->get_undo_redo()->add_do_method(instantiated_scene, "set_owner", EditorNode::get_singleton()->get_edited_scene());
- editor_data->get_undo_redo()->add_do_reference(instantiated_scene);
- editor_data->get_undo_redo()->add_undo_method(parent, "remove_child", instantiated_scene);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ undo_redo->add_do_method(parent, "add_child", instantiated_scene, true);
+ undo_redo->add_do_method(instantiated_scene, "set_owner", EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_reference(instantiated_scene);
+ undo_redo->add_undo_method(parent, "remove_child", instantiated_scene);
String new_name = parent->validate_child_name(instantiated_scene);
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
- editor_data->get_undo_redo()->add_do_method(ed, "live_debug_instance_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), path, new_name);
- editor_data->get_undo_redo()->add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
+ undo_redo->add_do_method(ed, "live_debug_instance_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), path, new_name);
+ undo_redo->add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
Node3D *node3d = Object::cast_to<Node3D>(instantiated_scene);
if (node3d) {
@@ -4045,29 +4069,30 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
gl_transform = parent_node3d->get_global_gizmo_transform();
}
- gl_transform.origin = spatial_editor->snap_point(preview_node_pos);
+ gl_transform.origin = preview_node_pos;
gl_transform.basis *= node3d->get_transform().basis;
- editor_data->get_undo_redo()->add_do_method(instantiated_scene, "set_global_transform", gl_transform);
+ undo_redo->add_do_method(instantiated_scene, "set_global_transform", gl_transform);
}
return true;
}
void Node3DEditorViewport::_perform_drop_data() {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (spatial_editor->get_preview_material_target().is_valid()) {
GeometryInstance3D *geometry_instance = Object::cast_to<GeometryInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
if (mesh_instance && spatial_editor->get_preview_material_surface() != -1) {
- editor_data->get_undo_redo()->create_action(vformat(TTR("Set Surface %d Override Material"), spatial_editor->get_preview_material_surface()));
- editor_data->get_undo_redo()->add_do_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_material());
- editor_data->get_undo_redo()->add_undo_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_reset_material());
- editor_data->get_undo_redo()->commit_action();
+ undo_redo->create_action(vformat(TTR("Set Surface %d Override Material"), spatial_editor->get_preview_material_surface()));
+ undo_redo->add_do_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_material());
+ undo_redo->add_undo_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_reset_material());
+ undo_redo->commit_action();
} else if (geometry_instance) {
- editor_data->get_undo_redo()->create_action(TTR("Set Material Override"));
- editor_data->get_undo_redo()->add_do_method(geometry_instance, "set_material_override", spatial_editor->get_preview_material());
- editor_data->get_undo_redo()->add_undo_method(geometry_instance, "set_material_override", spatial_editor->get_preview_reset_material());
- editor_data->get_undo_redo()->commit_action();
+ undo_redo->create_action(TTR("Set Material Override"));
+ undo_redo->add_do_method(geometry_instance, "set_material_override", spatial_editor->get_preview_material());
+ undo_redo->add_undo_method(geometry_instance, "set_material_override", spatial_editor->get_preview_reset_material());
+ undo_redo->commit_action();
}
_remove_preview_material();
@@ -4078,7 +4103,7 @@ void Node3DEditorViewport::_perform_drop_data() {
Vector<String> error_files;
- editor_data->get_undo_redo()->create_action(TTR("Create Node"));
+ undo_redo->create_action(TTR("Create Node"));
for (int i = 0; i < selected_files.size(); i++) {
String path = selected_files[i];
@@ -4096,7 +4121,7 @@ void Node3DEditorViewport::_perform_drop_data() {
}
}
- editor_data->get_undo_redo()->commit_action();
+ undo_redo->commit_action();
if (error_files.size() > 0) {
String files_str;
@@ -4129,11 +4154,13 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
ResourceLoader::get_recognized_extensions_for_type("Texture", &texture_extensions);
for (int i = 0; i < files.size(); i++) {
+ String extension = files[i].get_extension().to_lower();
+
// Check if dragged files with mesh or scene extension can be created at least once.
- if (mesh_extensions.find(files[i].get_extension()) ||
- scene_extensions.find(files[i].get_extension()) ||
- material_extensions.find(files[i].get_extension()) ||
- texture_extensions.find(files[i].get_extension())) {
+ if (mesh_extensions.find(extension) ||
+ scene_extensions.find(extension) ||
+ material_extensions.find(extension) ||
+ texture_extensions.find(extension)) {
Ref<Resource> res = ResourceLoader::load(files[i]);
if (res.is_null()) {
continue;
@@ -4262,6 +4289,7 @@ void Node3DEditorViewport::commit_transform() {
TTRC("Translate"),
TTRC("Scale"),
};
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(_transform_name[_edit.mode]);
List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -4667,9 +4695,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
_edit.gizmo_handle_secondary = false;
index = p_index;
- editor_data = SceneTreeDock::get_singleton()->get_editor_data();
editor_selection = EditorNode::get_singleton()->get_editor_selection();
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
orthogonal = false;
auto_orthogonal = false;
@@ -4938,7 +4964,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);
@@ -5753,6 +5779,7 @@ void Node3DEditor::_xform_dialog_action() {
t.basis.rotate(rotate);
t.origin = translate;
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("XForm Dialog"));
const List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -5864,6 +5891,7 @@ void Node3DEditor::_update_camera_override_viewport(Object *p_viewport) {
}
void Node3DEditor::_menu_item_pressed(int p_option) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (p_option) {
case MENU_TOOL_SELECT:
case MENU_TOOL_MOVE:
@@ -6191,9 +6219,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 +6271,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 +6687,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.
@@ -7049,6 +7077,7 @@ void Node3DEditor::_snap_selected_nodes_to_floor() {
}
if (snapped_to_floor) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Snap Nodes to Floor"));
// Perform snapping if at least one node can be snapped
@@ -7118,6 +7147,7 @@ void Node3DEditor::_add_sun_to_scene(bool p_already_added_environment) {
ERR_FAIL_COND(!base);
Node *new_sun = preview_sun->duplicate();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add Preview Sun to Scene"));
undo_redo->add_do_method(base, "add_child", new_sun, true);
// Move to the beginning of the scene tree since more "global" nodes
@@ -7151,6 +7181,7 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
new_env->set_camera_attributes(preview_environment->get_camera_attributes()->duplicate(true));
}
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add Preview Environment to Scene"));
undo_redo->add_do_method(base, "add_child", new_env, true);
// Move to the beginning of the scene tree since more "global" nodes
@@ -7290,14 +7321,6 @@ Vector<int> Node3DEditor::get_subgizmo_selection() {
return ret;
}
-void Node3DEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
-}
-
-Ref<EditorUndoRedoManager> Node3DEditor::get_undo_redo() {
- return undo_redo;
-}
-
void Node3DEditor::add_control_to_menu_panel(Control *p_control) {
context_menu_hbox->add_child(p_control);
}
@@ -7615,7 +7638,7 @@ void Node3DEditor::_preview_settings_changed() {
{ // preview sun
Transform3D t;
- t.basis = Basis(Vector3(sun_rotation.x, sun_rotation.y, 0));
+ t.basis = Basis::from_euler(Vector3(sun_rotation.x, sun_rotation.y, 0));
preview_sun->set_transform(t);
sun_direction->queue_redraw();
preview_sun->set_param(Light3D::PARAM_ENERGY, sun_energy->get_value());
@@ -7748,7 +7771,6 @@ Node3DEditor::Node3DEditor() {
gizmo.scale = 1.0;
viewport_environment = Ref<Environment>(memnew(Environment));
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
VBoxContainer *vbc = this;
custom_camera = nullptr;
@@ -8046,12 +8068,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 +8095,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 +8103,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 +8111,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 +8137,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 +8151,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 +8165,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/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 7dbe153efd..5ea1bf6dc1 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -53,7 +53,6 @@ class Node3DEditorViewport;
class SubViewportContainer;
class DirectionalLight3D;
class WorldEnvironment;
-class EditorUndoRedoManager;
class ViewportRotationControl : public Control {
GDCLASS(ViewportRotationControl, Control);
@@ -203,9 +202,7 @@ private:
Node *target_node = nullptr;
Point2 drop_pos;
- EditorData *editor_data = nullptr;
EditorSelection *editor_selection = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
CheckBox *preview_camera = nullptr;
SubViewportContainer *subviewport_container = nullptr;
@@ -686,7 +683,6 @@ private:
HBoxContainer *context_menu_hbox = nullptr;
void _generate_selection_boxes();
- Ref<EditorUndoRedoManager> undo_redo;
int camera_override_viewport_id;
@@ -835,9 +831,6 @@ public:
Ref<Environment> get_viewport_environment() { return viewport_environment; }
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
- Ref<EditorUndoRedoManager> get_undo_redo();
-
void add_control_to_menu_panel(Control *p_control);
void remove_control_from_menu_panel(Control *p_control);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 58a3a07c43..6218c887fb 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -32,8 +32,10 @@
#include "core/input/input_event.h"
#include "core/math/geometry_2d.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/gui/menu_button.h"
@@ -67,7 +69,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: {
@@ -150,6 +152,7 @@ void Polygon2DEditor::_sync_bones() {
Array new_bones = node->call("_get_bones");
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Sync Bones"));
undo_redo->add_do_method(node, "_set_bones", new_bones);
undo_redo->add_undo_method(node, "_set_bones", prev_bones);
@@ -279,6 +282,7 @@ void Polygon2DEditor::_uv_edit_popup_hide() {
}
void Polygon2DEditor::_menu_option(int p_option) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (p_option) {
case MODE_EDIT_UV: {
if (node->get_texture().is_null()) {
@@ -299,7 +303,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);
}
@@ -391,6 +395,7 @@ void Polygon2DEditor::_update_polygon_editing_state() {
void Polygon2DEditor::_commit_action() {
// Makes that undo/redoing actions made outside of the UV editor still affect its polygon.
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(uv_edit_draw, "queue_redraw");
undo_redo->add_undo_method(uv_edit_draw, "queue_redraw");
undo_redo->add_do_method(CanvasItemEditor::get_singleton(), "update_viewport");
@@ -458,8 +463,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
mtx.columns[2] = -uv_draw_ofs;
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
- Ref<InputEventMouseButton> mb = p_input;
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+ Ref<InputEventMouseButton> mb = p_input;
if (mb.is_valid()) {
if (mb->get_button_index() == MouseButton::LEFT) {
if (mb->is_pressed()) {
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 21647d1b69..e35e794b24 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
void ResourcePreloaderEditor::_notification(int p_what) {
switch (p_what) {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 876ef3bae9..4ff3919e9b 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);
@@ -3896,7 +3892,7 @@ ScriptEditor::ScriptEditor() {
vbc->add_child(disk_changed_list);
disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL);
- disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::reload_scripts));
+ disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::reload_scripts).bind(false));
disk_changed->set_ok_button_text(TTR("Reload"));
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
@@ -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/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 456c28d887..2f80e41dd4 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/filesystem_dock.h"
#include "editor/plugins/text_shader_editor.h"
#include "editor/plugins/visual_shader_editor_plugin.h"
@@ -225,7 +226,7 @@ void ShaderEditorPlugin::_close_shader(int p_index) {
memdelete(c);
edited_shaders.remove_at(p_index);
_update_shader_list();
- EditorNode::get_singleton()->get_undo_redo()->clear_history(); // To prevent undo on deleted graphs.
+ EditorNode::get_undo_redo()->clear_history(); // To prevent undo on deleted graphs.
}
void ShaderEditorPlugin::_resource_saved(Object *obj) {
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_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index be382759f5..4aed7a92a2 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "texture_editor_plugin.h"
-
#include "editor/editor_scale.h"
TextureRect *TexturePreview::get_texture_display() {
@@ -123,6 +122,7 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
add_child(checkerboard);
texture_display = memnew(TextureRect);
+ texture_display->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
texture_display->set_texture(p_texture);
texture_display->set_anchors_preset(TextureRect::PRESET_FULL_RECT);
texture_display->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 8e04391a94..b0c8597adf 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -86,8 +86,8 @@ void TextureRegionEditor::_region_draw() {
mtx.scale_basis(Vector2(draw_zoom, draw_zoom));
RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), mtx);
- edit_draw->draw_rect(Rect2(Point2(), base_tex->get_size()), Color(0.5, 0.5, 0.5, 0.5), false);
- edit_draw->draw_texture(base_tex, Point2());
+ edit_draw->draw_rect(Rect2(Point2(), preview_tex->get_size()), Color(0.5, 0.5, 0.5, 0.5), false);
+ edit_draw->draw_texture(preview_tex, Point2());
RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
const Color color = get_theme_color(SNAME("mono_color"), SNAME("Editor"));
@@ -242,7 +242,7 @@ void TextureRegionEditor::_region_draw() {
hscroll->set_value((hscroll->get_min() + hscroll->get_max() - hscroll->get_page()) / 2);
vscroll->set_value((vscroll->get_min() + vscroll->get_max() - vscroll->get_page()) / 2);
// This ensures that the view is updated correctly.
- callable_mp(this, &TextureRegionEditor::_pan_callback).bind(Vector2(1, 0)).call_deferredp(nullptr, 0);
+ callable_mp(this, &TextureRegionEditor::_pan_callback).bind(Vector2(1, 0)).call_deferred();
request_center = false;
}
@@ -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) {
@@ -905,6 +905,13 @@ void TextureRegionEditor::edit(Object *p_obj) {
if (atlas_tex.is_valid()) {
atlas_tex->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
+
+ node_sprite_2d = nullptr;
+ node_sprite_3d = nullptr;
+ node_ninepatch = nullptr;
+ obj_styleBox = Ref<StyleBoxTexture>(nullptr);
+ atlas_tex = Ref<AtlasTexture>(nullptr);
+
if (p_obj) {
node_sprite_2d = Object::cast_to<Sprite2D>(p_obj);
node_sprite_3d = Object::cast_to<Sprite3D>(p_obj);
@@ -926,13 +933,8 @@ void TextureRegionEditor::edit(Object *p_obj) {
p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
_edit_region();
- } else {
- node_sprite_2d = nullptr;
- node_sprite_3d = nullptr;
- node_ninepatch = nullptr;
- obj_styleBox = Ref<StyleBoxTexture>(nullptr);
- atlas_tex = Ref<AtlasTexture>(nullptr);
}
+
edit_draw->queue_redraw();
popup_centered_ratio(0.5);
request_center = true;
@@ -946,20 +948,80 @@ void TextureRegionEditor::_texture_changed() {
}
void TextureRegionEditor::_edit_region() {
+ CanvasItem::TextureFilter filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+
Ref<Texture2D> texture = nullptr;
if (atlas_tex.is_valid()) {
texture = atlas_tex->get_atlas();
} else if (node_sprite_2d) {
texture = node_sprite_2d->get_texture();
+ filter = node_sprite_2d->get_texture_filter_in_tree();
} else if (node_sprite_3d) {
texture = node_sprite_3d->get_texture();
+
+ StandardMaterial3D::TextureFilter filter_3d = node_sprite_3d->get_texture_filter();
+
+ switch (filter_3d) {
+ case StandardMaterial3D::TEXTURE_FILTER_NEAREST:
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST;
+ break;
+ case StandardMaterial3D::TEXTURE_FILTER_LINEAR:
+ filter = CanvasItem::TEXTURE_FILTER_LINEAR;
+ break;
+ case StandardMaterial3D::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+ break;
+ case StandardMaterial3D::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ filter = CanvasItem::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
+ break;
+ case StandardMaterial3D::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC;
+ break;
+ case StandardMaterial3D::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
+ filter = CanvasItem::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC;
+ break;
+ default:
+ // fallback to project default
+ filter = CanvasItem::TEXTURE_FILTER_PARENT_NODE;
+ break;
+ }
} else if (node_ninepatch) {
texture = node_ninepatch->get_texture();
+ filter = node_ninepatch->get_texture_filter_in_tree();
} else if (obj_styleBox.is_valid()) {
texture = obj_styleBox->get_texture();
}
+ // occurs when get_texture_filter_in_tree reaches the scene root
+ if (filter == CanvasItem::TEXTURE_FILTER_PARENT_NODE) {
+ SubViewport *root = EditorNode::get_singleton()->get_scene_root();
+
+ if (root != nullptr) {
+ Viewport::DefaultCanvasItemTextureFilter filter_default = root->get_default_canvas_item_texture_filter();
+
+ // depending on default filter, set filter to match, otherwise fall back on nearest w/ mipmaps
+ switch (filter_default) {
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST;
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
+ filter = CanvasItem::TEXTURE_FILTER_LINEAR;
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ filter = CanvasItem::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ default:
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+ break;
+ }
+ } else {
+ filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+ }
+ }
+
if (texture.is_null()) {
+ preview_tex->set_diffuse_texture(nullptr);
_zoom_reset();
hscroll->hide();
vscroll->hide();
@@ -967,6 +1029,9 @@ void TextureRegionEditor::_edit_region() {
return;
}
+ preview_tex->set_texture_filter(filter);
+ preview_tex->set_diffuse_texture(texture);
+
if (cache_map.has(texture->get_rid())) {
autoslice_cache = cache_map[texture->get_rid()];
autoslice_is_dirty = false;
@@ -1002,6 +1067,8 @@ TextureRegionEditor::TextureRegionEditor() {
atlas_tex = Ref<AtlasTexture>(nullptr);
undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ preview_tex = Ref<CanvasTexture>(memnew(CanvasTexture));
+
snap_step = Vector2(10, 10);
snap_separation = Vector2(0, 0);
snap_mode = SNAP_NONE;
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index e3bbaf49fc..7eda4f469f 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -86,6 +86,8 @@ class TextureRegionEditor : public AcceptDialog {
Ref<StyleBoxTexture> obj_styleBox;
Ref<AtlasTexture> atlas_tex;
+ Ref<CanvasTexture> preview_tex;
+
Rect2 rect;
Rect2 rect_prev;
float prev_margin = 0.0f;
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..4fe7178e7e 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -192,6 +192,19 @@ void TileAtlasView::_draw_base_tiles() {
rect = rect.intersection(Rect2i(Vector2(), texture->get_size()));
if (rect.size.x > 0 && rect.size.y > 0) {
base_tiles_draw->draw_texture_rect_region(texture, rect, rect);
+ }
+ }
+ }
+ }
+
+ // Draw dark overlay after for performance reasons.
+ for (int x = 0; x < grid_size.x; x++) {
+ for (int y = 0; y < grid_size.y; y++) {
+ Vector2i coords = Vector2i(x, y);
+ if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) {
+ Rect2i rect = Rect2i((texture_region_size + separation) * coords + margins, texture_region_size + separation);
+ rect = rect.intersection(Rect2i(Vector2(), texture->get_size()));
+ if (rect.size.x > 0 && rect.size.y > 0) {
base_tiles_draw->draw_rect(rect, Color(0.0, 0.0, 0.0, 0.5));
}
}
@@ -242,23 +255,34 @@ void TileAtlasView::_draw_base_tiles() {
// Draw the tile.
TileMap::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0, frame);
+ }
+ }
- // Draw, the texture in the separation areas
- if (separation.x > 0) {
- Rect2i right_sep_rect = Rect2i(base_frame_rect.get_position() + Vector2i(base_frame_rect.size.x, 0), Vector2i(separation.x, base_frame_rect.size.y));
- right_sep_rect = right_sep_rect.intersection(Rect2i(Vector2(), texture->get_size()));
- if (right_sep_rect.size.x > 0 && right_sep_rect.size.y > 0) {
- base_tiles_draw->draw_texture_rect_region(texture, right_sep_rect, right_sep_rect);
- base_tiles_draw->draw_rect(right_sep_rect, Color(0.0, 0.0, 0.0, 0.5));
+ // Draw Dark overlay on separation in its own pass.
+ if (separation.x > 0 || separation.y > 0) {
+ for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
+ Vector2i atlas_coords = tile_set_atlas_source->get_tile_id(i);
+
+ for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(atlas_coords); frame++) {
+ // Update the y to max value.
+ Rect2i base_frame_rect = tile_set_atlas_source->get_tile_texture_region(atlas_coords, frame);
+
+ if (separation.x > 0) {
+ Rect2i right_sep_rect = Rect2i(base_frame_rect.get_position() + Vector2i(base_frame_rect.size.x, 0), Vector2i(separation.x, base_frame_rect.size.y));
+ right_sep_rect = right_sep_rect.intersection(Rect2i(Vector2(), texture->get_size()));
+ if (right_sep_rect.size.x > 0 && right_sep_rect.size.y > 0) {
+ //base_tiles_draw->draw_texture_rect_region(texture, right_sep_rect, right_sep_rect);
+ base_tiles_draw->draw_rect(right_sep_rect, Color(0.0, 0.0, 0.0, 0.5));
+ }
}
- }
- if (separation.y > 0) {
- Rect2i bottom_sep_rect = Rect2i(base_frame_rect.get_position() + Vector2i(0, base_frame_rect.size.y), Vector2i(base_frame_rect.size.x + separation.x, separation.y));
- bottom_sep_rect = bottom_sep_rect.intersection(Rect2i(Vector2(), texture->get_size()));
- if (bottom_sep_rect.size.x > 0 && bottom_sep_rect.size.y > 0) {
- base_tiles_draw->draw_texture_rect_region(texture, bottom_sep_rect, bottom_sep_rect);
- base_tiles_draw->draw_rect(bottom_sep_rect, Color(0.0, 0.0, 0.0, 0.5));
+ if (separation.y > 0) {
+ Rect2i bottom_sep_rect = Rect2i(base_frame_rect.get_position() + Vector2i(0, base_frame_rect.size.y), Vector2i(base_frame_rect.size.x + separation.x, separation.y));
+ bottom_sep_rect = bottom_sep_rect.intersection(Rect2i(Vector2(), texture->get_size()));
+ if (bottom_sep_rect.size.x > 0 && bottom_sep_rect.size.y > 0) {
+ //base_tiles_draw->draw_texture_rect_region(texture, bottom_sep_rect, bottom_sep_rect);
+ base_tiles_draw->draw_rect(bottom_sep_rect, Color(0.0, 0.0, 0.0, 0.5));
+ }
}
}
}
@@ -298,7 +322,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 +533,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 cbc95ef6d6..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) {
@@ -2348,27 +2348,27 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrain_path_o
}
HashMap<Vector2i, TileMapCell> output;
- for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E : terrain_fill_output) {
- if (painted_set.has(E.key)) {
+ for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &kv : terrain_fill_output) {
+ if (painted_set.has(kv.key)) {
// Paint a random tile with the correct terrain for the painted path.
- output[E.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, E.value);
+ output[kv.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, kv.value);
} else {
// Avoids updating the painted path from the output if the new pattern is the same as before.
- bool keep_old = false;
- TileMapCell cell = tile_map->get_cell(tile_map_layer, E.key);
+ TileSet::TerrainsPattern in_map_terrain_pattern = TileSet::TerrainsPattern(*tile_set, p_terrain_set);
+ TileMapCell cell = tile_map->get_cell(tile_map_layer, kv.key);
if (cell.source_id != TileSet::INVALID_SOURCE) {
TileSetSource *source = *tile_set->get_source(cell.source_id);
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
// Get tile data.
TileData *tile_data = atlas_source->get_tile_data(cell.get_atlas_coords(), cell.alternative_tile);
- if (tile_data && tile_data->get_terrains_pattern() == E.value) {
- keep_old = true;
+ if (tile_data && tile_data->get_terrain_set() == p_terrain_set) {
+ in_map_terrain_pattern = tile_data->get_terrains_pattern();
}
}
}
- if (!keep_old) {
- output[E.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, E.value);
+ if (in_map_terrain_pattern != kv.value) {
+ output[kv.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, kv.value);
}
}
}
@@ -2395,24 +2395,28 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrain_patter
}
HashMap<Vector2i, TileMapCell> output;
- for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E : terrain_fill_output) {
- if (painted_set.has(E.key)) {
+ for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &kv : terrain_fill_output) {
+ if (painted_set.has(kv.key)) {
// Paint a random tile with the correct terrain for the painted path.
- output[E.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, E.value);
+ output[kv.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, kv.value);
} else {
// Avoids updating the painted path from the output if the new pattern is the same as before.
- TileMapCell cell = tile_map->get_cell(tile_map_layer, E.key);
+ TileSet::TerrainsPattern in_map_terrain_pattern = TileSet::TerrainsPattern(*tile_set, p_terrain_set);
+ TileMapCell cell = tile_map->get_cell(tile_map_layer, kv.key);
if (cell.source_id != TileSet::INVALID_SOURCE) {
TileSetSource *source = *tile_set->get_source(cell.source_id);
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
// Get tile data.
TileData *tile_data = atlas_source->get_tile_data(cell.get_atlas_coords(), cell.alternative_tile);
- if (tile_data && !(tile_data->get_terrains_pattern() == E.value)) {
- output[E.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, E.value);
+ if (tile_data && tile_data->get_terrain_set() == p_terrain_set) {
+ in_map_terrain_pattern = tile_data->get_terrains_pattern();
}
}
}
+ if (in_map_terrain_pattern != kv.value) {
+ output[kv.key] = tile_set->get_random_tile_from_terrains_pattern(p_terrain_set, kv.value);
+ }
}
}
return output;
@@ -3019,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++) {
@@ -3416,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;
@@ -3431,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: {
@@ -3874,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..ab54a093f2 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -33,7 +33,9 @@
#include "tiles_editor_plugin.h"
#include "editor/editor_inspector.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/progress_dialog.h"
#include "editor/editor_node.h"
@@ -671,7 +673,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 +712,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 +730,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 +752,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 +886,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;
@@ -1310,6 +1312,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
}
void TileSetAtlasSourceEditor::_end_dragging() {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
switch (drag_type) {
case DRAG_TYPE_CREATE_TILES:
undo_redo->create_action(TTR("Create tiles"));
@@ -1540,6 +1543,8 @@ HashMap<Vector2i, List<const PropertyInfo *>> TileSetAtlasSourceEditor::_group_p
}
void TileSetAtlasSourceEditor::_menu_option(int p_option) {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
+
switch (p_option) {
case TILE_DELETE: {
List<PropertyInfo> list;
@@ -1667,7 +1672,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 +1963,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.
@@ -1997,7 +2002,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
continue;
}
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2 position = rect.get_center();
+ Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -2021,7 +2026,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
continue;
}
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E.tile, E.alternative);
- Vector2 position = rect.get_center();
+ Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(E.tile, E.alternative);
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -2198,6 +2203,7 @@ void TileSetAtlasSourceEditor::_auto_create_tiles() {
Vector2i separation = tile_set_atlas_source->get_separation();
Vector2i texture_region_size = tile_set_atlas_source->get_texture_region_size();
Size2i grid_size = tile_set_atlas_source->get_atlas_grid_size();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Create tiles in non-transparent texture regions"));
for (int y = 0; y < grid_size.y; y++) {
for (int x = 0; x < grid_size.x; x++) {
@@ -2243,6 +2249,7 @@ void TileSetAtlasSourceEditor::_auto_remove_tiles() {
Vector2i texture_region_size = tile_set_atlas_source->get_texture_region_size();
Vector2i grid_size = tile_set_atlas_source->get_atlas_grid_size();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Remove tiles in fully transparent texture regions"));
List<PropertyInfo> list;
@@ -2336,8 +2343,6 @@ void TileSetAtlasSourceEditor::_bind_methods() {
}
TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
- undo_redo = EditorNode::get_undo_redo();
-
set_process_unhandled_key_input(true);
set_process_internal(true);
@@ -2366,7 +2371,6 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tile_proxy_object->connect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_proxy_object_changed));
tile_inspector = memnew(EditorInspector);
- tile_inspector->set_undo_redo(undo_redo);
tile_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
tile_inspector->edit(tile_proxy_object);
tile_inspector->set_use_folding(true);
@@ -2414,7 +2418,6 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
atlas_source_proxy_object->connect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_atlas_source_proxy_object_changed));
atlas_source_inspector = memnew(EditorInspector);
- atlas_source_inspector->set_undo_redo(undo_redo);
atlas_source_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
atlas_source_inspector->edit(atlas_source_proxy_object);
middle_vbox_container->add_child(atlas_source_inspector);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h
index badb702e29..8e217e359f 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.h
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h
@@ -114,8 +114,6 @@ private:
TileSetAtlasSource *tile_set_atlas_source = nullptr;
int tile_set_atlas_source_id = TileSet::INVALID_SOURCE;
- Ref<EditorUndoRedoManager> undo_redo;
-
bool tile_set_changed_needs_update = false;
// -- Properties painting --
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..3b711a568e 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
@@ -35,6 +35,7 @@
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "scene/gui/item_list.h"
@@ -235,6 +236,7 @@ void TileSetScenesCollectionSourceEditor::_scenes_list_item_activated(int p_inde
void TileSetScenesCollectionSourceEditor::_source_add_pressed() {
int scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add a Scene Tile"));
undo_redo->add_do_method(tile_set_scenes_collection_source, "create_scene_tile", Ref<PackedScene>(), scene_id);
undo_redo->add_undo_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id);
@@ -249,6 +251,7 @@ void TileSetScenesCollectionSourceEditor::_source_delete_pressed() {
ERR_FAIL_COND(selected_indices.size() <= 0);
int scene_id = scene_tiles_list->get_item_metadata(selected_indices[0]);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Remove a Scene Tile"));
undo_redo->add_do_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id);
undo_redo->add_undo_method(tile_set_scenes_collection_source, "create_scene_tile", tile_set_scenes_collection_source->get_scene_tile_scene(scene_id), scene_id);
@@ -323,7 +326,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));
}
@@ -400,6 +403,7 @@ void TileSetScenesCollectionSourceEditor::_drop_data_fw(const Point2 &p_point, c
Ref<PackedScene> resource = ResourceLoader::load(files[i]);
if (resource.is_valid()) {
int scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add a Scene Tile"));
undo_redo->add_do_method(tile_set_scenes_collection_source, "create_scene_tile", resource, scene_id);
undo_redo->add_undo_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id);
@@ -453,8 +457,6 @@ void TileSetScenesCollectionSourceEditor::_bind_methods() {
}
TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() {
- undo_redo = EditorNode::get_undo_redo();
-
// -- Right side --
HSplitContainer *split_container_right_side = memnew(HSplitContainer);
split_container_right_side->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -479,7 +481,6 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() {
scenes_collection_source_proxy_object->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_scenes_collection_source_proxy_object_changed));
scenes_collection_source_inspector = memnew(EditorInspector);
- scenes_collection_source_inspector->set_undo_redo(undo_redo);
scenes_collection_source_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
scenes_collection_source_inspector->edit(scenes_collection_source_proxy_object);
middle_vbox_container->add_child(scenes_collection_source_inspector);
@@ -495,7 +496,6 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() {
tile_proxy_object->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_update_action_buttons).unbind(1));
tile_inspector = memnew(EditorInspector);
- tile_inspector->set_undo_redo(undo_redo);
tile_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
tile_inspector->edit(tile_proxy_object);
tile_inspector->set_use_folding(true);
diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
index 0284b45c0f..7270cccbd8 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
@@ -37,8 +37,6 @@
#include "scene/gui/item_list.h"
#include "scene/resources/tile_set.h"
-class UndoRedo;
-
class TileSetScenesCollectionSourceEditor : public HBoxContainer {
GDCLASS(TileSetScenesCollectionSourceEditor, HBoxContainer);
@@ -97,8 +95,6 @@ private:
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int tile_set_source_id = -1;
- Ref<EditorUndoRedoManager> undo_redo;
-
bool tile_set_scenes_collection_source_changed_needs_update = false;
// Source inspector.
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/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index 336ce9e4c8..4fdfaed50e 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -430,7 +430,7 @@ void VersionControlEditorPlugin::_discard_file(String p_file_path, EditorVCSInte
CHECK_PLUGIN_INITIALIZED();
EditorVCSInterface::get_singleton()->discard_file(p_file_path);
}
- // FIXIT: The project.godot file shows weird behaviour
+ // FIXIT: The project.godot file shows weird behavior
EditorFileSystem::get_singleton()->update_file(p_file_path);
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 8355f64fe5..c8f6a2431d 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: {
@@ -4064,7 +4062,7 @@ void VisualShaderEditor::_input_select_item(Ref<VisualShaderNodeInput> p_input,
bool type_changed = next_input_type != prev_input_type;
- Ref<EditorUndoRedoManager> undo_redo_man = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo_man = EditorNode::get_undo_redo();
undo_redo_man->create_action(TTR("Visual Shader Input Type Changed"));
undo_redo_man->add_do_method(p_input.ptr(), "set_input_name", p_name);
@@ -4133,7 +4131,7 @@ void VisualShaderEditor::_parameter_ref_select_item(Ref<VisualShaderNodeParamete
bool type_changed = p_parameter_ref->get_parameter_type_by_name(p_name) != p_parameter_ref->get_parameter_type_by_name(prev_name);
- Ref<EditorUndoRedoManager> undo_redo_man = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo_man = EditorNode::get_undo_redo();
undo_redo_man->create_action(TTR("ParameterRef Name Changed"));
undo_redo_man->add_do_method(p_parameter_ref.ptr(), "set_parameter_name", p_name);
@@ -4177,7 +4175,7 @@ void VisualShaderEditor::_varying_select_item(Ref<VisualShaderNodeVarying> p_var
bool is_getter = Ref<VisualShaderNodeVaryingGetter>(p_varying.ptr()).is_valid();
- Ref<EditorUndoRedoManager> undo_redo_man = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo_man = EditorNode::get_undo_redo();
undo_redo_man->create_action(TTR("Varying Name Changed"));
undo_redo_man->add_do_method(p_varying.ptr(), "set_varying_name", p_name);
@@ -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);
@@ -5087,23 +5085,23 @@ VisualShaderEditor::VisualShaderEditor() {
const String &compare_func_desc = TTR("Returns the boolean result of the %s comparison between two parameters.");
- add_options.push_back(AddOption("Equal", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Equal (==)")), { VisualShaderNodeCompare::FUNC_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("GreaterThan", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Greater Than (>)")), { VisualShaderNodeCompare::FUNC_GREATER_THAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("GreaterThanEqual", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Greater Than or Equal (>=)")), { VisualShaderNodeCompare::FUNC_GREATER_THAN_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("Equal (==)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Equal (==)")), { VisualShaderNodeCompare::FUNC_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("GreaterThan (>)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Greater Than (>)")), { VisualShaderNodeCompare::FUNC_GREATER_THAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("GreaterThanEqual (>=)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Greater Than or Equal (>=)")), { VisualShaderNodeCompare::FUNC_GREATER_THAN_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
add_options.push_back(AddOption("If", "Conditional/Functions", "VisualShaderNodeIf", TTR("Returns an associated vector if the provided scalars are equal, greater or less."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("IsInf", "Conditional/Functions", "VisualShaderNodeIs", TTR("Returns the boolean result of the comparison between INF and a scalar parameter."), { VisualShaderNodeIs::FUNC_IS_INF }, VisualShaderNode::PORT_TYPE_BOOLEAN));
add_options.push_back(AddOption("IsNaN", "Conditional/Functions", "VisualShaderNodeIs", TTR("Returns the boolean result of the comparison between NaN and a scalar parameter."), { VisualShaderNodeIs::FUNC_IS_NAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("LessThan", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Less Than (<)")), { VisualShaderNodeCompare::FUNC_LESS_THAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("LessThanEqual", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Less Than or Equal (<=)")), { VisualShaderNodeCompare::FUNC_LESS_THAN_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("NotEqual", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Not Equal (!=)")), { VisualShaderNodeCompare::FUNC_NOT_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("Switch", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated 3D vector if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Switch2D", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated 2D vector if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("SwitchBool", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated boolean if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_BOOLEAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
- add_options.push_back(AddOption("SwitchFloat", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated floating-point scalar if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_FLOAT }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("SwitchInt", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated integer scalar if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_INT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("SwitchTransform", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated transform if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_TRANSFORM }, VisualShaderNode::PORT_TYPE_TRANSFORM));
-
- add_options.push_back(AddOption("Compare", "Conditional/Common", "VisualShaderNodeCompare", TTR("Returns the boolean result of the comparison between two parameters."), {}, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("LessThan (<)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Less Than (<)")), { VisualShaderNodeCompare::FUNC_LESS_THAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("LessThanEqual (<=)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Less Than or Equal (<=)")), { VisualShaderNodeCompare::FUNC_LESS_THAN_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("NotEqual (!=)", "Conditional/Functions", "VisualShaderNodeCompare", vformat(compare_func_desc, TTR("Not Equal (!=)")), { VisualShaderNodeCompare::FUNC_NOT_EQUAL }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("Switch (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated 3D vector if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Switch2D (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated 2D vector if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("SwitchBool (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated boolean if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_BOOLEAN }, VisualShaderNode::PORT_TYPE_BOOLEAN));
+ add_options.push_back(AddOption("SwitchFloat (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated floating-point scalar if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_FLOAT }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("SwitchInt (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated integer scalar if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_INT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("SwitchTransform (==)", "Conditional/Functions", "VisualShaderNodeSwitch", TTR("Returns an associated transform if the provided boolean value is true or false."), { VisualShaderNodeSwitch::OP_TYPE_TRANSFORM }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+
+ add_options.push_back(AddOption("Compare (==)", "Conditional/Common", "VisualShaderNodeCompare", TTR("Returns the boolean result of the comparison between two parameters."), {}, VisualShaderNode::PORT_TYPE_BOOLEAN));
add_options.push_back(AddOption("Is", "Conditional/Common", "VisualShaderNodeIs", TTR("Returns the boolean result of the comparison between INF (or NaN) and a scalar parameter."), {}, VisualShaderNode::PORT_TYPE_BOOLEAN));
add_options.push_back(AddOption("BooleanConstant", "Conditional/Variables", "VisualShaderNodeBooleanConstant", TTR("Boolean constant."), {}, VisualShaderNode::PORT_TYPE_BOOLEAN));
@@ -5308,7 +5306,7 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("EmitParticle", "Particles", "VisualShaderNodeParticleEmit", "", {}, -1, TYPE_FLAGS_PROCESS | TYPE_FLAGS_PROCESS_CUSTOM | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES));
add_options.push_back(AddOption("ParticleAccelerator", "Particles", "VisualShaderNodeParticleAccelerator", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES));
add_options.push_back(AddOption("ParticleRandomness", "Particles", "VisualShaderNodeParticleRandomness", "", {}, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("MultiplyByAxisAngle", "Particles/Transform", "VisualShaderNodeParticleMultiplyByAxisAngle", TTR("A node for help to multiply a position input vector by rotation using specific axis. Intended to work with emitters."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("MultiplyByAxisAngle (*)", "Particles/Transform", "VisualShaderNodeParticleMultiplyByAxisAngle", TTR("A node for help to multiply a position input vector by rotation using specific axis. Intended to work with emitters."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES));
add_options.push_back(AddOption("BoxEmitter", "Particles/Emitters", "VisualShaderNodeParticleBoxEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES));
add_options.push_back(AddOption("MeshEmitter", "Particles/Emitters", "VisualShaderNodeParticleMeshEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES));
@@ -5359,10 +5357,10 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Max", "Scalar/Functions", "VisualShaderNodeFloatOp", TTR("Returns the greater of two values."), { VisualShaderNodeFloatOp::OP_MAX }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Min", "Scalar/Functions", "VisualShaderNodeFloatOp", TTR("Returns the lesser of two values."), { VisualShaderNodeFloatOp::OP_MIN }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Mix", "Scalar/Functions", "VisualShaderNodeMix", TTR("Linear interpolation between two scalars."), { VisualShaderNodeMix::OP_TYPE_SCALAR }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("MultiplyAdd", "Scalar/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on scalars."), { VisualShaderNodeMultiplyAdd::OP_TYPE_SCALAR }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Negate", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeFloatFunc::FUNC_NEGATE }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Negate", "Scalar/Functions", "VisualShaderNodeIntFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeIntFunc::FUNC_NEGATE }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("OneMinus", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("1.0 - scalar"), { VisualShaderNodeFloatFunc::FUNC_ONEMINUS }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("MultiplyAdd (a * b + c)", "Scalar/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on scalars."), { VisualShaderNodeMultiplyAdd::OP_TYPE_SCALAR }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Negate (*-1)", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeFloatFunc::FUNC_NEGATE }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Negate (*-1)", "Scalar/Functions", "VisualShaderNodeIntFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeIntFunc::FUNC_NEGATE }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("OneMinus (1-)", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("1.0 - scalar"), { VisualShaderNodeFloatFunc::FUNC_ONEMINUS }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Pow", "Scalar/Functions", "VisualShaderNodeFloatOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeFloatOp::OP_POW }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Radians", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("Converts a quantity in degrees to radians."), { VisualShaderNodeFloatFunc::FUNC_RADIANS }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Reciprocal", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("1.0 / scalar"), { VisualShaderNodeFloatFunc::FUNC_RECIPROCAL }, VisualShaderNode::PORT_TYPE_SCALAR));
@@ -5381,21 +5379,21 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("TanH", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("Returns the hyperbolic tangent of the parameter."), { VisualShaderNodeFloatFunc::FUNC_TANH }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Trunc", "Scalar/Functions", "VisualShaderNodeFloatFunc", TTR("Finds the truncated value of the parameter."), { VisualShaderNodeFloatFunc::FUNC_TRUNC }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Add", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Sums two floating-point scalars."), { VisualShaderNodeFloatOp::OP_ADD }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Add", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Sums two integer scalars."), { VisualShaderNodeIntOp::OP_ADD }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("BitwiseAND", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise AND (a & b) operation for two integers."), { VisualShaderNodeIntOp::OP_BITWISE_AND }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("BitwiseLeftShift", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise left shift (a << b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_LEFT_SHIFT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("BitwiseOR", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise OR (a | b) operation for two integers."), { VisualShaderNodeIntOp::OP_BITWISE_OR }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("BitwiseRightShift", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise right shift (a >> b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_RIGHT_SHIFT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("BitwiseXOR", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise XOR (a ^ b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_XOR }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("Divide", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Divides two floating-point scalars."), { VisualShaderNodeFloatOp::OP_DIV }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Divide", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Divides two integer scalars."), { VisualShaderNodeIntOp::OP_DIV }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("Multiply", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Multiplies two floating-point scalars."), { VisualShaderNodeFloatOp::OP_MUL }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Multiply", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Multiplies two integer scalars."), { VisualShaderNodeIntOp::OP_MUL }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("Add (+)", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Sums two floating-point scalars."), { VisualShaderNodeFloatOp::OP_ADD }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Add (+)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Sums two integer scalars."), { VisualShaderNodeIntOp::OP_ADD }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("BitwiseAND (&)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise AND (a & b) operation for two integers."), { VisualShaderNodeIntOp::OP_BITWISE_AND }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("BitwiseLeftShift (<<)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise left shift (a << b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_LEFT_SHIFT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("BitwiseOR (|)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise OR (a | b) operation for two integers."), { VisualShaderNodeIntOp::OP_BITWISE_OR }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("BitwiseRightShift (>>)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise right shift (a >> b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_RIGHT_SHIFT }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("BitwiseXOR (^)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the result of bitwise XOR (a ^ b) operation on the integer."), { VisualShaderNodeIntOp::OP_BITWISE_XOR }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("Divide (/)", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Divides two floating-point scalars."), { VisualShaderNodeFloatOp::OP_DIV }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Divide (/)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Divides two integer scalars."), { VisualShaderNodeIntOp::OP_DIV }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("Multiply (*)", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Multiplies two floating-point scalars."), { VisualShaderNodeFloatOp::OP_MUL }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Multiply (*)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Multiplies two integer scalars."), { VisualShaderNodeIntOp::OP_MUL }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
add_options.push_back(AddOption("Remainder", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Returns the remainder of the two floating-point scalars."), { VisualShaderNodeFloatOp::OP_MOD }, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("Remainder", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Returns the remainder of the two integer scalars."), { VisualShaderNodeIntOp::OP_MOD }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
- add_options.push_back(AddOption("Subtract", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Subtracts two floating-point scalars."), { VisualShaderNodeFloatOp::OP_SUB }, VisualShaderNode::PORT_TYPE_SCALAR));
- add_options.push_back(AddOption("Subtract", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Subtracts two integer scalars."), { VisualShaderNodeIntOp::OP_SUB }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
+ add_options.push_back(AddOption("Subtract (-)", "Scalar/Operators", "VisualShaderNodeFloatOp", TTR("Subtracts two floating-point scalars."), { VisualShaderNodeFloatOp::OP_SUB }, VisualShaderNode::PORT_TYPE_SCALAR));
+ add_options.push_back(AddOption("Subtract (-)", "Scalar/Operators", "VisualShaderNodeIntOp", TTR("Subtracts two integer scalars."), { VisualShaderNodeIntOp::OP_SUB }, VisualShaderNode::PORT_TYPE_SCALAR_INT));
add_options.push_back(AddOption("FloatConstant", "Scalar/Variables", "VisualShaderNodeFloatConstant", TTR("Scalar floating-point constant."), {}, VisualShaderNode::PORT_TYPE_SCALAR));
add_options.push_back(AddOption("IntConstant", "Scalar/Variables", "VisualShaderNodeIntConstant", TTR("Scalar integer constant."), {}, VisualShaderNode::PORT_TYPE_SCALAR_INT));
@@ -5452,12 +5450,12 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Inverse", "Transform/Functions", "VisualShaderNodeTransformFunc", TTR("Calculates the inverse of a transform."), { VisualShaderNodeTransformFunc::FUNC_INVERSE }, VisualShaderNode::PORT_TYPE_TRANSFORM));
add_options.push_back(AddOption("Transpose", "Transform/Functions", "VisualShaderNodeTransformFunc", TTR("Calculates the transpose of a transform."), { VisualShaderNodeTransformFunc::FUNC_TRANSPOSE }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Add", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Sums two transforms."), { VisualShaderNodeTransformOp::OP_ADD }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Divide", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Divides two transforms."), { VisualShaderNodeTransformOp::OP_A_DIV_B }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Multiply", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Multiplies two transforms."), { VisualShaderNodeTransformOp::OP_AxB }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("MultiplyComp", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Performs per-component multiplication of two transforms."), { VisualShaderNodeTransformOp::OP_AxB_COMP }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("Subtract", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Subtracts two transforms."), { VisualShaderNodeTransformOp::OP_A_MINUS_B }, VisualShaderNode::PORT_TYPE_TRANSFORM));
- add_options.push_back(AddOption("TransformVectorMult", "Transform/Operators", "VisualShaderNodeTransformVecMult", TTR("Multiplies vector by transform."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Add (+)", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Sums two transforms."), { VisualShaderNodeTransformOp::OP_ADD }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+ add_options.push_back(AddOption("Divide (/)", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Divides two transforms."), { VisualShaderNodeTransformOp::OP_A_DIV_B }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+ add_options.push_back(AddOption("Multiply (*)", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Multiplies two transforms."), { VisualShaderNodeTransformOp::OP_AxB }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+ add_options.push_back(AddOption("MultiplyComp (*)", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Performs per-component multiplication of two transforms."), { VisualShaderNodeTransformOp::OP_AxB_COMP }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+ add_options.push_back(AddOption("Subtract (-)", "Transform/Operators", "VisualShaderNodeTransformOp", TTR("Subtracts two transforms."), { VisualShaderNodeTransformOp::OP_A_MINUS_B }, VisualShaderNode::PORT_TYPE_TRANSFORM));
+ add_options.push_back(AddOption("TransformVectorMult (*)", "Transform/Operators", "VisualShaderNodeTransformVecMult", TTR("Multiplies vector by transform."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("TransformConstant", "Transform/Variables", "VisualShaderNodeTransformConstant", TTR("Transform constant."), {}, VisualShaderNode::PORT_TYPE_TRANSFORM));
add_options.push_back(AddOption("TransformParameter", "Transform/Variables", "VisualShaderNodeTransformParameter", TTR("Transform parameter."), {}, VisualShaderNode::PORT_TYPE_TRANSFORM));
@@ -5573,21 +5571,21 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("MixS", "Vector/Functions", "VisualShaderNodeMix", TTR("Linear interpolation between two vectors using scalar."), { VisualShaderNodeMix::OP_TYPE_VECTOR_2D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("MixS", "Vector/Functions", "VisualShaderNodeMix", TTR("Linear interpolation between two vectors using scalar."), { VisualShaderNodeMix::OP_TYPE_VECTOR_3D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("MixS", "Vector/Functions", "VisualShaderNodeMix", TTR("Linear interpolation between two vectors using scalar."), { VisualShaderNodeMix::OP_TYPE_VECTOR_4D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("MultiplyAdd", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("MultiplyAdd", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("MultiplyAdd", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Negate", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Negate", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Negate", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("MultiplyAdd (a * b + c)", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("MultiplyAdd (a * b + c)", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("MultiplyAdd (a * b + c)", "Vector/Functions", "VisualShaderNodeMultiplyAdd", TTR("Performs a fused multiply-add operation (a * b + c) on vectors."), { VisualShaderNodeMultiplyAdd::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Negate (*-1)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Negate (*-1)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Negate (*-1)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the opposite value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_NEGATE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
add_options.push_back(AddOption("Normalize", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Calculates the normalize product of vector."), { VisualShaderNodeVectorFunc::FUNC_NORMALIZE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("Normalize", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Calculates the normalize product of vector."), { VisualShaderNodeVectorFunc::FUNC_NORMALIZE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("Normalize", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Calculates the normalize product of vector."), { VisualShaderNodeVectorFunc::FUNC_NORMALIZE, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("OneMinus", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("OneMinus", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("OneMinus", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Pow", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Pow", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Pow", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("OneMinus (1-)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("OneMinus (1-)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("OneMinus (1-)", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("1.0 - vector"), { VisualShaderNodeVectorFunc::FUNC_ONEMINUS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Pow (^)", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Pow (^)", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Pow (^)", "Vector/Functions", "VisualShaderNodeVectorOp", TTR("Returns the value of the first parameter raised to the power of the second."), { VisualShaderNodeVectorOp::OP_POW, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
add_options.push_back(AddOption("Radians", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Converts a quantity in degrees to radians."), { VisualShaderNodeVectorFunc::FUNC_RADIANS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("Radians", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Converts a quantity in degrees to radians."), { VisualShaderNodeVectorFunc::FUNC_RADIANS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("Radians", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Converts a quantity in degrees to radians."), { VisualShaderNodeVectorFunc::FUNC_RADIANS, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
@@ -5632,9 +5630,9 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("StepS", "Vector/Functions", "VisualShaderNodeStep", TTR("Step function( scalar(edge), vector(x) ).\n\nReturns 0.0 if 'x' is smaller than 'edge' and otherwise 1.0."), { VisualShaderNodeStep::OP_TYPE_VECTOR_2D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("StepS", "Vector/Functions", "VisualShaderNodeStep", TTR("Step function( scalar(edge), vector(x) ).\n\nReturns 0.0 if 'x' is smaller than 'edge' and otherwise 1.0."), { VisualShaderNodeStep::OP_TYPE_VECTOR_3D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("StepS", "Vector/Functions", "VisualShaderNodeStep", TTR("Step function( scalar(edge), vector(x) ).\n\nReturns 0.0 if 'x' is smaller than 'edge' and otherwise 1.0."), { VisualShaderNodeStep::OP_TYPE_VECTOR_4D_SCALAR }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Sum", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
- add_options.push_back(AddOption("Sum", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
- add_options.push_back(AddOption("Sum", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
+ add_options.push_back(AddOption("Sum (+)", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
+ add_options.push_back(AddOption("Sum (+)", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
+ add_options.push_back(AddOption("Sum (+)", "Vector/Functions", "VisualShaderNodeDerivativeFunc", TTR("(Fragment/Light mode only) (Vector) Sum of absolute derivative in 'x' and 'y'."), { VisualShaderNodeDerivativeFunc::FUNC_SUM, VisualShaderNodeDerivativeFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_FRAGMENT | TYPE_FLAGS_LIGHT, -1, true));
add_options.push_back(AddOption("Tan", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the tangent of the parameter."), { VisualShaderNodeVectorFunc::FUNC_TAN, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("Tan", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the tangent of the parameter."), { VisualShaderNodeVectorFunc::FUNC_TAN, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("Tan", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Returns the tangent of the parameter."), { VisualShaderNodeVectorFunc::FUNC_TAN, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
@@ -5645,21 +5643,21 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Trunc", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Finds the truncated value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_TRUNC, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("Trunc", "Vector/Functions", "VisualShaderNodeVectorFunc", TTR("Finds the truncated value of the parameter."), { VisualShaderNodeVectorFunc::FUNC_TRUNC, VisualShaderNodeVectorFunc::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Add", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 2D vector to 2D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Add", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 3D vector to 3D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Add", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 4D vector to 4D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Divide", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 2D vector by 2D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Divide", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 3D vector by 3D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Divide", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 4D vector by 4D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Multiply", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 2D vector by 2D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Multiply", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 3D vector by 3D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Multiply", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 4D vector by 4D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Add (+)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 2D vector to 2D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Add (+)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 3D vector to 3D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Add (+)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Adds 4D vector to 4D vector."), { VisualShaderNodeVectorOp::OP_ADD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Divide (/)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 2D vector by 2D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Divide (/)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 3D vector by 3D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Divide (/)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Divides 4D vector by 4D vector."), { VisualShaderNodeVectorOp::OP_DIV, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Multiply (*)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 2D vector by 2D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Multiply (*)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 3D vector by 3D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Multiply (*)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Multiplies 4D vector by 4D vector."), { VisualShaderNodeVectorOp::OP_MUL, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
add_options.push_back(AddOption("Remainder", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Returns the remainder of the two 2D vectors."), { VisualShaderNodeVectorOp::OP_MOD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("Remainder", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Returns the remainder of the two 3D vectors."), { VisualShaderNodeVectorOp::OP_MOD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
add_options.push_back(AddOption("Remainder", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Returns the remainder of the two 4D vectors."), { VisualShaderNodeVectorOp::OP_MOD, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
- add_options.push_back(AddOption("Subtract", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 2D vector from 2D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
- add_options.push_back(AddOption("Subtract", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 3D vector from 3D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
- add_options.push_back(AddOption("Subtract", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 4D vector from 4D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
+ add_options.push_back(AddOption("Subtract (-)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 2D vector from 2D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_2D }, VisualShaderNode::PORT_TYPE_VECTOR_2D));
+ add_options.push_back(AddOption("Subtract (-)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 3D vector from 3D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_3D }, VisualShaderNode::PORT_TYPE_VECTOR_3D));
+ add_options.push_back(AddOption("Subtract (-)", "Vector/Operators", "VisualShaderNodeVectorOp", TTR("Subtracts 4D vector from 4D vector."), { VisualShaderNodeVectorOp::OP_SUB, VisualShaderNodeVectorOp::OP_TYPE_VECTOR_4D }, VisualShaderNode::PORT_TYPE_VECTOR_4D));
add_options.push_back(AddOption("Vector2Constant", "Vector/Variables", "VisualShaderNodeVec2Constant", TTR("2D vector constant."), {}, VisualShaderNode::PORT_TYPE_VECTOR_2D));
add_options.push_back(AddOption("Vector2Parameter", "Vector/Variables", "VisualShaderNodeVec2Parameter", TTR("2D vector parameter."), {}, VisualShaderNode::PORT_TYPE_VECTOR_2D));
@@ -5894,7 +5892,7 @@ public:
return;
}
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
updating = true;
undo_redo->create_action(TTR("Edit Visual Property:") + " " + p_property, UndoRedo::MERGE_ENDS);
@@ -6096,7 +6094,7 @@ void EditorPropertyVisualShaderMode::_option_selected(int p_which) {
return;
}
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Visual Shader Mode Changed"));
//do is easy
undo_redo->add_do_method(visual_shader.ptr(), "set_mode", p_which);
@@ -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..b2a2566ad4 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -546,7 +546,6 @@ private:
Vector<String> failed_files;
- int idx = 0;
while (ret == UNZ_OK) {
//get filename
unz_file_info info;
@@ -585,7 +584,6 @@ private:
}
}
- idx++;
ret = unzGoToNextFile(pkg);
}
@@ -714,7 +712,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 +1263,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 +1914,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 +2559,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 +2585,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 +2594,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 +2813,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 +2852,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 +2934,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 +2942,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..28111bed58 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -114,6 +114,7 @@ void ProjectSettingsEditor::_add_setting() {
Variant value;
Variant::construct(Variant::Type(type_box->get_selected_id()), value, nullptr, 0, ce);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add Project Setting"));
undo_redo->add_do_property(ps, setting, value);
undo_redo->add_undo_property(ps, setting, ps->has_setting(setting) ? ps->get(setting) : Variant());
@@ -133,6 +134,7 @@ void ProjectSettingsEditor::_delete_setting() {
Variant value = ps->get(setting);
int order = ps->get_order(setting);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Delete Item"));
undo_redo->add_do_method(ps, "clear", setting);
@@ -221,9 +223,9 @@ void ProjectSettingsEditor::_select_type(Variant::Type p_type) {
void ProjectSettingsEditor::shortcut_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
const Ref<InputEventKey> k = p_event;
-
if (k.is_valid() && k->is_pressed()) {
bool handled = false;
@@ -339,6 +341,7 @@ void ProjectSettingsEditor::_action_added(const String &p_name) {
action["events"] = Array();
action["deadzone"] = 0.5f;
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add Input Action"));
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name);
@@ -352,8 +355,9 @@ 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);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (old_val["deadzone"] != p_action["deadzone"]) {
// Deadzone Changed
undo_redo->create_action(TTR("Change Action deadzone"));
@@ -387,9 +391,10 @@ 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);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Erase Input Action"));
undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", property_name);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property_name, old_val);
@@ -410,8 +415,9 @@ 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);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Rename Input Action Event"));
// Do: clear old, set new
undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", old_property_name);
@@ -441,6 +447,7 @@ void ProjectSettingsEditor::_action_reordered(const String &p_action_name, const
HashMap<String, Variant> action_values;
ProjectSettings::get_singleton()->get_property_list(&props);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Update Input Action Order"));
for (const PropertyInfo &prop : props) {
@@ -505,7 +512,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;
@@ -573,7 +580,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
set_title(TTR("Project Settings (project.godot)"));
ps = ProjectSettings::get_singleton();
- undo_redo = p_data->get_undo_redo();
data = p_data;
tab_container = memnew(TabContainer);
@@ -632,7 +638,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
custom_properties->add_child(del_button);
general_settings_inspector = memnew(SectionedInspector);
- general_settings_inspector->get_inspector()->set_undo_redo(EditorNode::get_undo_redo());
general_settings_inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
general_settings_inspector->register_search_box(search_box);
general_settings_inspector->get_inspector()->set_use_filter(true);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index ec10c76cb7..7f6dd1b692 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -42,7 +42,6 @@
#include "editor/shader_globals_editor.h"
#include "scene/gui/tab_container.h"
-class EditorUndoRedoManager;
class FileSystemDock;
class ProjectSettingsEditor : public AcceptDialog {
@@ -78,7 +77,6 @@ class ProjectSettingsEditor : public AcceptDialog {
ImportDefaultsEditor *import_defaults_editor = nullptr;
EditorData *data = nullptr;
- Ref<EditorUndoRedoManager> undo_redo;
void _advanced_toggled(bool p_button_pressed);
void _update_advanced(bool p_is_advanced);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index ee358a8064..64ac38aaa5 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -42,6 +42,7 @@
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/editor_undo_redo_manager.h"
#include "editor/multi_node_edit.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
@@ -267,7 +268,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base)
return;
}
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Replace with Branch Scene"));
Node *parent = base->get_parent();
@@ -946,7 +947,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 +1238,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 +1326,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 +1334,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 +1402,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 +2449,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 +2896,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 +3220,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 +3267,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);
@@ -3566,7 +3569,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
editor_selection->connect("selection_changed", callable_mp(this, &SceneTreeDock::_selection_changed));
- scene_tree->set_undo_redo(editor_data->get_undo_redo());
+ scene_tree->set_as_scene_tree_dock();
scene_tree->set_editor_selection(editor_selection);
create_dialog = memnew(CreateDialog);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index da727a127a..46d3502a24 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -68,6 +68,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
Node *n = get_node(np);
ERR_FAIL_COND(!n);
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (p_id == BUTTON_SUBSCENE) {
if (n == get_scene_node()) {
if (n && n->get_scene_inherited_state().is_valid()) {
@@ -167,6 +168,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
void SceneTreeEditor::_toggle_visible(Node *p_node) {
if (p_node->has_method("is_visible") && p_node->has_method("set_visible")) {
bool v = bool(p_node->call("is_visible"));
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->add_do_method(p_node, "set_visible", !v);
undo_redo->add_undo_method(p_node, "set_visible", v);
}
@@ -379,8 +381,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
item->set_tooltip_text(0, tooltip);
}
- if (can_open_instance && undo_redo.is_valid()) { //Show buttons only when necessary(SceneTreeDock) to avoid crashes
-
+ if (can_open_instance && is_scene_tree_dock) { // Show buttons only when necessary (SceneTreeDock) to avoid crashes.
if (!p_node->is_connected("script_changed", callable_mp(this, &SceneTreeEditor::_node_script_changed))) {
p_node->connect("script_changed", callable_mp(this, &SceneTreeEditor::_node_script_changed).bind(p_node));
}
@@ -483,8 +484,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;
}
@@ -996,11 +998,12 @@ void SceneTreeEditor::_renamed() {
return;
}
- if (!undo_redo.is_valid()) {
+ if (!is_scene_tree_dock) {
n->set_name(new_name);
which->set_metadata(0, n->get_path());
emit_signal(SNAME("node_renamed"));
} else {
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Rename Node"));
emit_signal(SNAME("node_prerename"), n, new_name);
undo_redo->add_do_method(this, "_rename_node", n->get_instance_id(), new_name);
@@ -1044,8 +1047,8 @@ String SceneTreeEditor::get_filter_term_warning() {
return filter_term_warning;
}
-void SceneTreeEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
- undo_redo = p_undo_redo;
+void SceneTreeEditor::set_as_scene_tree_dock() {
+ is_scene_tree_dock = true;
}
void SceneTreeEditor::set_display_foreign_nodes(bool p_display) {
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index dcdfead885..33ef5dbcb3 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -37,8 +37,6 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
-class EditorUndoRedoManager;
-
class SceneTreeEditor : public Control {
GDCLASS(SceneTreeEditor, Control);
@@ -98,9 +96,9 @@ class SceneTreeEditor : public Control {
bool can_open_instance;
bool updating_tree = false;
bool show_enabled_subscene = false;
+ bool is_scene_tree_dock = false;
void _renamed();
- Ref<EditorUndoRedoManager> undo_redo;
HashSet<Node *> marked;
bool marked_selectable = false;
@@ -145,7 +143,7 @@ public:
String get_filter() const;
String get_filter_term_warning();
- void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo);
+ void set_as_scene_tree_dock();
void set_display_foreign_nodes(bool p_display);
void set_marked(const HashSet<Node *> &p_marked, bool p_selectable = false, bool p_children_selectable = true);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index cc09c3a432..08c0f0f708 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -275,7 +275,6 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
bool found = false;
bool match = false;
- int index = 0;
for (const String &E : extensions) {
if (E.nocasecmp_to(extension) == 0) {
found = true;
@@ -284,7 +283,6 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
}
break;
}
- index++;
}
if (!found) {
@@ -373,7 +371,7 @@ void ScriptCreateDialog::_create_new() {
const ScriptLanguage::ScriptTemplate sinfo = _get_current_template();
String parent_class = parent_name->get_text();
- if (!ClassDB::class_exists(parent_class) && !ScriptServer::is_global_class(parent_class)) {
+ if (!parent_name->get_text().is_quoted() && !ClassDB::class_exists(parent_class) && !ScriptServer::is_global_class(parent_class)) {
// If base is a custom type, replace with script path instead.
const EditorData::CustomType *type = EditorNode::get_editor_data().get_custom_type_by_name(parent_class);
ERR_FAIL_NULL(type);
diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp
index 473bbd69d9..596b3eefba 100644
--- a/editor/shader_globals_editor.cpp
+++ b/editor/shader_globals_editor.cpp
@@ -86,7 +86,7 @@ protected:
return false;
}
- Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo();
+ Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Set Shader Global Variable"));
undo_redo->add_do_method(RS::get_singleton(), "global_shader_parameter_set", p_name, p_value);
@@ -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();