addon.py 文件源码

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

项目:io_scene_mk8muunt 作者: Syroot 项目源码 文件源码
def set_models(ob, name):
    # If possible, attach child mesh objects (requires models to be available, io_scene_bfres and no existing children).
    if name in _empty_models or not addon_utils.check("io_scene_bfres")[1] or len(ob.children):
        return
    # Get the model or load it if it does not exist yet.
    model_ob = bpy.data.objects.get("MK8.{}".format(name))
    if not model_ob:
        model_ob = _load_model(name)
        if not model_ob:
            log(0, "Warning: No model found for '{}'.".format(name))
            _empty_models.append(name)
            return
        model_ob.name = "MK8.{}".format(name)
    # Link-clone the child objects and attach them to the given parent.
    for child in model_ob.children:
        child_ob = bpy.data.objects.new(child.name, child.data)
        child_ob.mk8.object_type = "ADDON_VISUALIZER"
        child_ob.parent = ob
        child_ob.lock_location = [True] * 3
        child_ob.lock_rotation = [True] * 3
        child_ob.lock_scale = [True] * 3
        bpy.context.scene.objects.link(child_ob)
        bpy.context.scene.update()  # Required to find the children at the parent's transform eventually.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号