diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 04:29:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 04:29:35 +0300 |
commit | 54dd0f57cfd0c228c6a5823f9a3e28d34712a6d7 (patch) | |
tree | 18ab4f1ab05adb38da4a909287fb76be4ca2b906 /release | |
parent | 7809d7d0c8cde22ec39e0b00e20742393a18c019 (diff) |
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.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 234627cd98a..9786d650f01 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -278,19 +278,29 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup): 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): |