archipack_reference_point.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def execute(self, context):
        if context.mode == "OBJECT":
            o = context.active_object
            props = archipack_reference_point.datablock(o)
            if props is None:
                return {'CANCELLED'}
            sel = [obj for obj in context.selected_objects if obj != o and obj.parent != o]
            itM = o.matrix_world.inverted()
            # print("parent_to_reference parenting:%s objects" % (len(sel)))
            for child in sel:
                rs = child.matrix_world.to_3x3().to_4x4()
                loc = itM * child.matrix_world.translation
                child.parent = None
                child.matrix_parent_inverse.identity()
                child.location = Vector((0, 0, 0))
                child.parent = o
                child.matrix_world = rs
                child.location = loc
            return {'FINISHED'}
        else:
            self.report({'WARNING'}, "Archipack: Option only valid in Object mode")
            return {'CANCELLED'}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号