Module Mesh
[frames | no frames]

Module Mesh

The Blender.Mesh submodule.

New:

Mesh Data

This module provides access to Mesh Data objects in Blender. It differs from the NMesh module by allowing direct access to the actual Blender data, so that changes are done immediately without need to update or put the data back into the original mesh. The result is faster operations with less memory usage.

Example:
 import Blender
 from Blender import Mesh, Material, Window

 editmode = Window.EditMode()    # are we in edit mode?  If so ...
 if editmode: Window.EditMode(0) # leave edit mode before getting the mesh

 me = Mesh.Get("Plane")          # get the mesh data called "Plane"

 if not me.materials:             # if there are no materials ...
   newmat = Material.New()        # create one ...
   me.materials=[newmat]          # and set the mesh's list of mats

 print me.materials               # print the list of materials
 mat = me.materials[0]            # grab the first material in the list
 mat.R = 1.0                      # redefine its red component
 for v in me.verts:               # loop the list of vertices
   v.co[0] *= 2.5                 # multiply the coordinates
   v.co[1] *= 5.0
   v.co[2] *= 2.5

 if editmode: Window.EditMode(1)  # optional, just being nice

Classes
MCol This object is four ints representing an RGBA color.
MEdge This object holds mesh edge data.
MEdgeSeq This object provides sequence and iterator access to the mesh's edges.
Mesh This object gives access to mesh data in Blender.
MFace This object holds mesh face data.
MFaceSeq This object provides sequence and iterator access to the mesh's faces.
MVert This object holds mesh vertex data.
MVertSeq This object provides sequence and iterator access to the mesh's vertices.

Function Summary
Mesh Get(name)
Get the mesh data object called name from Blender.
Mesh New(name)
Create a new mesh data object called name.

Variable Summary
readonly dictionary. AssignModes: The available vertex group assignment modes, used by mesh.assignVertsToGroup().
  EdgeFlags: The available edge flags.
readonly dictionary FaceFlags: The available *texture face* (uv face select mode) selection flags.
readonly dictionary FaceModes: The available *texture face* modes.
readonly dictionary FaceTranspModes: The available face transparency modes.
readonly dictionary Modes: The available mesh modes.

Function Details

Get(name=None)

Get the mesh data object called name from Blender.
Parameters:
name - The name of the mesh data object.
           (type=string)
Returns:
If a name is given, it returns either the requested mesh or None. If no parameter is given, it returns all the meshs in the current scene.
           (type=Mesh)

New(name='Mesh')

Create a new mesh data object called name.
Parameters:
name - The name of the mesh data object.
           (type=string)
Returns:
a new Blender mesh.
           (type=Mesh)

Variable Details

AssignModes

The available vertex group assignment modes, used by mesh.assignVertsToGroup().
  • ADD: if the vertex in the list is not assigned to the group already, this creates a new association between this vertex and the group with the weight specified, otherwise the weight given is added to the current weight of an existing association between the vertex and group.
  • SUBTRACT: will attempt to subtract the weight passed from a vertex already associated with a group, else it does nothing.
  • REPLACE: attempts to replace a weight with the new weight value for an already associated vertex/group, else it does nothing.
Type:
readonly dictionary.
Value:
{'REPLACE': 1}                                                         

EdgeFlags

The available edge flags.
  • SELECT - selected.
  • EDGEDRAW - edge is drawn out of edition mode.
  • SEAM - edge is a seam for LSCM UV unwrapping
  • FGON - edge is part of a F-Gon.

FaceFlags

The available *texture face* (uv face select mode) selection flags. Note: these refer to TexFace faces, available if nmesh.hasFaceUV() returns true.
  • SELECT - selected.
  • HIDE - hidden.
  • ACTIVE - the active face.
Type:
readonly dictionary

FaceModes

The available *texture face* modes. Note: these are only meaningful if nmesh.hasFaceUV() returns true, since in Blender this info is stored at the TexFace (TexFace button in Edit Mesh buttons) structure.
  • ALL - set all modes at once.
  • BILLBOARD - always orient after camera.
  • HALO - halo face, always point to camera.
  • DYNAMIC - respond to collisions.
  • INVISIBLE - invisible face.
  • LIGHT - dynamic lighting.
  • OBCOL - use object color instead of vertex colors.
  • SHADOW - shadow type.
  • SHAREDVERT - apparently unused in Blender.
  • SHAREDCOL - shared vertex colors (per vertex).
  • TEX - has texture image.
  • TILES - uses tiled image.
  • TWOSIDE - two-sided face.
Type:
readonly dictionary

FaceTranspModes

The available face transparency modes. Note: these are enumerated values (enums), they can't be combined (and'ed, or'ed, etc) like a bit vector.
  • SOLID - draw solid.
  • ADD - add to background (halo).
  • ALPHA - draw with transparency.
  • SUB - subtract from background.
Type:
readonly dictionary

Modes

The available mesh modes.
  • NOVNORMALSFLIP - no flipping of vertex normals during render.
  • TWOSIDED - double sided mesh.
  • AUTOSMOOTH - turn auto smoothing of faces "on".
  • SUBSURF - turn Catmull-Clark subdivision of surfaces "on".
  • OPTIMAL - optimal drawing of edges when "SubSurf" is "on".
Type:
readonly dictionary

Generated by Epydoc 2.1 on Thu Dec 22 22:38:14 2005 http://epydoc.sf.net