Skip to content

Commit 402805d

Browse files
committed
Merge pull request #112267 from KoBeWi/sk8leton
Remove default skeleton path in MeshInstance3D
2 parents 4ca3a90 + d27fb9b commit 402805d

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

core/config/project_settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,9 @@ ProjectSettings::ProjectSettings() {
16481648
GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
16491649
GLOBAL_DEF("animation/warnings/check_invalid_track_paths", true);
16501650
GLOBAL_DEF("animation/warnings/check_angle_interpolation_type_conflicting", true);
1651+
#ifndef DISABLE_DEPRECATED
1652+
GLOBAL_DEF_RST("animation/compatibility/default_parent_skeleton_in_mesh_instance_3d", false);
1653+
#endif
16511654

16521655
GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"), "res://default_bus_layout.tres");
16531656
GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/default_playback_type", PROPERTY_HINT_ENUM, "Stream,Sample"), 0);

doc/classes/MeshInstance3D.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@
128128
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
129129
The [Mesh] resource for the instance.
130130
</member>
131-
<member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath(&quot;..&quot;)">
131+
<member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath(&quot;&quot;)">
132132
[NodePath] to the [Skeleton3D] associated with the instance.
133+
[b]Note:[/b] The default value of this property has changed in Godot 4.6. Enable [member ProjectSettings.animation/compatibility/default_parent_skeleton_in_mesh_instance_3d] if the old behavior is needed for compatibility.
133134
</member>
134135
<member name="skin" type="Skin" setter="set_skin" getter="get_skin">
135136
The [Skin] to be used by this instance.

doc/classes/ProjectSettings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@
269269
<member name="accessibility/general/updates_per_second" type="int" setter="" getter="" default="60">
270270
The number of accessibility information updates per second.
271271
</member>
272+
<member name="animation/compatibility/default_parent_skeleton_in_mesh_instance_3d" type="bool" setter="" getter="" default="false">
273+
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.
274+
</member>
272275
<member name="animation/warnings/check_angle_interpolation_type_conflicting" type="bool" setter="" getter="" default="true">
273276
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.
274277
</member>

scene/3d/mesh_instance_3d.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,11 @@ void MeshInstance3D::_bind_methods() {
926926

927927
MeshInstance3D::MeshInstance3D() {
928928
_define_ancestry(AncestralClass::MESH_INSTANCE_3D);
929+
#ifndef DISABLE_DEPRECATED
930+
if (use_parent_skeleton_compat) {
931+
skeleton_path = NodePath("..");
932+
}
933+
#endif
929934
}
930935

931936
MeshInstance3D::~MeshInstance3D() {

scene/3d/mesh_instance_3d.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class MeshInstance3D : public GeometryInstance3D {
4949
Ref<Skin> skin;
5050
Ref<Skin> skin_internal;
5151
Ref<SkinReference> skin_ref;
52-
NodePath skeleton_path = NodePath("..");
52+
NodePath skeleton_path;
5353

5454
LocalVector<float> blend_shape_tracks;
5555
HashMap<StringName, int> blend_shape_properties;
@@ -73,6 +73,10 @@ class MeshInstance3D : public GeometryInstance3D {
7373
public:
7474
static constexpr AncestralClass static_ancestral_class = AncestralClass::MESH_INSTANCE_3D;
7575

76+
#ifndef DISABLE_DEPRECATED
77+
static inline bool use_parent_skeleton_compat = false;
78+
#endif
79+
7680
void set_mesh(const Ref<Mesh> &p_mesh);
7781
Ref<Mesh> get_mesh() const;
7882

scene/register_scene_types.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ void register_scene_types() {
607607
GDREGISTER_CLASS(Camera3D);
608608
GDREGISTER_CLASS(AudioListener3D);
609609
GDREGISTER_CLASS(MeshInstance3D);
610+
#ifndef DISABLE_DEPRECATED
611+
MeshInstance3D::use_parent_skeleton_compat = GLOBAL_GET("animation/compatibility/default_parent_skeleton_in_mesh_instance_3d");
612+
#endif
610613
GDREGISTER_CLASS(OccluderInstance3D);
611614
GDREGISTER_ABSTRACT_CLASS(Occluder3D);
612615
GDREGISTER_CLASS(ArrayOccluder3D);

0 commit comments

Comments
 (0)