diff --git a/source/blender/animrig/intern/keyframing.cc b/source/blender/animrig/intern/keyframing.cc index 9be15b8c770..d4ee04c3b27 100644 --- a/source/blender/animrig/intern/keyframing.cc +++ b/source/blender/animrig/intern/keyframing.cc @@ -1091,10 +1091,16 @@ CombinedKeyingResult insert_keyframes(Main *bmain, &force_all, rna_values_mask); - const std::optional rna_path_id_to_prop = RNA_path_from_ID_to_property(&ptr, - prop); + std::optional rna_path_id_to_prop = RNA_path_from_ID_to_property(&ptr, prop); if (!rna_path_id_to_prop.has_value()) { - continue; + /* In the case of nested RNA properties the path cannot be reconstructed in all cases. There + * may be a system in place in the future, see #122427.*/ + if (struct_pointer->data != id) { + continue; + } + /* However if the struct pointer happens to be an ID pointer we can use the path that was + * passed in. This fixes issues like #132195.*/ + rna_path_id_to_prop = rna_path.path; } /* Handle the `force_all` condition mentioned above, ensuring the diff --git a/tests/python/bl_animation_keyframing.py b/tests/python/bl_animation_keyframing.py index 30ce785b149..42a80c1ea7b 100644 --- a/tests/python/bl_animation_keyframing.py +++ b/tests/python/bl_animation_keyframing.py @@ -266,6 +266,15 @@ class InsertKeyTest(AbstractKeyframingTest, unittest.TestCase): self.assertEqual('show_wire', fcurves[0].data_path) self.assertEqual(["Téšt"], [group.name for group in fgroups]) + def test_keyframe_insert_nested_rna_path(self): + bpy.ops.mesh.primitive_cube_add() + obj = bpy.context.object + obj.data.attributes.new("test", "FLOAT", "POINT") + self.assertTrue(obj.data.keyframe_insert('attributes["test"].data[0].value')) + fcurves = obj.data.animation_data.action.fcurves + self.assertEqual(len(fcurves), 1) + self.assertEqual(fcurves[0].data_path, 'attributes["test"].data[0].value') + class VisualKeyingTest(AbstractKeyframingTest, unittest.TestCase): """ Check if visual keying produces the correct keyframe values. """