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 | |
---|---|
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. | |
Replace the mesh's existing data with the raw mesh data from a Blender Object. | |
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. | |
Convert selected quads to triangles. | |
Recalculates inside or outside normals for selected faces. | |
int |
Removes duplicates from selected vertices. |
Remove a named vertex (deform) group from the object linked to this mesh. | |
Remove a list of vertices from the given group. | |
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 | |
---|---|
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. |
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. |
boolean | hide : Sets hidden status for all vertices, edges and faces in the mesh
(write only). |
list of Materials | materials : The mesh's materials. |
maxSmoothAngle : Same as degr . | |
int | mode : The mesh's mode bitfield. |
str | name : The Mesh name. |
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]. |
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 |
---|
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. |
getFromObject(name, cage=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.
|
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])
|
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.
|
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 ).
|
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, Scene scn= Scene.GetCurrent() # Get the current scene ob = scn.getActiveObject() # Get the active 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.
|
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 |
---|
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).
|
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.
|
hideSets hidden status for all vertices, edges and faces in the mesh (write only).
|
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 faces material indicies, take care when using the faces
material indices to reference a material in the materials list.
Note: The the list thats returned is not linked to the original
mesh. mesh.materials.append(material) wont 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 .
|
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).
|
selSets selection status for all vertices, edges and faces in the mesh (write only).
|
subDivLevelsThe [display, rendering] subdivision levels in [1, 6].
|
usersThe number of Objects using (linked to) this mesh.
|
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 Thu Jul 13 16:50:05 2006 | http://epydoc.sf.net |