space_userpref.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def draw_ex(self, context, *, use_splash=False, use_default=False, use_install=False):
        import os

        layout = self.layout

        # now draw the presets
        layout.operator_context = 'EXEC_DEFAULT'

        if use_default:
            props = layout.operator("wm.read_homefile", text="Default")
            props.use_splash = True
            props.app_template = ""
            layout.separator()

        template_paths = bpy.utils.app_template_paths()

        # expand template paths
        app_templates = []
        for path in template_paths:
            for d in os.listdir(path):
                if d.startswith(("__", ".")):
                    continue
                template = os.path.join(path, d)
                if os.path.isdir(template):
                    # template_paths_expand.append(template)
                    app_templates.append(d)

        for d in sorted(app_templates):
            props = layout.operator(
                "wm.read_homefile",
                text=bpy.path.display_name(d),
            )
            props.use_splash = True
            props.app_template = d

        if use_install:
            layout.separator()
            layout.operator_context = 'INVOKE_DEFAULT'
            props = layout.operator("wm.app_template_install")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号