Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/armature/editarmature.c')
-rw-r--r--source/blender/editors/armature/editarmature.c73
1 files changed, 14 insertions, 59 deletions
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
}
}