From a485bf65564f5445e121fbda7efdbd0571f5280b Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 6 Mar 2025 15:51:44 +0100 Subject: [PATCH] Fix #134034: Baking a custom property with a name existing in Blender failed When baking custom properties that were named exactly the same as a property already in Blender (in this case `scale`), it would fail. The issue was introduced with eee32726c7 where the goal was to not key addon defined properties. The problem with that approach was that `obj.bpy_rna.properties` not only contains addon defined properties but also all that are native to Blender. So the rna path would be created to be identical as for e.g. transform properties. The fix is to test the property for `is_runtime` which is true for addon defined properties but false for blender internal properties I tested with the test file of #121349 to confirm that doing so doesn't bring that original bug back. Pull Request: https://projects.blender.org/blender/blender/pulls/135297 --- scripts/modules/bpy_extras/anim_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/modules/bpy_extras/anim_utils.py b/scripts/modules/bpy_extras/anim_utils.py index e566daad758..9c2c91fd05c 100644 --- a/scripts/modules/bpy_extras/anim_utils.py +++ b/scripts/modules/bpy_extras/anim_utils.py @@ -279,7 +279,10 @@ def bake_action_iter( if isinstance(obj[key], idprop.types.IDPropertyGroup): continue obj[key] = value - if key in obj.bl_rna.properties: + # The check for `is_runtime` is needed in case the custom property has the same + # name as a built in property, e.g. `scale`. In that case the simple check + # `key in ...` would be true and the square brackets would never get added. + if key in obj.bl_rna.properties and obj.bl_rna.properties[key].is_runtime: rna_path = key else: rna_path = "[\"{:s}\"]".format(bpy.utils.escape_identifier(key))