def relocate_child(self, context, o, g, child):
d = archipack_roof.datablock(child)
if d is not None and d.t_part - 1 < len(g.segs):
# print("relocate_child(%s)" % (child.name))
seg = g.segs[d.t_part]
# adjust T part matrix_world from parent
# T part origin located on parent axis
# with y in parent direction
t = (d.t_dist_x / seg.length)
x, y, z = seg.lerp(t).to_3d()
dy = -seg.v.normalized()
child.matrix_world = o.matrix_world * Matrix([
[dy.x, -dy.y, 0, x],
[dy.y, dy.x, 0, y],
[0, 0, 1, z],
[0, 0, 0, 1]
])
评论列表
文章目录