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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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
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.show_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")
51 layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
55 if rd.has_multiple_engines:
56 layout.prop(rd, "engine", text="")
60 layout.template_running_jobs()
62 layout.template_reports_banner()
64 layout.label(text=scene.statistics())
66 # XXX: this should be right-aligned to the RHS of the region
67 layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
69 # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
71 sinfo = context.space_data
72 row = layout.row(align=True)
73 row.prop(sinfo, "show_report_debug", text="Debug")
74 row.prop(sinfo, "show_report_info", text="Info")
75 row.prop(sinfo, "show_report_operator", text="Operators")
76 row.prop(sinfo, "show_report_warning", text="Warnings")
77 row.prop(sinfo, "show_report_error", text="Errors")
80 row.enabled = sinfo.show_report_operator
81 row.operator("info.report_replay")
83 row.menu("INFO_MT_report")
87 class INFO_MT_report(bpy.types.Menu):
90 def draw(self, context):
93 layout.operator("console.select_all_toggle")
94 layout.operator("console.select_border")
95 layout.operator("console.report_delete")
96 layout.operator("console.report_copy")
99 class INFO_MT_file(bpy.types.Menu):
102 def draw(self, context):
105 layout.operator_context = 'EXEC_AREA'
106 layout.operator("wm.read_homefile", text="New", icon='NEW')
107 layout.operator_context = 'INVOKE_AREA'
108 layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
109 layout.menu("INFO_MT_file_open_recent")
110 layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
111 layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
115 layout.operator_context = 'INVOKE_AREA'
116 layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
117 layout.operator_context = 'INVOKE_AREA'
118 layout.operator("wm.save_as_mainfile", text="Save As...")
119 layout.operator_context = 'INVOKE_AREA'
120 layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
124 layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
126 layout.operator_context = 'EXEC_AREA'
127 layout.operator("wm.save_homefile")
128 layout.operator("wm.read_factory_settings")
132 layout.operator_context = 'INVOKE_AREA'
133 layout.operator("wm.link_append", text="Link")
134 props = layout.operator("wm.link_append", text="Append")
136 props.instance_groups = False
140 layout.menu("INFO_MT_file_import")
141 layout.menu("INFO_MT_file_export")
145 layout.menu("INFO_MT_file_external_data")
149 layout.operator_context = 'EXEC_AREA'
150 layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
153 class INFO_MT_file_import(bpy.types.Menu):
154 bl_idname = "INFO_MT_file_import"
157 def draw(self, context):
158 if hasattr(bpy.types, "WM_OT_collada_import"):
159 self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
162 class INFO_MT_file_export(bpy.types.Menu):
163 bl_idname = "INFO_MT_file_export"
166 def draw(self, context):
167 if hasattr(bpy.types, "WM_OT_collada_export"):
168 self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
171 class INFO_MT_file_external_data(bpy.types.Menu):
172 bl_label = "External Data"
174 def draw(self, context):
177 layout.operator("file.pack_all", text="Pack into .blend file")
178 layout.operator("file.unpack_all", text="Unpack into Files")
182 layout.operator("file.make_paths_relative")
183 layout.operator("file.make_paths_absolute")
184 layout.operator("file.report_missing_files")
185 layout.operator("file.find_missing_files")
188 class INFO_MT_mesh_add(bpy.types.Menu):
189 bl_idname = "INFO_MT_mesh_add"
192 def draw(self, context):
194 layout.operator_context = 'INVOKE_REGION_WIN'
195 layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
196 layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
197 layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
198 layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
199 layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
200 layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
201 layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
203 layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
204 layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
207 class INFO_MT_curve_add(bpy.types.Menu):
208 bl_idname = "INFO_MT_curve_add"
211 def draw(self, context):
213 layout.operator_context = 'INVOKE_REGION_WIN'
214 layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
215 layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
216 layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
217 layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
218 layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
221 class INFO_MT_edit_curve_add(bpy.types.Menu):
222 bl_idname = "INFO_MT_edit_curve_add"
225 def draw(self, context):
226 is_surf = context.active_object.type == 'SURFACE'
229 layout.operator_context = 'INVOKE_REGION_WIN'
232 INFO_MT_surface_add.draw(self, context)
234 INFO_MT_curve_add.draw(self, context)
237 class INFO_MT_surface_add(bpy.types.Menu):
238 bl_idname = "INFO_MT_surface_add"
241 def draw(self, context):
243 layout.operator_context = 'INVOKE_REGION_WIN'
244 layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
245 layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
246 layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
247 layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
248 layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
249 layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
252 class INFO_MT_armature_add(bpy.types.Menu):
253 bl_idname = "INFO_MT_armature_add"
254 bl_label = "Armature"
256 def draw(self, context):
258 layout.operator_context = 'INVOKE_REGION_WIN'
259 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
262 class INFO_MT_add(bpy.types.Menu):
265 def draw(self, context):
268 layout.operator_context = 'EXEC_SCREEN'
270 #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
271 layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
273 #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
274 layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
275 #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
276 layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
277 layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
278 layout.operator_context = 'INVOKE_REGION_WIN'
279 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
282 layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
283 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
284 layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
287 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
288 layout.operator_context = 'EXEC_SCREEN'
289 layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
292 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
295 if(len(bpy.data.groups) > 10):
296 layout.operator_context = 'INVOKE_DEFAULT'
297 layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
299 layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
302 class INFO_MT_game(bpy.types.Menu):
305 def draw(self, context):
308 gs = context.scene.game_settings
310 layout.operator("view3d.game_start")
314 layout.prop(gs, "show_debug_properties")
315 layout.prop(gs, "show_framerate_profile")
316 layout.prop(gs, "show_physics_visualization")
317 layout.prop(gs, "use_deprecation_warnings")
318 layout.prop(gs, "use_animation_record")
320 layout.prop(gs, "use_auto_start")
323 class INFO_MT_render(bpy.types.Menu):
326 def draw(self, context):
329 # rd = context.scene.render
331 layout.operator("render.render", text="Render Image", icon='RENDER_STILL')
332 layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
336 layout.operator("render.opengl", text="OpenGL Render Image")
337 layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
341 layout.operator("render.view_show")
342 layout.operator("render.play_rendered_anim")
345 class INFO_MT_help(bpy.types.Menu):
348 def draw(self, context):
353 layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
354 layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-256-beta/'
358 layout.operator("wm.url_open", text="Blender Website", icon='URL').url = 'http://www.blender.org/'
359 layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = 'http://www.blender.org/e-shop'
360 layout.operator("wm.url_open", text="Developer Community", icon='URL').url = 'http://www.blender.org/community/get-involved/'
361 layout.operator("wm.url_open", text="User Community", icon='URL').url = 'http://www.blender.org/community/user-community/'
363 layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
365 layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version)
366 layout.operator("help.operator_cheat_sheet", icon='TEXT')
367 layout.operator("wm.sysinfo", icon='TEXT')
369 if sys.platform == "win32":
370 layout.operator("wm.toggle_console", icon='CONSOLE')
372 layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
374 layout.operator("wm.splash", icon='BLENDER')
380 class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
381 bl_idname = "help.operator_cheat_sheet"
382 bl_label = "Operator Cheat Sheet"
384 def execute(self, context):
387 for op_module_name in dir(bpy.ops):
388 op_module = getattr(bpy.ops, op_module_name)
389 for op_submodule_name in dir(op_module):
390 op = getattr(op_module, op_submodule_name)
392 if text.split("\n")[-1].startswith('bpy.ops.'):
393 op_strings.append(text)
396 op_strings.append('')
398 textblock = bpy.data.texts.new("OperatorList.txt")
399 textblock.write('# %d Operators\n\n' % tot)
400 textblock.write('\n'.join(op_strings))
401 self.report({'INFO'}, "See OperatorList.txt textblock")
406 bpy.utils.register_module(__name__)
410 bpy.utils.unregister_module(__name__)
412 if __name__ == "__main__":