Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / release / ui / space_info.py
1
2 import bpy
3
4 class INFO_HT_header(bpy.types.Header):
5         __space_type__ = "INFO"
6
7         def draw(self, context):
8                 layout = self.layout
9                 
10                 st = context.space_data
11                 rd = context.scene.render_data
12
13                 row = layout.row(align=True)
14                 row.template_header()
15
16                 if context.area.show_menus:
17                         sub = row.row(align=True)
18                         sub.itemM("INFO_MT_file")
19                         sub.itemM("INFO_MT_add")
20                         if rd.use_game_engine:
21                                 sub.itemM("INFO_MT_game")
22                         else:
23                                 sub.itemM("INFO_MT_render")
24                         sub.itemM("INFO_MT_help")
25
26                 layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
27                 layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
28
29                 if rd.multiple_engines:
30                         layout.itemR(rd, "engine", text="")
31
32                 layout.itemS()
33
34                 layout.template_operator_search()
35                 layout.template_running_jobs()
36                         
37 class INFO_MT_file(bpy.types.Menu):
38         __space_type__ = "INFO"
39         __label__ = "File"
40
41         def draw(self, context):
42                 layout = self.layout
43
44                 layout.operator_context = "EXEC_AREA"
45                 layout.itemO("wm.read_homefile", text="New")
46                 layout.operator_context = "INVOKE_AREA"
47                 layout.itemO("wm.open_mainfile", text="Open...")
48                 layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
49                 layout.itemO("wm.recover_last_session")
50
51                 layout.itemS()
52
53                 layout.operator_context = "EXEC_AREA"
54                 layout.itemO("wm.save_mainfile", text="Save")
55                 layout.operator_context = "INVOKE_AREA"
56                 layout.itemO("wm.save_as_mainfile", text="Save As...")
57                 layout.itemO("screen.userpref_show", text="User Preferences...")
58
59                 layout.itemS()
60
61                 layout.itemM("INFO_MT_file_import")
62                 layout.itemM("INFO_MT_file_export")
63
64                 layout.itemS()
65
66                 layout.itemM("INFO_MT_file_external_data")
67
68                 layout.itemS()
69
70                 layout.operator_context = "EXEC_AREA"
71                 layout.itemO("wm.exit_blender", text="Quit")
72
73 class INFO_MT_file_import(bpy.types.Menu):
74         __space_type__ = "INFO"
75         __label__ = "Import"
76
77         def draw(self, context):
78                 layout = self.layout
79                 layout.itemO("import.3ds", text="3DS")
80                 layout.itemO("import.obj", text="OBJ")
81
82 class INFO_MT_file_export(bpy.types.Menu):
83         __space_type__ = "INFO"
84         __label__ = "Export"
85
86         def draw(self, context):
87                 layout = self.layout
88
89                 layout.itemO("export.3ds", text="3DS")
90                 layout.itemO("export.fbx", text="FBX")
91                 layout.itemO("export.obj", text="OBJ")
92                 layout.itemO("export.ply", text="PLY")
93                 layout.itemO("export.x3d", text="X3D")
94
95 class INFO_MT_file_external_data(bpy.types.Menu):
96         __space_type__ = "INFO"
97         __label__ = "External Data"
98
99         def draw(self, context):
100                 layout = self.layout
101
102                 layout.itemO("file.pack_all", text="Pack into .blend file")
103                 layout.itemO("file.unpack_all", text="Unpack into Files...")
104
105                 layout.itemS()
106
107                 layout.itemO("file.make_paths_relative")
108                 layout.itemO("file.make_paths_absolute")
109                 layout.itemO("file.report_missing_files")
110                 layout.itemO("file.find_missing_files")
111
112 class INFO_MT_add(bpy.types.Menu):
113         __space_type__ = "INFO"
114         __label__ = "Add"
115
116         def draw(self, context):
117                 layout = self.layout
118
119                 layout.operator_context = "EXEC_SCREEN"
120
121                 layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
122                 layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
123                 layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
124                 layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", 'META', icon='ICON_OUTLINER_OB_META')
125                 layout.itemO("OBJECT_OT_text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
126
127                 layout.itemS()
128
129                 layout.itemO("OBJECT_OT_armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
130                 layout.item_enumO("OBJECT_OT_object_add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
131                 layout.item_enumO("OBJECT_OT_object_add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
132
133                 layout.itemS()
134
135                 layout.item_enumO("OBJECT_OT_object_add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
136                 layout.item_enumO("OBJECT_OT_object_add", "type", 'LAMP', icon='ICON_OUTLINER_OB_LAMP')
137
138 class INFO_MT_game(bpy.types.Menu):
139         __space_type__ = "INFO"
140         __label__ = "Game"
141
142         def draw(self, context):
143                 layout = self.layout
144
145                 gs = context.scene.game_data
146
147                 layout.itemO("view3d.game_start")
148
149                 layout.itemS()
150
151                 layout.itemR(gs, "show_debug_properties")
152                 layout.itemR(gs, "show_framerate_profile")
153                 layout.itemR(gs, "show_physics_visualization")
154                 layout.itemR(gs, "deprecation_warnings")
155
156 class INFO_MT_render(bpy.types.Menu):
157         __space_type__ = "INFO"
158         __label__ = "Render"
159
160         def draw(self, context):
161                 layout = self.layout
162                 
163                 rd = context.scene.render_data
164
165                 layout.itemO("screen.render", text="Render Image")
166                 layout.item_booleanO("screen.render", "animation", True, text="Render Animation")
167
168                 layout.itemS()
169
170                 layout.itemO("screen.render_view_show")
171
172 class INFO_MT_help(bpy.types.Menu):
173         __space_type__ = "INFO"
174         __label__ = "Help"
175
176         def draw(self, context):
177                 layout = self.layout
178
179                 layout.itemO("help.manual")
180                 layout.itemO("help.release_logs")
181
182                 layout.itemS()
183
184                 layout.itemO("help.blender_website")
185                 layout.itemO("help.blender_eshop")
186                 layout.itemO("help.developer_community")
187                 layout.itemO("help.user_community")
188
189 bpy.types.register(INFO_HT_header)
190 bpy.types.register(INFO_MT_file)
191 bpy.types.register(INFO_MT_file_import)
192 bpy.types.register(INFO_MT_file_export)
193 bpy.types.register(INFO_MT_file_external_data)
194 bpy.types.register(INFO_MT_add)
195 bpy.types.register(INFO_MT_game)
196 bpy.types.register(INFO_MT_render)
197 bpy.types.register(INFO_MT_help)
198
199 # Help operators
200
201 import bpy_ops # XXX - should not need to do this
202 del bpy_ops
203
204 class HelpOperator(bpy.types.Operator):
205         def execute(self, context):
206                 try: import webbrowser
207                 except: webbrowser = None
208
209                 if webbrowser:
210                         webbrowser.open(self.__URL__)
211                 else:
212                         raise Exception("Operator requires a full Python installation")
213
214                 return ('FINISHED',)
215
216 class HELP_OT_manual(HelpOperator):
217         __idname__ = "help.manual"
218         __label__ = "Manual"
219         __URL__ = 'http://wiki.blender.org/index.php/Manual'
220
221 class HELP_OT_release_logs(HelpOperator):
222         __idname__ = "help.release_logs"
223         __label__ = "Release Logs"
224         __URL__ = 'http://www.blender.org/development/release-logs/'
225
226 class HELP_OT_blender_website(HelpOperator):
227         __idname__ = "help.blender_website"
228         __label__ = "Blender Website"
229         __URL__ = 'http://www.blender.org/'
230
231 class HELP_OT_blender_eshop(HelpOperator):
232         __idname__ = "help.blender_eshop"
233         __label__ = "Blender e-Shop"
234         __URL__ = 'http://www.blender3d.org/e-shop'
235
236 class HELP_OT_developer_community(HelpOperator):
237         __idname__ = "help.developer_community"
238         __label__ = "Developer Community"
239         __URL__ = 'http://www.blender.org/community/get-involved/'
240
241 class HELP_OT_user_community(HelpOperator):
242         __idname__ = "help.user_community"
243         __label__ = "User Community"
244         __URL__ = 'http://www.blender.org/community/user-community/'
245
246 bpy.ops.add(HELP_OT_manual)
247 bpy.ops.add(HELP_OT_release_logs)
248 bpy.ops.add(HELP_OT_blender_website)
249 bpy.ops.add(HELP_OT_blender_eshop)
250 bpy.ops.add(HELP_OT_developer_community)
251 bpy.ops.add(HELP_OT_user_community)
252