diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | core/input/input.cpp | 12 | ||||
-rw-r--r-- | core/input/input.h | 2 | ||||
-rw-r--r-- | doc/classes/EditorFileDialog.xml | 6 | ||||
-rw-r--r-- | doc/classes/ResourceLoader.xml | 2 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 4 | ||||
-rw-r--r-- | editor/gui/editor_file_dialog.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/themes/editor_theme_manager.cpp | 2 | ||||
-rw-r--r-- | platform/android/detect.py | 2 | ||||
-rw-r--r-- | scene/3d/cpu_particles_3d.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 25 | ||||
-rw-r--r-- | scene/gui/control.h | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp | 2 |
15 files changed, 54 insertions, 17 deletions
diff --git a/.clang-tidy b/.clang-tidy index 659b91013d..02aa95c709 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,7 +2,6 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init' WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false FormatStyle: none CheckOptions: - key: cert-dcl16-c.NewSuffixes diff --git a/core/input/input.cpp b/core/input/input.cpp index 1eabfacd8e..a8409cc06d 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -858,7 +858,7 @@ void Input::warp_mouse(const Vector2 &p_position) { warp_mouse_func(p_position); } -Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) { +Point2 Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) { // The relative distance reported for the next event after a warp is in the boundaries of the // size of the rect on that axis, but it may be greater, in which case there's no problem as fmod() // will warp it, but if the pointer has moved in the opposite direction between the pointer relocation @@ -868,14 +868,14 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con // detect the warp: if the relative distance is greater than the half of the size of the relevant rect // (checked per each axis), it will be considered as the consequence of a former pointer warp. - const Point2i rel_sign(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1); - const Size2i warp_margin = p_rect.size * 0.5f; - const Point2i rel_warped( + const Point2 rel_sign(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1); + const Size2 warp_margin = p_rect.size * 0.5f; + const Point2 rel_warped( Math::fmod(p_motion->get_relative().x + rel_sign.x * warp_margin.x, p_rect.size.x) - rel_sign.x * warp_margin.x, Math::fmod(p_motion->get_relative().y + rel_sign.y * warp_margin.y, p_rect.size.y) - rel_sign.y * warp_margin.y); - const Point2i pos_local = p_motion->get_global_position() - p_rect.position; - const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y)); + const Point2 pos_local = p_motion->get_global_position() - p_rect.position; + const Point2 pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y)); if (pos_warped != pos_local) { warp_mouse(pos_warped + p_rect.position); } diff --git a/core/input/input.h b/core/input/input.h index 93407da2d9..6e7ab43082 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -316,7 +316,7 @@ public: BitField<MouseButtonMask> get_mouse_button_mask() const; void warp_mouse(const Vector2 &p_position); - Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect); + Point2 warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect); void parse_input_event(const Ref<InputEvent> &p_event); diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml index 4befcf5e69..d5c2ed55d7 100644 --- a/doc/classes/EditorFileDialog.xml +++ b/doc/classes/EditorFileDialog.xml @@ -90,6 +90,12 @@ Notify the [EditorFileDialog] that its view of the data is no longer accurate. Updates the view contents on next view update. </description> </method> + <method name="popup_file_dialog"> + <return type="void" /> + <description> + Shows the [EditorFileDialog] at the default size and position for file dialogs in the editor, and selects the file name if there is a current file. + </description> + </method> <method name="set_option_default"> <return type="void" /> <param index="0" name="option" type="int" /> diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml index 885c6f0478..1961ca2b0e 100644 --- a/doc/classes/ResourceLoader.xml +++ b/doc/classes/ResourceLoader.xml @@ -76,7 +76,7 @@ The registered [ResourceFormatLoader]s are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted. An optional [param type_hint] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. Anything that inherits from [Resource] can be used as a type hint, for example [Image]. The [param cache_mode] property defines whether and how the cache should be used or updated when loading the resource. See [enum CacheMode] for details. - Returns an empty resource if no [ResourceFormatLoader] could handle the file. + Returns an empty resource if no [ResourceFormatLoader] could handle the file, and prints an error if no file is found at the specified path. GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios. [b]Note:[/b] If [member ProjectSettings.editor/export/convert_text_resources_to_binary] is [code]true[/code], [method @GDScript.load] will not be able to read converted files in an exported project. If you rely on run-time loading of files present within the PCK, set [member ProjectSettings.editor/export/convert_text_resources_to_binary] to [code]false[/code]. [b]Note:[/b] Relative paths will be prefixed with [code]"res://"[/code] before loading, to avoid unexpected results make sure your paths are absolute. diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ac4991755b..01d9096db3 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1220,8 +1220,10 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit if (is_imported) { SceneImportSettingsDialog::get_singleton()->open_settings(p_path, resource_type == "AnimationLibrary"); - } else { + } else if (resource_type == "PackedScene") { EditorNode::get_singleton()->open_request(fpath); + } else { + EditorNode::get_singleton()->load_resource(fpath); } } else if (ResourceLoader::is_imported(fpath)) { // If the importer has advanced settings, show them. diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index f0ad2946d0..7d26cb21fb 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -1929,6 +1929,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_disable_overwrite_warning", "disable"), &EditorFileDialog::set_disable_overwrite_warning); ClassDB::bind_method(D_METHOD("is_overwrite_warning_disabled"), &EditorFileDialog::is_overwrite_warning_disabled); ClassDB::bind_method(D_METHOD("add_side_menu", "menu", "title"), &EditorFileDialog::add_side_menu, DEFVAL("")); + ClassDB::bind_method(D_METHOD("popup_file_dialog"), &EditorFileDialog::popup_file_dialog); ClassDB::bind_method(D_METHOD("invalidate"), &EditorFileDialog::invalidate); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 4a418e62ca..45bae96f77 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2593,8 +2593,8 @@ void Node3DEditorViewport::scale_freelook_speed(real_t scale) { surface->queue_redraw(); } -Point2i Node3DEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const { - Point2i relative; +Point2 Node3DEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const { + Point2 relative; if (bool(EDITOR_GET("editors/3d/navigation/warped_mouse_panning"))) { relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect()); } else { diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 96210de403..a3e1224cb8 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -430,7 +430,7 @@ private: void _selection_result_pressed(int); void _selection_menu_hide(); void _list_select(Ref<InputEventMouseButton> b); - Point2i _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const; + Point2 _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const; Vector3 _get_instance_position(const Point2 &p_pos) const; static AABB _calculate_spatial_bounds(const Node3D *p_parent, const Node3D *p_top_level_parent = nullptr); diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index ddacce6270..ee008e5636 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -1291,7 +1291,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the // Use a different color for folder icons to make them easier to distinguish from files. // On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color. p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7)); - p_theme->set_color("files_disabled", "FileDialog", p_config.font_disabled_color); + p_theme->set_color("file_disabled_color", "FileDialog", p_config.font_disabled_color); // PopupDialog. p_theme->set_stylebox("panel", "PopupDialog", p_config.popup_style); diff --git a/platform/android/detect.py b/platform/android/detect.py index cbd6144182..6a8c4ed86d 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -88,7 +88,7 @@ def install_ndk_if_needed(env: "SConsEnvironment"): else: print_error( f'Cannot find "{sdkmanager}". Please ensure ANDROID_HOME is correct and cmdline-tools' - f'are installed, or install NDK version "{get_ndk_version()}" manually.' + f' are installed, or install NDK version "{get_ndk_version()}" manually.' ) sys.exit(255) env["ANDROID_NDK_ROOT"] = get_android_ndk_root(env) diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index db7b80683c..5aa50a4a21 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -1125,7 +1125,7 @@ void CPUParticles3D::_particles_process(double p_delta) { //turn particle by rotation in Y if (particle_flags[PARTICLE_FLAG_ROTATE_Y]) { Basis rot_y(Vector3(0, 1, 0), p.custom[0]); - p.transform.basis = p.transform.basis * rot_y; + p.transform.basis = rot_y; } } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 7ac7ceb6bc..d78077316a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1383,6 +1383,15 @@ void Control::_set_position(const Point2 &p_point) { void Control::set_position(const Point2 &p_point, bool p_keep_offsets) { ERR_MAIN_THREAD_GUARD; + +#ifdef TOOLS_ENABLED + // Can't compute anchors, set position directly and return immediately. + if (saving && !is_inside_tree()) { + data.pos_cache = p_point; + return; + } +#endif + if (p_keep_offsets) { _compute_anchors(Rect2(p_point, data.size_cache), data.offset, data.anchor); } else { @@ -1441,6 +1450,14 @@ void Control::set_size(const Size2 &p_size, bool p_keep_offsets) { new_size.y = min.y; } +#ifdef TOOLS_ENABLED + // Can't compute anchors, set size directly and return immediately. + if (saving && !is_inside_tree()) { + data.size_cache = new_size; + return; + } +#endif + if (p_keep_offsets) { _compute_anchors(Rect2(data.pos_cache, new_size), data.offset, data.anchor); } else { @@ -3140,6 +3157,14 @@ Control *Control::make_custom_tooltip(const String &p_text) const { void Control::_notification(int p_notification) { ERR_MAIN_THREAD_GUARD; switch (p_notification) { +#ifdef TOOLS_ENABLED + case NOTIFICATION_EDITOR_PRE_SAVE: { + saving = true; + } break; + case NOTIFICATION_EDITOR_POST_SAVE: { + saving = false; + } break; +#endif case NOTIFICATION_POSTINITIALIZE: { data.initialized = true; diff --git a/scene/gui/control.h b/scene/gui/control.h index bdb908e089..c784d4330d 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -47,6 +47,10 @@ class ThemeContext; class Control : public CanvasItem { GDCLASS(Control, CanvasItem); +#ifdef TOOLS_ENABLED + bool saving = false; +#endif + public: enum Anchor { ANCHOR_BEGIN = 0, diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index 733cbd1ff2..dd722cc2dd 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -587,7 +587,7 @@ void SceneShaderForwardMobile::init(const String p_defines) { actions.usage_defines["COLOR"] = "#define COLOR_USED\n"; actions.usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n"; actions.usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n"; - actions.usage_defines["LIGHT_VERTEX"] = "#define LIGHT_VERTEX\n"; + actions.usage_defines["LIGHT_VERTEX"] = "#define LIGHT_VERTEX_USED\n"; actions.usage_defines["ALPHA_SCISSOR_THRESHOLD"] = "#define ALPHA_SCISSOR_USED\n"; actions.usage_defines["ALPHA_HASH_SCALE"] = "#define ALPHA_HASH_USED\n"; |