1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
23 class INFO_HT_header(bpy.types.Header):
24 bl_space_type = 'INFO'
26 def draw(self, context):
29 window = context.window
31 rd = scene.render_data
33 row = layout.row(align=True)
36 if context.area.show_menus:
37 sub = row.row(align=True)
38 sub.menu("INFO_MT_file")
39 sub.menu("INFO_MT_add")
40 if rd.use_game_engine:
41 sub.menu("INFO_MT_game")
43 sub.menu("INFO_MT_render")
44 sub.menu("INFO_MT_help")
46 if window.screen.fullscreen:
47 layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
50 layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
52 layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
56 if rd.multiple_engines:
57 layout.prop(rd, "engine", text="")
61 layout.template_operator_search()
62 layout.template_running_jobs()
64 layout.label(text=scene.statistics())
66 layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
69 class INFO_MT_file(bpy.types.Menu):
72 def draw(self, context):
75 layout.operator_context = 'EXEC_AREA'
76 layout.operator("wm.read_homefile", text="New", icon='NEW')
77 layout.operator_context = 'INVOKE_AREA'
78 layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
79 layout.menu("INFO_MT_file_open_recent")
80 layout.operator("wm.recover_last_session")
81 layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
85 layout.operator_context = 'INVOKE_AREA'
86 layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
87 layout.operator_context = 'INVOKE_AREA'
88 layout.operator("wm.save_as_mainfile", text="Save As...")
92 layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
93 layout.operator("wm.read_homefile", text="Load Factory Settings").factory = True
97 layout.operator_context = 'INVOKE_AREA'
98 layout.operator("wm.link_append", text="Link")
99 layout.operator("wm.link_append", text="Append").link = False
103 layout.menu("INFO_MT_file_import")
104 layout.menu("INFO_MT_file_export")
108 layout.menu("INFO_MT_file_external_data")
112 layout.operator_context = 'EXEC_AREA'
113 layout.operator("wm.exit_blender", text="Quit", icon='QUIT')
116 class INFO_MT_file_open_recent(bpy.types.Menu):
117 bl_idname = "INFO_MT_file_open_recent"
118 bl_label = "Open Recent..."
120 def draw(self, context):
123 layout.operator_context = 'EXEC_AREA'
124 file = open(os.path.join(bpy.home, ".Blog"), "rU")
127 layout.operator("wm.open_mainfile", text=line, icon='FILE_BLEND').path = line
130 class INFO_MT_file_import(bpy.types.Menu):
131 bl_idname = "INFO_MT_file_import"
134 def draw(self, context):
135 if "collada_import" in dir(bpy.ops.wm):
136 self.layout.operator("wm.collada_import", text="COLLADA (.dae)...")
139 class INFO_MT_file_export(bpy.types.Menu):
140 bl_idname = "INFO_MT_file_export"
143 def draw(self, context):
144 if "collada_export" in dir(bpy.ops.wm):
145 self.layout.operator("wm.collada_export", text="COLLADA (.dae)...")
148 class INFO_MT_file_external_data(bpy.types.Menu):
149 bl_label = "External Data"
151 def draw(self, context):
154 layout.operator("file.pack_all", text="Pack into .blend file")
155 layout.operator("file.unpack_all", text="Unpack into Files...")
159 layout.operator("file.make_paths_relative")
160 layout.operator("file.make_paths_absolute")
161 layout.operator("file.report_missing_files")
162 layout.operator("file.find_missing_files")
165 class INFO_MT_mesh_add(bpy.types.Menu):
166 bl_idname = "INFO_MT_mesh_add"
167 bl_label = "Add Mesh"
169 def draw(self, context):
171 layout.operator_context = 'INVOKE_REGION_WIN'
172 layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
173 layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
174 layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
175 layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
176 layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
177 layout.operator("mesh.primitive_tube_add", icon='MESH_TUBE', text="Tube")
178 layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
180 layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
181 layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
184 class INFO_MT_armature_add(bpy.types.Menu):
185 bl_idname = "INFO_MT_armature_add"
186 bl_label = "Armature"
188 def draw(self, context):
190 layout.operator_context = 'INVOKE_REGION_WIN'
191 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
194 class INFO_MT_add(bpy.types.Menu):
197 def draw(self, context):
200 layout.operator_context = 'EXEC_SCREEN'
202 #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
203 layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
205 layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
206 layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
207 layout.operator_menu_enum("object.metaball_add", "type", 'META', text="Metaball", icon='OUTLINER_OB_META')
208 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
211 layout.operator_context = 'INVOKE_REGION_WIN'
212 layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
213 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
214 layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
217 layout.operator("object.add", text="Camera", icon='OUTLINER_OB_CAMERA').type = 'CAMERA'
218 layout.operator_context = 'EXEC_SCREEN'
219 layout.operator_menu_enum("object.lamp_add", "type", 'LAMP', text="Lamp", icon='OUTLINER_OB_LAMP')
222 layout.operator_menu_enum("object.effector_add", "type", 'EMPTY', text="Force Field", icon='OUTLINER_OB_EMPTY')
225 layout.operator_menu_enum("object.group_instance_add", "type", text="Group Instance", icon='OUTLINER_OB_EMPTY')
228 class INFO_MT_game(bpy.types.Menu):
231 def draw(self, context):
234 gs = context.scene.game_data
236 layout.operator("view3d.game_start")
240 layout.prop(gs, "show_debug_properties")
241 layout.prop(gs, "show_framerate_profile")
242 layout.prop(gs, "show_physics_visualization")
243 layout.prop(gs, "deprecation_warnings")
246 class INFO_MT_render(bpy.types.Menu):
249 def draw(self, context):
252 # rd = context.scene.render_data
254 layout.operator("screen.render", text="Render Image", icon='RENDER_STILL')
255 layout.operator("screen.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
259 layout.operator("screen.opengl_render", text="OpenGL Render Image")
260 layout.operator("screen.opengl_render", text="OpenGL Render Animation").animation = True
264 layout.operator("screen.render_view_show")
265 layout.operator("screen.play_rendered_anim")
268 class INFO_MT_help(bpy.types.Menu):
271 def draw(self, context):
274 layout.operator("help.manual", icon='HELP')
275 layout.operator("help.release_logs", icon='URL')
279 layout.operator("help.blender_website", icon='URL')
280 layout.operator("help.blender_eshop", icon='URL')
281 layout.operator("help.developer_community", icon='URL')
282 layout.operator("help.user_community", icon='URL')
284 layout.operator("help.report_bug", icon='URL')
286 layout.operator("help.python_api", icon='URL')
287 layout.operator("help.operator_cheat_sheet")
289 bpy.types.register(INFO_HT_header)
290 bpy.types.register(INFO_MT_file)
291 bpy.types.register(INFO_MT_file_open_recent)
292 bpy.types.register(INFO_MT_file_import)
293 bpy.types.register(INFO_MT_file_export)
294 bpy.types.register(INFO_MT_file_external_data)
295 bpy.types.register(INFO_MT_add)
296 bpy.types.register(INFO_MT_mesh_add)
297 bpy.types.register(INFO_MT_armature_add)
298 bpy.types.register(INFO_MT_game)
299 bpy.types.register(INFO_MT_render)
300 bpy.types.register(INFO_MT_help)
305 class HelpOperator(bpy.types.Operator):
307 def execute(self, context):
309 webbrowser.open(self._url)
313 class HELP_OT_manual(HelpOperator):
314 '''The Blender Wiki manual'''
315 bl_idname = "help.manual"
317 _url = 'http://wiki.blender.org/index.php/Doc:Manual'
320 class HELP_OT_release_logs(HelpOperator):
321 '''Information about the changes in this version of Blender'''
322 bl_idname = "help.release_logs"
323 bl_label = "Release Log"
324 _url = 'http://www.blender.org/development/release-logs/blender-250/'
327 class HELP_OT_blender_website(HelpOperator):
328 '''The official Blender website'''
329 bl_idname = "help.blender_website"
330 bl_label = "Blender Website"
331 _url = 'http://www.blender.org/'
334 class HELP_OT_blender_eshop(HelpOperator):
335 '''Buy official Blender resources and merchandise online'''
336 bl_idname = "help.blender_eshop"
337 bl_label = "Blender e-Shop"
338 _url = 'http://www.blender3d.org/e-shop'
341 class HELP_OT_developer_community(HelpOperator):
342 '''Get involved with Blender development'''
343 bl_idname = "help.developer_community"
344 bl_label = "Developer Community"
345 _url = 'http://www.blender.org/community/get-involved/'
348 class HELP_OT_user_community(HelpOperator):
349 '''Get involved with other Blender users'''
350 bl_idname = "help.user_community"
351 bl_label = "User Community"
352 _url = 'http://www.blender.org/community/user-community/'
355 class HELP_OT_report_bug(HelpOperator):
356 '''Report a bug in the Blender bug tracker'''
357 bl_idname = "help.report_bug"
358 bl_label = "Report a Bug"
359 _url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
362 class HELP_OT_python_api(HelpOperator):
363 '''Reference for operator and data Python API'''
364 bl_idname = "help.python_api"
365 bl_label = "Python API Reference"
366 _url = 'http://www.blender.org/documentation/250PythonDoc/'
369 class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
370 bl_idname = "help.operator_cheat_sheet"
371 bl_label = "Operator Cheat Sheet (new textblock)"
373 def execute(self, context):
376 for op_module_name in dir(bpy.ops):
377 op_module = getattr(bpy.ops, op_module_name)
378 for op_submodule_name in dir(op_module):
379 op = getattr(op_module, op_submodule_name)
381 if text.startswith('bpy.ops.'):
382 op_strings.append(text)
385 op_strings.append('')
387 bpy.ops.text.new() # XXX - assumes new text is always at the end!
388 textblock = bpy.data.texts[-1]
389 textblock.write('# %d Operators\n\n' % tot)
390 textblock.write('\n'.join(op_strings))
391 textblock.name = "OperatorList.txt"
392 print("See OperatorList.txt textblock")
395 bpy.types.register(HELP_OT_manual)
396 bpy.types.register(HELP_OT_release_logs)
397 bpy.types.register(HELP_OT_blender_website)
398 bpy.types.register(HELP_OT_blender_eshop)
399 bpy.types.register(HELP_OT_developer_community)
400 bpy.types.register(HELP_OT_user_community)
401 bpy.types.register(HELP_OT_report_bug)
402 bpy.types.register(HELP_OT_python_api)
403 bpy.types.register(HELP_OT_operator_cheat_sheet)