Python API

==========

Bugfix #4951:  This might be a serious change for python script writers.
-- ob.getMatrix('localspace') did not return the correct matrix when the object
   had a parent; this has been corrected.
-- ob.setMatrix(m) did not work predictably (more correctly, in an easy-to-
   predict manner) when an object had a parent.  The method has been changed
   so that if thee is a parent, it ASSUMES the matrix is "localspace",
   relative to the parent.  The documentation now states this.
-- ob.mat and ob.matrix are now read-only attributes, while ob.matrixLocal
   (which calls Object_setMatrix() ) is now read-write.

Ton is not thrilled (is that a fair summary, Ton? ;-) with this method since
the ob->obmat is calculated from the loc/rot/size attributes of an object.
I'll let him speak on this, but I believe his desire is for this method to be
deprecated in the future and replaced with something else.
This commit is contained in:
Ken Hughes
2006-11-21 21:15:15 +00:00
parent 973e8920f0
commit 2dbed48e24
2 changed files with 64 additions and 9 deletions

View File

@@ -344,7 +344,7 @@ class Object:
@ivar matrix: Same as L{mat}. Read-only.
@type matrix: Matrix
@ivar matrixLocal: The matrix of the object relative to its parent; if there is no parent,
returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}). Read-only.
returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}).
@type matrixLocal: Matrix
@ivar matrixOldWorld: Old-type worldspace matrix (prior to Blender 2.34).
Read-only.
@@ -1054,15 +1054,23 @@ class Object:
def setMatrix(matrix):
"""
Sets the object's matrix and updates its transformation.
Sets the object's matrix and updates its transformation. If the object
has a parent, the matrix transform is relative to the parent.
@type matrix: Py_Matrix 3x3 or 4x4
@param matrix: a 3x3 or 4x4 Python matrix. If a 3x3 matrix is given,
it is extended to a 4x4 matrix.
@Note: This method is "bad": when called it changes the location,
rotation and size attributes of the object (since Blender uses these
values to calculate the object's transformation matrix). Ton is
not happy having a method which "pretends" to do a matrix operation.
In the future, this method may be replaced with other methods which
make it easier for the user to determine the correct loc/rot/size values
for necessary for the object.
"""
def setName(name):
"""
Sets the name of the object. A string longer then 20 characters will be shortened.
Sets the name of the object. A string longer than 20 characters will be shortened.
@type name: String
@param name: The new name for the object.
"""
@@ -1091,7 +1099,7 @@ class Object:
if both objects are of the same type.
@type object: Blender Object
@param object: A Blender Object of the same type.
@note: This function is faster then using L{getData()} and setData()
@note: This function is faster than using L{getData()} and setData()
because it skips making a Python object from the object's data.
"""