[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35008] trunk/blender/release/scripts/ modules/bpy_types.py: bug [#26089] editbone.transfrom() seems to mess up bone roll (by more than float precision error)
Campbell Barton
ideasman42 at gmail.com
Mon Feb 21 02:29:35 CET 2011
Revision: 35008
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35008
Author: campbellbarton
Date: 2011-02-21 01:29:35 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
bug [#26089] editbone.transfrom() seems to mess up bone roll (by more than float precision error)
This is intentional behavior but add options not to transform the bones scale & roll.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy_types.py
Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py 2011-02-21 01:02:30 UTC (rev 35007)
+++ trunk/blender/release/scripts/modules/bpy_types.py 2011-02-21 01:29:35 UTC (rev 35008)
@@ -278,21 +278,31 @@
self.tail = self.head + vec
self.roll = other.roll
- def transform(self, matrix):
+ def transform(self, matrix, scale=True, roll=True):
"""
Transform the the bones head, tail, roll and envalope (when the matrix has a scale component).
- Expects a 4x4 or 3x3 matrix.
+
+ :arg matrix: 3x3 or 4x4 transformation matrix.
+ :type matrix: :class:`Matrix`
+ :arg scale: Scale the bone envalope by the matrix.
+ :type scale: bool
+ :arg roll: Correct the roll to point in the same relative direction to the head and tail.
+ :type roll: bool
"""
from mathutils import Vector
z_vec = Vector((0.0, 0.0, 1.0)) * self.matrix.to_3x3()
self.tail = self.tail * matrix
self.head = self.head * matrix
- scalar = matrix.median_scale
- self.head_radius *= scalar
- self.tail_radius *= scalar
- self.align_roll(z_vec * matrix)
+ if scale:
+ scalar = matrix.median_scale
+ self.head_radius *= scalar
+ self.tail_radius *= scalar
+ if roll:
+ self.align_roll(z_vec * matrix)
+
+
def ord_ind(i1, i2):
if i1 < i2:
return i1, i2
More information about the Bf-blender-cvs
mailing list