[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26239] trunk/blender: Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
Campbell Barton
ideasman42 at gmail.com
Mon Jan 25 10:44:05 CET 2010
Revision: 26239
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26239
Author: campbellbarton
Date: 2010-01-25 10:44:04 +0100 (Mon, 25 Jan 2010)
Log Message:
-----------
Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
- Mathutils.MidpointVecs --> vector.lerp(other, fac)
- Mathutils.AngleBetweenVecs --> vector.angle(other)
- Mathutils.ProjectVecs --> vector.project(other)
- Mathutils.DifferenceQuats --> quat.difference(other)
- Mathutils.Slerp --> quat.slerp(other, fac)
- Mathutils.Rand: removed, use pythons random module
- Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
- Matrix.scalePart --> Matrix.scale_part
- Matrix.translationPart --> Matrix.translation_part
- Matrix.rotationPart --> Matrix.rotation_part
- toMatrix --> to_matrix
- toEuler --> to_euler
- toQuat --> to_quat
- Vector.toTrackQuat --> Vector.to_track_quat
Modified Paths:
--------------
trunk/blender/release/scripts/io/engine_render_pov.py
trunk/blender/release/scripts/io/export_3ds.py
trunk/blender/release/scripts/io/export_fbx.py
trunk/blender/release/scripts/io/export_x3d.py
trunk/blender/release/scripts/io/import_anim_bvh.py
trunk/blender/release/scripts/modules/bpy_types.py
trunk/blender/release/scripts/modules/retopo.py
trunk/blender/release/scripts/modules/rigify/delta.py
trunk/blender/release/scripts/modules/rigify/leg_quadruped.py
trunk/blender/release/scripts/modules/rigify/mouth.py
trunk/blender/release/scripts/modules/rigify/palm_curl.py
trunk/blender/release/scripts/modules/rigify/shape_key_rotdiff.py
trunk/blender/release/scripts/modules/rigify_utils.py
trunk/blender/release/scripts/op/mesh.py
trunk/blender/release/scripts/op/mesh_skin.py
trunk/blender/release/scripts/op/uvcalc_smart_project.py
trunk/blender/release/scripts/templates/gamelogic.py
trunk/blender/source/blender/python/doc/epy/Geometry.py
trunk/blender/source/blender/python/doc/epy/Mathutils.py
trunk/blender/source/blender/python/generic/Geometry.c
trunk/blender/source/blender/python/generic/Mathutils.c
trunk/blender/source/blender/python/generic/euler.c
trunk/blender/source/blender/python/generic/matrix.c
trunk/blender/source/blender/python/generic/quat.c
trunk/blender/source/blender/python/generic/vector.c
trunk/blender/source/blender/python/sphinx_doc_gen.py
Modified: trunk/blender/release/scripts/io/engine_render_pov.py
===================================================================
--- trunk/blender/release/scripts/io/engine_render_pov.py 2010-01-25 07:19:28 UTC (rev 26238)
+++ trunk/blender/release/scripts/io/engine_render_pov.py 2010-01-25 09:44:04 UTC (rev 26239)
@@ -146,7 +146,7 @@
file.write('\tup <0, 1, 0>\n')
file.write('\tangle %f \n' % (360.0 * atan(16.0 / camera.data.lens) / pi))
- file.write('\trotate <%.6f, %.6f, %.6f>\n' % tuple([degrees(e) for e in matrix.rotationPart().toEuler()]))
+ file.write('\trotate <%.6f, %.6f, %.6f>\n' % tuple([degrees(e) for e in matrix.rotation_part().to_euler()]))
file.write('\ttranslate <%.6f, %.6f, %.6f>\n' % (matrix[3][0], matrix[3][1], matrix[3][2]))
file.write('}\n')
Modified: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py 2010-01-25 07:19:28 UTC (rev 26238)
+++ trunk/blender/release/scripts/io/export_3ds.py 2010-01-25 09:44:04 UTC (rev 26239)
@@ -839,7 +839,7 @@
track_chunk.add_variable("position", _3ds_point_3d(obj.getLocation()))
elif ID==ROT_TRACK_TAG:
# rotation (quaternion, angle first, followed by axis):
- q = obj.getEuler().toQuat()
+ q = obj.getEuler().to_quat()
track_chunk.add_variable("rotation", _3ds_point_4d((q.angle, q.axis[0], q.axis[1], q.axis[2])))
elif ID==SCL_TRACK_TAG:
# scale vector:
Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py 2010-01-25 07:19:28 UTC (rev 26238)
+++ trunk/blender/release/scripts/io/export_fbx.py 2010-01-25 09:44:04 UTC (rev 26239)
@@ -146,7 +146,7 @@
mtx4_identity = Mathutils.Matrix()
# testing
-mtx_x90 = Mathutils.RotationMatrix( math.pi/2, 3, 'x') # used
+mtx_x90 = Mathutils.RotationMatrix( math.pi/2, 3, 'X') # used
#mtx_x90n = RotationMatrix(-90, 3, 'x')
#mtx_y90 = RotationMatrix( 90, 3, 'y')
#mtx_y90n = RotationMatrix(-90, 3, 'y')
@@ -154,11 +154,11 @@
#mtx_z90n = RotationMatrix(-90, 3, 'z')
#mtx4_x90 = RotationMatrix( 90, 4, 'x')
-mtx4_x90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'x') # used
+mtx4_x90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'X') # used
#mtx4_y90 = RotationMatrix( 90, 4, 'y')
-mtx4_y90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'y') # used
-mtx4_z90 = Mathutils.RotationMatrix( math.pi/2, 4, 'z') # used
-mtx4_z90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'z') # used
+mtx4_y90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'Y') # used
+mtx4_z90 = Mathutils.RotationMatrix( math.pi/2, 4, 'Z') # used
+mtx4_z90n = Mathutils.RotationMatrix(-math.pi/2, 4, 'Z') # used
# def strip_path(p):
# return p.split('\\')[-1].split('/')[-1]
@@ -590,9 +590,9 @@
def getAnimParRelMatrixRot(self, frame):
type = self.blenObject.type
if self.fbxParent:
- matrix_rot = (((self.__anim_poselist[frame] * GLOBAL_MATRIX) * (self.fbxParent.__anim_poselist[frame] * GLOBAL_MATRIX).invert())).rotationPart()
+ matrix_rot = (((self.__anim_poselist[frame] * GLOBAL_MATRIX) * (self.fbxParent.__anim_poselist[frame] * GLOBAL_MATRIX).invert())).rotation_part()
else:
- matrix_rot = (self.__anim_poselist[frame] * GLOBAL_MATRIX).rotationPart()
+ matrix_rot = (self.__anim_poselist[frame] * GLOBAL_MATRIX).rotation_part()
# Lamps need to be rotated
if type =='LAMP':
@@ -600,7 +600,7 @@
elif type =='CAMERA':
# elif ob and type =='Camera':
y = Mathutils.Vector(0,1,0) * matrix_rot
- matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, 'r', y)
+ matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, y)
return matrix_rot
@@ -676,11 +676,11 @@
# par_matrix = mtx4_z90 * parent.matrix['ARMATURESPACE'] # dont apply armature matrix anymore
matrix = matrix * par_matrix.copy().invert()
- matrix_rot = matrix.rotationPart()
+ matrix_rot = matrix.rotation_part()
- loc = tuple(matrix.translationPart())
- scale = tuple(matrix.scalePart())
- rot = tuple(matrix_rot.toEuler())
+ loc = tuple(matrix.translation_part())
+ scale = tuple(matrix.scale_part())
+ rot = tuple(matrix_rot.to_euler())
else:
# This is bad because we need the parent relative matrix from the fbx parent (if we have one), dont use anymore
@@ -692,20 +692,20 @@
# matrix = matrix_scale * matrix
if matrix:
- loc = tuple(matrix.translationPart())
- scale = tuple(matrix.scalePart())
+ loc = tuple(matrix.translation_part())
+ scale = tuple(matrix.scale_part())
- matrix_rot = matrix.rotationPart()
+ matrix_rot = matrix.rotation_part()
# Lamps need to be rotated
if ob and ob.type =='Lamp':
matrix_rot = mtx_x90 * matrix_rot
- rot = tuple(matrix_rot.toEuler())
+ rot = tuple(matrix_rot.to_euler())
elif ob and ob.type =='Camera':
y = Mathutils.Vector(0,1,0) * matrix_rot
- matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, 'r', y)
- rot = tuple(matrix_rot.toEuler())
+ matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, y)
+ rot = tuple(matrix_rot.to_euler())
else:
- rot = tuple(matrix_rot.toEuler())
+ rot = tuple(matrix_rot.to_euler())
else:
if not loc:
loc = 0,0,0
@@ -1131,7 +1131,7 @@
else:
do_light = 1
- scale = abs(GLOBAL_MATRIX.scalePart()[0]) # scale is always uniform in this case
+ scale = abs(GLOBAL_MATRIX.scale_part()[0]) # scale is always uniform in this case
file.write('\n\t\t\tProperty: "LightType", "enum", "",%i' % light_type)
file.write('\n\t\t\tProperty: "CastLightOnObject", "bool", "",1')
@@ -2866,18 +2866,18 @@
# ----------------
for TX_LAYER, TX_CHAN in enumerate('TRS'): # transform, rotate, scale
- if TX_CHAN=='T': context_bone_anim_vecs = [mtx[0].translationPart() for mtx in context_bone_anim_mats]
- elif TX_CHAN=='S': context_bone_anim_vecs = [mtx[0].scalePart() for mtx in context_bone_anim_mats]
+ if TX_CHAN=='T': context_bone_anim_vecs = [mtx[0].translation_part() for mtx in context_bone_anim_mats]
+ elif TX_CHAN=='S': context_bone_anim_vecs = [mtx[0].scale_part() for mtx in context_bone_anim_mats]
elif TX_CHAN=='R':
# Was....
- # elif TX_CHAN=='R': context_bone_anim_vecs = [mtx[1].toEuler() for mtx in context_bone_anim_mats]
+ # elif TX_CHAN=='R': context_bone_anim_vecs = [mtx[1].to_euler() for mtx in context_bone_anim_mats]
#
# ...but we need to use the previous euler for compatible conversion.
context_bone_anim_vecs = []
prev_eul = None
for mtx in context_bone_anim_mats:
- if prev_eul: prev_eul = mtx[1].toEuler(prev_eul)
- else: prev_eul = mtx[1].toEuler()
+ if prev_eul: prev_eul = mtx[1].to_euler(prev_eul)
+ else: prev_eul = mtx[1].to_euler()
context_bone_anim_vecs.append(eulerRadToDeg(prev_eul))
# context_bone_anim_vecs.append(prev_eul)
Modified: trunk/blender/release/scripts/io/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/io/export_x3d.py 2010-01-25 07:19:28 UTC (rev 26238)
+++ trunk/blender/release/scripts/io/export_x3d.py 2010-01-25 09:44:04 UTC (rev 26239)
@@ -81,7 +81,7 @@
#
DEG2RAD=0.017453292519943295
-MATWORLD= Mathutils.RotationMatrix(-90, 4, 'x')
+MATWORLD= Mathutils.RotationMatrix(-90, 4, 'X')
####################################
# Global Variables
@@ -239,8 +239,8 @@
# get the camera location, subtract 90 degress from X to orient like X3D does
# mat = ob.matrixWorld - mat is now passed!
- loc = self.rotatePointForVRML(mat.translationPart())
- rot = mat.toEuler()
+ loc = self.rotatePointForVRML(mat.translation_part())
+ rot = mat.to_euler()
rot = (((rot[0]-90)), rot[1], rot[2])
# rot = (((rot[0]-90)*DEG2RAD), rot[1]*DEG2RAD, rot[2]*DEG2RAD)
nRot = self.rotatePointForVRML( rot )
@@ -300,8 +300,8 @@
# note -dz seems to equal om[3][1]
# note dy seems to equal om[3][2]
- #location=(ob.matrixWorld*MATWORLD).translationPart() # now passed
- location=(mtx*MATWORLD).translationPart()
+ #location=(ob.matrixWorld*MATWORLD).translation_part() # now passed
+ location=(mtx*MATWORLD).translation_part()
radius = lamp.distance*math.cos(beamWidth)
# radius = lamp.dist*math.cos(beamWidth)
@@ -346,8 +346,8 @@
ambi = 0
ambientIntensity = 0
- # location=(ob.matrixWorld*MATWORLD).translationPart() # now passed
- location= (mtx*MATWORLD).translationPart()
+ # location=(ob.matrixWorld*MATWORLD).translation_part() # now passed
+ location= (mtx*MATWORLD).translation_part()
self.file.write("<PointLight DEF=\"%s\" " % safeName)
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
@@ -364,8 +364,8 @@
return
else:
dx,dy,dz = self.computeDirection(mtx)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list