论坛

由用户创建的信息 Shaft
27 August 2016 22:49
Спасибо за помощь, сделал через GitHub. Жду ответа там.
24 August 2016 21:05
Предлагаю простое изменение в коде класса B4W_FaceVertexNormals (vertex_normals.py) которое позволяет этой функции работать с любым количеством выделенных лиц и задавать им независимые нормали:

Старый код:
if len(sel_indices) < 3:
self.report({'INFO'}, _('Please select at least 3 vertices'))
return {"FINISHED"}

for p in mesh.polygons:
all_in = True

for i in sel_indices:
if mesh.vertices.index not in p.vertices:
all_in = False
break

if all_in:
for i in sel_indices:
set_vertex_normal(i, (p.normal.x, p.normal.y, p.normal.z))

Новый код:
if len(sel_indices) < 3:
self.report({'INFO'}, _('Please select at least 3 vertices'))
return {"FINISHED"}
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')

sel_polys = []

for p in mesh.polygons:
if p.select == True:
sel_polys.append(p)

for i in sel_indices:
resVec = mathutils.Vector((0,0,0))
for p in sel_polys:
if i.index in p.vertices:
resVec = resVec + p.normal
resVec.normalize()
set_vertex_normal(i,(resVec.x,resVec.y,resVec.z))