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:
authorJoshua Leung <aligorith@gmail.com>2008-05-12 08:25:53 +0400
committerJoshua Leung <aligorith@gmail.com>2008-05-12 08:25:53 +0400
commit3fd357196439798a2663acf7018c1974770ac26f (patch)
tree929f881d360a538d0fce5e77240262f0bc3661a2 /source/blender/src/editarmature.c
parente9706d6f0d630606e06609b82e5e9450d4e419cc (diff)
Bugfix for Separate Armatures:
Constraint relinking now works correctly for this tool, so it should be safe to be used by users now.
Diffstat (limited to 'source/blender/src/editarmature.c')
-rw-r--r--source/blender/src/editarmature.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index f87eb321fc8..d0be862c052 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -661,9 +661,10 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
Object *ob;
bPoseChannel *pchan, *pcha, *pchb;
bConstraint *con;
- ListBase *npchans;
+ ListBase *opchans, *npchans;
- /* get reference to list of bones in new armature */
+ /* get reference to list of bones in original and new armatures */
+ opchans= &origArm->pose->chanbase;
npchans= &newArm->pose->chanbase;
/* let's go through all objects in database */
@@ -682,8 +683,8 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
for (ct= targets.first; ct; ct= ct->next) {
/* any targets which point to original armature are redirected to the new one only if:
- * - the target isn't the original armature itself
- * - the target is one that can be found in newArm
+ * - the target isn't origArm/newArm itself
+ * - the target is one that can be found in newArm/origArm
*/
if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) {
for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
@@ -699,6 +700,20 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
if (pcha == pchb) break;
}
}
+ else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) {
+ for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
+ /* check if either one matches */
+ if ( (strcmp(pcha->name, ct->subtarget)==0) ||
+ (strcmp(pchb->name, ct->subtarget)==0) )
+ {
+ ct->tar= origArm;
+ break;
+ }
+
+ /* check if both ends have met (to stop checking) */
+ if (pcha == pchb) break;
+ }
+ }
}
if (cti->flush_constraint_targets)
@@ -721,8 +736,8 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
for (ct= targets.first; ct; ct= ct->next) {
/* any targets which point to original armature are redirected to the new one only if:
- * - the target isn't the original armature itself
- * - the target is one of the bones which were moved into newArm
+ * - the target isn't origArm/newArm itself
+ * - the target is one that can be found in newArm/origArm
*/
if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) {
for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
@@ -736,7 +751,21 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
- }
+ }
+ }
+ else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) {
+ for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
+ /* check if either one matches */
+ if ( (strcmp(pcha->name, ct->subtarget)==0) ||
+ (strcmp(pchb->name, ct->subtarget)==0) )
+ {
+ ct->tar= origArm;
+ break;
+ }
+
+ /* check if both ends have met (to stop checking) */
+ if (pcha == pchb) break;
+ }
}
}
@@ -829,12 +858,6 @@ void separate_armature (void)
Base *base, *oldbase, *newbase;
bArmature *arm;
- // 31 Mar 08 \ 11 May 08 - Aligorith:
- // currently, this is still too unstable to be enabled for general consumption.
- // remove the following two lines to test this tool... you have been warned!
- // okee("Not implemented (WIP)");
- // return;
-
if ( G.vd==0 || (G.vd->lay & G.obedit->lay)==0 ) return;
if ( okee("Separate")==0 ) return;