diff options
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_ops.c | 32 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 73 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 2 |
3 files changed, 31 insertions, 76 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 2bf414ef969..3a7ad8fc5ec 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -214,6 +214,22 @@ void ED_keymap_armature(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Armature", 0, 0); keymap->poll= ED_operator_editarmature; + /* Armature -> Etch-A-Ton ------------------------ */ + WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", SELECTMOUSE, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); + + /* sketch poll checks mode */ + WM_keymap_add_item(keymap, "SKETCH_OT_gesture", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "snap", 1); + WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0); + kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "snap", 1); + /* only set in editmode armature, by space_view3d listener */ // WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_align", AKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); @@ -278,22 +294,6 @@ void ED_keymap_armature(wmKeyConfig *keyconf) /* 2) set roll */ kmi= WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL); - - /* Armature -> Etch-A-Ton ------------------------ */ - WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", SELECTMOUSE, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - - /* sketch poll checks mode */ - WM_keymap_add_item(keymap, "SKETCH_OT_gesture", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "snap", 1); - WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0); - kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "snap", 1); /* Pose ------------------------ */ /* only set in posemode, by space_view3d listener */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 0343fea5bfb..f379ff6c395 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -55,6 +55,7 @@ #include "BLI_editVert.h" #include "BLI_ghash.h" +#include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_constraint.h" @@ -5036,11 +5037,11 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op) /* Set the flags */ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pchans) { - /* select pchan, only if selectable */ - if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) { - if (sel==0) pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE); - else pchan->bone->flag |= BONE_SELECTED; - } + /* select pchan only if selectable, but deselect works always */ + if (sel==0) + pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE); + else if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) + pchan->bone->flag |= BONE_SELECTED; } CTX_DATA_END; @@ -5289,9 +5290,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) /* now check if we're in editmode, we need to find the unique name */ if (arm->edbo) { - EditBone *eBone; + EditBone *eBone= editbone_name_exists(arm->edbo, oldname); - eBone= editbone_name_exists(arm->edbo, oldname); if (eBone) { unique_editbone_name(arm->edbo, newname, NULL); BLI_strncpy(eBone->name, newname, MAXBONENAME); @@ -5302,7 +5302,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) Bone *bone= get_named_bone(arm, oldname); if (bone) { - unique_bone_name (arm, newname); + unique_bone_name(arm, newname); BLI_strncpy(bone->name, newname, MAXBONENAME); } else return; @@ -5313,21 +5313,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) /* we have the object using the armature */ if (arm==ob->data) { Object *cob; - //bAction *act; - //bActionChannel *achan; - //bActionStrip *strip; - /* Rename action channel if necessary */ -#if 0 // XXX old animation system - act = ob->action; - if (act && !act->id.lib) { - /* Find the appropriate channel */ - achan= get_action_channel(act, oldname); - if (achan) - BLI_strncpy(achan->name, newname, MAXBONENAME); - } -#endif // XXX old animation system - /* Rename the pose channel, if it exists */ if (ob->pose) { bPoseChannel *pchan = get_pose_channel(ob->pose, oldname); @@ -5335,20 +5321,6 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) BLI_strncpy(pchan->name, newname, MAXBONENAME); } - /* check all nla-strips too */ -#if 0 // XXX old animation system - for (strip= ob->nlastrips.first; strip; strip= strip->next) { - /* Rename action channel if necessary */ - act = strip->act; - if (act && !act->id.lib) { - /* Find the appropriate channel */ - achan= get_action_channel(act, oldname); - if (achan) - BLI_strncpy(achan->name, newname, MAXBONENAME); - } - } -#endif // XXX old animation system - /* Update any object constraints to use the new bone name */ for (cob= G.main->object.first; cob; cob= cob->id.next) { if (cob->constraints.first) @@ -5379,31 +5351,14 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) BLI_strncpy(dg->name, newname, MAXBONENAME); } } - } - - /* do entire db - ipo's for the drivers */ -#if 0 // XXX old animation system - for (ipo= G.main->ipo.first; ipo; ipo= ipo->id.next) { - IpoCurve *icu; - /* check each curve's driver */ - for (icu= ipo->curve.first; icu; icu= icu->next) { - IpoDriver *icd= icu->driver; - - if ((icd) && (icd->ob)) { - ob= icd->ob; - - if (icu->driver->type == IPO_DRIVER_TYPE_NORMAL) { - if (!strcmp(oldname, icd->name)) - BLI_strncpy(icd->name, newname, MAXBONENAME); - } - else { - /* TODO: pydrivers need to be treated differently */ - } - } - } + /* Fix animation data attached to this object */ + // TODO: should we be using the database wide version instead (since drivers may break) + if (ob->adt) { + /* posechannels only... */ + BKE_animdata_fix_paths_rename(&ob->id, ob->adt, "pose.pose_channels", oldname, newname); + } } -#endif // XXX old animation system } } diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 57fe083b319..331bd6fa28f 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1154,7 +1154,7 @@ void pose_adds_vgroups(Scene *scene, Object *meshobj, int heatweights) return; } -// XXX add_verts_to_dgroups(meshobj, poseobj, heatweights, (Gwp.flag & VP_MIRROR_X)); +// XXX add_verts_to_dgroups(meshobj, poseobj, heatweights, ((Mesh *)(meshobj->data))->editflag & ME_EDIT_MIRROR_X); if(heatweights) BIF_undo_push("Apply Bone Heat Weights to Vertex Groups"); |