diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-22 22:39:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-22 22:39:44 +0400 |
commit | af02a0aa4e0b80c3c1154e7be095f4a387f81179 (patch) | |
tree | 3f714e683c96929cc4e44962570860ab0f635bc9 /source/blender/editors/armature | |
parent | 643d59bb9bf3bdd46f41a0b8c79384146629f9c8 (diff) |
UI
* Headers and menus can now be created in python.
* Replaced the uiMenuItem functions to create menus with equivalent
uiItem functions using a layout, removing duplicated code.
* More uiItem functions are now exposed to python.
* The text editor header, panels and one of its menus are now created
in space_text.py.
* Buttons window data context icon new changes depending on active
object.
Issues
* Icons are not wrapped yet, hardcoded ints at the moment.
* The ID browse template is unfinished.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 19 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 32 |
2 files changed, 29 insertions, 22 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 80f51f3797c..ca0694a7ece 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -3460,11 +3460,13 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) static int armature_subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event) { - uiMenuItem *head; + uiPopupMenu *pup; + uiLayout *layout; - head= uiPupMenuBegin("Subdivision Type", 0); - uiMenuItemsEnumO(head, "ARMATURE_OT_subdivs", "type"); - uiPupMenuEnd(C, head); + pup= uiPupMenuBegin("Subdivision Type", 0); + layout= uiPupMenuLayout(pup); + uiItemsEnumO(layout, "ARMATURE_OT_subdivs", "type"); + uiPupMenuEnd(C, pup); return OPERATOR_CANCELLED; } @@ -3744,7 +3746,8 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) { EditBone *actbone = CTX_data_active_bone(C); - uiMenuItem *head= uiPupMenuBegin("Make Parent ", 0); + uiPopupMenu *pup= uiPupMenuBegin("Make Parent ", 0); + uiLayout *layout= uiPupMenuLayout(pup); int allchildbones = 0; CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { @@ -3754,13 +3757,13 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *even } CTX_DATA_END; - uiMenuItemEnumO(head, "", 0, "ARMATURE_OT_parent_set", "type", ARM_PAR_CONNECT); + uiItemEnumO(layout, NULL, 0, "ARMATURE_OT_parent_set", "type", ARM_PAR_CONNECT); /* ob becomes parent, make the associated menus */ if (allchildbones) - uiMenuItemEnumO(head, "", 0, "ARMATURE_OT_parent_set", "type", ARM_PAR_OFFSET); + uiItemEnumO(layout, NULL, 0, "ARMATURE_OT_parent_set", "type", ARM_PAR_OFFSET); - uiPupMenuEnd(C, head); + uiPupMenuEnd(C, pup); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index fc5b98b1690..9b4a9d63439 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -301,7 +301,7 @@ static void poselib_get_builtin_keyingsets (void) /* ----- */ -static void poselib_add_menu_invoke__replacemenu (bContext *C, uiMenuItem *head, void *arg) +static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg) { Object *ob= CTX_data_active_object(C); bAction *act= ob->poselib; @@ -309,7 +309,7 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiMenuItem *head, /* add each marker to this menu */ for (marker= act->markers.first; marker; marker= marker->next) - uiMenuItemIntO(head, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame); + uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame); } static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) @@ -318,29 +318,31 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) Object *ob= CTX_data_active_object(C); bArmature *arm= (ob) ? ob->data : NULL; bPose *pose= (ob) ? ob->pose : NULL; - uiMenuItem *head; + uiPopupMenu *pup; + uiLayout *layout; /* sanity check */ if (ELEM3(NULL, ob, arm, pose)) return OPERATOR_CANCELLED; /* start building */ - head= uiPupMenuBegin(op->type->name, 0); - uiMenuContext(head, WM_OP_EXEC_DEFAULT); + pup= uiPupMenuBegin(op->type->name, 0); + layout= uiPupMenuLayout(pup); + uiLayoutContext(layout, WM_OP_EXEC_DEFAULT); /* add new (adds to the first unoccupied frame) */ - uiMenuItemIntO(head, "Add New", 0, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); + uiItemIntO(layout, "Add New", 0, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); /* check if we have any choices to add a new pose in any other way */ if ((ob->poselib) && (ob->poselib->markers.first)) { /* add new (on current frame) */ - uiMenuItemIntO(head, "Add New (Current Frame)", 0, "POSELIB_OT_pose_add", "frame", CFRA); + uiItemIntO(layout, "Add New (Current Frame)", 0, "POSELIB_OT_pose_add", "frame", CFRA); /* replace existing - submenu */ - uiMenuLevel(head, "Replace Existing...", poselib_add_menu_invoke__replacemenu); + uiItemLevel(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu); } - uiPupMenuEnd(C, head); + uiPupMenuEnd(C, pup); /* this operator is only for a menu, not used further */ return OPERATOR_CANCELLED; @@ -449,7 +451,8 @@ static int poselib_stored_pose_menu_invoke (bContext *C, wmOperator *op, wmEvent Object *ob= CTX_data_active_object(C); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; - uiMenuItem *head; + uiPopupMenu *pup; + uiLayout *layout; int i; /* sanity check */ @@ -457,14 +460,15 @@ static int poselib_stored_pose_menu_invoke (bContext *C, wmOperator *op, wmEvent return OPERATOR_CANCELLED; /* start building */ - head= uiPupMenuBegin(op->type->name, 0); - uiMenuContext(head, WM_OP_EXEC_DEFAULT); + pup= uiPupMenuBegin(op->type->name, 0); + layout= uiPupMenuLayout(pup); + uiLayoutContext(layout, WM_OP_EXEC_DEFAULT); /* add each marker to this menu */ for (marker=act->markers.first, i=0; marker; marker= marker->next, i++) - uiMenuItemIntO(head, marker->name, ICON_ARMATURE_DATA, op->idname, "index", i); + uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, op->idname, "index", i); - uiPupMenuEnd(C, head); + uiPupMenuEnd(C, pup); /* this operator is only for a menu, not used further */ return OPERATOR_CANCELLED; |