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 #####
21 from bpy.types import Header, Menu
24 class INFO_HT_header(Header):
25 bl_space_type = 'INFO'
27 def draw(self, context):
30 window = context.window
34 row = layout.row(align=True)
37 if context.area.show_menus:
38 sub = row.row(align=True)
39 sub.menu("INFO_MT_file")
40 sub.menu("INFO_MT_add")
41 if rd.use_game_engine:
42 sub.menu("INFO_MT_game")
44 sub.menu("INFO_MT_render")
45 sub.menu("INFO_MT_window")
46 sub.menu("INFO_MT_help")
48 if window.screen.show_fullscreen:
49 layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
52 layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
53 layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
57 if rd.has_multiple_engines:
58 layout.prop(rd, "engine", text="")
62 layout.template_running_jobs()
64 layout.template_reports_banner()
66 row = layout.row(align=True)
67 row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
68 row.label(text=scene.statistics())
70 # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
72 sinfo = context.space_data
73 row = layout.row(align=True)
74 row.prop(sinfo, "show_report_debug", text="Debug")
75 row.prop(sinfo, "show_report_info", text="Info")
76 row.prop(sinfo, "show_report_operator", text="Operators")
77 row.prop(sinfo, "show_report_warning", text="Warnings")
78 row.prop(sinfo, "show_report_error", text="Errors")
81 row.enabled = sinfo.show_report_operator
82 row.operator("info.report_replay")
84 row.menu("INFO_MT_report")
88 class INFO_MT_report(Menu):
91 def draw(self, context):
94 layout.operator("console.select_all_toggle")
95 layout.operator("console.select_border")
96 layout.operator("console.report_delete")
97 layout.operator("console.report_copy")
100 class INFO_MT_file(Menu):
103 def draw(self, context):
106 layout.operator_context = 'INVOKE_AREA'
107 layout.operator("wm.read_homefile", text="New", icon='NEW')
108 layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
109 layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
110 layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
111 layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
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...", icon='SAVE_AS')
119 layout.operator_context = 'INVOKE_AREA'
120 layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='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", icon='SAVE_PREFS')
128 layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
132 layout.operator_context = 'INVOKE_AREA'
133 layout.operator("wm.link_append", text="Link", icon='LINK_BLEND')
134 props = layout.operator("wm.link_append", text="Append", icon='APPEND_BLEND')
136 props.instance_groups = False
140 layout.menu("INFO_MT_file_import", icon='IMPORT')
141 layout.menu("INFO_MT_file_export", icon='EXPORT')
145 layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
149 layout.operator_context = 'EXEC_AREA'
150 layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
153 class INFO_MT_file_import(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 (Default) (.dae)")
162 class INFO_MT_file_export(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 (Default) (.dae)")
171 class INFO_MT_file_external_data(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(Menu):
189 bl_idname = "INFO_MT_mesh_add"
192 def draw(self, context):
195 layout.operator_context = 'INVOKE_REGION_WIN'
196 layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
197 layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
198 layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
199 layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
200 layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
201 layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
202 layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
204 layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
205 layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
206 layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
209 class INFO_MT_curve_add(Menu):
210 bl_idname = "INFO_MT_curve_add"
213 def draw(self, context):
216 layout.operator_context = 'INVOKE_REGION_WIN'
217 layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
218 layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
219 layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
220 layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
221 layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
224 class INFO_MT_edit_curve_add(Menu):
225 bl_idname = "INFO_MT_edit_curve_add"
228 def draw(self, context):
229 is_surf = context.active_object.type == 'SURFACE'
232 layout.operator_context = 'INVOKE_REGION_WIN'
235 INFO_MT_surface_add.draw(self, context)
237 INFO_MT_curve_add.draw(self, context)
240 class INFO_MT_surface_add(Menu):
241 bl_idname = "INFO_MT_surface_add"
244 def draw(self, context):
247 layout.operator_context = 'INVOKE_REGION_WIN'
248 layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
249 layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
250 layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
251 layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
252 layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
253 layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
256 class INFO_MT_armature_add(Menu):
257 bl_idname = "INFO_MT_armature_add"
258 bl_label = "Armature"
260 def draw(self, context):
263 layout.operator_context = 'INVOKE_REGION_WIN'
264 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
267 class INFO_MT_add(Menu):
270 def draw(self, context):
273 # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
275 layout.operator_context = 'EXEC_AREA'
277 #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
278 layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
280 #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
281 layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
282 #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
283 layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
284 layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
285 layout.operator_context = 'INVOKE_REGION_WIN'
286 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
289 layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
290 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
291 layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
294 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
297 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
298 layout.operator_context = 'EXEC_AREA'
299 layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
302 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
305 if(len(bpy.data.groups) > 10):
306 layout.operator_context = 'INVOKE_DEFAULT'
307 layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
309 layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
312 class INFO_MT_game(Menu):
315 def draw(self, context):
318 gs = context.scene.game_settings
320 layout.operator("view3d.game_start")
324 layout.prop(gs, "show_debug_properties")
325 layout.prop(gs, "show_framerate_profile")
326 layout.prop(gs, "show_physics_visualization")
327 layout.prop(gs, "use_deprecation_warnings")
328 layout.prop(gs, "use_animation_record")
330 layout.prop(gs, "use_auto_start")
333 class INFO_MT_render(Menu):
336 def draw(self, context):
339 layout.operator("render.render", text="Render Image", icon='RENDER_STILL')
340 layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
344 layout.operator("render.opengl", text="OpenGL Render Image")
345 layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
349 layout.operator("render.view_show")
350 layout.operator("render.play_rendered_anim")
353 class INFO_MT_window(Menu):
356 def draw(self, context):
359 window = context.window
360 display_settings = window.display_settings
364 layout.operator("wm.window_duplicate")
365 layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER')
366 if sys.platform[:3] == "win":
368 layout.operator("wm.console_toggle", icon='CONSOLE')
371 layout.prop_menu_enum(display_settings, "display_device", text="Display")
374 class INFO_MT_help(Menu):
377 def draw(self, context):
380 layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
381 layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-263"
384 layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
385 layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = "http://www.blender.org/e-shop"
386 layout.operator("wm.url_open", text="Developer Community", icon='URL').url = "http://www.blender.org/community/get-involved"
387 layout.operator("wm.url_open", text="User Community", icon='URL').url = "http://www.blender.org/community/user-community"
389 layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = "http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse"
392 layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = bpy.types.WM_OT_doc_view._prefix
393 layout.operator("wm.operator_cheat_sheet", icon='TEXT')
394 layout.operator("wm.sysinfo", icon='TEXT')
396 layout.operator("anim.update_data_paths", text="FCurve/Driver Version fix", icon='HELP')
397 layout.operator("logic.texface_convert", text="TexFace to Material Convert", icon='GAME')
400 layout.operator("wm.splash", icon='BLENDER')
402 if __name__ == "__main__": # only for live edit.
403 bpy.utils.register_module(__name__)