[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36231] trunk/blender/source: minor cleanup & replace inline armature separate pchan searches with BLI_findstring (), no functional changes.
Campbell Barton
ideasman42 at gmail.com
Wed Apr 20 04:56:52 CEST 2011
Revision: 36231
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36231
Author: campbellbarton
Date: 2011-04-20 02:56:51 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
minor cleanup & replace inline armature separate pchan searches with BLI_findstring(), no functional changes.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/ipo.c
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/editors/armature/editarmature.c
trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
Modified: trunk/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ipo.c 2011-04-20 01:21:55 UTC (rev 36230)
+++ trunk/blender/source/blender/blenkernel/intern/ipo.c 2011-04-20 02:56:51 UTC (rev 36231)
@@ -1416,8 +1416,7 @@
/* 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) {
Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c 2011-04-20 01:21:55 UTC (rev 36230)
+++ trunk/blender/source/blender/blenkernel/intern/object.c 2011-04-20 02:56:51 UTC (rev 36231)
@@ -2271,7 +2271,7 @@
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);
}
Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c 2011-04-20 01:21:55 UTC (rev 36230)
+++ trunk/blender/source/blender/editors/armature/editarmature.c 2011-04-20 02:56:51 UTC (rev 36231)
@@ -997,7 +997,7 @@
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 @@
* - 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 @@
* - 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;
}
}
}
Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2011-04-20 01:21:55 UTC (rev 36230)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2011-04-20 02:56:51 UTC (rev 36231)
@@ -156,7 +156,7 @@
}
#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);
}
More information about the Bf-blender-cvs
mailing list