minor cleanup & replace inline armature separate pchan searches with BLI_findstring(), no functional changes.

This commit is contained in:
Campbell Barton 2011-04-20 02:56:51 +00:00
parent 6931decd23
commit 33b8d53224
4 changed files with 28 additions and 69 deletions

@ -1416,8 +1416,7 @@ static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[],
/* if this IPO block doesn't have any users after this one, free... */
ipo->id.us--;
if ( (ipo->id.us == 0) || ((ipo->id.us == 1) && (ipo->id.flag & LIB_FAKEUSER)) )
{
if (ID_REAL_USERS(ipo) <= 0) {
IpoCurve *icn;
for (icu= ipo->curve.first; icu; icu= icn) {

@ -2271,7 +2271,7 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob)
workob->constraints.first = ob->constraints.first;
workob->constraints.last = ob->constraints.last;
strcpy(workob->parsubstr, ob->parsubstr);
BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
where_is_object(scene, workob);
}

@ -997,7 +997,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
static void separated_armature_fix_links(Object *origArm, Object *newArm)
{
Object *ob;
bPoseChannel *pchan, *pcha, *pchb;
bPoseChannel *pchan;
bConstraint *con;
ListBase *opchans, *npchans;
@ -1024,38 +1024,23 @@ static void separated_armature_fix_links(Object *origArm, Object *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) {
/* check if either one matches */
if ( (strcmp(pcha->name, ct->subtarget)==0) ||
(strcmp(pchb->name, ct->subtarget)==0) )
{
if (ct->subtarget[0] != 0) {
if (ct->tar == origArm) {
if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
break;
}
/* 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) )
{
}
else if (ct->tar == newArm) {
if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
}
}
}
if (cti->flush_constraint_targets)
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 0);
}
}
}
}
@ -1077,58 +1062,33 @@ static void separated_armature_fix_links(Object *origArm, Object *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) {
/* check if either one matches */
if ( (strcmp(pcha->name, ct->subtarget)==0) ||
(strcmp(pchb->name, ct->subtarget)==0) )
{
if(ct->subtarget[0] != '\0') {
if (ct->tar == origArm) {
if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
break;
}
/* 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) )
{
}
else if (ct->tar == newArm) {
if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
}
}
}
if (cti->flush_constraint_targets)
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 0);
}
}
}
}
/* See if an object is parented to this armature */
if ((ob->parent) && (ob->parent == origArm)) {
if (ob->parent && (ob->parent == origArm)) {
/* Is object parented to a bone of this src armature? */
if (ob->partype==PARBONE) {
/* bone name in object */
for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
/* check if either one matches */
if ( (strcmp(pcha->name, ob->parsubstr)==0) ||
(strcmp(pchb->name, ob->parsubstr)==0) )
{
ob->parent= newArm;
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
if ((ob->partype == PARBONE) && (ob->parsubstr[0] != '\0')) {
if(BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
ob->parent= newArm;
}
}
}

@ -156,7 +156,7 @@ KX_GameObject::~KX_GameObject()
}
#ifdef WITH_PYTHON
if (m_attr_dict) {
PyDict_Clear(m_attr_dict); /* incase of circular refs or other weired cases */
PyDict_Clear(m_attr_dict); /* incase of circular refs or other weird cases */
/* Py_CLEAR: Py_DECREF's and NULL's */
Py_CLEAR(m_attr_dict);
}