在前面我们可以看到闪屏的图片,也分析了闪屏里显示的菜单来源,但是还没有把整个菜单显示的过程搞清楚。比如说在blender里是怎么调用python的类代码运行呢?在这里闪屏菜单的python的类代码如下:
- class WM_MT_splash(Menu):
- bl_label = "Splash"
-
- def draw(self, context):
- layout = self.layout
- layout.operator_context = 'EXEC_DEFAULT'
- layout.emboss = 'PULLDOWN_MENU'
-
- split = layout.split()
-
- # Templates
- col1 = split.column()
- col1.label(text="New File")
-
- bpy.types.TOPBAR_MT_file_new.draw_ex(col1, context, use_splash=True)
-
- # Recent
- col2 = split.column()
- col2_title = col2.row()
-
- found_recent = col2.template_recent_files()
-
- if found_recent:
- col2_title.label(text="Recent Files")
- else:
-
- # Links if no recent files
- col2_title.label(text=&