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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rigify/utils/misc.py')
-rw-r--r--rigify/utils/misc.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/rigify/utils/misc.py b/rigify/utils/misc.py
index e4ba55f2..9d4307c0 100644
--- a/rigify/utils/misc.py
+++ b/rigify/utils/misc.py
@@ -22,7 +22,7 @@ import bpy
import math
import collections
-from itertools import tee, chain, islice, repeat
+from itertools import tee, chain, islice, repeat, permutations
from mathutils import Vector, Matrix, Color
from rna_prop_ui import rna_idprop_value_to_python
@@ -32,6 +32,28 @@ from rna_prop_ui import rna_idprop_value_to_python
#=============================================
+axis_vectors = {
+ 'x': (1,0,0),
+ 'y': (0,1,0),
+ 'z': (0,0,1),
+ '-x': (-1,0,0),
+ '-y': (0,-1,0),
+ '-z': (0,0,-1),
+}
+
+
+# Matrices that reshuffle axis order and/or invert them
+shuffle_matrix = {
+ sx+x+sy+y+sz+z: Matrix((
+ axis_vectors[sx+x], axis_vectors[sy+y], axis_vectors[sz+z]
+ )).transposed().freeze()
+ for x, y, z in permutations(['x', 'y', 'z'])
+ for sx in ('', '-')
+ for sy in ('', '-')
+ for sz in ('', '-')
+}
+
+
def angle_on_plane(plane, vec1, vec2):
""" Return the angle between two vectors projected onto a plane.
"""