[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28126] trunk/blender: PyAPI
Campbell Barton
ideasman42 at gmail.com
Sun Apr 11 16:22:29 CEST 2010
Revision: 28126
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28126
Author: campbellbarton
Date: 2010-04-11 16:22:27 +0200 (Sun, 11 Apr 2010)
Log Message:
-----------
PyAPI
- added new mathutils.Color() type, use with rna so we can do for eg:
material.diffuse_color.r = 1.0
# also has hsv access
material.diffuse_color.s = 0.6
- made Mathutils and Geometry module names lowercase.
Modified Paths:
--------------
trunk/blender/release/scripts/io/export_fbx.py
trunk/blender/release/scripts/io/export_mdd.py
trunk/blender/release/scripts/io/export_obj.py
trunk/blender/release/scripts/io/export_x3d.py
trunk/blender/release/scripts/io/import_anim_bvh.py
trunk/blender/release/scripts/io/import_scene_3ds.py
trunk/blender/release/scripts/io/import_scene_obj.py
trunk/blender/release/scripts/modules/bpy_types.py
trunk/blender/release/scripts/modules/rigify/__init__.py
trunk/blender/release/scripts/modules/rigify/arm_biped.py
trunk/blender/release/scripts/modules/rigify/eye_balls.py
trunk/blender/release/scripts/modules/rigify/eye_lid.py
trunk/blender/release/scripts/modules/rigify/leg_biped.py
trunk/blender/release/scripts/modules/rigify/leg_quadruped.py
trunk/blender/release/scripts/modules/rigify/mouth.py
trunk/blender/release/scripts/modules/rigify/neck.py
trunk/blender/release/scripts/modules/rigify/neck_flex.py
trunk/blender/release/scripts/modules/rigify/palm_curl.py
trunk/blender/release/scripts/modules/rigify/spine_pivot_flex.py
trunk/blender/release/scripts/modules/rigify/tail_control.py
trunk/blender/release/scripts/modules/rigify/tongue.py
trunk/blender/release/scripts/modules/rigify_utils.py
trunk/blender/release/scripts/op/add_armature_human.py
trunk/blender/release/scripts/op/add_mesh_torus.py
trunk/blender/release/scripts/op/console_python.py
trunk/blender/release/scripts/op/fcurve_euler_filter.py
trunk/blender/release/scripts/op/mesh.py
trunk/blender/release/scripts/op/nla.py
trunk/blender/release/scripts/op/object.py
trunk/blender/release/scripts/op/object_align.py
trunk/blender/release/scripts/op/object_randomize_transform.py
trunk/blender/release/scripts/op/uvcalc_smart_project.py
trunk/blender/release/scripts/op/vertexpaint_dirt.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/doc/sphinx_doc_gen.py
trunk/blender/source/blender/python/generic/geometry.c
trunk/blender/source/blender/python/generic/mathutils.c
trunk/blender/source/blender/python/generic/mathutils.h
trunk/blender/source/blender/python/generic/mathutils_euler.c
trunk/blender/source/blender/python/generic/mathutils_matrix.c
trunk/blender/source/blender/python/generic/mathutils_matrix.h
trunk/blender/source/blender/python/generic/mathutils_quat.c
trunk/blender/source/blender/python/generic/mathutils_quat.h
trunk/blender/source/blender/python/generic/mathutils_vector.c
trunk/blender/source/blender/python/generic/mathutils_vector.h
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
trunk/blender/source/gameengine/PyDoc/API_intro.py
trunk/blender/source/gameengine/PyDoc/GameTypes.py
Added Paths:
-----------
trunk/blender/source/blender/python/doc/examples/mathutils.Euler.py
trunk/blender/source/blender/python/doc/examples/mathutils.Matrix.py
trunk/blender/source/blender/python/doc/examples/mathutils.Quaternion.py
trunk/blender/source/blender/python/doc/examples/mathutils.Vector.py
trunk/blender/source/blender/python/doc/examples/mathutils.py
trunk/blender/source/blender/python/generic/mathutils_color.c
trunk/blender/source/blender/python/generic/mathutils_color.h
Removed Paths:
-------------
trunk/blender/source/blender/python/doc/examples/Mathutils.Euler.py
trunk/blender/source/blender/python/doc/examples/Mathutils.Matrix.py
trunk/blender/source/blender/python/doc/examples/Mathutils.Quaternion.py
trunk/blender/source/blender/python/doc/examples/Mathutils.Vector.py
trunk/blender/source/blender/python/doc/examples/Mathutils.py
Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/export_fbx.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -77,7 +77,7 @@
# import Blender
import bpy
-import Mathutils
+import mathutils
@@ -135,7 +135,7 @@
# I guess FBX uses degrees instead of radians (Arystan).
# Call this function just before writing to FBX.
def eulerRadToDeg(eul):
- ret = Mathutils.Euler()
+ ret = mathutils.Euler()
ret.x = 180 / math.pi * eul[0]
ret.y = 180 / math.pi * eul[1]
@@ -143,10 +143,10 @@
return ret
-mtx4_identity = Mathutils.Matrix()
+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]
@@ -333,7 +333,7 @@
EXP_CAMERA = True,
EXP_EMPTY = True,
EXP_IMAGE_COPY = False,
- GLOBAL_MATRIX = Mathutils.Matrix(),
+ GLOBAL_MATRIX = mathutils.Matrix(),
ANIM_ENABLE = True,
ANIM_OPTIMIZE = True,
ANIM_OPTIMIZE_PRECISSION = 6,
@@ -600,8 +600,8 @@
matrix_rot = matrix_rot * mtx_x90
elif type =='CAMERA':
# elif ob and type =='Camera':
- y = matrix_rot * Mathutils.Vector(0,1,0)
- matrix_rot = Mathutils.RotationMatrix(math.pi/2, 3, y) * matrix_rot
+ y = matrix_rot * mathutils.Vector(0,1,0)
+ matrix_rot = mathutils.RotationMatrix(math.pi/2, 3, y) * matrix_rot
return matrix_rot
@@ -702,8 +702,8 @@
matrix_rot = matrix_rot * mtx_x90
rot = tuple(matrix_rot.to_euler())
elif ob and ob.type =='Camera':
- y = matrix_rot * Mathutils.Vector(0,1,0)
- matrix_rot = Mathutils.RotationMatrix(math.pi/2, 3, y) * matrix_rot
+ y = matrix_rot * mathutils.Vector(0,1,0)
+ matrix_rot = mathutils.RotationMatrix(math.pi/2, 3, y) * matrix_rot
rot = tuple(matrix_rot.to_euler())
else:
rot = tuple(matrix_rot.to_euler())
@@ -1088,8 +1088,8 @@
file.write('\n\t\tTypeFlags: "Camera"')
file.write('\n\t\tGeometryVersion: 124')
file.write('\n\t\tPosition: %.6f,%.6f,%.6f' % loc)
- file.write('\n\t\tUp: %.6f,%.6f,%.6f' % tuple(matrix_rot * Mathutils.Vector(0,1,0)) )
- file.write('\n\t\tLookAt: %.6f,%.6f,%.6f' % tuple(matrix_rot * Mathutils.Vector(0,0,-1)) )
+ file.write('\n\t\tUp: %.6f,%.6f,%.6f' % tuple(matrix_rot * mathutils.Vector(0,1,0)) )
+ file.write('\n\t\tLookAt: %.6f,%.6f,%.6f' % tuple(matrix_rot * mathutils.Vector(0,0,-1)) )
#file.write('\n\t\tUp: 0,0,0' )
#file.write('\n\t\tLookAt: 0,0,0' )
Modified: trunk/blender/release/scripts/io/export_mdd.py
===================================================================
--- trunk/blender/release/scripts/io/export_mdd.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/export_mdd.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -48,7 +48,7 @@
# ***** END GPL LICENCE BLOCK *****
import bpy
-import Mathutils
+import mathutils
from struct import pack
@@ -87,7 +87,7 @@
me = ob.create_mesh(sce, True, 'PREVIEW')
#Flip y and z
- mat_flip = Mathutils.Matrix(\
+ mat_flip = mathutils.Matrix(\
[1.0, 0.0, 0.0, 0.0],\
[0.0, 0.0, 1.0, 0.0],\
[0.0, 1.0, 0.0, 0.0],\
Modified: trunk/blender/release/scripts/io/export_obj.py
===================================================================
--- trunk/blender/release/scripts/io/export_obj.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/export_obj.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -47,7 +47,7 @@
import shutil
import bpy
-import Mathutils
+import mathutils
# Returns a tuple - path,extension.
@@ -221,7 +221,7 @@
cu = ob.data
# use negative indices
- Vector = Blender.Mathutils.Vector
+ Vector = Blender.mathutils.Vector
for nu in cu:
if nu.type==0: DEG_ORDER_U = 1
@@ -370,7 +370,7 @@
file.write('mtllib %s\n' % ( mtlfilename.split('\\')[-1].split('/')[-1] ))
if EXPORT_ROTX90:
- mat_xrot90= Mathutils.RotationMatrix(-math.pi/2, 4, 'X')
+ mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
# Initialize totals, these are updated each object
totverts = totuvco = totno = 1
Modified: trunk/blender/release/scripts/io/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/io/export_x3d.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/export_x3d.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -69,7 +69,7 @@
import os
import bpy
-import Mathutils
+import mathutils
from export_3ds import create_derived_objects, free_derived_objects
@@ -81,7 +81,7 @@
#
DEG2RAD=0.017453292519943295
-MATWORLD= Mathutils.RotationMatrix(-90, 4, 'X')
+MATWORLD= mathutils.RotationMatrix(-90, 4, 'X')
####################################
# Global Variables
Modified: trunk/blender/release/scripts/io/import_anim_bvh.py
===================================================================
--- trunk/blender/release/scripts/io/import_anim_bvh.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/import_anim_bvh.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -22,8 +22,8 @@
from math import radians
import bpy
-import Mathutils
-from Mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix
+import mathutils
+from mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix
class bvh_node_class(object):
Modified: trunk/blender/release/scripts/io/import_scene_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_3ds.py 2010-04-11 12:20:30 UTC (rev 28125)
+++ trunk/blender/release/scripts/io/import_scene_3ds.py 2010-04-11 14:22:27 UTC (rev 28126)
@@ -144,7 +144,7 @@
from import_scene_obj import unpack_face_list, load_image
import bpy
-import Mathutils
+import mathutils
BOUNDS_3DS = []
@@ -310,8 +310,8 @@
contextObName = None
contextLamp = [None, None] # object, Data
contextMaterial = None
- contextMatrix_rot = None # Blender.Mathutils.Matrix(); contextMatrix.identity()
- #contextMatrix_tx = None # Blender.Mathutils.Matrix(); contextMatrix.identity()
+ contextMatrix_rot = None # Blender.mathutils.Matrix(); contextMatrix.identity()
+ #contextMatrix_tx = None # Blender.mathutils.Matrix(); contextMatrix.identity()
contextMesh_vertls = None
contextMesh_facels = None
contextMeshMaterials = {} # matname:[face_idxs]
@@ -722,7 +722,7 @@
def getuv():
temp_data = file.read(STRUCT_SIZE_2FLOAT)
new_chunk.bytes_read += STRUCT_SIZE_2FLOAT #2 float x 4 bytes each
- return Mathutils.Vector( struct.unpack('<2f', temp_data) )
+ return mathutils.Vector( struct.unpack('<2f', temp_data) )
contextMeshUV = [ getuv() for i in range(num_uv) ]
@@ -732,7 +732,7 @@
data = list( struct.unpack('<ffffffffffff', temp_data) )
new_chunk.bytes_read += STRUCT_SIZE_4x3MAT
- contextMatrix_rot = Mathutils.Matrix(\
+ contextMatrix_rot = mathutils.Matrix(\
data[:3] + [0],\
data[3:6] + [0],\
data[6:9] + [0],\
@@ -740,7 +740,7 @@
'''
- contextMatrix_rot = Blender.Mathutils.Matrix(\
+ contextMatrix_rot = Blender.mathutils.Matrix(\
data[:3] + [0],\
data[3:6] + [0],\
data[6:9] + [0],\
@@ -748,14 +748,14 @@
'''
'''
- contextMatrix_rot = Blender.Mathutils.Matrix(\
+ contextMatrix_rot = Blender.mathutils.Matrix(\
data[:3] ,\
data[3:6],\
data[6:9])
'''
'''
- contextMatrix_rot = Blender.Mathutils.Matrix()
+ contextMatrix_rot = Blender.mathutils.Matrix()
m = 0
for j in xrange(4):
for i in xrange(3):
@@ -773,7 +773,7 @@
#print contextMatrix_rot
contextMatrix_rot.invert()
#print contextMatrix_rot
- #contextMatrix_tx = Blender.Mathutils.TranslationMatrix(0.5 * Blender.Mathutils.Vector(data[9:]))
+ #contextMatrix_tx = Blender.mathutils.TranslationMatrix(0.5 * Blender.mathutils.Vector(data[9:]))
#contextMatrix_tx.invert()
#tx.invert()
@@ -946,8 +946,8 @@
SCALE/=10
# SCALE Matrix
- SCALE_MAT = Mathutils.Matrix([SCALE,0,0,0],[0,SCALE,0,0],[0,0,SCALE,0],[0,0,0,1])
-# SCALE_MAT = Blender.Mathutils.Matrix([SCALE,0,0,0],[0,SCALE,0,0],[0,0,SCALE,0],[0,0,0,1])
+ SCALE_MAT = mathutils.Matrix([SCALE,0,0,0],[0,SCALE,0,0],[0,0,SCALE,0],[0,0,0,1])
+# SCALE_MAT = Blender.mathutils.Matrix([SCALE,0,0,0],[0,SCALE,0,0],[0,0,SCALE,0],[0,0,0,1])
for ob in importedObjects:
ob.setMatrix(ob.matrixWorld * SCALE_MAT)
Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list