2.5:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 10 Jul 2009 13:56:29 +0000 (13:56 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 10 Jul 2009 13:56:29 +0000 (13:56 +0000)
* 3D view Object menu works again, many operators missing still
  because they are not yet implemented.
* Constraint types now have separator, and fix too much spacing
  in the constraints header.

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/editgroup.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/makesrna/intern/rna_constraint.c

index b84a3ab469c0c0e28598583a84ed6135284e3fc9..4fe28c2e457bb48a68183bfd22efa6180f52317a 100644 (file)
@@ -2124,7 +2124,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
                                BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
                                for(i=0; i<totitem; i++) {
                                        if(!item[i].identifier[0])
-                                               BLI_dynstr_appendf(dynstr, "|%l");
+                                               BLI_dynstr_append(dynstr, "|%l");
                                        else if(item[i].icon)
                                                BLI_dynstr_appendf(dynstr, "|%s %%i%d %%x%d", item[i].name, item[i].icon, item[i].value);
                                        else
index bb6ca6c502f352ce58098c78e8a780c21c22018a..8e880b1018562fd40cdc8b4555c6efb44836b6be 100644 (file)
@@ -559,12 +559,12 @@ static char *ui_menu_enumpropname(char *opname, char *propname, int retval)
 
        if(prop) {
                const EnumPropertyItem *item;
-               int totitem, i;
-               char *name;
+               int totitem;
+               const char *name;
 
                RNA_property_enum_items(&ptr, prop, &item, &totitem);
                if(RNA_enum_name(item, retval, &name))
-                       return name;
+                       return (char*)name;
        }
 
        return "";
index 5fd84ad3c9f841fc96e95665a306400bdc20ff56..91fbd24f8a6d0457bc52ee6ab597c74b65d6f455 100644 (file)
@@ -757,7 +757,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
        box= uiLayoutBox(col);
        row= uiLayoutRow(box, 0);
 
-       block= uiLayoutFreeBlock(box);
+       block= uiLayoutGetBlock(box);
 
        subrow= uiLayoutRow(row, 0);
        uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
@@ -772,27 +772,19 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
        uiDefIconButBitS(block, ICONTOG, CONSTRAINT_EXPAND, B_CONSTRAINT_TEST, ICON_TRIA_RIGHT, xco-10, yco, 20, 20, &con->flag, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Constraint");
        
        /* name */      
-       if ((con->flag & CONSTRAINT_EXPAND) && (proxy_protected==0)) {
-               /* XXX if (con->flag & CONSTRAINT_DISABLE)
-                       uiBlockSetCol(block, TH_REDALERT);*/
-               
-               uiBlockSetEmboss(block, UI_EMBOSS);
-               
-               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
-               
+       uiBlockSetEmboss(block, UI_EMBOSS);
+       
+       /* XXX if (con->flag & CONSTRAINT_DISABLE)
+               uiBlockSetCol(block, TH_REDALERT);*/
+       
+       uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
+       
+       if(proxy_protected == 0) {
                but = uiDefBut(block, TEX, B_CONSTRAINT_TEST, "", xco+120, yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name"); 
                uiButSetFunc(but, verify_constraint_name_func, con, NULL);
-       }       
-       else {
-               uiBlockSetEmboss(block, UI_EMBOSSN);
-               
-               /* XXX if (con->flag & CONSTRAINT_DISABLE)
-                       uiBlockSetCol(block, TH_REDALERT);*/
-               
-               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
-               
-               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, xco+120, yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
        }
+       else
+               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, xco+120, yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
 
        // XXX uiBlockSetCol(block, TH_AUTO);   
 
index b49e2040b034b5d1e425b9c5f1d4ae91964aad81..5943b36a6b09e6dac6c8dc7c6c3461b4952ff3d5 100644 (file)
@@ -161,7 +161,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Remove Selected From active group";
+       ot->name= "Remove Selected From Active Group";
        ot->description = "Remove the object from an object group that contains the active object.";
        ot->idname= "GROUP_OT_objects_remove_active";
        
index da3b5e1e6b36790f347147670eb4139717c9cbec..0a9ed945c1d74bec2f7acc4170b55f6f9ba92551 100644 (file)
@@ -704,8 +704,8 @@ void OBJECT_OT_delete(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Delete Objects";
-       ot->description = "Delete the object.";
+       ot->name= "Delete";
+       ot->description = "Delete selected objects.";
        ot->idname= "OBJECT_OT_delete";
        
        /* api callbacks */
@@ -1407,7 +1407,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_parent_clear(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Clear parent";
+       ot->name= "Clear Parent";
        ot->description = "Clear the object's parenting.";
        ot->idname= "OBJECT_OT_parent_clear";
        
@@ -1895,7 +1895,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Clear Object Location";
+       ot->name= "Clear Location";
        ot->description = "Clear the object's location.";
        ot->idname= "OBJECT_OT_location_clear";
        
@@ -1939,7 +1939,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Clear Object Rotation";
+       ot->name= "Clear Rotation";
        ot->description = "Clear the object's rotation.";
        ot->idname= "OBJECT_OT_rotation_clear";
        
@@ -1987,7 +1987,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Clear Object Scale";
+       ot->name= "Clear Scale";
        ot->description = "Clear the object's scale.";
        ot->idname= "OBJECT_OT_scale_clear";
        
@@ -2033,7 +2033,7 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
 {
 
        /* identifiers */
-       ot->name= "Clear Object Origin";
+       ot->name= "Clear Origin";
        ot->description = "Clear the object's origin.";
        ot->idname= "OBJECT_OT_origin_clear";
        
@@ -2076,12 +2076,11 @@ void OBJECT_OT_restrictview_clear(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Clear restrict view";
+       ot->name= "Clear Restrict View";
        ot->description = "Reveal the object by setting the restrictview flag.";
        ot->idname= "OBJECT_OT_restrictview_clear";
        
        /* api callbacks */
-       ot->invoke= WM_operator_confirm;
        ot->exec= object_restrictview_clear_exec;
        ot->poll= ED_operator_view3d_active;
        
@@ -2089,19 +2088,14 @@ void OBJECT_OT_restrictview_clear(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-static EnumPropertyItem prop_set_restrictview_types[] = {
-       {0, "SELECTED", 0, "Selected", ""},
-       {1, "UNSELECTED", 0, "Unselected ", ""},
-       {0, NULL, 0, NULL, NULL}
-};
-
 static int object_restrictview_set_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        short changed = 0;
+       int unselected= RNA_boolean_get(op->ptr, "unselected");
        
        CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if(RNA_enum_is_equal(op->ptr, "type", "SELECTED")){
+               if(!unselected) {
                        if (base->flag & SELECT){
                                base->flag &= ~SELECT;
                                base->object->flag = base->flag;
@@ -2112,7 +2106,7 @@ static int object_restrictview_set_exec(bContext *C, wmOperator *op)
                                }
                        }
                }
-               else if (RNA_enum_is_equal(op->ptr, "type", "UNSELECTED")){
+               else {
                        if (!(base->flag & SELECT)){
                                base->object->restrictflag |= OB_RESTRICT_VIEW;
                                changed = 1;
@@ -2134,19 +2128,18 @@ static int object_restrictview_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_restrictview_set(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Set restrict view";
+       ot->name= "Set Restrict View";
        ot->description = "Hide the object by setting the restrictview flag.";
        ot->idname= "OBJECT_OT_restrictview_set";
        
        /* api callbacks */
-       ot->invoke= WM_menu_invoke;
        ot->exec= object_restrictview_set_exec;
        ot->poll= ED_operator_view3d_active;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
-       RNA_def_enum(ot->srna, "type", prop_set_restrictview_types, 0, "Type", "");
+       RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects.");
        
 }
 /* ************* Slow Parent ******************* */
@@ -2643,7 +2636,7 @@ static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void OBJECT_OT_parent_set(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Make parent";
+       ot->name= "Make Parent";
        ot->description = "Set the object's parenting.";
        ot->idname= "OBJECT_OT_parent_set";
        
@@ -2797,7 +2790,7 @@ static void make_object_duplilist_real(Scene *scene, View3D *v3d, Base *base)
 }
 
 
-static int object_dupli_set_real_exec(bContext *C, wmOperator *op)
+static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        ScrArea *sa= CTX_wm_area(C);
@@ -2817,17 +2810,17 @@ static int object_dupli_set_real_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-void OBJECT_OT_dupli_set_real(wmOperatorType *ot)
+void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Make Dupli Real";
+       ot->name= "Make Duplicates Real";
        ot->description = "Make dupli objects attached to this object real.";
-       ot->idname= "OBJECT_OT_dupli_set_real";
+       ot->idname= "OBJECT_OT_duplicates_make_real";
        
        /* api callbacks */
        ot->invoke= WM_operator_confirm;
-       ot->exec= object_dupli_set_real_exec;
+       ot->exec= object_duplicates_make_real_exec;
        
        ot->poll= ED_operator_scene_editable;
        
@@ -5966,7 +5959,8 @@ static int duplicate_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        View3D *v3d= CTX_wm_view3d(C);
-       int dupflag= U.dupflag;
+       int linked= RNA_boolean_get(op->ptr, "linked");
+       int dupflag= (linked)? 0: U.dupflag;
        
        clear_id_newpoins();
        clear_sca_new_poins();  /* sensor/contr/act */
@@ -6008,8 +6002,8 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Duplicate Objects";
-       ot->description = "Duplicate the objects.";
+       ot->name= "Duplicate";
+       ot->description = "Duplicate selected objects.";
        ot->idname= "OBJECT_OT_duplicate";
        
        /* api callbacks */
@@ -6022,6 +6016,7 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
+       RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data.");
        RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
 }
 
index 12776c08d4f6b85367b44486f1b634cd4cd0cc45..2173e79ac66e839e8ca44f0e16f5d058d86b7e36 100644 (file)
@@ -59,7 +59,7 @@ void OBJECT_OT_restrictview_clear(struct wmOperatorType *ot);
 void OBJECT_OT_slowparent_set(struct wmOperatorType *ot);
 void OBJECT_OT_slowparent_clear(struct wmOperatorType *ot);
 void OBJECT_OT_center_set(struct wmOperatorType *ot);
-void OBJECT_OT_dupli_set_real(struct wmOperatorType *ot);
+void OBJECT_OT_duplicates_make_real(struct wmOperatorType *ot);
 void OBJECT_OT_object_add(struct wmOperatorType *ot);
 void OBJECT_OT_duplicate(struct wmOperatorType *ot);
 void OBJECT_OT_delete(struct wmOperatorType *ot);
index 3a9973b7ec5dc1f2ed85491d305d9dae753f4a14..50c1467393943208fbd1814b64cc2f4319dcf430 100644 (file)
@@ -83,7 +83,7 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_slowparent_set);
        WM_operatortype_append(OBJECT_OT_slowparent_clear);
        WM_operatortype_append(OBJECT_OT_center_set);
-       WM_operatortype_append(OBJECT_OT_dupli_set_real);
+       WM_operatortype_append(OBJECT_OT_duplicates_make_real);
        WM_operatortype_append(OBJECT_OT_duplicate);
        WM_operatortype_append(GROUP_OT_group_create);
        WM_operatortype_append(GROUP_OT_objects_remove);
@@ -155,12 +155,14 @@ void ED_keymap_object(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0);
        
-       WM_keymap_verify_item(keymap, "OBJECT_OT_restrictview_clear", HKEY, KM_PRESS, KM_ALT, 0);
-       WM_keymap_verify_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_clear", HKEY, KM_PRESS, KM_ALT, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, 0, 0);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
        
        WM_keymap_verify_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "OBJECT_OT_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
-       WM_keymap_verify_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", 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);
        
        // XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
        WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe_menu", IKEY, KM_PRESS, 0, 0);
index d23b47092bf9c1dd4cc7e3e6edd0e20c98e8ae83..9a03a602ac25bea6c106769bbcc5e87af895cb1a 100644 (file)
@@ -1707,6 +1707,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
        return block;
 }
 
+#if 0
 void do_view3d_object_mirrormenu(bContext *C, void *arg, int event)
 {
 #if 0
@@ -1752,64 +1753,29 @@ static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unu
        uiTextBoundsBlock(block, 60);
        return block;
 }
-
-static void do_view3d_edit_object_transformmenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event) {
-       case 0: /*      clear origin */
-               clear_object('o');
-               break;
-       case 1: /* clear scale */
-               clear_object('s');
-               break;
-       case 2: /* clear rotation */
-               clear_object('r');
-               break;
-       case 3: /* clear location */
-               clear_object('g');
-               break;
-       case 4:
-               if(OBACT) object_apply_deform(OBACT);
-               break;
-       case 5: /* make duplis real */
-               make_duplilist_real();
-               break;
-       case 6: /* apply scale/rotation or deformation */
-               apply_objects_locrot();
-               break;  
-       case 7: /* apply visual matrix to objects loc/size/rot */
-               apply_objects_visual_tx();
-               break;  
-       }
 #endif
-}
 
-static uiBlock *view3d_edit_object_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_transformmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-
-       block= uiBeginBlock(C, ar, "view3d_edit_object_transformmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_transformmenu, NULL);
-       
+#if 0
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation to ObData|Ctrl A, 1",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+       apply_objects_locrot();
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Visual Transform|Ctrl A, 2",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+       apply_objects_visual_tx();
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Deformation|Ctrl Shift A",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Duplicates Real|Ctrl Shift A",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       
-       uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Location|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Rotation|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Scale|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Origin|Alt O",             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
+       if(OBACT) object_apply_deform(OBACT);
+#endif
+       uiItemO(layout, NULL, 0, "OBJECT_OT_duplicates_make_real");
+
+       uiItemS(layout);
+
+       uiItemO(layout, NULL, 0, "OBJECT_OT_location_clear");
+       uiItemO(layout, NULL, 0, "OBJECT_OT_rotation_clear");
+       uiItemO(layout, NULL, 0, "OBJECT_OT_scale_clear");
+       uiItemO(layout, NULL, 0, "OBJECT_OT_origin_clear");
 }
 
+#if 0
 static void do_view3d_edit_object_makelocalmenu(bContext *C, void *arg, int event)
 {
 #if 0
@@ -2046,164 +2012,49 @@ static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, ARegion *ar, void *
        uiTextBoundsBlock(block, 60);
        return block;
 }
-
-
-static void do_view3d_edit_object_parentmenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event) {
-       case 0: /* clear parent */
-               clear_parent();
-               break;
-       case 1: /* make parent */
-               make_parent();
-               break;
-               }
 #endif
-}
 
-static uiBlock *view3d_edit_object_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_parentmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-
-       block= uiBeginBlock(C, ar, "view3d_edit_object_parentmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_parentmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P",                  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Parent...|Alt P",          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
+       uiItemO(layout, "Make Parent...", 0, "OBJECT_OT_parent_set");
+       uiItemO(layout, "Clear Parent...", 0, "OBJECT_OT_parent_clear");
 }
 
-static void do_view3d_edit_object_groupmenu(bContext *C, void *arg, int event)
+static void view3d_edit_object_groupmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-#if 0
-       switch(event) {
-               case 1:
-               case 2:
-               case 3:
-                       group_operation(event);
-                       break;
-       }
-#endif
-}
+       uiItemO(layout, NULL, 0, "GROUP_OT_group_create");
+       uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove");
 
-static uiBlock *view3d_edit_object_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-       
-       block= uiBeginBlock(C, ar, "view3d_edit_object_groupmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_groupmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to Existing Group|Ctrl G, 1",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to New Group|Ctrl G, 2",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove from All Groups|Ctrl G, 3",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
-}
+       uiItemS(layout);
 
-static void do_view3d_edit_object_trackmenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event) {
-       case 0: /* clear track */
-               clear_track();
-               break;
-       case 1: /* make track */
-               make_track();
-               break;
-               }
-#endif
+       uiItemO(layout, NULL, 0, "GROUP_OT_objects_add_active");
+       uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove_active");
 }
 
-static uiBlock *view3d_edit_object_trackmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_trackmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-
-       block= uiBeginBlock(C, ar, "view3d_edit_object_trackmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_trackmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Track...|Ctrl T",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Track...|Alt T",           0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
+       uiItemO(layout, "Make Track...", 0, "OBJECT_OT_track_set");
+       uiItemO(layout, "Clear Track...", 0, "OBJECT_OT_track_clear");
 }
 
-static void do_view3d_edit_object_constraintsmenu(bContext *C, void *arg, int event)
+static void view3d_edit_object_constraintsmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
 #if 0
-       switch(event) {
-       case 1: /* add constraint */
-               add_constraint(0);
-               break;
-       case 2: /* clear constraint */
-               ob_clear_constraints();
-               break;
-               }
-#endif
-}
-
-static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-
-       block= uiBeginBlock(C, ar, "view3d_edit_object_constraintsmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_constraintsmenu, NULL);
-       
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint...|Ctrl Alt C",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       add_constraint(0);
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Constraints",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
-}
-
-static void do_view3d_edit_object_showhidemenu(bContext *C, void *arg, int event)
-{
-#if 0
-       
-       switch(event) {
-                
-       case 0: /* show objects */
-               show_objects();
-               break;
-       case 1: /* hide selected objects */
-               hide_objects(1);
-               break;
-       case 2: /* hide deselected objects */
-               hide_objects(0);
-               break;
-       }
+       ob_clear_constraints();
 #endif
 }
 
-static uiBlock *view3d_edit_object_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-       short yco = 20, menuwidth = 120;
-
-       block= uiBeginBlock(C, ar, "view3d_edit_object_showhidemenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_object_showhidemenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Unselected|Shift H",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       return block;
+       uiItemO(layout, "Show Hidden", 0, "OBJECT_OT_restrictview_clear");
+       uiItemO(layout, "Hide Selected", 0, "OBJECT_OT_restrictview_set");
+       uiItemBooleanO(layout, "Hide Unselected", 0, "OBJECT_OT_restrictview_set", "unselected", 1);
 }
 
+#if 0
 #ifndef DISABLE_PYTHON
 static void do_view3d_edit_object_scriptsmenu(bContext *C, void *arg, int event)
 {
@@ -2233,11 +2084,12 @@ static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, ARegion *ar, void *a
        return block;
 }
 #endif /* DISABLE_PYTHON */
+#endif
 
 
+#if 0
 static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
 {
-#if 0
        Scene *scene= CTX_data_scene(C);
        ScrArea *sa= CTX_wm_area(C);
        View3D *v3d= sa->spacedata.first;
@@ -2247,15 +2099,6 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
        case 0: /* transform    properties*/
 // XXX         mainqenter(NKEY, 1);
                break;
-       case 1: /* delete */
-               delete_context_selected();
-               break;
-       case 2: /* duplicate */
-               duplicate_context_selected();
-               break;
-       case 3: /* duplicate linked */
-               adduplicate(0, 0);
-               break;
        case 5: /* make single user */
                single_user();
                break;
@@ -2274,9 +2117,6 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
        case 11: /* insert keyframe */
                common_insertkey();
                break;
-       case 15: /* Object Panel */
-               add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
-               break;
        case 16: /* make proxy object*/
                make_proxy();
                break;
@@ -2284,82 +2124,75 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
                common_deletekey();
                break; 
        }
-#endif
 }
+#endif
 
-static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_objectmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, ar, "view3d_edit_objectmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N",             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
+#if 0
+       Object *ob= CTX_data_active_object(C);
+
        uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_object_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
+#endif
 
-       uiDefIconTextBlockBut(block, view3d_edit_object_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear/Apply", 0, yco-=20, 120, 19, "");
-       // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
+       uiItemMenuF(layout, "Clear/Apply", 0, view3d_edit_object_transformmenu);
+       uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu);
+
+       uiItemS(layout);
+
+#if 0
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");  
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");  
        
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Linked|Alt D",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiItemS(layout);
+#endif
        
+       uiItemO(layout, NULL, 0, "OBJECT_OT_duplicate");
+       uiItemBooleanO(layout, "Duplicate Linked", 0, "OBJECT_OT_duplicate", "linked", 1);
+       uiItemO(layout, NULL, 0, "OBJECT_OT_delete");
+
+#if 0
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Proxy|Ctrl Alt P",                  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
        uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_edit_object_copyattrmenu, NULL, ICON_RIGHTARROW_THIN, "Copy Attributes", 0, yco-=20, 120, 19, "");
+#endif
        
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBlockBut(block, view3d_edit_object_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, "");
-       uiDefIconTextBlockBut(block, view3d_edit_object_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
-       uiDefIconTextBlockBut(block, view3d_edit_object_trackmenu, NULL, ICON_RIGHTARROW_THIN, "Track", 0, yco-=20, 120, 19, "");
-       uiDefIconTextBlockBut(block, view3d_edit_object_constraintsmenu, NULL, ICON_RIGHTARROW_THIN, "Constraints", 0, yco-=20, 120, 19, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiItemS(layout);
        
-       if (OBACT && OBACT->type == OB_MESH) {
+       uiItemMenuF(layout, "Parent", 0, view3d_edit_object_parentmenu);
+       uiItemMenuF(layout, "Track", 0, view3d_edit_object_trackmenu);
+       uiItemMenuF(layout, "Group", 0, view3d_edit_object_groupmenu);
+       uiItemMenuF(layout, "Constraints", 0, view3d_edit_object_constraintsmenu);
+
+#if 0
+       uiItemS(layout);
+
+       if(ob && ob->type == OB_MESH) {
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Boolean Operation...|W",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
        }
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Join Objects|Ctrl J",                            0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Object Type...|Alt C",                           0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+#endif
+
+       uiItemS(layout);
        
-       uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
+#if 0
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-       uiDefIconTextBlockBut(block, view3d_edit_object_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Objects", 0, yco-=20, 120, 19, "");
+#endif
+
+       uiItemMenuF(layout, "Show/Hide", 0, view3d_edit_object_showhidemenu);
        
+#if 0
 #ifndef DISABLE_PYTHON
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
 #endif
-               
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
-
-       uiTextBoundsBlock(block, 50);
-       return block;
+#endif
 }
 
-
 static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
        uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
@@ -4612,7 +4445,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
                }
                else {
                        xmax= GetButStringLength("Object");
-                       uiDefPulldownBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco, xmax-3, 20, "");
+                       uiDefMenuBut(block, view3d_edit_objectmenu, NULL, "Object",     xco,yco, xmax-3, 20, "");
                        xco+= xmax;
                }
        }
index 5c4b6a955240d624d43e0cb5c9ae4be67bd4e00a..cda1716f664c6cd619428c81dcf471c399bfd194 100644 (file)
 EnumPropertyItem constraint_type_items[] ={
        {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", 0, "Child Of", ""},
        {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", 0, "Transformation", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", 0, "Copy Location", ""},
        {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", 0, "Copy Rotation", ""},
        {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", 0, "Copy Scale", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", 0, "Limit Location", ""},
        {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", 0, "Limit Rotation", ""},
        {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", 0, "Limit Scale", ""},
        {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", 0, "Limit Distance", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", 0, "Track To", ""},
        {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", 0, "Locked Track", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_MINMAX, "FLOOR", 0, "Floor", ""},
        {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", 0, "Shrinkwrap", ""},
        {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", 0, "Follow Path", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", 0, "Clamp To", ""},
        {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", 0, "Stretch To", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_KINEMATIC, "IK", 0, "IK", ""},
        {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", 0, "Rigid Body Joint", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_ACTION, "ACTION", 0, "Action", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_PYTHON, "SCRIPT", 0, "Script", ""},
-       
+       {0, "", 0, NULL, NULL},
        {CONSTRAINT_TYPE_NULL, "NULL", 0, "Null", ""},
        {0, NULL, 0, NULL, NULL}};