From 3faafe7af51d7d19411a5fd4e398a62a3df33efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 16 Oct 2025 11:05:50 +0200 Subject: [PATCH] Fix #147796: Animated Transforms to Deltas resets non-animated props Instead of always resetting the 'standard' transform, only reset those array elements that were actually animated (and whose animation has thus been transfered to the corresponding 'delta' transform). This approach also has the advantage of using the defaults from RNA, rather than hard-coding defaults based on the property name. Pull Request: https://projects.blender.org/blender/blender/pulls/147982 --- scripts/startup/bl_operators/object.py | 33 +++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/scripts/startup/bl_operators/object.py b/scripts/startup/bl_operators/object.py index 5e7b211298b..270d7806395 100644 --- a/scripts/startup/bl_operators/object.py +++ b/scripts/startup/bl_operators/object.py @@ -881,24 +881,23 @@ class TransformsToDeltasAnim(Operator): # no conflict yet existingFCurves[dpath] = [fcu.array_index] - # if F-Curve uses standard transform path - # just append "delta_" to this path + # Move the 'standard' to the 'delta' data paths. for fcu in channelbag.fcurves: - if fcu.data_path == "location": - fcu.data_path = "delta_location" - obj.location.zero() - elif fcu.data_path == "rotation_euler": - fcu.data_path = "delta_rotation_euler" - obj.rotation_euler.zero() - elif fcu.data_path == "rotation_quaternion": - fcu.data_path = "delta_rotation_quaternion" - obj.rotation_quaternion.identity() - # XXX: currently not implemented - # ~ elif fcu.data_path == "rotation_axis_angle": - # ~ fcu.data_path = "delta_rotation_axis_angle" - elif fcu.data_path == "scale": - fcu.data_path = "delta_scale" - obj.scale = 1.0, 1.0, 1.0 + standard_path = fcu.data_path + array_index = fcu.array_index + try: + delta_path = STANDARD_TO_DELTA_PATHS[standard_path] + except KeyError: + # Not a standard transform path. + continue + + # Just change the F-Curve's data path. The array index should remain the same. + fcu.data_path = delta_path + + # Reset the now-no-longer-animated property to its default value. + default_array = obj.bl_rna.properties[standard_path].default_array + property_array = getattr(obj, standard_path) + property_array[array_index] = default_array[array_index] # hack: force animsys flush by changing frame, so that deltas get run context.scene.frame_set(context.scene.frame_current)