Home | Trees | Index | Help |
|
---|
Module Mesh :: Class Mesh |
|
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.
Method Summary | |
---|---|
Mesh |
Make a copy of this mesh |
Adds a new Vertex Color layer to this mesh, it will always be the last layer but not made active. | |
Adds a new UV/Image layer to this mesh, it will always be the last layer but not made active. | |
Add a named and empty vertex (deform) group to the object this mesh is linked to. | |
Adds an array (a Python list) of vertex points to a named vertex group associated with a mesh. | |
Recalculates the vertex normals using face data. | |
Scan fill a closed selected edge loop. | |
int, None or list |
Quickly search for the location of an edges. |
Toggles the direction of selected face's normals. | |
list of strings |
Return a list of all color layer names |
Replace the mesh's existing data with the raw mesh data from a Blender Object. | |
list of strings |
Return a list of all UV layer names |
list of lists |
Get the bone influences for a specific vertex. |
list of strings |
Return a list of all vertex group names. |
Return a list of vertex indices associated with the passed group. | |
Insert a mesh key at the given frame. | |
Convert selected quads to triangles. | |
Recalculates inside or outside normals for selected faces. | |
int |
Removes duplicates from selected vertices. |
bool |
Remove all mesh keys stored in this mesh. |
Removes the active Vertex Color layer. | |
Removes the active UV/Image layer. | |
Remove a named vertex (deform) group from the object linked to this mesh. | |
Remove a list of vertices from the given group. | |
Removes the active Vertex Color layer. | |
Removes the active UV/Image layer. | |
Renames a vertex group. | |
Flattens angle of selected faces. | |
Subdivide selected edges in a mesh. | |
Moves selected vertices outward in a spherical shape. | |
Transforms the mesh by the specified 4x4 matrix (such as returned by Object.Object.getMatrix ). | |
Convert selected triangles to quads. | |
Update display lists after changes to mesh. | |
Colors vertices based on the current lighting setup, like when there are no vertex colors and no textured faces and a user enters Vertex Paint Mode in Blender (only lamps in visible layers account). |
Instance Variable Summary | |
---|---|
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. |
sequence of MFaces | faces : The mesh's faces. |
bool | faceUV : The mesh contains UV-mapped textured faces. |
bool | fakeUser : The fake user status. |
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. |
list of Material s |
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]. |
str | name : The Mesh name. |
IDGroup |
properties : Returns an IDGroup reference to this mesh's ID
Properties. |
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]. |
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 Objects using (linked to) this mesh. |
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 |
---|
__copy__()Make a copy of this mesh
|
addColorLayer(name)Adds a new Vertex Color layer to this mesh, it will always be the last layer but not made active.
|
addUVLayer(name)Adds a new UV/Image layer to this mesh, it will always be the last layer but not made active.
|
addVertGroup(group)Add a named and empty vertex (deform) group to the object this mesh is linked to. The mesh must first be linked to an object (with object.link() or object.getData() ) so the method knows which object to update. This is because vertex groups in Blender are stored in the object -- not in the mesh, which may be linked to more than one object.
|
assignVertsToGroup(group, vertList, weight, assignmode=1)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)
|
calcNormals()Recalculates the vertex normals using face data. |
fill()Scan fill a closed selected edge loop. Experimental mesh tool. An exception is thrown if called while in EditMode. |
findEdges(edges)Quickly search for the location of an edges.
|
flipNormals()Toggles the direction of selected face's normals. Experimental mesh tool. An exception is thrown if called while in EditMode. |
getColorLayerNames()Return a list of all color layer names
|
getFromObject(object, cage=0, render=0)Replace the mesh's existing data with the raw mesh data from a Blender Object. This method supports all the geometry based objects (mesh, text, curve, surface, and meta). If the object has modifiers, they will be applied before to the object before extracting the vertex data unless the cage parameter is 1.
|
getUVLayerNames()Return a list of all UV layer names
|
getVertexInfluences(index)Get the bone influences for a specific vertex.
|
getVertGroupNames()Return a list of all vertex group names.
|
getVertsFromGroup(group, weightsFlag=0, vertList=None)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 fromassignVertsToGroup :
# ... 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])
|
insertKey(frame=None, type='relative')Insert a mesh key at the given frame.
|
quadToTriangle(mode=0)Convert selected quads to triangles. Experimental mesh tool. An exception is thrown if called while in EditMode.
|
recalcNormals(direction=0)Recalculates inside or outside normals for selected faces. Experimental mesh tool. An exception is thrown if called while in EditMode.
|
remDoubles(limit)Removes duplicates from selected vertices. Experimental mesh tool. An exception is thrown if called while in EditMode.
|
removeAllKeys()Remove all mesh keys stored in this mesh.
|
removeColorLayer(name)Removes the active Vertex Color layer.
|
removeUVLayer(name)Removes the active UV/Image layer.
|
removeVertGroup(group)Remove a named vertex (deform) group from the object linked to this mesh. All vertices assigned to the group will be removed (just from the group, not deleted from the mesh), if any. If this mesh was newly created, it must first be linked to an object (read the comment inaddVertGroup for more info).
|
removeVertsFromGroup(group, vertList=None)Remove a list of vertices from the given group. If this mesh was newly created, it must first be linked to an object (checkaddVertGroup ).
|
renameColorLayer(name, newname)Removes the active Vertex Color layer.
|
renameUVLayer(name, newname)Removes the active UV/Image layer.
|
renameVertGroup(groupName, newName)Renames a vertex group.
|
smooth()Flattens angle of selected faces. Experimental mesh tool. An exception is thrown if called while in EditMode. |
subdivide(beauty=0)Subdivide selected edges in a mesh. Experimental mesh tool. An exception is thrown if called while in EditMode.
|
toSphere()Moves selected vertices outward in a spherical shape. Experimental mesh tool. An exception is thrown if called while in EditMode. |
transform(matrix, recalc_normals=False)Transforms the mesh by the specified 4x4 matrix (such as returned by
# 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
|
triangleToQuad()Convert selected triangles to quads. Experimental mesh tool. An exception is thrown if called while in EditMode. |
update()Update display lists after changes to mesh. Note: with changes taking place for using a directed acyclic graph (DAG) for scene and object updating, this method may be only temporary and may be removed in future releases.
|
vertexShade(object)Colors vertices based on the current lighting setup, like when there are no vertex colors and no textured faces and a user enters Vertex Paint Mode in Blender (only lamps in visible layers account). An exception is thrown if called while in EditMode.
|
Instance Variable Details |
---|
activeColorLayerThe mesh's active Vertex Color layer. None if there is no UV/Image layers.
|
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; usefaceUV
to test.
|
activeGroupThe mesh's active vertex group. The mesh must be linked to an object (read the comment inaddVertGroup for more info).
|
activeUVLayerThe mesh's active UV/Image layer. None if there is no UV/Image layers.
|
degrThe max angle for auto smoothing in [1,80].
|
edgesThe mesh's edges.
|
facesThe mesh's faces.
|
faceUVThe mesh contains UV-mapped textured faces. Enabling faceUV does not initialize the face colors like the Blender UI does; this must be done in the script. Note: if faceUV is set,vertexColors cannot be set. Furthermore, if
vertexColors is already set when faceUV is set, vertexColors is cleared.
This is because the vertex color information is stored with UV faces, so
enabling faceUV implies enabling vertexColors. In addition, faceUV cannot
be set when the mesh has no faces defined (this is the same behavior as
the UI). Attempting to do so will throw a RuntimeError exception.
|
fakeUserThe fake user status. enabling this will keep it in the blend even if there are no users.
|
hideSets hidden status for all vertices, edges and faces in the mesh (write only).
|
keyTheKey
object containing the keyframes for this mesh, if any.
|
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 asdegr . This attribute is only for
compatibility with NMesh scripts and will probably be deprecated in the
future.
|
modeThe mesh's mode bitfield. SeeModes .
|
multiresThe mesh has multires data, set True to add multires data. Will throw an exception if the mesh has shape keys; usekey to
test.
|
multiresDrawLevelThe multires level to display in the 3dview in [1 - multiresLevelCount].
|
multiresEdgeLevelThe multires level edge display in the 3dview [1 - multiresLevelCount].
|
multiresLevelCountThe mesh has multires data. (read only)
|
multiresPinLevelThe multires pin level, used for applying modifiers [1 - multiresLevelCount].
|
multiresRenderLevelThe multires level to render [1 - multiresLevelCount].
|
nameThe Mesh name. It's common to use this field to store extra data about the mesh (to be exported to another program, for example).
|
propertiesReturns anIDGroup reference to this mesh's ID
Properties.
|
selSets selection status for all vertices, edges and faces in the mesh (write only).
|
subDivLevelsThe [display, rendering] subdivision levels in [1, 6].
|
texMeshThe mesh's texMesh setting, used so coordinates from another mesh can be used for rendering textures.
|
usersThe number of Objects using (linked to) this mesh. (read only)
|
vertexColorsThe mesh contains vertex colors. SeefaceUV
for the use of vertex colors when UV-mapped texture faces are
enabled.
|
vertexUVThe mesh contains "sticky" per-vertex UV coordinates.
|
vertsThe mesh's vertices.
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sun Feb 11 13:30:19 2007 | http://epydoc.sf.net |