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")
评论列表
文章目录