def update(self, context):
# update height via bmesh to avoid loosing material ids
# this should be the rule for other simple objects
# as long as there is no topologic changes
o = context.active_object
if archipack_wall.datablock(o) != self:
return
bpy.ops.object.mode_set(mode='EDIT')
me = o.data
bm = bmesh.from_edit_mesh(me)
bm.verts.ensure_lookup_table()
bm.faces.ensure_lookup_table()
new_z = self.z
last_z = list(v.co.z for v in bm.verts)
max_z = max(last_z)
for v in bm.verts:
if v.co.z == max_z:
v.co.z = new_z
bmesh.update_edit_mesh(me, True)
bpy.ops.object.mode_set(mode='OBJECT')
评论列表
文章目录