Welcome to mirror list, hosted at ThFree Co, Russian Federation.

space_info.py « ui « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bfe051b8df293c159e91b301a56328111f2368b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

import bpy

class INFO_HT_header(bpy.types.Header):
	__space_type__ = "INFO"

	def draw(self, context):
		layout = self.layout
		
		st = context.space_data
		rd = context.scene.render_data

		row = layout.row(align=True)
		row.template_header()

		if context.area.show_menus:
			sub = row.row(align=True)
			sub.itemM("INFO_MT_file")
			sub.itemM("INFO_MT_add")
			if rd.use_game_engine:
				sub.itemM("INFO_MT_game")
			else:
				sub.itemM("INFO_MT_render")
			sub.itemM("INFO_MT_help")

		layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
		layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")

		if rd.multiple_engines:
			layout.itemR(rd, "engine", text="")

		layout.itemS()

		layout.template_operator_search()
		layout.template_running_jobs()
			
class INFO_MT_file(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "File"

	def draw(self, context):
		layout = self.layout

		layout.operator_context = "EXEC_AREA"
		layout.itemO("wm.read_homefile", text="New")
		layout.operator_context = "INVOKE_AREA"
		layout.itemO("wm.open_mainfile", text="Open...")
		layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
		layout.itemO("wm.recover_last_session")

		layout.itemS()

		layout.operator_context = "EXEC_AREA"
		layout.itemO("wm.save_mainfile", text="Save")
		layout.operator_context = "INVOKE_AREA"
		layout.itemO("wm.save_as_mainfile", text="Save As...")
		layout.itemO("screen.userpref_show", text="User Preferences...")

		layout.itemS()

		layout.itemM("INFO_MT_file_import")
		layout.itemM("INFO_MT_file_export")

		layout.itemS()

		layout.itemM("INFO_MT_file_external_data")

		layout.itemS()

		layout.operator_context = "EXEC_AREA"
		layout.itemO("wm.exit_blender", text="Quit")

class INFO_MT_file_import(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Import"

	def draw(self, context):
		layout = self.layout
		layout.itemO("import.3ds", text="3DS")
		layout.itemO("import.obj", text="OBJ")

class INFO_MT_file_export(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Export"

	def draw(self, context):
		layout = self.layout

		layout.itemO("export.3ds", text="3DS")
		layout.itemO("export.fbx", text="FBX")
		layout.itemO("export.obj", text="OBJ")
		layout.itemO("export.ply", text="PLY")
		layout.itemO("export.x3d", text="X3D")

class INFO_MT_file_external_data(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "External Data"

	def draw(self, context):
		layout = self.layout

		layout.itemO("file.pack_all", text="Pack into .blend file")
		layout.itemO("file.unpack_all", text="Unpack into Files...")

		layout.itemS()

		layout.itemO("file.make_paths_relative")
		layout.itemO("file.make_paths_absolute")
		layout.itemO("file.report_missing_files")
		layout.itemO("file.find_missing_files")

class INFO_MT_add(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Add"

	def draw(self, context):
		layout = self.layout

		layout.operator_context = "EXEC_SCREEN"

		layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
		layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
		layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
		layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", 'META', icon='ICON_OUTLINER_OB_META')
		layout.itemO("OBJECT_OT_text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')

		layout.itemS()

		layout.itemO("OBJECT_OT_armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
		layout.item_enumO("OBJECT_OT_object_add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
		layout.item_enumO("OBJECT_OT_object_add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')

		layout.itemS()

		layout.item_enumO("OBJECT_OT_object_add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
		layout.item_enumO("OBJECT_OT_object_add", "type", 'LAMP', icon='ICON_OUTLINER_OB_LAMP')

class INFO_MT_game(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Game"

	def draw(self, context):
		layout = self.layout

		gs = context.scene.game_data

		layout.itemO("view3d.game_start")

		layout.itemS()

		layout.itemR(gs, "show_debug_properties")
		layout.itemR(gs, "show_framerate_profile")
		layout.itemR(gs, "show_physics_visualization")
		layout.itemR(gs, "deprecation_warnings")

class INFO_MT_render(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Render"

	def draw(self, context):
		layout = self.layout
		
		rd = context.scene.render_data

		layout.itemO("screen.render", text="Render Image")
		layout.item_booleanO("screen.render", "animation", True, text="Render Animation")

		layout.itemS()

		layout.itemO("screen.render_view_show")

class INFO_MT_help(bpy.types.Menu):
	__space_type__ = "INFO"
	__label__ = "Help"

	def draw(self, context):
		layout = self.layout

		layout.itemO("help.manual")
		layout.itemO("help.release_logs")

		layout.itemS()

		layout.itemO("help.blender_website")
		layout.itemO("help.blender_eshop")
		layout.itemO("help.developer_community")
		layout.itemO("help.user_community")

bpy.types.register(INFO_HT_header)
bpy.types.register(INFO_MT_file)
bpy.types.register(INFO_MT_file_import)
bpy.types.register(INFO_MT_file_export)
bpy.types.register(INFO_MT_file_external_data)
bpy.types.register(INFO_MT_add)
bpy.types.register(INFO_MT_game)
bpy.types.register(INFO_MT_render)
bpy.types.register(INFO_MT_help)

# Help operators

import bpy_ops # XXX - should not need to do this
del bpy_ops

class HelpOperator(bpy.types.Operator):
	def execute(self, context):
		try: import webbrowser
		except: webbrowser = None

		if webbrowser:
			webbrowser.open(self.__URL__)
		else:
			raise Exception("Operator requires a full Python installation")

		return ('FINISHED',)

class HELP_OT_manual(HelpOperator):
	__idname__ = "help.manual"
	__label__ = "Manual"
	__URL__ = 'http://wiki.blender.org/index.php/Manual'

class HELP_OT_release_logs(HelpOperator):
	__idname__ = "help.release_logs"
	__label__ = "Release Logs"
	__URL__ = 'http://www.blender.org/development/release-logs/'

class HELP_OT_blender_website(HelpOperator):
	__idname__ = "help.blender_website"
	__label__ = "Blender Website"
	__URL__ = 'http://www.blender.org/'

class HELP_OT_blender_eshop(HelpOperator):
	__idname__ = "help.blender_eshop"
	__label__ = "Blender e-Shop"
	__URL__ = 'http://www.blender3d.org/e-shop'

class HELP_OT_developer_community(HelpOperator):
	__idname__ = "help.developer_community"
	__label__ = "Developer Community"
	__URL__ = 'http://www.blender.org/community/get-involved/'

class HELP_OT_user_community(HelpOperator):
	__idname__ = "help.user_community"
	__label__ = "User Community"
	__URL__ = 'http://www.blender.org/community/user-community/'

bpy.ops.add(HELP_OT_manual)
bpy.ops.add(HELP_OT_release_logs)
bpy.ops.add(HELP_OT_blender_website)
bpy.ops.add(HELP_OT_blender_eshop)
bpy.ops.add(HELP_OT_developer_community)
bpy.ops.add(HELP_OT_user_community)