Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-03 01:47:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-03 01:47:56 +0300
commite7d863cee530d477f0aa494a4f0f9e70ac5012c7 (patch)
tree43bbd414b707a62424eb1863bdcc1724b2bd9332 /release
parentcf7b19c0bab463a70ce5e364712ab61f6b11e336 (diff)
editbone.transform(matrix) function, requested by Cessen.
Also added matrix.median_scale attribute to get the average scale from the matrix, use for scaling bone envalopes.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy_types.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index d90e7ab3597..d890882b77c 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -198,6 +198,19 @@ class EditBone(StructRNA, _GenericBone):
self.tail = self.head + vec
self.roll = other.roll
+ def transform(self, matrix):
+ """
+ Transform the the bones head, tail, roll and envalope (when the matrix has a scale component).
+ Expects a 4x4 or 3x3 matrix.
+ """
+ from Mathutils import Vector
+ z_vec = self.matrix.rotationPart() * Vector(0.0, 0.0, 1.0)
+ self.tail = matrix * self.tail
+ self.head = matrix * self.head
+ scalar = matrix.median_scale
+ self.head_radius *= scalar
+ self.tail_radius *= scalar
+ self.align_roll(matrix * z_vec)
def ord_ind(i1, i2):
if i1 < i2: