2.5
authorMichael Fox <mfoxdogg@gmail.com>
Sun, 18 Jan 2009 01:26:20 +0000 (01:26 +0000)
committerMichael Fox <mfoxdogg@gmail.com>
Sun, 18 Jan 2009 01:26:20 +0000 (01:26 +0000)
******
-ported some of the Object mode select menu to use uiDefMenuButO
- select random/layer still uses the hard coded value as no sutible popup exists
- select by type suffers from random crashes, somthing to do with Context
- need some way of doing sub menu's using the operator's invoke
- the old menu is just #if'ed out
- and did a little hous cleaning aswel

- added some undo pushes to the select operators

source/blender/editors/object/object_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c

index 57a7668..fb4e50a 100644 (file)
@@ -1157,6 +1157,7 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* undo? */
+       ED_undo_push(C,"Select By Type");
        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
@@ -1337,6 +1338,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* undo? */
+       ED_undo_push(C,"Select By Layer");
        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
@@ -1368,6 +1370,7 @@ static int object_select_invert_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* undo? */
+       ED_undo_push(C,"Selection Invert");
        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
@@ -1411,6 +1414,7 @@ static int object_de_select_all_exec(bContext *C, wmOperator *op)
        
        /* undo? */
        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       ED_undo_push(C,"(De)Select All");
        
        return OPERATOR_FINISHED;
 }
@@ -1443,6 +1447,7 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* undo? */
+       ED_undo_push(C,"Select Random");
        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
@@ -2760,7 +2765,7 @@ static int object_set_center_exec(bContext *C, wmOperator *op)
 if (tot_change) {
        ED_anim_dag_flush_update(C);
        allqueue(REDRAWVIEW3D, 0);
-       BIF_undo_push("Do Center");     
+       ED_undo_push(C,"Do Center");    
        }
        
        /* Warn if any errors occured */
index 33f7308..71824b4 100644 (file)
@@ -900,34 +900,14 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, uiMenuBlockHandle
        return block;
 }
 
-void do_view3d_select_objectmenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event) {
-       
-       case 0: /* border select */
-               borderselect();
-               break;
-       case 1: /* Select/Deselect All */
-               deselectall();
-               break;
-       case 2: /* inverse */
-               selectswap();
-               break;
-       case 3: /* random */
-               selectrandom();
-               break;
-       }
-       allqueue(REDRAWVIEW3D, 0);
-#endif
-}
-
 static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        uiBlock *block;
        short yco= 0, menuwidth=120;
        
        block= uiBeginBlock(C, handle->region, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV);
+       
+#if 0
        uiBlockSetButmFunc(block, do_view3d_select_objectmenu, NULL);
        
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -945,6 +925,17 @@ static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle,
        
        uiDefIconTextBlockBut(block, view3d_select_object_linkedmenu, NULL, ICON_RIGHTARROW_THIN, "Linked", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_select_object_groupedmenu, NULL, ICON_RIGHTARROW_THIN, "Grouped", 0, yco-=20, 120, 19, "");
+#endif
+       uiDefMenuButO(block, "VIEW3D_OT_borderselect", "Border Select");
+       
+       uiDefMenuSep(block);
+       
+       uiDefMenuButO(block, "OBJECT_OT_de_select_all", "Select/Deselect All");
+       uiDefMenuButO(block, "OBJECT_OT_select_invert", "Inverse");
+       uiDefMenuButO(block, "OBJECT_OT_select_random", "Random");
+       uiDefMenuButO(block, "OBJECT_OT_select_by_layer", "Select All by Layer");
+       uiDefMenuButO(block, "OBJECT_OT_select_by_type", "Select All by Type");
+
 
        if(handle->region->alignment==RGN_ALIGN_TOP) {
                uiBlockSetDirection(block, UI_DOWN);
index 2999051..d6f6b04 100644 (file)
@@ -1477,7 +1477,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                }
                MEM_freeN(vbuffer);
        }
-       
+       ED_undo_push(C,"Border Select");
        return OPERATOR_FINISHED;
 } 
 
@@ -1542,6 +1542,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        else 
                mouse_select(C, mval, extend, 0);
        
+       ED_undo_push(C,"Mouse Select");
        /* allowing tweaks */
        return OPERATOR_PASS_THROUGH;
 }
@@ -1770,6 +1771,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
                WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        }
        
+       ED_undo_push(C,"Circle Select");
        return OPERATOR_FINISHED;
 }