diff options
author | Daniel Salazar <zanqdo@gmail.com> | 2011-12-09 10:21:26 +0400 |
---|---|---|
committer | Daniel Salazar <zanqdo@gmail.com> | 2011-12-09 10:21:26 +0400 |
commit | fbdb8b414d9734606f1e51304b7c355e2f59e02f (patch) | |
tree | 74904208bf65647878c33d2245e8541ac99a0e50 /release/scripts | |
parent | fd543185cc2fa802df15e33c823d61d0f3ede89d (diff) |
[#29509] Randomize rotations fails with Axis/Angle
Fix based on Brecht's idea: use Blender's conversion from quat or axis angle to euler and back. Euler rotations are left alone so their rotation order is respected
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_operators/object_randomize_transform.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index ed881fab5fd..319fd1526fb 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -42,8 +42,13 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even, scale_min): else: # otherwise the values change under us uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0) - if rot: # TODO, non euler's + if rot: vec = rand_vec(rot) + + rotation_mode = obj.rotation_mode + if rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): + obj.rotation_mode = 'XYZ' + if delta: obj.delta_rotation_euler[0] += vec[0] obj.delta_rotation_euler[1] += vec[1] @@ -52,6 +57,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even, scale_min): obj.rotation_euler[0] += vec[0] obj.rotation_euler[1] += vec[1] obj.rotation_euler[2] += vec[2] + obj.rotation_mode = rotation_mode else: uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0) |