Files
blender/release/scripts/ui/space_info.py
Arystanbek Dyussenov 31258507d0 Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).

SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.

The detailed command log of the merge (can be useful for educational purposes):

branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00

328 lines
10 KiB
Python

import bpy
import dynamic_menu
# reload(dynamic_menu)
class INFO_HT_header(bpy.types.Header):
__space_type__ = 'INFO'
def draw(self, context):
layout = self.layout
st = context.space_data
scene = context.scene
rd = 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()
layout.itemL(text=scene.statistics())
layout.itemO("wm.window_fullscreen_toggle", icon='ICON_ARROW_LEFTRIGHT', text="")
class INFO_MT_file(bpy.types.Menu):
__label__ = "File"
def draw(self, context):
layout = self.layout
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.read_homefile", text="New", icon='ICON_NEW')
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER')
layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
layout.itemO("wm.recover_last_session")
layout.itemO("wm.recover_auto_save", text="Recover Auto Save...")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK')
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.save_as_mainfile", text="Save As...")
layout.itemO("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES')
layout.itemS()
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.link_append", text="Link")
layout.item_booleanO("wm.link_append", "link", False, text="Append")
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", icon='ICON_QUIT')
# test for expanding menus
'''
class INFO_MT_file_more(INFO_MT_file):
__label__ = "File"
def draw(self, context):
layout = self.layout
layout.itemO("wm.read_homefile", text="TESTING ")
dynamic_menu.setup(INFO_MT_file_more)
'''
class INFO_MT_file_import(dynamic_menu.DynMenu):
__label__ = "Import"
def draw(self, context):
self.layout.itemO("WM_OT_collada_import", text="COLLADA (.dae)...")
class INFO_MT_file_export(dynamic_menu.DynMenu):
__label__ = "Export"
def draw(self, context):
self.layout.itemO("WM_OT_collada_export", text="COLLADA (.dae)...")
class INFO_MT_file_external_data(bpy.types.Menu):
__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_mesh_add(dynamic_menu.DynMenu):
__label__ = "Mesh"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.itemO("mesh.primitive_plane_add", icon='ICON_MESH_PLANE', text="Plane")
layout.itemO("mesh.primitive_cube_add", icon='ICON_MESH_CUBE', text="Cube")
layout.itemO("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle")
layout.itemO("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere")
layout.itemO("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere")
layout.itemO("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube")
layout.itemO("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone")
layout.itemS()
layout.itemO("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid")
layout.itemO("mesh.primitive_monkey_add", icon='ICON_MESH_MONKEY', text="Monkey")
class INFO_MT_add(bpy.types.Menu):
__label__ = "Add"
def draw(self, context):
layout = self.layout
layout.operator_context = "EXEC_SCREEN"
# layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
layout.itemM("INFO_MT_mesh_add", icon='ICON_OUTLINER_OB_MESH')
layout.item_menu_enumO("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
layout.item_menu_enumO("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
layout.item_menu_enumO("object.metaball_add", "type", 'META', text="Metaball", icon='ICON_OUTLINER_OB_META')
layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
layout.itemS()
layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
layout.itemS()
layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP')
layout.itemS()
layout.item_menu_enumO("object.effector_add", "type", 'EMPTY', text="Force Field", icon='ICON_OUTLINER_OB_EMPTY')
layout.itemS()
layout.item_menu_enumO("object.group_instance_add", "type", text="Group Instance", icon='ICON_OUTLINER_OB_EMPTY')
class INFO_MT_game(bpy.types.Menu):
__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):
__label__ = "Render"
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
layout.itemO("screen.render", text="Render Image", icon='ICON_RENDER_STILL')
layout.item_booleanO("screen.render", "animation", True, text="Render Animation", icon='ICON_RENDER_ANIMATION')
layout.itemS()
layout.itemO("screen.opengl_render", text="OpenGL Render Image")
layout.item_booleanO("screen.opengl_render", "animation", True, text="OpenGL Render Animation")
layout.itemS()
layout.itemO("screen.render_view_show")
class INFO_MT_help(bpy.types.Menu):
__label__ = "Help"
def draw(self, context):
layout = self.layout
layout.itemO("help.manual", icon='ICON_HELP')
layout.itemO("help.release_logs", icon='ICON_URL')
layout.itemS()
layout.itemO("help.blender_website", icon='ICON_URL')
layout.itemO("help.blender_eshop", icon='ICON_URL')
layout.itemO("help.developer_community", icon='ICON_URL')
layout.itemO("help.user_community", icon='ICON_URL')
layout.itemS()
layout.itemO("help.report_bug", icon='ICON_URL')
layout.itemS()
layout.itemO("help.operator_cheat_sheet")
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_mesh_add)
bpy.types.register(INFO_MT_game)
bpy.types.register(INFO_MT_render)
bpy.types.register(INFO_MT_help)
# Help operators
class HelpOperator(bpy.types.Operator):
def execute(self, context):
import webbrowser
webbrowser.open(self.__URL__)
return ('FINISHED',)
class HELP_OT_manual(HelpOperator):
'''The Blender Wiki manual'''
__idname__ = "help.manual"
__label__ = "Manual"
__URL__ = 'http://wiki.blender.org/index.php/Manual'
class HELP_OT_release_logs(HelpOperator):
'''Information about the changes in this version of Blender'''
__idname__ = "help.release_logs"
__label__ = "Release Logs"
__URL__ = 'http://www.blender.org/development/release-logs/'
class HELP_OT_blender_website(HelpOperator):
'''The official Blender website'''
__idname__ = "help.blender_website"
__label__ = "Blender Website"
__URL__ = 'http://www.blender.org/'
class HELP_OT_blender_eshop(HelpOperator):
'''Buy official Blender resources and merchandise online'''
__idname__ = "help.blender_eshop"
__label__ = "Blender e-Shop"
__URL__ = 'http://www.blender3d.org/e-shop'
class HELP_OT_developer_community(HelpOperator):
'''Get involved with Blender development'''
__idname__ = "help.developer_community"
__label__ = "Developer Community"
__URL__ = 'http://www.blender.org/community/get-involved/'
class HELP_OT_user_community(HelpOperator):
'''Get involved with other Blender users'''
__idname__ = "help.user_community"
__label__ = "User Community"
__URL__ = 'http://www.blender.org/community/user-community/'
class HELP_OT_report_bug(HelpOperator):
'''Report a bug in the Blender bug tracker'''
__idname__ = "help.report_bug"
__label__ = "Report a Bug"
__URL__ = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
__idname__ = "help.operator_cheat_sheet"
__label__ = "Operator Cheat Sheet (new textblock)"
def execute(self, context):
op_strings = []
tot = 0
for op_module_name in dir(bpy.ops):
op_module = getattr(bpy.ops, op_module_name)
for op_submodule_name in dir(op_module):
op = getattr(op_module, op_submodule_name)
text = repr(op)
if text.startswith('bpy.ops.'):
op_strings.append(text)
tot += 1
op_strings.append('')
bpy.ops.text.new() # XXX - assumes new text is always at the end!
textblock = bpy.data.texts[-1]
textblock.write('# %d Operators\n\n' % tot)
textblock.write('\n'.join(op_strings))
textblock.name = "OperatorList.txt"
print("See OperatorList.txt textblock")
return ('FINISHED',)
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)
bpy.ops.add(HELP_OT_report_bug)
bpy.ops.add(HELP_OT_operator_cheat_sheet)