diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-20 06:56:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-20 06:56:51 +0400 |
commit | 33b8d53224071f1b491b18cec77461797e28ce71 (patch) | |
tree | ec7b07245d40d78be7c185b2be4b99ac4028c42b /source | |
parent | 6931decd23cd298e26e0599f828158ddf0d6bacb (diff) |
minor cleanup & replace inline armature separate pchan searches with BLI_findstring(), no functional changes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 90 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 2 |
4 files changed, 28 insertions, 69 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 7f8f9b5bb4b..4f921f005f4 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -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) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 74f66837b44..488ede5c072 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -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); } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 76a6cd8c998..b81b6a79c32 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -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; } } } diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 85d09d9f5d5..d8bc7510c7b 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -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); } |