Blender Object
A Blender Object (note the capital O) is the instance of a 3D structure,
or rather, the Object that is (normally) visible in your Blender Scene.
An instance of a Blender Object object is created by:
from Blender import Object
ob = Object.New(type) # type must be a valid type string,
# see Object.Types
...
Attributes
Note that it is in general not recommended to access the Object's
attributes directly. Please rather use the get-/set- functions instead.
- loc
position vector (LocX, LocY, LocZ)
- dloc
delta position vector (dLocX, dLocY, dLocZ)
- rot
euler rotation vector (RotX, RotY, RotZ).
Warning: this may change in future.
- drot
delta rotation euler vector (dRotX, dRotY, dRotZ)
Warning: this may change in future.
- size
scale vector (SizeX, SizeY, SizeZ)
- dsize
delta scale vector (dSizeX, dSizeY, dSizeZ)
- layer
layer bitvector (20 bit), defining what layers the object is
visible in
The following items are listed here only for compatibility to older
scripts and are READ-ONLY! USE the get- functions instead!
- data
reference to the data object (e.g. Mesh, Camera, Lamp, etc.)
- parent
reference to the parent object, if existing, None otherwise.
- track
reference to the tracked object, if existing, None otherwise.
This bit mask can be read and written:
- colbits
the Material usage mask. A set bit #n means:
The Material #n in the Object's material list is used.
Otherwise, the Material #n of the Objects Data material list
is displayed.
Methods
|
|
|
|
__init__
|
__init__ ( self, object=None )
Returns an empty shadow Object
|
|
__repr__
|
__repr__ ( self )
|
|
clrParent
|
clrParent (
self,
mode=0,
fast=0,
)
Clears parent object.
If specified:
- mode
2: keep object transform
- fast > 0
don't update scene hierarchy (faster)
|
|
copy
|
copy ( self )
Returns a copy of self .
This is a true, linked copy, i.e. the copy shares the same data as the
original. The returned object is free, meaning, not linked to any scene.
|
|
getData
|
getData ( self )
Returns the Datablock object containing the object's data, e.g. Mesh
Exceptions
|
|
TypeError, "getData() not yet supported for this object type"
|
|
|
getDeformData
|
getDeformData ( self )
Returns the Datablock object containing the object's deformed data.
Currently, this is only supported for a Mesh
Exceptions
|
|
TypeError, "getDeformData() not yet supported for this object type"
|
|
|
getDeltaLocation
|
getDeltaLocation ( self )
Returns the object's delta location (x, y, z)
|
|
getDrawMode
|
getDrawMode ( self )
Returns the Object draw modes as a list of strings
|
|
getDrawType
|
getDrawType ( self )
Returns the Object draw type
|
|
getEuler
|
getEuler ( self )
Returns the object's rotation as Euler rotation vector
(rotX, rotY, rotZ)
|
|
getInverseMatrix
|
getInverseMatrix ( self )
Returns the object's inverse matrix
|
|
getLocation
|
getLocation ( self, relative=None )
Returns the object's location (x, y, z). For the moment,
relative has no effect.
|
|
getMaterials
|
getMaterials ( self )
Returns list of materials assigned to the object
|
|
getMatrix
|
getMatrix ( self )
Returns the object matrix
|
|
getParent
|
getParent ( self )
Returns object's parent object
|
|
getTracked
|
getTracked ( self )
Returns object's tracked object
|
|
getType
|
getType ( self )
Returns type string of Object, which is one of Object.Types.keys()
|
|
link
|
link ( self, data )
Links Object self with data data . The data type must match
the Object's type, so you cannot link a Lamp to a mesh type Object.
data can also be an Ipo object (IpoBlock)
|
|
makeParent
|
makeParent (
self,
objlist,
mode=0,
fast=0,
)
Makes self the parent of the objects in objlist which must be
a list of valid Objects.
If specified:
- mode
0: make parent with inverse
1: without inverse
- fast
0: update scene hierarchy automatically
1: don't update scene hierarchy (faster). In this case, you
must explicitely update the Scene hierarchy, see:
Blender.Scene.getCurrent().update()
|
|
materialUsage
|
materialUsage ( self, flag )
Determines the way the material is used and returns status.
flag = Data : Materials assigned to the object's data are shown. (default)
flag = Object : Materials assigned to the object are shown.
The second case is desired when the object's data wants to be shared among
objects, but not the Materials assigned to their data. See also colbits
attribute for more (and no future compatible) control.
|
|
setDeltaLocation
|
setDeltaLocation ( self, delta_location )
Sets the object's delta location which must be a vector triple
|
|
setDrawMode
|
setDrawMode ( self, *args )
Sets the Object's drawing modes as a list of strings
|
|
setDrawType
|
setDrawType ( self, name )
Sets the Object draw type. name must be one of:
Bounds : Draw bounding box only
Wire : Draw in wireframe mode
Solid : Draw solid
Shaded : Draw solid, shaded and textures
Exceptions
|
|
TypeError, "type must be one of %s" % self.DrawTypes.keys()
|
|
|
setEuler
|
setEuler ( self, euler=( 0.0, 0.0, 0.0 ) )
Sets the object's rotation according to the specified Euler angles.
euler must be a vector triple
|
|
setLocation
|
setLocation (
self,
location,
relative=None,
)
Sets the object's location. location must be a vector triple.
See getLocation() about relative coordinate systems.
|
|
setMaterials
|
setMaterials ( self, materials=[] )
Sets materials. materials must be a list of valid material objects
|
|
shareFrom
|
shareFrom ( self, object )
Link data of self with data of object . This works only if
object has the same type as self .
|
|