diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index adf2a7c7895..99a2fc67146 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -989,6 +989,21 @@ Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path,
// Fallback to text-based project.godot file if binary was not found.
err = _load_settings_text(p_text_path);
if (err == OK) {
+#ifndef DISABLE_DEPRECATED
+ const PackedStringArray features = get_setting("application/config/features");
+ for (const String &feat : features) {
+ if (feat.contains_char('.') && feat.get_slice_count(".") == 2) {
+ int major_version = feat.get_slicec('.', 0).to_int();
+ int minor_version = feat.get_slicec('.', 1).to_int();
+ // Major version is irrelevant, but the extra check ensures that the feature is in fact a version string.
+ if (major_version == 4 && minor_version < 6) {
+ // Enable MeshInstance3D compat for projects created before 4.6.
+ set_setting("animation/compatibility/default_parent_skeleton_in_mesh_instance_3d", true);
+ }
+ break;
+ }
+ }
+#endif
return OK;
} else if (err != ERR_FILE_NOT_FOUND) {
ERR_PRINT(vformat("Couldn't load file '%s', error code %d.", p_text_path, err));
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 6f5486be0a4..1c7525b3afa 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -284,6 +284,7 @@
If [code]true[/code], [member MeshInstance3D.skeleton] will point to the parent node ([code]..[/code]) by default, which was the behavior before Godot 4.6. It's recommended to keep this setting disabled unless the old behavior is needed for compatibility.
+ [b]Note:[/b] If you disable this option in an existing project, it's strongly recommended to use the [code]Project > Tools > Upgrade Project Files...[/code] option to ensure existing scenes do not break.
If [code]true[/code], [AnimationMixer] prints the warning of interpolation being forced to choose the shortest rotation path due to multiple angle interpolation types being mixed in the [AnimationMixer] cache.
diff --git a/editor/project_upgrade/project_upgrade_tool.cpp b/editor/project_upgrade/project_upgrade_tool.cpp
index c984803b62b..432839a0709 100644
--- a/editor/project_upgrade/project_upgrade_tool.cpp
+++ b/editor/project_upgrade/project_upgrade_tool.cpp
@@ -30,12 +30,14 @@
#include "project_upgrade_tool.h"
+#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "editor/editor_node.h"
#include "editor/file_system/editor_file_system.h"
#include "editor/scene/editor_scene_tabs.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
+#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/dialogs.h"
void ProjectUpgradeTool::_add_files(EditorFileSystemDirectory *p_dir, Vector &r_reimport_paths, Vector &r_resave_scenes, Vector &r_resave_resources) {
@@ -77,6 +79,9 @@ void ProjectUpgradeTool::popup_dialog() {
void ProjectUpgradeTool::prepare_upgrade() {
EditorSettings::get_singleton()->set_project_metadata(META_PROJECT_UPGRADE_TOOL, META_RUN_ON_RESTART, true);
+ ProjectSettings::get_singleton()->set_setting("animation/compatibility/default_parent_skeleton_in_mesh_instance_3d", false);
+ ProjectSettings::get_singleton()->save();
+
Vector reimport_paths;
Vector resave_scenes;
Vector resave_resources;
@@ -102,6 +107,7 @@ void ProjectUpgradeTool::finish_upgrade() {
EditorFileSystem::get_singleton()->reimport_files(paths);
EditorSettings::get_singleton()->set_project_metadata(META_PROJECT_UPGRADE_TOOL, META_REIMPORT_PATHS, Variant());
+ MeshInstance3D::upgrading_skeleton_compat = true;
{
paths = EditorSettings::get_singleton()->get_project_metadata(META_PROJECT_UPGRADE_TOOL, META_RESAVE_SCENES, Vector());
EditorProgress ep("uid_upgrade_resave", TTR("Updating Project Scenes"), paths.size());
@@ -115,6 +121,7 @@ void ProjectUpgradeTool::finish_upgrade() {
}
EditorSettings::get_singleton()->set_project_metadata(META_PROJECT_UPGRADE_TOOL, META_RESAVE_SCENES, Variant());
}
+ MeshInstance3D::upgrading_skeleton_compat = false;
{
paths = EditorSettings::get_singleton()->get_project_metadata(META_PROJECT_UPGRADE_TOOL, META_RESAVE_RESOURCES, Vector());
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index e1378398fd3..e44c955a6aa 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -342,6 +342,13 @@ void MeshInstance3D::create_multiple_convex_collisions(const Ref(get_parent())) {
+ skeleton_path = NodePath("..");
+ }
+ }
+#endif
_resolve_skeleton_path();
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h
index fe0f8993053..34a344da694 100644
--- a/scene/3d/mesh_instance_3d.h
+++ b/scene/3d/mesh_instance_3d.h
@@ -75,6 +75,7 @@ public:
#ifndef DISABLE_DEPRECATED
static inline bool use_parent_skeleton_compat = false;
+ static inline bool upgrading_skeleton_compat = false;
#endif
void set_mesh(const Ref &p_mesh);