|
|
@@ -1,421 +0,0 @@
|
|
1
|
|
-# ***** BEGIN GPL LICENSE BLOCK *****
|
|
2
|
|
-#
|
|
3
|
|
-# This program is free software; you can redistribute it and/or
|
|
4
|
|
-# modify it under the terms of the GNU General Public License
|
|
5
|
|
-# as published by the Free Software Foundation; either version 2
|
|
6
|
|
-# of the License, or (at your option) any later version.
|
|
7
|
|
-#
|
|
8
|
|
-# This program is distributed in the hope that it will be useful,
|
|
9
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See th
|
|
11
|
|
-# GNU General Public License for more details.
|
|
12
|
|
-#
|
|
13
|
|
-# You should have received a copy of the GNU General Public License
|
|
14
|
|
-# along with this program; if not, write to the Free Software Foundation,
|
|
15
|
|
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
16
|
|
-#
|
|
17
|
|
-# object_render_wire.py liero, meta-androcto,
|
|
18
|
|
-# Yorik van Havre, Alejandro Sierra, Howard Trickey
|
|
19
|
|
-# ***** END GPL LICENCE BLOCK *****
|
|
20
|
|
-
|
|
21
|
|
-bl_info = {
|
|
22
|
|
- "name": "Render Wireframe",
|
|
23
|
|
- "author": "Community",
|
|
24
|
|
- "description": " WireRender & WireSoild modes",
|
|
25
|
|
- "version": (2, 3),
|
|
26
|
|
- "blender": (2, 63, 0),
|
|
27
|
|
- "location": "Object > Render Wireframe",
|
|
28
|
|
- "warning": '',
|
|
29
|
|
- 'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts',
|
|
30
|
|
- 'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
|
|
31
|
|
- 'func=detail&aid=26997',
|
|
32
|
|
- 'category': 'Object'}
|
|
33
|
|
-
|
|
34
|
|
-import bpy, mathutils
|
|
35
|
|
-
|
|
36
|
|
-cube_faces = [ [0,3,2,1], [5,6,7,4], [0,1,5,4],
|
|
37
|
|
- [7,6,2,3], [2,6,5,1], [0,4,7,3] ]
|
|
38
|
|
-cube_normals = [ mathutils.Vector((0,0,-1)),
|
|
39
|
|
- mathutils.Vector((0,0,1)),
|
|
40
|
|
- mathutils.Vector((0,-1,0)),
|
|
41
|
|
- mathutils.Vector((0,1,0)),
|
|
42
|
|
- mathutils.Vector((1,0,0)),
|
|
43
|
|
- mathutils.Vector((-1,0,0)) ]
|
|
44
|
|
-
|
|
45
|
|
-def create_cube(me, v, d):
|
|
46
|
|
- x = v.co.x
|
|
47
|
|
- y = v.co.y
|
|
48
|
|
- z = v.co.z
|
|
49
|
|
- coords=[ [x-d,y-d,z-d], [x+d,y-d,z-d], [x+d,y+d,z-d], [x-d,y+d,z-d],
|
|
50
|
|
- [x-d,y-d,z+d], [x+d,y-d,z+d], [x+d,y+d,z+d], [x-d,y+d,z+d] ]
|
|
51
|
|
- for coord in coords:
|
|
52
|
|
- me.vertices.add(1)
|
|
53
|
|
- me.vertices[-1].co = mathutils.Vector(coord)
|
|
54
|
|
-
|
|
55
|
|
-def norm_dot(e, k, fnorm, me):
|
|
56
|
|
- v = me.vertices[e[1]].co - me.vertices[e[0]].co
|
|
57
|
|
- if k == 1:
|
|
58
|
|
- v = -v
|
|
59
|
|
- v.normalize()
|
|
60
|
|
- return v * fnorm
|
|
61
|
|
-
|
|
62
|
|
-def fill_cube_face(me, index, f):
|
|
63
|
|
- return [index + cube_faces[f][i] for i in range(4)]
|
|
64
|
|
-
|
|
65
|
|
-# Coords of jth point of face f in cube instance i
|
|
66
|
|
-def cube_face_v(me, f, i, j):
|
|
67
|
|
- return me.vertices[i + cube_faces[f][j]].co
|
|
68
|
|
-
|
|
69
|
|
-def cube_face_center(me, f, i):
|
|
70
|
|
- return 0.5 * (cube_face_v(me, f, i, 0) + \
|
|
71
|
|
- cube_face_v(me, f, i, 2))
|
|
72
|
|
-
|
|
73
|
|
-# Return distance between points on two faces when
|
|
74
|
|
-# each point is projected onto the plane that goes through
|
|
75
|
|
-# the face center and is perpendicular to the line
|
|
76
|
|
-# through the face centers.
|
|
77
|
|
-def projected_dist(me, i1, i2, f1, f2, j1, j2):
|
|
78
|
|
- f1center = cube_face_center(me, f1, i1)
|
|
79
|
|
- f2center = cube_face_center(me, f2, i2)
|
|
80
|
|
- axis_norm = (f2center - f1center).normalized()
|
|
81
|
|
- v1 = cube_face_v(me, f1, i1, j1)
|
|
82
|
|
- v2 = cube_face_v(me, f2, i2, j2)
|
|
83
|
|
- v1proj = v1 - (axis_norm * (v1 - f1center)) * axis_norm
|
|
84
|
|
- v2proj = v2 - (axis_norm * (v2 - f2center)) * axis_norm
|
|
85
|
|
- return (v2proj - v1proj).length
|
|
86
|
|
-
|
|
87
|
|
-def skin_edges(me, i1, i2, f1, f2):
|
|
88
|
|
- # Connect verts starting at i1 forming cube face f1
|
|
89
|
|
- # to those starting at i2 forming cube face f2.
|
|
90
|
|
- # Need to find best alignment to avoid a twist.
|
|
91
|
|
- shortest_length = 1e6
|
|
92
|
|
- f2_start_index = 0
|
|
93
|
|
- for i in range(4):
|
|
94
|
|
- x = projected_dist(me, i1, i2, f1, f2, 0, i)
|
|
95
|
|
- if x < shortest_length:
|
|
96
|
|
- shortest_length = x
|
|
97
|
|
- f2_start_index = i
|
|
98
|
|
- ans = []
|
|
99
|
|
- j = f2_start_index
|
|
100
|
|
- for i in range(4):
|
|
101
|
|
- fdata = [i1 + cube_faces[f1][i],
|
|
102
|
|
- i2 + cube_faces[f2][j],
|
|
103
|
|
- i2 + cube_faces[f2][(j + 1) % 4],
|
|
104
|
|
- i1 + cube_faces[f1][(i - 1) % 4]]
|
|
105
|
|
- if fdata[3] == 0:
|
|
106
|
|
- fdata = [fdata[3]] + fdata[0:3]
|
|
107
|
|
- ans.extend(fdata)
|
|
108
|
|
- j = (j - 1) % 4
|
|
109
|
|
- return ans
|
|
110
|
|
-
|
|
111
|
|
-
|
|
112
|
|
-# Return map: v -> list of length len(node_normals) where
|
|
113
|
|
-# each element of the list is either None (no assignment)
|
|
114
|
|
-# or ((v0, v1), 0 or 1) giving an edge and direction that face is assigned to.
|
|
115
|
|
-def find_assignment(me, edges, vert_edges, node_normals):
|
|
116
|
|
- nf = len(node_normals)
|
|
117
|
|
- feasible = {}
|
|
118
|
|
- for e in edges:
|
|
119
|
|
- for k in (0, 1):
|
|
120
|
|
- fds = [(f, norm_dot(e, k, node_normals[f], me)) for f in range(nf)]
|
|
121
|
|
- feasible[(e, k)] = [fd for fd in fds if fd[1] > 0.01]
|
|
122
|
|
- assignment = {}
|
|
123
|
|
- for v, ves in vert_edges.items():
|
|
124
|
|
- assignment[v] = best_assignment(ves, feasible, nf)
|
|
125
|
|
- return assignment
|
|
126
|
|
-
|
|
127
|
|
-def best_assignment(ves, feasible, nf):
|
|
128
|
|
- apartial = [ None ] * nf
|
|
129
|
|
- return best_assign_help(ves, feasible, apartial, 0.0)[0]
|
|
130
|
|
-
|
|
131
|
|
-def best_assign_help(ves, feasible, apartial, sumpartial):
|
|
132
|
|
- if len(ves) == 0:
|
|
133
|
|
- return (apartial, sumpartial)
|
|
134
|
|
- else:
|
|
135
|
|
- ek0 = ves[0]
|
|
136
|
|
- vesrest = ves[1:]
|
|
137
|
|
- feas = feasible[ek0]
|
|
138
|
|
- bestsum = 0
|
|
139
|
|
- besta = None
|
|
140
|
|
- for (f, d) in feas:
|
|
141
|
|
- if apartial[f] is None:
|
|
142
|
|
- ap = apartial[:]
|
|
143
|
|
- ap[f] = ek0
|
|
144
|
|
- # sum up d**2 to penalize smaller d's more
|
|
145
|
|
- sp = sumpartial + d*d
|
|
146
|
|
- (a, s) = best_assign_help(vesrest, feasible, ap, sp)
|
|
147
|
|
- if s > bestsum:
|
|
148
|
|
- bestsum = s
|
|
149
|
|
- besta = a
|
|
150
|
|
- if besta:
|
|
151
|
|
- return (besta, bestsum)
|
|
152
|
|
- else:
|
|
153
|
|
- # not feasible to assign e0, k0; try to assign rest
|
|
154
|
|
- return best_assign_help(vesrest, feasible, apartial, sumpartial)
|
|
155
|
|
-
|
|
156
|
|
-def assigned_face(e, assignment):
|
|
157
|
|
- (v0, v1), dir = e
|
|
158
|
|
- a = assignment[v1]
|
|
159
|
|
- for j, ee in enumerate(a):
|
|
160
|
|
- if e == ee:
|
|
161
|
|
- return j
|
|
162
|
|
- return -1
|
|
163
|
|
-
|
|
164
|
|
-def create_wired_mesh(me2, me, thick):
|
|
165
|
|
- edges = []
|
|
166
|
|
- vert_edges = {}
|
|
167
|
|
- for be in me.edges:
|
|
168
|
|
- if be.select and not be.hide:
|
|
169
|
|
- e = (be.key[0], be.key[1])
|
|
170
|
|
- edges.append(e)
|
|
171
|
|
- for k in (0, 1):
|
|
172
|
|
- if e[k] not in vert_edges:
|
|
173
|
|
- vert_edges[e[k]] = []
|
|
174
|
|
- vert_edges[e[k]].append((e, k))
|
|
175
|
|
-
|
|
176
|
|
- assignment = find_assignment(me, edges, vert_edges, cube_normals)
|
|
177
|
|
-
|
|
178
|
|
- # Create the geometry
|
|
179
|
|
- n_idx = {}
|
|
180
|
|
- for v in assignment:
|
|
181
|
|
- vpos = me.vertices[v]
|
|
182
|
|
- index = len(me2.vertices)
|
|
183
|
|
- # We need to associate each node with the new geometry
|
|
184
|
|
- n_idx[v] = index
|
|
185
|
|
- # Geometry for the nodes, each one a cube
|
|
186
|
|
- create_cube(me2, vpos, thick)
|
|
187
|
|
-
|
|
188
|
|
- # Skin using the new geometry
|
|
189
|
|
- cfaces = []
|
|
190
|
|
- for k, f in assignment.items():
|
|
191
|
|
- # Skin the nodes
|
|
192
|
|
- for i in range(len(cube_faces)):
|
|
193
|
|
- if f[i] is None:
|
|
194
|
|
- cfaces.extend(fill_cube_face(me2, n_idx[k], i))
|
|
195
|
|
- else:
|
|
196
|
|
- (v0, v1), dir = f[i]
|
|
197
|
|
- # only skin between edges in forward direction
|
|
198
|
|
- # to avoid making doubles
|
|
199
|
|
- if dir == 1:
|
|
200
|
|
- # but first make sure other end actually assigned
|
|
201
|
|
- i2 = assigned_face(((v0, v1), 0), assignment)
|
|
202
|
|
- if i2 == -1:
|
|
203
|
|
- cfaces.extend(fill_cube_face(me2, n_idx[k], i))
|
|
204
|
|
- continue
|
|
205
|
|
- i2 = assigned_face(((v0, v1), 1), assignment)
|
|
206
|
|
- if i2 != -1:
|
|
207
|
|
- cfaces.extend(skin_edges(me2, n_idx[v0], n_idx[v1], i, i2))
|
|
208
|
|
- else:
|
|
209
|
|
- # assignment failed for this edge
|
|
210
|
|
- cfaces.extend(fill_cube_face(me2, n_idx[k], i))
|
|
211
|
|
-
|
|
212
|
|
- # adding faces to the mesh
|
|
213
|
|
- me2.tessfaces.add(len(cfaces) // 4)
|
|
214
|
|
- me2.tessfaces.foreach_set("vertices_raw", cfaces)
|
|
215
|
|
- me2.update(calc_edges=True)
|
|
216
|
|
-
|
|
217
|
|
-# Add built in wireframe
|
|
218
|
|
-def wire_add(mallas):
|
|
219
|
|
- if mallas:
|
|
220
|
|
- bpy.ops.object.select_all(action='DESELECT')
|
|
221
|
|
- bpy.context.scene.objects.active = mallas[0]
|
|
222
|
|
- for o in mallas: o.select = True
|
|
223
|
|
- bpy.ops.object.duplicate()
|
|
224
|
|
- obj, sce = bpy.context.object, bpy.context.scene
|
|
225
|
|
- for mod in obj.modifiers: obj.modifiers.remove(mod)
|
|
226
|
|
- bpy.ops.object.join()
|
|
227
|
|
- bpy.ops.object.mode_set(mode='EDIT')
|
|
228
|
|
- bpy.ops.mesh.wireframe(thickness=0.005)
|
|
229
|
|
- bpy.ops.object.mode_set()
|
|
230
|
|
- for mat in obj.material_slots: bpy.ops.object.material_slot_remove()
|
|
231
|
|
- if 'wire_object' in sce.objects.keys():
|
|
232
|
|
- sce.objects.get('wire_object').data = obj.data
|
|
233
|
|
- sce.objects.get('wire_object').matrix_world = mallas[0].matrix_world
|
|
234
|
|
- sce.objects.unlink(obj)
|
|
235
|
|
- else:
|
|
236
|
|
- obj.name = 'wire_object'
|
|
237
|
|
- obj.data.materials.append(bpy.data.materials.get('mat_wireobj'))
|
|
238
|
|
-
|
|
239
|
|
- return{'FINISHED'}
|
|
240
|
|
-'''
|
|
241
|
|
-class VIEW3D_PT_tools_SolidifyWireframe(bpy.types.Panel):
|
|
242
|
|
- bl_space_type = 'VIEW_3D'
|
|
243
|
|
- bl_region_type = 'TOOLS'
|
|
244
|
|
- bl_context = "mesh_edit"
|
|
245
|
|
- bl_label = "Solidify Wireframe"
|
|
246
|
|
-
|
|
247
|
|
- def draw(self, context):
|
|
248
|
|
- active_obj = context.active_object
|
|
249
|
|
- layout = self.layout
|
|
250
|
|
- col = layout.column(align=True)
|
|
251
|
|
- col.operator("mesh.solidify_wireframe", text="Solidify")
|
|
252
|
|
- col.prop(context.scene, "swThickness")
|
|
253
|
|
- col.prop(context.scene, "swSelectNew")
|
|
254
|
|
-'''
|
|
255
|
|
-# a class for your operator
|
|
256
|
|
-class SolidifyWireframe(bpy.types.Operator):
|
|
257
|
|
- """Turns the selected edges of a mesh into solid objects"""
|
|
258
|
|
- bl_idname = "mesh.solidify_wireframe"
|
|
259
|
|
- bl_label = "Solidify Wireframe"
|
|
260
|
|
- bl_options = {'REGISTER', 'UNDO'}
|
|
261
|
|
-
|
|
262
|
|
- def invoke(self, context, event):
|
|
263
|
|
- return self.execute(context)
|
|
264
|
|
-
|
|
265
|
|
- @classmethod
|
|
266
|
|
- def poll(cls, context):
|
|
267
|
|
- ob = context.active_object
|
|
268
|
|
- return ob and ob.type == 'MESH'
|
|
269
|
|
-
|
|
270
|
|
- def execute(self, context):
|
|
271
|
|
- # Get the active object
|
|
272
|
|
- ob_act = context.active_object
|
|
273
|
|
- # getting current edit mode
|
|
274
|
|
- currMode = ob_act.mode
|
|
275
|
|
- # switching to object mode
|
|
276
|
|
- bpy.ops.object.mode_set(mode='OBJECT')
|
|
277
|
|
- bpy.ops.object.select_all(action='DESELECT')
|
|
278
|
|
- # getting mesh data
|
|
279
|
|
- mymesh = ob_act.data
|
|
280
|
|
- #getting new mesh
|
|
281
|
|
- newmesh = bpy.data.meshes.new(mymesh.name + " wire")
|
|
282
|
|
- obj = bpy.data.objects.new(newmesh.name,newmesh)
|
|
283
|
|
- obj.location = ob_act.location
|
|
284
|
|
- obj.rotation_euler = ob_act.rotation_euler
|
|
285
|
|
- obj.scale = ob_act.scale
|
|
286
|
|
- context.scene.objects.link(obj)
|
|
287
|
|
- create_wired_mesh(newmesh, mymesh, context.scene.swThickness)
|
|
288
|
|
-
|
|
289
|
|
- # restoring original editmode if needed
|
|
290
|
|
- if context.scene.swSelectNew:
|
|
291
|
|
- obj.select = True
|
|
292
|
|
- context.scene.objects.active = obj
|
|
293
|
|
- else:
|
|
294
|
|
- bpy.ops.object.mode_set(mode=currMode)
|
|
295
|
|
-
|
|
296
|
|
- # returning after everything is done
|
|
297
|
|
- return {'FINISHED'}
|
|
298
|
|
-
|
|
299
|
|
-class WireMaterials(bpy.types.Operator):
|
|
300
|
|
- bl_idname = 'scene.wire_render'
|
|
301
|
|
- bl_label = 'Apply Materials'
|
|
302
|
|
- bl_description = 'Set Up Materials for a Wire Render'
|
|
303
|
|
- bl_options = {'REGISTER', 'UNDO'}
|
|
304
|
|
-
|
|
305
|
|
- def execute(self, context):
|
|
306
|
|
- wm = bpy.context.window_manager
|
|
307
|
|
- sce = bpy.context.scene
|
|
308
|
|
-
|
|
309
|
|
- if 'mat_clay' not in bpy.data.materials:
|
|
310
|
|
- mat = bpy.data.materials.new('mat_clay')
|
|
311
|
|
- mat.specular_intensity = 0
|
|
312
|
|
- else: mat = bpy.data.materials.get('mat_clay')
|
|
313
|
|
- mat.diffuse_color = wm.col_clay
|
|
314
|
|
- mat.use_shadeless = wm.shadeless_mat
|
|
315
|
|
-
|
|
316
|
|
- if 'mat_wire' not in bpy.data.materials:
|
|
317
|
|
- mat = bpy.data.materials.new('mat_wire')
|
|
318
|
|
- mat.specular_intensity = 0
|
|
319
|
|
- mat.use_transparency = True
|
|
320
|
|
- mat.type = 'WIRE'
|
|
321
|
|
- mat.offset_z = 0.05
|
|
322
|
|
- else: mat = bpy.data.materials.get('mat_wire')
|
|
323
|
|
- mat.diffuse_color = wm.col_wire
|
|
324
|
|
- mat.use_shadeless = wm.shadeless_mat
|
|
325
|
|
-
|
|
326
|
|
- try: bpy.ops.object.mode_set()
|
|
327
|
|
- except: pass
|
|
328
|
|
-
|
|
329
|
|
- if wm.selected_meshes: objetos = bpy.context.selected_objects
|
|
330
|
|
- else: objetos = sce.objects
|
|
331
|
|
-
|
|
332
|
|
- mallas = [o for o in objetos if o.type == 'MESH' and o.is_visible(sce) and o.name != 'wire_object']
|
|
333
|
|
-
|
|
334
|
|
- for obj in mallas:
|
|
335
|
|
- sce.objects.active = obj
|
|
336
|
|
- print ('procesando >', obj.name)
|
|
337
|
|
- obj.show_wire = wm.wire_view
|
|
338
|
|
- for mat in obj.material_slots:
|
|
339
|
|
- bpy.ops.object.material_slot_remove()
|
|
340
|
|
- obj.data.materials.append(bpy.data.materials.get('mat_wire'))
|
|
341
|
|
- obj.data.materials.append(bpy.data.materials.get('mat_clay'))
|
|
342
|
|
- obj.material_slots.data.active_material_index = 1
|
|
343
|
|
- bpy.ops.object.editmode_toggle()
|
|
344
|
|
- bpy.ops.mesh.select_all(action='SELECT')
|
|
345
|
|
- bpy.ops.object.material_slot_assign()
|
|
346
|
|
- bpy.ops.object.mode_set()
|
|
347
|
|
-
|
|
348
|
|
- if wm.wire_object:
|
|
349
|
|
- if 'mat_wireobj' not in bpy.data.materials:
|
|
350
|
|
- mat = bpy.data.materials.new('mat_wireobj')
|
|
351
|
|
- mat.specular_intensity = 0
|
|
352
|
|
- else: mat = bpy.data.materials.get('mat_wireobj')
|
|
353
|
|
- mat.diffuse_color = wm.col_wire
|
|
354
|
|
- mat.use_shadeless = wm.shadeless_mat
|
|
355
|
|
- wire_add(mallas)
|
|
356
|
|
-
|
|
357
|
|
- return{'FINISHED'}
|
|
358
|
|
-
|
|
359
|
|
-class PanelWMat(bpy.types.Panel):
|
|
360
|
|
- bl_label = 'Setup Wire Render'
|
|
361
|
|
- bl_space_type = 'VIEW_3D'
|
|
362
|
|
- bl_region_type = 'TOOLS'
|
|
363
|
|
- bl_options = {'DEFAULT_CLOSED'}
|
|
364
|
|
-
|
|
365
|
|
- def draw(self, context):
|
|
366
|
|
- wm = bpy.context.window_manager
|
|
367
|
|
- active_obj = context.active_object
|
|
368
|
|
- layout = self.layout
|
|
369
|
|
-
|
|
370
|
|
- column = layout.column(align=True)
|
|
371
|
|
- column.prop(wm, 'col_clay')
|
|
372
|
|
- column.prop(wm, 'col_wire')
|
|
373
|
|
- column = layout.column(align=True)
|
|
374
|
|
- column.prop(wm, 'selected_meshes')
|
|
375
|
|
- column.prop(wm, 'shadeless_mat')
|
|
376
|
|
- column.prop(wm, 'wire_view')
|
|
377
|
|
- column.prop(wm, 'wire_object')
|
|
378
|
|
- column.separator()
|
|
379
|
|
- column.operator('scene.wire_render')
|
|
380
|
|
- column.label(text='- - - - - - - - - - - - - - - - - - - - - -')
|
|
381
|
|
- col = layout.column(align=True)
|
|
382
|
|
- column.label(text='Solid WireFrame')
|
|
383
|
|
- layout.operator("mesh.solidify_wireframe", text="Create Mesh Object")
|
|
384
|
|
- col.prop(context.scene, "swThickness")
|
|
385
|
|
- col.prop(context.scene, "swSelectNew")
|
|
386
|
|
-bpy.types.WindowManager.selected_meshes = bpy.props.BoolProperty(name='Selected Meshes', default=False, description='Apply materials to Selected Meshes / All Visible Meshes')
|
|
387
|
|
-bpy.types.WindowManager.shadeless_mat = bpy.props.BoolProperty(name='Shadeless', default=False, description='Generate Shadeless Materials')
|
|
388
|
|
-bpy.types.WindowManager.col_clay = bpy.props.FloatVectorProperty(name='', description='Clay Color', default=(1.0, 0.9, 0.8), min=0, max=1, step=1, precision=3, subtype='COLOR_GAMMA', size=3)
|
|
389
|
|
-bpy.types.WindowManager.col_wire = bpy.props.FloatVectorProperty(name='', description='Wire Color', default=(0.1 ,0.0 ,0.0), min=0, max=1, step=1, precision=3, subtype='COLOR_GAMMA', size=3)
|
|
390
|
|
-bpy.types.WindowManager.wire_view = bpy.props.BoolProperty(name='Viewport Wires', default=False, description='Overlay wires display over solid in Viewports')
|
|
391
|
|
-bpy.types.WindowManager.wire_object = bpy.props.BoolProperty(name='Create Mesh Object', default=False, description='Add a Wire Object to scene to be able to render wires in Cycles')
|
|
392
|
|
-bpy.types.Scene.swThickness = bpy.props.FloatProperty(name="Thickness", description="Thickness of the skinned edges", default=0.01)
|
|
393
|
|
-bpy.types.Scene.swSelectNew = bpy.props.BoolProperty(name="Select wire", description="If checked, the wire object will be selected after creation", default=True)
|
|
394
|
|
-
|
|
395
|
|
-# Register the operator
|
|
396
|
|
-def solidifyWireframe_menu_func(self, context):
|
|
397
|
|
- self.layout.operator(SolidifyWireframe.bl_idname, text="Solidify Wireframe", icon='PLUGIN')
|
|
398
|
|
-
|
|
399
|
|
-# Add "Solidify Wireframe" menu to the "Mesh" menu.
|
|
400
|
|
-def register():
|
|
401
|
|
- bpy.utils.register_class(WireMaterials)
|
|
402
|
|
- bpy.utils.register_class(PanelWMat)
|
|
403
|
|
- bpy.utils.register_module(__name__)
|
|
404
|
|
- bpy.types.Scene.swThickness = bpy.props.FloatProperty(name="Thickness",
|
|
405
|
|
- description="Thickness of the skinned edges",
|
|
406
|
|
- default=0.01)
|
|
407
|
|
- bpy.types.Scene.swSelectNew = bpy.props.BoolProperty(name="Select wire",
|
|
408
|
|
- description="If checked, the wire object will be selected after creation",
|
|
409
|
|
- default=True)
|
|
410
|
|
- bpy.types.VIEW3D_MT_edit_mesh_edges.append(solidifyWireframe_menu_func)
|
|
411
|
|
-
|
|
412
|
|
-# Remove "Solidify Wireframe" menu entry from the "Mesh" menu.
|
|
413
|
|
-def unregister():
|
|
414
|
|
- bpy.utils.unregister_class(WireMaterials)
|
|
415
|
|
- bpy.utils.unregister_class(PanelWMat)
|
|
416
|
|
- bpy.utils.unregister_module(__name__)
|
|
417
|
|
- del bpy.types.Scene.swThickness
|
|
418
|
|
- bpy.types.VIEW3D_MT_edit_mesh_edges.remove(solidifyWireframe_menu_func)
|
|
419
|
|
-
|
|
420
|
|
-if __name__ == "__main__":
|
|
421
|
|
- register()
|