Removed a few operators that were just used to generate popup menus and replaced...
authorMatt Ebb <matt@mke3.net>
Thu, 24 Dec 2009 10:39:30 +0000 (10:39 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 24 Dec 2009 10:39:30 +0000 (10:39 +0000)
release/scripts/ui/space_view3d.py
source/blender/editors/curve/curve_ops.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/physics_intern.h
source/blender/editors/physics/physics_ops.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_snap.c

index 26a018f81cb972863e8593030a6542f7cfd31cbb..26f2953be40755e9a712befba0857e49793dbd8d 100644 (file)
@@ -903,6 +903,24 @@ class VIEW3D_MT_particle(bpy.types.Menu):
         layout.menu("VIEW3D_MT_particle_showhide")
 
 
+class VIEW3D_MT_particle_specials(bpy.types.Menu):
+    bl_label = "Specials"
+
+    def draw(self, context):
+        layout = self.layout
+        particle_edit = context.tool_settings.particle_edit
+
+        layout.operator("particle.rekey")
+
+        layout.separator()
+        if particle_edit.selection_mode == 'POINT':
+            layout.operator("particle.subdivide")
+            layout.operator("particle.select_first")
+            layout.operator("particle.select_last")
+
+        layout.operator("particle.remove_doubles")
+
+
 class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
     _operator_name = "particle"
 
@@ -1344,7 +1362,19 @@ class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
 
         layout.operator("curve.subdivide")
         layout.operator("curve.switch_direction")
+        
+class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
+    bl_label = "Specials"
 
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("curve.subdivide")
+        layout.operator("curve.switch_direction")
+        layout.operator("curve.spline_weight_set")
+        layout.operator("curve.radius_set")
+        layout.operator("curve.smooth")
+        layout.operator("curve.smooth_radius")
 
 class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
     _operator_name = "curve"
@@ -1924,7 +1954,8 @@ bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
 
 bpy.types.register(VIEW3D_MT_paint_vertex)
 
-bpy.types.register(VIEW3D_MT_particle) # Particle Menu
+bpy.types.register(VIEW3D_MT_particle)# Particle Menu
+bpy.types.register(VIEW3D_MT_particle_specials)
 bpy.types.register(VIEW3D_MT_particle_showhide)
 
 bpy.types.register(VIEW3D_MT_pose) # POSE Menu
@@ -1948,6 +1979,7 @@ bpy.types.register(VIEW3D_MT_edit_mesh_showhide)
 bpy.types.register(VIEW3D_MT_edit_curve)
 bpy.types.register(VIEW3D_MT_edit_curve_ctrlpoints)
 bpy.types.register(VIEW3D_MT_edit_curve_segments)
+bpy.types.register(VIEW3D_MT_edit_curve_specials)
 bpy.types.register(VIEW3D_MT_edit_curve_showhide)
 
 bpy.types.register(VIEW3D_MT_edit_surface)
index be52952b474576997181640eceff135bdd2448a6..660db2f095109f1e4e37e1867e71a2603adbdadb 100644 (file)
 #include "curve_intern.h"
 
 
-/**************************** menus *****************************/
-
-static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Specials", 0);
-       layout= uiPupMenuLayout(pup);
-       uiItemO(layout, NULL, 0, "CURVE_OT_subdivide");
-       uiItemO(layout, NULL, 0, "CURVE_OT_switch_direction");
-       uiItemO(layout, NULL, 0, "CURVE_OT_spline_weight_set");
-       uiItemO(layout, NULL, 0, "CURVE_OT_radius_set");
-       uiItemO(layout, NULL, 0, "CURVE_OT_smooth");
-       uiItemO(layout, NULL, 0, "CURVE_OT_smooth_radius");
-       uiPupMenuEnd(C, pup);
-
-       return OPERATOR_CANCELLED;
-}
-
-void CURVE_OT_specials_menu(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Specials Menu";
-       ot->idname= "CURVE_OT_specials_menu";
-       
-       /* api clastbacks */
-       ot->invoke= specials_menu_invoke;
-       ot->poll= ED_operator_editsurfcurve;
-}
-
 /************************* registration ****************************/
 
 void ED_operatortypes_curve(void)
@@ -157,8 +126,6 @@ void ED_operatortypes_curve(void)
        WM_operatortype_append(CURVE_OT_vertex_add);
        WM_operatortype_append(CURVE_OT_extrude);
        WM_operatortype_append(CURVE_OT_cyclic_toggle);
-
-       WM_operatortype_append(CURVE_OT_specials_menu);
 }
 
 void ED_keymap_curve(wmKeyConfig *keyconf)
@@ -248,7 +215,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
        RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "unselected", 1);
 
-       WM_keymap_add_item(keymap, "CURVE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_curve_specials", WKEY, KM_PRESS, 0, 0);
 
        /* menus */
        WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
index 8bacad3c13237d9ac43203de31ddf87dafbd2d80..c29214f4633dbba6b544d0cb83e6d478971f1f0e 100644 (file)
@@ -4035,39 +4035,3 @@ void PARTICLE_OT_edited_clear(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-/*********************** specials menu **************************/
-
-static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       Scene *scene= CTX_data_scene(C);
-       ParticleEditSettings *pset=PE_settings(scene);
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Specials", 0);
-       layout= uiPupMenuLayout(pup);
-
-       uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey");
-       if(pset->selectmode & SCE_SELECT_POINT) {
-               uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide");
-               uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first");
-               uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last");
-       }
-       uiItemO(layout, NULL, 0, "PARTICLE_OT_remove_doubles");
-
-       uiPupMenuEnd(C, pup);
-
-       return OPERATOR_CANCELLED;
-}
-
-void PARTICLE_OT_specials_menu(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Specials Menu";
-       ot->idname= "PARTICLE_OT_specials_menu";
-       
-       /* api callbacks */
-       ot->invoke= specials_menu_invoke;
-       ot->poll= PE_hair_poll;
-}
-
index 085332b1788f6bb8149b79909c20d0d7a3461c94..e1b1a8b90a8dc3a462e7033437d858ca850cd93a 100644 (file)
@@ -57,8 +57,6 @@ void PARTICLE_OT_brush_set(struct wmOperatorType *ot);
 void PARTICLE_OT_brush_edit(struct wmOperatorType *ot);
 void PARTICLE_OT_brush_radial_control(struct wmOperatorType *ot);
 
-void PARTICLE_OT_specials_menu(struct wmOperatorType *ot);
-
 void PARTICLE_OT_particle_edit_toggle(struct wmOperatorType *ot);
 void PARTICLE_OT_edited_clear(struct wmOperatorType *ot);
 
index 09b4ebec7a211e76cb41d04d96b34db8d2080ff0..24b3881d6b8cd09e338558e9c5c78bc197ebbeca 100644 (file)
@@ -64,8 +64,6 @@ static void operatortypes_particle(void)
        WM_operatortype_append(PARTICLE_OT_brush_edit);
        WM_operatortype_append(PARTICLE_OT_brush_radial_control);
 
-       WM_operatortype_append(PARTICLE_OT_specials_menu);
-
        WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
        WM_operatortype_append(PARTICLE_OT_edited_clear);
 
@@ -113,7 +111,7 @@ static void keymap_particle(wmKeyConfig *keyconf)
        RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
        RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
 
-       WM_keymap_add_item(keymap, "PARTICLE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0);
 
        ED_object_generic_keymap(keyconf, keymap, 1);
 }
index b32a067206e7f6be41a2e705563e728e987bd26a..bf5d516c03a8a19764a0752054fe52e326ebcecd 100644 (file)
@@ -161,7 +161,6 @@ void VIEW3D_OT_snap_selected_to_center(struct wmOperatorType *ot);
 void VIEW3D_OT_snap_cursor_to_grid(struct wmOperatorType *ot);
 void VIEW3D_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
 void VIEW3D_OT_snap_cursor_to_active(struct wmOperatorType *ot);
-void VIEW3D_OT_snap_menu(struct wmOperatorType *ot);
 
 /* space_view3d.c */
 ARegion *view3d_has_buttons_region(ScrArea *sa);
index 4bb65ec4ed47823c3d1068c2115be617b65abcdb..c211e55d7a0412fa233423ffd7469dc966486466 100644 (file)
@@ -98,7 +98,6 @@ void view3d_operatortypes(void)
        WM_operatortype_append(VIEW3D_OT_snap_cursor_to_grid);
        WM_operatortype_append(VIEW3D_OT_snap_cursor_to_selected);
        WM_operatortype_append(VIEW3D_OT_snap_cursor_to_active);
-       WM_operatortype_append(VIEW3D_OT_snap_menu);
                
        transform_operatortypes();
 }
@@ -241,7 +240,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
        
-       WM_keymap_add_item(keymap, "VIEW3D_OT_snap_menu", SKEY, KM_PRESS, KM_SHIFT, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
 
        /* context ops */
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
index a23163f4a5c8bc12184dbafd47ca6ce1dcda4bc6..3147abd499b7328bec256f54ec6ef54beb6271f8 100644 (file)
@@ -1112,42 +1112,3 @@ int minmax_verts(Object *obedit, float *min, float *max)
        return 1;
 }
 
-/* ************************************************* */
-
-static int snap_menu_invoke(bContext *C, wmOperator *unused, wmEvent *event)
-{
-       uiPopupMenu *pup= uiPupMenuBegin(C, "Snap", 0);
-       uiLayout *layout= uiPupMenuLayout(pup);
-       
-       uiItemO(layout, "Selected to Grid", 0, "VIEW3D_OT_snap_selected_to_grid");
-       uiItemO(layout, "Selected to Cursor", 0, "VIEW3D_OT_snap_selected_to_cursor");
-       uiItemO(layout, "Selected to Center", 0, "VIEW3D_OT_snap_selected_to_center");
-       uiItemS(layout);
-       uiItemO(layout, "Cursor to Selected", 0, "VIEW3D_OT_snap_cursor_to_selected");
-       uiItemO(layout, "Cursor to Grid", 0, "VIEW3D_OT_snap_cursor_to_grid");
-       uiItemO(layout, "Cursor to Active", 0, "VIEW3D_OT_snap_cursor_to_active");
-       
-       uiPupMenuEnd(C, pup);
-       
-       /* this operator is only for a menu, not used further */
-       return OPERATOR_CANCELLED;
-}
-
-/* only used as menu */
-void VIEW3D_OT_snap_menu(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Snap Menu";
-       ot->description= "Display snap menu.";
-       ot->idname= "VIEW3D_OT_snap_menu";
-       
-       /* api callbacks */
-       ot->invoke= snap_menu_invoke;
-       
-       ot->poll= ED_operator_view3d_active;
-       
-       /* flags */
-       ot->flag= 0;
-}
-
-