menus are now global (like operators), so for eg, the info add menu and the 3D add...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 8 Oct 2009 19:06:32 +0000 (19:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 8 Oct 2009 19:06:32 +0000 (19:06 +0000)
29 files changed:
release/scripts/ui/space_buttons.py
release/scripts/ui/space_console.py
release/scripts/ui/space_image.py
release/scripts/ui/space_info.py
release/scripts/ui/space_node.py
release/scripts/ui/space_outliner.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_time.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
source/blender/blenkernel/BKE_screen.h
source/blender/blenkernel/intern/screen.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/space_node/node_header.c
source/blender/makesrna/intern/rna_ui.c
source/blender/python/intern/bpy_operator.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_window.h

index aa89c06ea08ca3cacdfae4e671bf2eadbd74370a..299e8bc9daeaed266b6e26eac689a0ba66e8eead 100644 (file)
@@ -22,7 +22,6 @@ class Buttons_HT_header(bpy.types.Header):
                row.itemR(scene, "current_frame")
 
 class Buttons_MT_view(bpy.types.Menu):
-       __space_type__ = 'PROPERTIES'
        __label__ = "View"
 
        def draw(self, context):
index a65d7577c7a16b561cd6a38bfd4a472bc4a4a5d6..5bb211f7d9820b2efc18a22e210a0f0678817eb5 100644 (file)
@@ -38,7 +38,6 @@ class CONSOLE_HT_header(bpy.types.Header):
                        row.itemO("console.autocomplete", text="Autocomplete")
 
 class CONSOLE_MT_console(bpy.types.Menu):
-       __space_type__ = 'CONSOLE'
        __label__ = "Console"
 
        def draw(self, context):
@@ -51,7 +50,6 @@ class CONSOLE_MT_console(bpy.types.Menu):
                layout.itemO("console.paste")
 
 class CONSOLE_MT_report(bpy.types.Menu):
-       __space_type__ = 'CONSOLE'
        __label__ = "Report"
 
        def draw(self, context):
index b14bec0e40e0a71af77ab98ba06a147023901997..c1a4fc723ca0ca27da920386e49858fe1849b5dd 100644 (file)
@@ -2,7 +2,6 @@
 import bpy
 
 class IMAGE_MT_view(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "View"
 
        def draw(self, context):
@@ -44,7 +43,6 @@ class IMAGE_MT_view(bpy.types.Menu):
                layout.itemO("screen.screen_full_area")
 
 class IMAGE_MT_select(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Select"
 
        def draw(self, context):
@@ -65,7 +63,6 @@ class IMAGE_MT_select(bpy.types.Menu):
                layout.itemO("uv.select_linked")
 
 class IMAGE_MT_image(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Image"
 
        def draw(self, context):
@@ -109,7 +106,6 @@ class IMAGE_MT_image(bpy.types.Menu):
                        layout.itemR(sima, "image_painting")
 
 class IMAGE_MT_uvs_showhide(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Show/Hide Faces"
 
        def draw(self, context):
@@ -120,7 +116,6 @@ class IMAGE_MT_uvs_showhide(bpy.types.Menu):
                layout.item_booleanO("uv.hide", "unselected", True)
 
 class IMAGE_MT_uvs_transform(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Transform"
 
        def draw(self, context):
@@ -131,7 +126,6 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu):
                layout.itemO("tfm.resize")
 
 class IMAGE_MT_uvs_mirror(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Mirror"
 
        def draw(self, context):
@@ -145,7 +139,6 @@ class IMAGE_MT_uvs_mirror(bpy.types.Menu):
                props.constraint_axis[1]= True
 
 class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "Weld/Align"
 
        def draw(self, context):
@@ -155,7 +148,6 @@ class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
                layout.items_enumO("uv.align", "axis") # W, 2/3/4
 
 class IMAGE_MT_uvs(bpy.types.Menu):
-       __space_type__ = 'IMAGE_EDITOR'
        __label__ = "UVs"
 
        def draw(self, context):
index 3805a7d0dec6858cd6c5acf14968ccedb9f85cd5..32068f1b94170816c2ac00a74d0fee0ca10c8e12 100644 (file)
@@ -38,7 +38,6 @@ class INFO_HT_header(bpy.types.Header):
                layout.itemL(text=scene.statistics())
                        
 class INFO_MT_file(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "File"
 
        def draw(self, context):
@@ -78,7 +77,6 @@ class INFO_MT_file(bpy.types.Menu):
                layout.itemO("wm.exit_blender", text="Quit")
 
 class INFO_MT_file_import(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Import"
 
        def draw(self, context):
@@ -89,7 +87,6 @@ class INFO_MT_file_import(bpy.types.Menu):
 
 
 class INFO_MT_file_export(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Export"
 
        def draw(self, context):
@@ -104,7 +101,6 @@ class INFO_MT_file_export(bpy.types.Menu):
 
 
 class INFO_MT_file_external_data(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "External Data"
 
        def draw(self, context):
@@ -121,7 +117,6 @@ class INFO_MT_file_external_data(bpy.types.Menu):
                layout.itemO("file.find_missing_files")
 
 class INFO_MT_add(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Add"
 
        def draw(self, context):
@@ -151,7 +146,6 @@ class INFO_MT_add(bpy.types.Menu):
                layout.item_menu_enumO("object.effector_add", "type", 'EMPTY', text="Force Field", icon='ICON_OUTLINER_OB_EMPTY')
 
 class INFO_MT_game(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Game"
 
        def draw(self, context):
@@ -169,7 +163,6 @@ class INFO_MT_game(bpy.types.Menu):
                layout.itemR(gs, "deprecation_warnings")
 
 class INFO_MT_render(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Render"
 
        def draw(self, context):
@@ -185,7 +178,6 @@ class INFO_MT_render(bpy.types.Menu):
                layout.itemO("screen.render_view_show")
 
 class INFO_MT_help(bpy.types.Menu):
-       __space_type__ = 'INFO'
        __label__ = "Help"
 
        def draw(self, context):
index b32e6a9f61a76efb423b4e15d4af4f4f80902099..5c5c49afbc7aebbb1aeb58673d8bf5ff941cbcd7 100644 (file)
@@ -48,7 +48,6 @@ class NODE_HT_header(bpy.types.Header):
                        layout.itemR(snode, "backdrop")
 
 class NODE_MT_view(bpy.types.Menu):
-       __space_type__ = 'NODE_EDITOR'
        __label__ = "View"
 
        def draw(self, context):
@@ -66,7 +65,6 @@ class NODE_MT_view(bpy.types.Menu):
                layout.itemO("screen.screen_full_area")
 
 class NODE_MT_select(bpy.types.Menu):
-       __space_type__ = 'NODE_EDITOR'
        __label__ = "Select"
 
        def draw(self, context):
@@ -80,7 +78,6 @@ class NODE_MT_select(bpy.types.Menu):
                layout.itemO("node.select_linked_to")
 
 class NODE_MT_node(bpy.types.Menu):
-       __space_type__ = 'NODE_EDITOR'
        __label__ = "Node"
 
        def draw(self, context):
index 522b620e29d67c5450756c0200269a9812fdcb4a..f3c45983d7625c91e6ddeb9855ec4e0ff2804e1f 100644 (file)
@@ -36,7 +36,6 @@ class OUTLINER_HT_header(bpy.types.Header):
                
 
 class OUTLINER_MT_view(bpy.types.Menu):
-       __space_type__ = 'OUTLINER'
        __label__ = "View"
 
        def draw(self, context):
index a804998cdaa52a472312e38bcbe97f5e0cd3700b..582481401a620adfbc3bd6323f074c1a7babf088 100644 (file)
@@ -38,7 +38,6 @@ class SEQUENCER_HT_header(bpy.types.Header):
                        layout.itemR(st, "display_channel", text="Channel")
 
 class SEQUENCER_MT_view(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "View"
        
        def draw(self, context):
@@ -106,7 +105,6 @@ class SEQUENCER_MT_view(bpy.types.Menu):
                """
 
 class SEQUENCER_MT_select(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "Select"
 
        def draw(self, context):
@@ -127,7 +125,6 @@ class SEQUENCER_MT_select(bpy.types.Menu):
                layout.itemO("sequencer.select_inverse")
 
 class SEQUENCER_MT_marker(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "Marker (TODO)"
 
        def draw(self, context):
@@ -146,7 +143,6 @@ class SEQUENCER_MT_marker(bpy.types.Menu):
                #layout.itemO("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
 
 class SEQUENCER_MT_add(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "Add"
 
        def draw(self, context):
@@ -163,7 +159,6 @@ class SEQUENCER_MT_add(bpy.types.Menu):
                layout.itemM("SEQUENCER_MT_add_effect")
 
 class SEQUENCER_MT_add_effect(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "Effect Strip..."
 
        def draw(self, context):
@@ -187,7 +182,6 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
                layout.item_enumO("sequencer.effect_strip_add", 'type', 'SPEED')
 
 class SEQUENCER_MT_strip(bpy.types.Menu):
-       __space_type__ = 'SEQUENCE_EDITOR'
        __label__ = "Strip"
 
        def draw(self, context):
index 117033c50a1d63dc3ce355791f7151437b8f82c1..4860767d69decefb48bb041a00aa473a1786286e 100644 (file)
@@ -98,7 +98,6 @@ class TEXT_PT_find(bpy.types.Panel):
                row.itemR(st, "find_all", text="All")
 
 class TEXT_MT_text(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Text"
 
        def draw(self, context):
@@ -140,7 +139,6 @@ class TEXT_MT_text(bpy.types.Menu):
                #endif
 
 class TEXT_MT_edit_view(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "View"
 
        def draw(self, context):
@@ -150,7 +148,6 @@ class TEXT_MT_edit_view(bpy.types.Menu):
                layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
 
 class TEXT_MT_edit_select(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Select"
 
        def draw(self, context):
@@ -160,7 +157,6 @@ class TEXT_MT_edit_select(bpy.types.Menu):
                layout.itemO("text.select_line")
 
 class TEXT_MT_edit_markers(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Markers"
 
        def draw(self, context):
@@ -171,7 +167,6 @@ class TEXT_MT_edit_markers(bpy.types.Menu):
                layout.itemO("text.previous_marker")
 
 class TEXT_MT_format(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Format"
 
        def draw(self, context):
@@ -190,7 +185,6 @@ class TEXT_MT_format(bpy.types.Menu):
                layout.item_menu_enumO("text.convert_whitespace", "type")
 
 class TEXT_MT_edit_to3d(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Text To 3D Object"
 
        def draw(self, context):
@@ -200,7 +194,6 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
                layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
 
 class TEXT_MT_edit(bpy.types.Menu):
-       __space_type__ = 'TEXT_EDITOR'
        __label__ = "Edit"
 
        def poll(self, context):
index fdb01d5c216065b5242858e89d2cc7bacedc1d41..2ead4305960af8045eeb5df9800dfd1f8b707c1a 100644 (file)
@@ -64,7 +64,6 @@ class TIME_HT_header(bpy.types.Header):
                row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT')
 
 class TIME_MT_view(bpy.types.Menu):
-       __space_type__ = 'TIMELINE'
        __label__ = "View"
 
        def draw(self, context):
@@ -79,7 +78,6 @@ class TIME_MT_view(bpy.types.Menu):
                layout.itemR(st, "only_selected")
 
 class TIME_MT_frame(bpy.types.Menu):
-       __space_type__ = 'TIMELINE'
        __label__ = "Frame"
 
        def draw(self, context):
@@ -104,7 +102,6 @@ class TIME_MT_frame(bpy.types.Menu):
                sub.itemM("TIME_MT_autokey")
 
 class TIME_MT_playback(bpy.types.Menu):
-       __space_type__ = 'TIMELINE'
        __label__ = "Playback"
 
        def draw(self, context):
@@ -132,7 +129,6 @@ class TIME_MT_playback(bpy.types.Menu):
                layout.itemR(scene, "scrub_audio")
 
 class TIME_MT_autokey(bpy.types.Menu):
-       __space_type__ = 'TIMELINE'
        __label__ = "Auto-Keyframing Mode"
 
        def draw(self, context):
index ff4461db02f607143810b0ce5c9c66799aaf0f2b..27c826b133b4886862e8747b83e4dfe5f3e9eff1 100644 (file)
@@ -18,7 +18,6 @@ class USERPREF_HT_header(bpy.types.Header):
                        layout.itemO("wm.keyconfig_save", "Save Key Configuration...")
                        
 class USERPREF_MT_view(bpy.types.Menu):
-       __space_type__ = 'USER_PREFERENCES'
        __label__ = "View"
 
        def draw(self, context):
index ef1947dbb39378d86749da8352a3d6bddcde5426..ecc4d298b944c20c7793f819d3195dbd0f185327 100644 (file)
@@ -44,7 +44,6 @@ class VIEW3D_HT_header(bpy.types.Header):
 # ********** Utilities **********
 
 class VIEW3D_MT_showhide(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Show/Hide"
        _operator_name = ""
 
@@ -56,7 +55,6 @@ class VIEW3D_MT_showhide(bpy.types.Menu):
                layout.item_booleanO("%s.hide" % self._operator_name, "unselected", True, text="Hide Unselected")
 
 class VIEW3D_MT_snap(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Snap"
 
        def draw(self, context):
@@ -75,7 +73,6 @@ class VIEW3D_MT_snap(bpy.types.Menu):
 # ********** View menus **********
 
 class VIEW3D_MT_view(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "View"
 
        def draw(self, context):
@@ -120,7 +117,6 @@ class VIEW3D_MT_view(bpy.types.Menu):
                layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
 
 class VIEW3D_MT_view_navigation(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Navigation"
 
        def draw(self, context):
@@ -142,7 +138,6 @@ class VIEW3D_MT_view_navigation(bpy.types.Menu):
                layout.itemO("view3d.fly")
 
 class VIEW3D_MT_view_align(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Align View"
 
        def draw(self, context):
@@ -151,7 +146,6 @@ class VIEW3D_MT_view_align(bpy.types.Menu):
                layout.itemO("view3d.view_center")
                
 class VIEW3D_MT_view_cameras(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Cameras"
 
        def draw(self, context):
@@ -162,7 +156,6 @@ class VIEW3D_MT_view_cameras(bpy.types.Menu):
 # ********** Select menus, suffix from context.mode **********
 
 class VIEW3D_MT_select_object(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -182,7 +175,6 @@ class VIEW3D_MT_select_object(bpy.types.Menu):
                layout.itemO("object.select_pattern", text="Select Pattern...")
 
 class VIEW3D_MT_select_pose(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -213,7 +205,6 @@ class VIEW3D_MT_select_pose(bpy.types.Menu):
                props.direction = 'CHILD'
 
 class VIEW3D_MT_select_particle(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -232,7 +223,6 @@ class VIEW3D_MT_select_particle(bpy.types.Menu):
                layout.itemO("particle.select_less")
 
 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -276,7 +266,6 @@ class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
                layout.itemO("mesh.region_to_loop")
 
 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -305,7 +294,6 @@ class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
                layout.itemO("curve.select_less")
 
 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -331,7 +319,6 @@ class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
                layout.itemO("curve.select_less")
 
 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -349,7 +336,6 @@ class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
                layout.itemO("mball.select_random_metaelems")
 
 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -362,7 +348,6 @@ class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
                layout.itemO("lattice.select_all_toggle", text="Select/Deselect All")
 
 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -391,7 +376,6 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
                props.direction = 'CHILD'
 
 class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum
-       __space_type__ = 'VIEW_3D'
        __label__ = "Select"
 
        def draw(self, context):
@@ -402,7 +386,6 @@ class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum
 # ********** Object menu **********
 
 class VIEW3D_MT_object(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __context__ = "objectmode"
        __label__ = "Object"
 
@@ -440,7 +423,6 @@ class VIEW3D_MT_object(bpy.types.Menu):
                layout.itemM("VIEW3D_MT_object_showhide")
                
 class VIEW3D_MT_object_clear(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Clear"
 
        def draw(self, context):
@@ -452,7 +434,6 @@ class VIEW3D_MT_object_clear(bpy.types.Menu):
                layout.itemO("object.origin_clear", text="Origin")
                
 class VIEW3D_MT_object_parent(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Parent"
 
        def draw(self, context):
@@ -462,7 +443,6 @@ class VIEW3D_MT_object_parent(bpy.types.Menu):
                layout.itemO("object.parent_clear", text="Clear")
                
 class VIEW3D_MT_object_track(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Track"
 
        def draw(self, context):
@@ -472,7 +452,6 @@ class VIEW3D_MT_object_track(bpy.types.Menu):
                layout.itemO("object.track_clear", text="Clear")
                
 class VIEW3D_MT_object_group(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Group"
 
        def draw(self, context):
@@ -487,7 +466,6 @@ class VIEW3D_MT_object_group(bpy.types.Menu):
                layout.itemO("group.objects_remove_active")
                
 class VIEW3D_MT_object_constraints(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Constraints"
 
        def draw(self, context):
@@ -497,7 +475,6 @@ class VIEW3D_MT_object_constraints(bpy.types.Menu):
                layout.itemO("object.constraints_clear")
                
 class VIEW3D_MT_object_showhide(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Show/Hide"
 
        def draw(self, context):
@@ -510,7 +487,6 @@ class VIEW3D_MT_object_showhide(bpy.types.Menu):
 # ********** Vertex paint menu **********      
        
 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Paint"
 
        def draw(self, context):
@@ -525,7 +501,6 @@ class VIEW3D_MT_paint_vertex(bpy.types.Menu):
 # ********** Sculpt menu **********    
        
 class VIEW3D_MT_sculpt(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Sculpt"
 
        def draw(self, context):
@@ -561,7 +536,6 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
 # ********** Particle menu **********  
        
 class VIEW3D_MT_particle(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Particle"
 
        def draw(self, context):
@@ -591,7 +565,6 @@ class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
 # ********** Pose Menu **********
 
 class VIEW3D_MT_pose(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Pose"
 
        def draw(self, context):
@@ -651,7 +624,6 @@ class VIEW3D_MT_pose(bpy.types.Menu):
                layout.item_menu_enumO("pose.flags_set", 'mode', text="Bone Settings")
 
 class VIEW3D_MT_pose_transform(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Clear Transform"
 
        def draw(self, context):
@@ -666,7 +638,6 @@ class VIEW3D_MT_pose_transform(bpy.types.Menu):
                layout.itemL(text="Origin")
                
 class VIEW3D_MT_pose_pose(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Pose Library"
 
        def draw(self, context):
@@ -681,7 +652,6 @@ class VIEW3D_MT_pose_pose(bpy.types.Menu):
                layout.itemO("poselib.pose_remove", text="Remove Pose...")
 
 class VIEW3D_MT_pose_motion(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Motion Paths"
 
        def draw(self, context):
@@ -691,7 +661,6 @@ class VIEW3D_MT_pose_motion(bpy.types.Menu):
                layout.itemO("pose.paths_clear", text="Clear")
                
 class VIEW3D_MT_pose_group(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Bone Groups"
 
        def draw(self, context):
@@ -706,7 +675,6 @@ class VIEW3D_MT_pose_group(bpy.types.Menu):
                
                
 class VIEW3D_MT_pose_ik(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Inverse Kinematics"
 
        def draw(self, context):
@@ -716,7 +684,6 @@ class VIEW3D_MT_pose_ik(bpy.types.Menu):
                layout.itemO("pose.ik_clear")
                
 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Constraints"
 
        def draw(self, context):
@@ -732,7 +699,6 @@ class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide):
 
 # Edit MESH
 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Mesh"
 
        def draw(self, context):
@@ -775,7 +741,6 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu):
                layout.itemM("VIEW3D_MT_edit_mesh_showhide")
 
 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Vertices"
 
        def draw(self, context):
@@ -792,7 +757,6 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
                layout.itemO("mesh.remove_doubles")
 
 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Edges"
 
        def draw(self, context):
@@ -817,7 +781,6 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
                layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
 
 class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Faces"
 
        def draw(self, context):
@@ -839,7 +802,6 @@ class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
                layout.itemO("mesh.faces_shade_flat")
 
 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Normals"
 
        def draw(self, context):
@@ -889,13 +851,11 @@ def draw_curve(self, context):
        layout.itemM("VIEW3D_MT_edit_curve_showhide")
 
 class VIEW3D_MT_edit_curve(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Curve"
 
        draw = draw_curve
        
 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Control Points"
 
        def draw(self, context):
@@ -913,7 +873,6 @@ class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
                        layout.item_menu_enumO("curve.handle_type_set", "type")
                
 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Segments"
 
        def draw(self, context):
@@ -927,14 +886,12 @@ class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
 
 # Edit SURFACE
 class VIEW3D_MT_edit_surface(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Surface"
 
        draw = draw_curve
 
 # Edit TEXT
 class VIEW3D_MT_edit_text(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Text"
 
        def draw(self, context):
@@ -947,7 +904,6 @@ class VIEW3D_MT_edit_text(bpy.types.Menu):
                layout.itemm("view3d_mt_edit_text_chars")
 
 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Special Characters"
 
        def draw(self, context):
@@ -982,7 +938,6 @@ class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
 
 # Edit META
 class VIEW3D_MT_edit_meta(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Metaball"
 
        def draw(self, context):
@@ -1012,7 +967,6 @@ class VIEW3D_MT_edit_meta(bpy.types.Menu):
                layout.itemM("VIEW3D_MT_edit_meta_showhide")
 
 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Show/Hide"
 
        def draw(self, context):
@@ -1024,7 +978,6 @@ class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
 
 # Edit LATTICE
 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Lattice"
 
        def draw(self, context):
@@ -1045,7 +998,6 @@ class VIEW3D_MT_edit_lattice(bpy.types.Menu):
 
 # Edit ARMATURE
 class VIEW3D_MT_edit_armature(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Armature"
 
        def draw(self, context):
@@ -1102,7 +1054,6 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
                layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings")
 
 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Parent"
 
        def draw(self, context):
@@ -1112,7 +1063,6 @@ class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
                layout.itemO("armature.parent_clear", text="Clear")
 
 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
-       __space_type__ = 'VIEW_3D'
        __label__ = "Bone Roll"
 
        def draw(self, context):
index 7c62c8c6dd459f6314e3ade59796095f71299591..39a90fe3074009f83950a07ccef84e1cb784b902 100644 (file)
@@ -138,9 +138,6 @@ typedef struct ARegionType {
 
        /* header type definitions */
        ListBase headertypes;
-
-       /* menu type definitions */
-       ListBase menutypes;
        
        /* hardcoded constraints, smaller than these values region is not visible */
        int                     minsizex, minsizey;
@@ -200,7 +197,6 @@ typedef struct MenuType {
 
        char            idname[BKE_ST_MAXNAME]; /* unique name */
        char            label[BKE_ST_MAXNAME];  /* for button text */
-       int             space_type;
 
        /* verify if the menu should draw or not */
        int                     (*poll)(const struct bContext *, struct MenuType *);
@@ -223,7 +219,7 @@ const struct ListBase *BKE_spacetypes_list(void);
 void BKE_spacetype_register(struct SpaceType *st);
 void BKE_spacetypes_free(void);        /* only for quitting blender */
 
-MenuType *BKE_spacemenu_find(const char *idname, int spacetype);
+// MenuType *BKE_spacemenu_find(const char *idname, int spacetype);
 
 /* spacedata */
 void BKE_spacedata_freelist(ListBase *lb);
index 3567de5df408b0cba891d867f55beb9c32ad25cd..918a67311a06e2a6f556dd3271814c3115d51a72 100644 (file)
@@ -70,13 +70,8 @@ static void spacetype_free(SpaceType *st)
                        if(ht->ext.free)
                                ht->ext.free(ht->ext.data);
 
-               for(mt= art->menutypes.first; mt; mt= mt->next)
-                       if(mt->ext.free)
-                               mt->ext.free(mt->ext.data);
-
                BLI_freelistN(&art->paneltypes);
                BLI_freelistN(&art->headertypes);
-               BLI_freelistN(&art->menutypes);
        }
        
        BLI_freelistN(&st->regiontypes);
@@ -343,25 +338,3 @@ unsigned int BKE_screen_visible_layers(bScreen *screen)
        return layer;
 }
 
-MenuType *BKE_spacemenu_find(const char *idname, int spacetype)
-{
-       SpaceType *st= BKE_spacetype_from_id(spacetype);
-       ARegionType *art;
-       MenuType* mt;
-
-       if(st==NULL) {
-               printf("space type %d is invalid\n", spacetype);
-               return NULL;
-       }
-
-       if(idname==NULL)
-               return NULL;
-
-       for(art= st->regiontypes.first; art; art= art->next)
-               for(mt=art->menutypes.first; mt; mt=mt->next)
-                       if(strcmp(idname, mt->idname)==0)
-                               return mt;
-
-       return NULL;
-}
-
index 3c6ed1137ae9cceef9b57489fbece33661d8e407..5766fcfdb1f76a4d0fb93d4b4ce0c2fc7f6dfff6 100644 (file)
@@ -257,7 +257,7 @@ void uiPupMenuSaveOver(struct bContext *C, struct wmOperator *op, char *filename
 void uiPupMenuNotice(struct bContext *C, char *str, ...);
 void uiPupMenuError(struct bContext *C, char *str, ...);
 void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
-void uiPupMenuInvoke(struct bContext *C, const char *idname, int spacetype); /* popup registered menu */
+void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registered menu */
 
 /* Popup Blocks
  *
index eb81044852a76edb8263cd8c38760eddb5f6494b..b0f93472240d30cb274389552e447ddfa55ffce8 100644 (file)
@@ -1232,7 +1232,7 @@ void uiItemM(uiLayout *layout, bContext *C, char *name, int icon, char *menuname
 {
        MenuType *mt;
 
-       mt= BKE_spacemenu_find(menuname, CTX_wm_area(C)->spacetype);
+       mt= WM_menutype_find(menuname, FALSE);
 
        if(mt==NULL) {
                printf("uiItemM: not found %s\n", menuname);
index cdb62d0a4b49c1e8b25ce7ab5293e0de657762b2..c837599baf328387b82aff85c333dadcf89d408c 100644 (file)
@@ -2481,12 +2481,12 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
        BLI_dynstr_free(ds);
 }
 
-void uiPupMenuInvoke(bContext *C, const char *idname, int spacetype)
+void uiPupMenuInvoke(bContext *C, const char *idname)
 {
        uiPopupMenu *pup;
        uiLayout *layout;
        Menu menu;
-       MenuType *mt= BKE_spacemenu_find(idname, spacetype);
+       MenuType *mt= WM_menutype_find(idname, TRUE);
 
        if(mt==NULL) {
                printf("uiPupMenuInvoke: named menu \"%s\" not found\n", idname);
index 4669f7a6741e24888aafc947f6234af55f243e39..3c3cdf25d7bbdd4c2523de9b8dac6dc13f71ea06 100644 (file)
@@ -119,7 +119,7 @@ void EM_select_mirrored(Object *obedit, EditMesh *em)
 
 void EM_automerge(Scene *scene, Object *obedit, int update)
 {
-       Mesh *me= (Mesh*)obedit->data; /* can be NULL */
+       Mesh *me= obedit ? obedit->data : NULL; /* can be NULL */
        int len;
 
        if ((scene->toolsettings->automerge) &&
index 780126852edce35237a08718c511cd1d9fc8725a..c552a2954b7c36d5c97b6ceeb46b34d0e66f6f07 100644 (file)
@@ -686,51 +686,6 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
 }
 
-static int object_primitive_add_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup= uiPupMenuBegin(C, "Add Object", 0);
-       uiLayout *layout= uiPupMenuLayout(pup);
-       
-       uiItemMenuEnumO(layout, "Mesh", ICON_OUTLINER_OB_MESH, "OBJECT_OT_mesh_add", "type");
-       uiItemMenuEnumO(layout, "Curve", ICON_OUTLINER_OB_CURVE, "OBJECT_OT_curve_add", "type");
-       uiItemMenuEnumO(layout, "Surface", ICON_OUTLINER_OB_SURFACE, "OBJECT_OT_surface_add", "type");
-       uiItemMenuEnumO(layout, "Metaball", ICON_OUTLINER_OB_META, "OBJECT_OT_metaball_add", "type");
-       uiItemO(layout, "Text", ICON_OUTLINER_OB_FONT, "OBJECT_OT_text_add");
-       uiItemS(layout);
-       uiItemO(layout, "Armature", ICON_OUTLINER_OB_ARMATURE, "OBJECT_OT_armature_add");
-       uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_LATTICE, "OBJECT_OT_add", "type", OB_LATTICE);
-       uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_EMPTY, "OBJECT_OT_add", "type", OB_EMPTY);
-       uiItemS(layout);
-       uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_CAMERA, "OBJECT_OT_add", "type", OB_CAMERA);
-       uiItemMenuEnumO(layout, "Lamp", ICON_OUTLINER_OB_LAMP, "OBJECT_OT_lamp_add", "type");
-       uiItemS(layout);
-       uiItemMenuEnumO(layout, "Force Field", ICON_OUTLINER_OB_EMPTY, "OBJECT_OT_effector_add", "type");
-       uiItemS(layout);
-       uiItemMenuEnumO(layout, "Group Instance", ICON_OUTLINER_OB_EMPTY, "OBJECT_OT_group_instance_add", "type");
-       
-       uiPupMenuEnd(C, pup);
-       
-       /* this operator is only for a menu, not used further */
-       return OPERATOR_CANCELLED;
-}
-
-/* only used as menu */
-void OBJECT_OT_primitive_add(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Add Primitive";
-       ot->description = "Add a primitive object.";
-       ot->idname= "OBJECT_OT_primitive_add";
-       
-       /* api callbacks */
-       ot->invoke= object_primitive_add_invoke;
-       
-       ot->poll= ED_operator_scene_editable;
-       
-       /* flags */
-       ot->flag= 0;
-}
-
 /* add dupligroup */
 static EnumPropertyItem *add_dupligroup_itemf(bContext *C, PointerRNA *ptr, int *free)
 {
index 1a7d3841aaa07c3e09fc6c4e9d1e7d663c10ff35..353622526d38885194af53313eccf7043b000fd9 100644 (file)
@@ -90,7 +90,6 @@ void OBJECT_OT_metaball_add(struct wmOperatorType *ot);
 void OBJECT_OT_text_add(struct wmOperatorType *ot);
 void OBJECT_OT_armature_add(struct wmOperatorType *ot);
 void OBJECT_OT_lamp_add(struct wmOperatorType *ot);
-void OBJECT_OT_primitive_add(struct wmOperatorType *ot); /* only used as menu */
 void OBJECT_OT_effector_add(struct wmOperatorType *ot);
 void OBJECT_OT_group_instance_add(struct wmOperatorType *ot);
 
index f2f24c099bca0be07dba0ff868ebd25a1956f9a1..d75cf63c1d41c5f383139583083ce4078189ec7a 100644 (file)
@@ -119,7 +119,6 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_add);
        WM_operatortype_append(OBJECT_OT_effector_add);
        WM_operatortype_append(OBJECT_OT_group_instance_add);
-       WM_operatortype_append(OBJECT_OT_primitive_add);
        WM_operatortype_append(OBJECT_OT_mesh_add);
        WM_operatortype_append(OBJECT_OT_metaball_add);
        WM_operatortype_append(OBJECT_OT_duplicates_make_real);
@@ -247,7 +246,9 @@ void ED_keymap_object(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0);
-       WM_keymap_verify_item(keymap, "OBJECT_OT_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
+       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "name", "INFO_MT_add");
+
        WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_ALT, 0)->ptr, "linked", 1);
        WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
index 2abcd2f213566120e32259430f3b96a48c0f8d21..a0eae40f5796d29815084104838503d370b7a2e1 100644 (file)
@@ -199,7 +199,7 @@ void node_menus_register(ARegionType *art)
        strcpy(mt->idname, "NODE_MT_add");
        strcpy(mt->label, "Add");
        mt->draw= node_menu_add;
-       BLI_addtail(&art->menutypes, mt);
+       WM_menutype_add(mt);
 }
 
 #if 0
index 1a1172247fcbdaa1e9086bed274d8a24d6d8810c..a1b412c70f40cca3157012aebbe226193a4c191e 100644 (file)
@@ -348,12 +348,11 @@ static void rna_Menu_unregister(const bContext *C, StructRNA *type)
 
        if(!mt)
                return;
-       if(!(art=region_type_find(NULL, mt->space_type, RGN_TYPE_HEADER)))
-               return;
        
        RNA_struct_free_extension(type, &mt->ext);
 
-       BLI_freelinkN(&art->menutypes, mt);
+       WM_menutype_freelink(mt);
+
        RNA_struct_free(&BLENDER_RNA, type);
 
        /* update while blender is running */
@@ -376,12 +375,9 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void
        /* validate the python class */
        if(validate(&dummymtr, data, have_function) != 0)
                return NULL;
-       
-       if(!(art=region_type_find(reports, dummymt.space_type, RGN_TYPE_HEADER)))
-               return NULL;
 
        /* check if we have registered this menu type before, and remove it */
-       mt= BKE_spacemenu_find(dummymt.idname, dummymt.space_type);
+       mt= WM_menutype_find(dummymt.idname, TRUE);
        if(mt && mt->ext.srna)
                rna_Menu_unregister(C, mt->ext.srna);
        
@@ -398,7 +394,7 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void
        mt->poll= (have_function[0])? menu_poll: NULL;
        mt->draw= (have_function[1])? menu_draw: NULL;
 
-       BLI_addtail(&art->menutypes, mt);
+       WM_menutype_add(mt);
 
        /* update while blender is running */
        if(C)
@@ -734,11 +730,6 @@ static void rna_def_menu(BlenderRNA *brna)
        RNA_def_property_string_sdna(prop, NULL, "type->label");
        RNA_def_property_flag(prop, PROP_REGISTER);
 
-       prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
-       RNA_def_property_enum_items(prop, space_type_items);
-       RNA_def_property_flag(prop, PROP_REGISTER);
-
        RNA_define_verify_sdna(1);
 }
 
index 301204d3e2b745abb06bd5388408e87087aa88f8..87752ca9c58f09be137ba0c9193fde1b3b6727fb 100644 (file)
@@ -94,7 +94,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
                        char *report_str= BKE_reports_string(reports, 0); /* all reports */
 
                        if(report_str) {
-                               PySys_WriteStdout(report_str);
+                               PySys_WriteStdout("%s\n", report_str);
                                MEM_freeN(report_str);
                        }
                }
index b29dbec63643a6e7dfa9d655f2575aca5cd469da..eaf8b00163cbf4d1e9c6eb685cf0f268f19f365c 100644 (file)
@@ -41,6 +41,7 @@ struct wmNotifier;
 struct rcti;
 struct PointerRNA;
 struct EnumPropertyItem;
+struct MenuType;
 
 typedef struct wmJob wmJob;
 
@@ -187,6 +188,12 @@ char               *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struc
 void           WM_operator_bl_idname(char *to, const char *from);
 void           WM_operator_py_idname(char *to, const char *from);
 
+/* *************** menu types ******************** */
+struct MenuType                *WM_menutype_find(const char *idname, int quiet);
+int                                    WM_menutype_add(struct MenuType* mt);
+void                           WM_menutype_freelink(struct MenuType* mt);
+void                           WM_menutype_free(void);
+
                        /* default operator callbacks for border/circle/lasso */
 int                    WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int                    WM_border_select_modal  (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
index a068f84ae294f413b4928012d08464803a578c38..dbb8fc400c01ce1bcc8656e30d47a4f05e0478af 100644 (file)
@@ -26,6 +26,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#include "string.h"
+
 #include "DNA_windowmanager_types.h"
 
 #include "MEM_guardedalloc.h"
@@ -39,6 +41,7 @@
 #include "BKE_idprop.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_screen.h"
 #include "BKE_report.h"
 
 #include "WM_api.h"
@@ -128,6 +131,49 @@ void WM_operator_stack_clear(bContext *C)
 
 /* ****************************************** */
 
+static ListBase menutypes = {NULL, NULL}; /* global menutype list */
+
+MenuType *WM_menutype_find(const char *idname, int quiet)
+{
+       MenuType* mt;
+
+       if (idname[0]) {
+               for(mt=menutypes.first; mt; mt=mt->next)
+                       if(strcmp(idname, mt->idname)==0)
+                               return mt;
+       }
+
+       if(!quiet)
+               printf("search for unknown menutype %s\n", idname);
+
+       return NULL;
+}
+
+int WM_menutype_add(MenuType* mt)
+{
+       BLI_addtail(&menutypes, mt);
+       return 1;
+}
+
+void WM_menutype_freelink(MenuType* mt)
+{
+       BLI_freelinkN(&menutypes, mt);
+}
+
+void WM_menutype_free(void)
+{
+       MenuType* mt;
+
+       for(mt= menutypes.first; mt; mt= mt->next) {
+               if(mt->ext.free) {
+                       mt->ext.free(mt->ext.data);
+               }
+               WM_menutype_freelink(mt);
+       }
+}
+
+/* ****************************************** */
+
 void WM_keymap_init(bContext *C)
 {
        wmWindowManager *wm= CTX_wm_manager(C);
index 490ef12a5230387b944c407c2971e133a1e0ad50..2e456669cb1fdc73497984107a525579caebc3aa 100644 (file)
@@ -195,6 +195,7 @@ void WM_exit(bContext *C)
                }
        }
        wm_operatortype_free();
+       WM_menutype_free();
        
        /* all non-screen and non-space stuff editors did, like editmode */
        if(C)
index a92fcee48e2d583da255232377ca360067463cae..915f4c80663e495232c506e43cfb6dcf3fd095ae 100644 (file)
@@ -783,7 +783,7 @@ static int wm_call_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
        char idname[BKE_ST_MAXNAME];
        RNA_string_get(op->ptr, "name", idname);
 
-       uiPupMenuInvoke(C, idname, CTX_wm_area(C)->spacetype);
+       uiPupMenuInvoke(C, idname);
 
        return OPERATOR_CANCELLED;
 }
index 44b7b60e451ce35b182f1a7cd38623b10d9f2097..f7116a2bd1f4c41dc98603f03e4800f74d009ec2 100644 (file)
@@ -68,7 +68,6 @@ GHOST_SystemHandle g_system= NULL;
 /* set by commandline */
 static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0;
 
-
 /* ******** win open & close ************ */
 
 /* XXX this one should correctly check for apple top header...
index f159f7f098dcb4837da52ec726b1b43d9fd12e9a..44c31e7cb691f7ffa1bf2a6291fd26e810bee392 100644 (file)
@@ -62,6 +62,5 @@ void          wm_window_testbreak             (void);
 int                    wm_window_duplicate_op  (bContext *C, wmOperator *op);
 int                    wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op);
 
-
 #endif /* WM_WINDOW_H */