diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-08 19:34:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-08 19:34:41 +0400 |
commit | 5e749af4295ba3120cd882f6e35b49a80292915e (patch) | |
tree | 2b350597577eb619dd3192dc5250a7fbbb4fb6f0 /source/blender/editors/armature | |
parent | f3fd7d88002dcfe42e51738cbb7d2d2be756dd19 (diff) |
2.5: Various Fixes
* Context panel now draws without header, with arrows, no scene name.
* Softbody vertex group search popup.
* Improve names for autogenerated shortcut keys in menus.
* Make most Select menus in the 3D view header work.
* Fix armature border select selection syncing.
* Add POSE_OT_select_constraint_target,
MESH_OT_select_by_number_vertices, MESH_OT_select_vertex_path.
* Merge mesh select similar into one operator.
* Don't give MESH_OT_select_random Space hotkey.
* Add DAG_object_flush_update to many mesh edit tools, not calling this
will crash with modifiers.
* RNA_def_enum_funcs for dynamic enums in operators, but not very useful
without context yet.
* Fix refresh issue with image window header + editmode.
* Fix drawing of shadow mesh for image painting.
* Remove deprecated uiDefMenuButO and uiDefMenuSep functions.
* Remove keyval.c, code is in wm_keymap.c already.
* Rename WM_operator_redo to WM_operator_props_popup.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 28 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 71 |
4 files changed, 83 insertions, 22 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 646c75f50bf..19204710116 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -60,6 +60,7 @@ void POSE_OT_select_invert(struct wmOperatorType *ot); void POSE_OT_select_parent(struct wmOperatorType *ot); void POSE_OT_select_hierarchy(struct wmOperatorType *ot); void POSE_OT_select_linked(struct wmOperatorType *ot); +void POSE_OT_select_constraint_target(struct wmOperatorType *ot); void SKETCH_OT_gesture(struct wmOperatorType *ot); void SKETCH_OT_delete(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 5c31883834c..adbfb500eb0 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -153,6 +153,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSE_OT_select_parent); WM_operatortype_append(POSE_OT_select_hierarchy); WM_operatortype_append(POSE_OT_select_linked); + WM_operatortype_append(POSE_OT_select_constraint_target); /* POSELIB */ WM_operatortype_append(POSELIB_OT_browse_interactive); @@ -194,14 +195,12 @@ void ED_keymap_armature(wmWindowManager *wm) kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT); - RNA_boolean_set(kmi->ptr, "extend", 0); kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT); RNA_boolean_set(kmi->ptr, "extend", 1); kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD); - RNA_boolean_set(kmi->ptr, "extend", 0); kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD); RNA_boolean_set(kmi->ptr, "extend", 1); @@ -240,14 +239,12 @@ void ED_keymap_armature(wmWindowManager *wm) kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT); - RNA_boolean_set(kmi->ptr, "extend", 0); kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT); RNA_boolean_set(kmi->ptr, "extend", 1); kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD); - RNA_boolean_set(kmi->ptr, "extend", 0); kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD); RNA_boolean_set(kmi->ptr, "extend", 1); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 7155bdd6850..97bf3492f7c 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -110,7 +110,7 @@ static void adduplicate() {} /* **************** tools on Editmode Armature **************** */ /* Sync selection to parent for connected children */ -static void armature_sync_selection(ListBase *edbo) +void ED_armature_sync_selection(ListBase *edbo) { EditBone *ebo; @@ -1435,7 +1435,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); /* BIF_undo_push("Select connected"); */ @@ -1668,7 +1668,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op) } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT, obedit); @@ -1742,7 +1742,7 @@ void deselectall_armature(Object *obedit, int toggle, int doundo) } } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); if (doundo) { if (sel==1) BIF_undo_push("Select All"); else BIF_undo_push("Deselect All"); @@ -1814,7 +1814,7 @@ void mouse_armature(bContext *C, short mval[2], int extend) nearBone->flag |= selmask; } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); if(nearBone) { /* then now check for active status */ @@ -2246,7 +2246,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op) } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, obedit); @@ -2508,7 +2508,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) if (CTX_DATA_COUNT(C, selected_bones) == 0) return OPERATOR_CANCELLED; - armature_sync_selection(arm->edbo); // XXX why is this needed? + ED_armature_sync_selection(arm->edbo); // XXX why is this needed? preEditBoneDuplicate(arm->edbo); @@ -3058,7 +3058,7 @@ void merge_armature(Scene *scene) } /* undo + updates */ - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); BIF_undo_push("Merge Bones"); } @@ -3080,7 +3080,7 @@ void hide_selected_armature_bones(Scene *scene) } } } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); BIF_undo_push("Hide Bones"); } @@ -3100,7 +3100,7 @@ void hide_unselected_armature_bones(Scene *scene) } } } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); BIF_undo_push("Hide Unselected Bones"); } @@ -3118,7 +3118,7 @@ void show_all_armature_bones(Scene *scene) } } } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); BIF_undo_push("Reveal Bones"); } @@ -3251,7 +3251,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) if (totbone==0) return OPERATOR_CANCELLED; /* Transform the endpoints */ - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); return OPERATOR_FINISHED; } @@ -3812,7 +3812,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT, ob); @@ -3963,7 +3963,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op) } } - armature_sync_selection(arm->edbo); + ED_armature_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 281f314a546..4a7056274c6 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -443,6 +443,65 @@ void pose_select_constraint_target(Scene *scene) } +static int pose_select_constraint_target_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_active_object(C); + bArmature *arm= ob->data; + bPoseChannel *pchan; + bConstraint *con; + int found= 0; + + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if (arm->layer & pchan->bone->layer) { + if (pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) { + for (con= pchan->constraints.first; con; con= con->next) { + bConstraintTypeInfo *cti= constraint_get_typeinfo(con); + ListBase targets = {NULL, NULL}; + bConstraintTarget *ct; + + if (cti && cti->get_constraint_targets) { + cti->get_constraint_targets(con, &targets); + + for (ct= targets.first; ct; ct= ct->next) { + if ((ct->tar == ob) && (ct->subtarget[0])) { + bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget); + if(pchanc) { + pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; + found= 1; + } + } + } + + if (cti->flush_constraint_targets) + cti->flush_constraint_targets(con, &targets, 1); + } + } + } + } + } + + if(!found) + return OPERATOR_CANCELLED; + + WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); + + return OPERATOR_FINISHED; +} + +void POSE_OT_select_constraint_target(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Select Constraint Target"; + ot->idname= "POSE_OT_select_constraint_target"; + + /* api callbacks */ + ot->exec= pose_select_constraint_target_exec; + ot->poll= ED_operator_posemode; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ******************* select hierarchy operator ************* */ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) @@ -453,6 +512,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) Bone *curbone, *pabone, *chbone; int direction = RNA_enum_get(op->ptr, "direction"); int add_to_sel = RNA_boolean_get(op->ptr, "extend"); + int found= 0; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { curbone= pchan->bone; @@ -469,8 +529,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) if (!add_to_sel) curbone->flag &= ~BONE_SELECTED; curbone->flag &= ~BONE_ACTIVE; pabone->flag |= (BONE_ACTIVE|BONE_SELECTED); - - // XXX notifiers need to be sent to other editors to update + + found= 1; break; } } else { // BONE_SELECT_CHILD @@ -483,8 +543,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) if (!add_to_sel) curbone->flag &= ~BONE_SELECTED; curbone->flag &= ~BONE_ACTIVE; chbone->flag |= (BONE_ACTIVE|BONE_SELECTED); - - // XXX notifiers need to be sent to other editors to update + + found= 1; break; } } @@ -492,6 +552,9 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) } } + if(!found) + return OPERATOR_CANCELLED; + WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); return OPERATOR_FINISHED; |