Module NMesh :: Class NMFace
[hide private]
[frames] | no frames]

Class NMFace

source code

The NMFace object

This object holds mesh face data.

Example:

import Blender
from Blender import NMesh, Window

in_emode = Window.EditMode()
if in_emode: Window.EditMode(0)

me = NMesh.GetRaw("Mesh")
faces = me.faces

## Example for editmode faces selection:
selected_faces = []
for f in faces:
  if f.sel:
    selected_faces.append(f)
# ... unselect selected and select all the others:
for f in faces:
  f.sel = 1 - f.sel # 1 becomes 0, 0 becomes 1

## Example for uv textured faces selection:
selected_faces = []
SEL = NMesh.FaceFlags['SELECT']
# get selected faces:
for f in faces:
  if f.flag & SEL:
    selected_faces.append(f)
# ... unselect selected and select all the others:
for f in faces:
  if f.flag & SEL:
    f.flag &=~SEL # unselect these
  else: f.flag |= SEL # and select these

me.update()
if in_emode: Window.EditMode(1)
Blender.Redraw()

Notes:
Instance Methods [hide private]
 
append(vertex)
Append a vertex to this face's vertex list.
source code
Instance Variables [hide private]
  col
The list of vertex colors.
  flag
Bit vector specifying selection / visibility flags for uv textured faces (visible in Face Select mode, see NMesh.FaceFlags).
bool hide
The visibility state (1: hidden, 0: visible) of this NMesh's faces *in edit mode*.
  image
The Image used as a texture for this face.
  mat
Same as materialIndex below.
  materialIndex
The index of this face's material in its NMesh materials list.
  mode
The display mode (see Mesh.FaceModes)
  normal
(or just no) The normal vector for this face: [x,y,z].
bool sel
The selection state (1: selected, 0: unselected) of this NMesh's faces *in edit mode*.
  smooth
If non-zero, the vertex normals are averaged to make this face look smooth.
  transp
Transparency mode bit vector (see NMesh.FaceTranspModes).
  uv
List of per-face UV coordinates: [(u0, v0), (u1, v1), ...].
list v
The list of face vertices (up to 4).
Method Details [hide private]

append(vertex)

source code 

Append a vertex to this face's vertex list.

Parameters:
  • vertex (NMVert) - An NMVert object.

Instance Variable Details [hide private]

hide

The visibility state (1: hidden, 0: visible) of this NMesh's faces *in edit mode*. This is not the same as the visibility state of the textured faces (see flag).
Type:
bool

sel

The selection state (1: selected, 0: unselected) of this NMesh's faces *in edit mode*. This is not the same as the selection state of the textured faces (see flag).
Type:
bool