Home | Trees | Indices | Help |
|
---|
|
Note: the verts, edges and faces attributes are implemented as sequences. The operator[] and len() are defined for these sequences. You cannot assign to an item in the sequence, but you can assign to most of the attributes of individual items.
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
int, None or list |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
list of strings |
|
||
list of strings |
|
||
list of strings |
|
||
list of lists |
|
||
bool |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
int |
|
||
|
|||
Mesh |
|
Instance Variables | |
string |
activeColorLayer The mesh's active Vertex Color layer. |
int |
activeFace Index of the mesh's active face in UV Face Select and Paint modes. |
string or None |
activeGroup The mesh's active vertex group. |
string |
activeUVLayer The mesh's active UV/Image layer. |
int |
degr The max angle for auto smoothing in [1,80]. |
sequence of MEdges |
edges The mesh's edges. |
bool |
faceUV The mesh contains UV-mapped textured faces. |
sequence of MFaces |
faces The mesh's faces. |
bool |
fakeUser When set to True, this datablock wont be removed, even if nothing is using it. |
boolean |
hide Sets hidden status for all vertices, edges and faces in the mesh (write only). |
Key or None |
key The Key object containing the keyframes for this mesh, if any. |
string or None |
lib path to the blend file this datablock is stored in (readonly). |
list of Materials |
materials The mesh's materials. |
maxSmoothAngle Same as degr. |
|
int |
mode The mesh's mode bitfield. |
bool |
multires The mesh has multires data, set True to add multires data. |
int |
multiresDrawLevel The multires level to display in the 3dview in [1 - multiresLevelCount]. |
int |
multiresEdgeLevel The multires level edge display in the 3dview [1 - multiresLevelCount]. |
int |
multiresLevelCount The mesh has multires data. |
int |
multiresPinLevel The multires pin level, used for applying modifiers [1 - multiresLevelCount]. |
int |
multiresRenderLevel The multires level to render [1 - multiresLevelCount]. |
string |
name unique name within each blend file. |
IDGroup |
properties Returns an IDGroup reference to this datablocks's ID Properties. |
string |
renderColorLayer The mesh's rendered Vertex Color layer. |
string |
renderUVLayer The mesh's rendered UV/Image layer. |
boolean |
sel Sets selection status for all vertices, edges and faces in the mesh (write only). |
list of 2 ints |
subDivLevels The [display, rendering] subdivision levels in [1, 6]. |
bool |
tag A temporary tag that to flag data as being used within a loop. |
Mesh or None |
texMesh The mesh's texMesh setting, used so coordinates from another mesh can be used for rendering textures. |
int |
users The number of users this datablock has. |
bool |
vertexColors The mesh contains vertex colors. |
bool |
vertexUV The mesh contains "sticky" per-vertex UV coordinates. |
sequence of MVerts |
verts The mesh's vertices. |
Method Details |
Notes:
|
Notes:
|
Calculates tangents for this mesh, returning a list of tuples, each with 3 or 4 tangent vectors, these are alligned with the meshes faces. Example:# Display the tangents as edges over a the active mesh object from Blender import * sce = Scene.GetCurrent() ob = sce.objects.active me = ob.getData(mesh=1) ts = me.getTangents() me_disp = Mesh.New() verts = [] edges = [] for i, f in enumerate(me.faces): ft = ts[i] for j, v in enumerate(f): tan = ft[j] print tan co = v.co verts.append(co) verts.append(co+tan) i = len(verts) edges.append((i-1, i-2)) me_disp.verts.extend( verts ) me_disp.edges.extend( edges ) sce.objects.new( me_disp ) Note: The tangents are computed using the active UV layer, if there are no UV layers, orco coords are used. |
Transforms the mesh by the specified 4x4 matrix (such as returned by Object.Object.getMatrix). The matrix should be invertible. Ideal usage for this is exporting to an external file where global vertex locations are required for each object. Sometimes external renderers or file formats do not use vertex normals. In this case, you can skip transforming the vertex normals by leaving the optional parameter recalc_normals as False or 0 (the default value). Example:# This script outputs deformed meshes worldspace vertex locations # for a selected object without changing the object import Blender from Blender import Mesh, Object ob = Object.GetSelected()[0] # Get the first selected object me = Mesh.New() # Create a new mesh me.getFromObject(ob.name) # Get the object's mesh data verts = me.verts[:] # Save a copy of the vertices me.transform(ob.matrix) # Convert verts to world space for v in me.verts: print 'worldspace vert', v.co me.verts = verts # Restore the original verts
Warning: unlike NMesh.transform(), this method will immediately modify the mesh data when it is used. If you transform the mesh using the object's matrix to get the vertices' world positions, the result will be a "double transform". To avoid this you either need to set the object's matrix to the identity matrix, perform the inverse transform after outputting the transformed vertices, or make a copy of the vertices prior to using this method and restore them after outputting the transformed vertices (as shown in the example). |
|
Warning: Since Blender 2.42 this function has changed; now it won't recalculate vertex normals (seen when faces are smooth). See Mesh.calcNormals(). |
|
|
|
Adds an array (a Python list) of vertex points to a named vertex group associated with a mesh. The vertex list is a list of vertex indices from the mesh. You should assign vertex points to groups only when the mesh has all its vertex points added to it and is already linked to an object. Example: The example here adds a new set of vertex indices to a sphere primitive:import Blender sphere = Blender.Object.Get('Sphere') replace = Blender.Mesh.AssignModes.REPLACE mesh = sphere.getData(mesh=True) mesh.addVertGroup('firstGroup') vertList = [] for x in range(300): if x % 3 == 0: vertList.append(x) mesh.assignVertsToGroup('firstGroup', vertList, 0.5, replace)
|
|
Return a list of vertex indices associated with the passed group. This method can be used to test whether a vertex index is part of a group and if so, what its weight is. Example: Append this to the example from assignVertsToGroup:# ... print "Vertex indices from group %s :" % groupName print mesh.getVertsFromGroup('firstGroup') print "Again, with weights:" print mesh.getVertsFromGroup('firstGroup',1) print "Again, with weights and restricted to the given indices:" print mesh.getVertsFromGroup('firstGroup',1,[1,2,3,4,5,6])
|
|
|
|
|
|
|
Warnings:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Instance Variable Details |
activeColorLayerThe mesh's active Vertex Color layer. None if there is no UV/Image layers. Note: After setting this value, call update so the result can be seen the the 3d view.
|
activeFaceIndex of the mesh's active face in UV Face Select and Paint modes. Only one face can be active at a time. Note that this is independent of the selected faces in Face Select and Edit modes. Will throw an exception if the mesh does not have UV faces; use faceUV to test.
|
activeGroupThe mesh's active vertex group. The mesh must be linked to an object (read the comment in addVertGroup for more info).
|
activeUVLayerThe mesh's active UV/Image layer. None if there is no UV/Image layers. Note: After setting this value, call update so the result can be seen the the 3d view.
|
fakeUserWhen set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
|
libpath to the blend file this datablock is stored in (readonly). lib will be None unless you are using external blend files with (File, Append/Link) Note: the path may be relative, to get the full path use Blender.sys.expandpath
|
materialsThe mesh's materials. Each mesh can reference up to 16 materials. Empty slots in the mesh's list are represented by None. Note: Object.colbits needs to be set correctly for each object in order for these materials to be used instead of the object's materials. Note: Making the material list shorter does not change the face's material indices. Take care when using the face's material indices to reference a material in this list. Note: The list that's returned is not linked to the original mesh. mesh.materials.append(material) won't do anything. Use mesh.materials += [material] instead.
|
maxSmoothAngleSame as degr. This attribute is only for compatibility with NMesh scripts and will probably be deprecated in the future. |
modeThe mesh's mode bitfield. See Modes.
|
multiresThe mesh has multires data, set True to add multires data. Will throw an exception if the mesh has shape keys; use key to test.
|
multiresLevelCountThe mesh has multires data. (read only)
|
nameunique name within each blend file. The name is case sensitive and 21 characters maximum length. Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib. Note: Setting a value longer then 21 characters will be shortened
|
renderColorLayerThe mesh's rendered Vertex Color layer. None if there is no UV/Image layers.
|
renderUVLayerThe mesh's rendered UV/Image layer. None if there is no UV/Image layers.
|
tagA temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
|
usersThe number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
|
vertexColorsThe mesh contains vertex colors. Set True to add vertex colors.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon May 19 15:32:20 2008 | http://epydoc.sourceforge.net |