1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
"""The Blender NMesh module
This module provides access to the raw **Mesh** data block.
Examples will not be given, as the life time of this module will be
most probably limited. Use the 'Mesh' module instead.
"""
import _Blender.NMesh as _NMesh
import shadow
class Mesh(shadow.shadow):
"""The NMesh object
This contains a copy of the raw mesh object data.
Attributes
verts -- A list of vertices of type 'Vert'
faces -- List of faces of type 'Face'
"""
def update(self):
"""updates the mesh object in Blender with the modified mesh data"""
self._object.update()
class Vert:
"""Vertex object
Attributes
co -- The vertex coordinates (x, y, z)
no -- Vertex normal vector (nx, ny, nz)
uvco -- Vertex texture ("sticky") coordinates
index -- The vertex index, if owned by a mesh
"""
class Face:
"""Face object
Attributes
mode -- Display mode, see NMesh.FaceModes
flag -- flag bit vector, specifying selection flags.
see NMesh.FaceFlags
transp -- transparency mode bit vector; see NMesh.FaceTranspModes
v -- List of Face vertices
col -- List of Vertex colours
materialIndex -- Material index (referring to one of the Materials in
the Meshes material list, see Mesh documentation
smooth -- Flag whether smooth normals should be calculated (1 = yes)
image -- Reference to texture image object
uv -- A list of per-face UV coordinates:
[(u0, v0), (u1, v1), (u2, v2), .. ]
"""
class Col:
"""Colour object
See NMesh module documentation for an example.
Attributes
r, g, b, a -- The RGBA components of the colour
A component must lie in the range of [0, 255]
"""
class FaceModes:
"""Face mode bit flags
BILLBOARD -- always orient after camera
DYNAMIC -- respond to collisions
INVISIBLE -- invisible face
HALO -- halo face, always point to camera
LIGHT -- dynamic lighting
OBCOL -- use object colour instead of vertex colours
SHADOW -- shadow type
SHAREDCOL -- shared vertex colors (per vertex)
TEX -- has texture image
TILES -- uses tiled image
TWOSIDE -- twosided face
"""
t = _NMesh.Const
BILLBOARD = t.BILLBOARD
DYNAMIC = t.DYNAMIC
INVISIBLE = t.INVISIBLE
HALO = t.HALO
LIGHT = t.LIGHT
OBCOL = t.OBCOL
SHADOW = t.SHADOW
SHAREDCOL = t.SHAREDCOL
TEX = t.TEX
TILES = t.TILES
TWOSIDE = t.TWOSIDE
del t
class FaceTranspModes:
"""Readonly dictionary
...containing Face transparency draw modes. They are of type 'enum', i.e.
can not be combined like a bit vector.
SOLID -- draw solid
ADD -- add to background(halo)
ALPHA -- draw with transparency
SUB -- subtract from background
"""
t = _NMesh.Const
SOLID = t.SOLID
ADD = t.ADD
ALPHA = t.ALPHA
SUB = t.SUB
del t
class FaceFlags:
"""Readonly dictionary
...containing Face flags bitvectors:
SELECT -- selected
HIDE -- hidden
ACTIVE -- the active face
"""
t = _NMesh.Const
SELECT = t.SELECT
HIDE = t.HIDE
ACTIVE = t.ACTIVE
del t
def New(name = None):
"""Creates a new NMesh mesh object and returns it"""
pass
def GetRaw(name = None):
"""If 'name' specified, the Mesh object with 'name' is returned, 'None'
if not existant. Otherwise, a new empty Mesh is initialized and returned."""
pass
def PutRaw(mesh, name = "Mesh"):
"""Creates a Mesh Object instance in Blender, i.e. a Mesh Object in the
current Scene and returns a reference to it. If 'name' specified, the Mesh
'name' is overwritten. In this case, no Object reference is returned."""
pass
def GetRawFromObject(name):
"""This returns the mesh as used by the object, which
means it contains all deformations and modifications."""
pass
# override all these functions again, because we only used them for
# documentation -- NMesh will be no longer supported in future
New = _NMesh.New
GetRaw = _NMesh.GetRaw
PutRaw = _NMesh.PutRaw
GetRawFromObject = _NMesh.GetRawFromObject
Const = _NMesh.Const
Vert = _NMesh.Vert
Face = _NMesh.Face
Col = _NMesh.Col
def NMesh(data):
return data
|