[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46825] trunk/blender/source/blender/ blenloader/intern/readfile.c: readfile. c Style cleanups Part 2 - More whitespace + replaced most of the while
Joshua Leung
aligorith at gmail.com
Mon May 21 08:33:32 CEST 2012
Revision: 46825
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46825
Author: aligorith
Date: 2012-05-21 06:33:32 +0000 (Mon, 21 May 2012)
Log Message:
-----------
readfile.c Style cleanups Part 2 - More whitespace + replaced most of the while
loops
Modified Paths:
--------------
trunk/blender/source/blender/blenloader/intern/readfile.c
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2012-05-21 03:28:22 UTC (rev 46824)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2012-05-21 06:33:32 UTC (rev 46825)
@@ -1254,9 +1254,9 @@
fd->imamap = oldnewmap_new();
- for (;ima; ima = ima->id.next) {
+ for (; ima; ima = ima->id.next) {
Link *ibuf = ima->ibufs.first;
- for (; ibuf; ibuf= ibuf->next)
+ for (; ibuf; ibuf = ibuf->next)
oldnewmap_insert(fd->imamap, ibuf, ibuf, 0);
if (ima->gputexture)
oldnewmap_insert(fd->imamap, ima->gputexture, ima->gputexture, 0);
@@ -1264,7 +1264,7 @@
if (ima->renders[a])
oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
}
- for (; sce; sce= sce->id.next) {
+ for (; sce; sce = sce->id.next) {
if (sce->nodetree) {
bNode *node;
for (node = sce->nodetree->nodes.first; node; node = node->next)
@@ -1283,12 +1283,12 @@
int i;
/* used entries were restored, so we put them to zero */
- for ( i= 0; i < fd->imamap->nentries; i++, entry++) {
+ for (i = 0; i < fd->imamap->nentries; i++, entry++) {
if (entry->nr > 0)
entry->newp = NULL;
}
- for (; ima; ima= ima->id.next) {
+ for (; ima; ima = ima->id.next) {
Link *ibuf, *next;
/* this mirrors direct_link_image */
@@ -1321,7 +1321,7 @@
fd->movieclipmap = oldnewmap_new();
- for (;clip; clip= clip->id.next) {
+ for (; clip; clip = clip->id.next) {
if (clip->cache)
oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0);
@@ -1535,7 +1535,7 @@
prop->totallen = prop->len;
prop->data.pointer = newdataadr(fd, prop->data.pointer);
- array= (IDProperty*) prop->data.pointer;
+ array = (IDProperty *)prop->data.pointer;
/* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared
* theres not really anything we can do to correct this, at least don't crash */
@@ -1652,7 +1652,7 @@
/* flag seems to be able to hang? Maybe old files... not bad to clear anyway */
cumap->flag &= ~CUMA_PREMULLED;
- for (a=0; a<CM_TOT; a++) {
+ for (a = 0; a < CM_TOT; a++) {
cumap->cm[a].curve = newdataadr(fd, cumap->cm[a].curve);
cumap->cm[a].table = NULL;
cumap->cm[a].premultable = NULL;
@@ -1666,7 +1666,7 @@
Brush *brush;
/* only link ID pointers */
- for (brush= main->brush.first; brush; brush= brush->id.next) {
+ for (brush = main->brush.first; brush; brush = brush->id.next) {
if (brush->id.flag & LIB_NEEDLINK) {
brush->id.flag -= LIB_NEEDLINK;
@@ -1738,8 +1738,7 @@
{
Ipo *ipo;
- ipo = main->ipo.first;
- while (ipo) {
+ for (ipo = main->ipo.first; ipo; ipo = ipo->id.next) {
if (ipo->id.flag & LIB_NEEDLINK) {
IpoCurve *icu;
for (icu = ipo->curve.first; icu; icu = icu->next) {
@@ -1748,7 +1747,6 @@
}
ipo->id.flag -= LIB_NEEDLINK;
}
- ipo = ipo->id.next;
}
}
@@ -1758,12 +1756,11 @@
IpoCurve *icu;
link_list(fd, &(ipo->curve));
- icu = ipo->curve.first;
- while (icu) {
+
+ for (icu = ipo->curve.first; icu; icu = icu->next) {
icu->bezt = newdataadr(fd, icu->bezt);
icu->bp = newdataadr(fd, icu->bp);
icu->driver = newdataadr(fd, icu->driver);
- icu = icu->next;
}
}
@@ -1777,7 +1774,7 @@
strip->object = newlibadr(fd, id->lib, strip->object);
strip->act = newlibadr_us(fd, id->lib, strip->act);
strip->ipo = newlibadr(fd, id->lib, strip->ipo);
- for (amod= strip->modifiers.first; amod; amod= amod->next)
+ for (amod = strip->modifiers.first; amod; amod = amod->next)
amod->ob = newlibadr(fd, id->lib, amod->ob);
}
}
@@ -1789,7 +1786,7 @@
link_list(fd, strips);
- for (strip= strips->first; strip; strip= strip->next)
+ for (strip = strips->first; strip; strip = strip->next)
link_list(fd, &strip->modifiers);
}
@@ -1951,7 +1948,7 @@
bAction *act;
bActionChannel *chan;
- for (act= main->action.first; act; act= act->id.next) {
+ for (act = main->action.first; act; act = act->id.next) {
if (act->id.flag & LIB_NEEDLINK) {
act->id.flag -= LIB_NEEDLINK;
@@ -2168,7 +2165,7 @@
ntree->gpd = newlibadr_us(fd, id->lib, ntree->gpd);
- for (node= ntree->nodes.first; node; node= node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->id = newlibadr_us(fd, id->lib, node->id);
}
@@ -2178,7 +2175,7 @@
bNodeTree *ntree;
/* only link ID pointers */
- for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+ for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
if (ntree->id.flag & LIB_NEEDLINK) {
ntree->id.flag -= LIB_NEEDLINK;
lib_link_ntree(fd, &ntree->id, ntree);
@@ -2196,24 +2193,24 @@
return;
switch (sock->type) {
- case SOCK_FLOAT:
- valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value");
- valfloat->value = sock->ns.vec[0];
- valfloat->min = sock->ns.min;
- valfloat->max = sock->ns.max;
- valfloat->subtype = PROP_NONE;
- break;
- case SOCK_VECTOR:
- valvector = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueVector), "default socket value");
- copy_v3_v3(valvector->value, sock->ns.vec);
- valvector->min = sock->ns.min;
- valvector->max = sock->ns.max;
- valvector->subtype = PROP_NONE;
- break;
- case SOCK_RGBA:
- valrgba = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueRGBA), "default socket value");
- copy_v4_v4(valrgba->value, sock->ns.vec);
- break;
+ case SOCK_FLOAT:
+ valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value");
+ valfloat->value = sock->ns.vec[0];
+ valfloat->min = sock->ns.min;
+ valfloat->max = sock->ns.max;
+ valfloat->subtype = PROP_NONE;
+ break;
+ case SOCK_VECTOR:
+ valvector = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueVector), "default socket value");
+ copy_v3_v3(valvector->value, sock->ns.vec);
+ valvector->min = sock->ns.min;
+ valvector->max = sock->ns.max;
+ valvector->subtype = PROP_NONE;
+ break;
+ case SOCK_RGBA:
+ valrgba = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueRGBA), "default socket value");
+ copy_v4_v4(valrgba->value, sock->ns.vec);
+ break;
}
}
@@ -2351,7 +2348,7 @@
}
}
- for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next)
ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE;
}
@@ -2420,7 +2417,7 @@
if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
direct_link_curvemapping(fd, node->storage);
else if (ntree->type==NTREE_COMPOSIT) {
- if ( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+ if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
direct_link_curvemapping(fd, node->storage);
else if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
((ImageUser *)node->storage)->ok = 1;
@@ -2565,7 +2562,7 @@
/* always rebuild to match proxy or lib changes */
- rebuild= ob->proxy || (ob->id.lib==NULL && arm->id.lib);
+ rebuild = ob->proxy || (ob->id.lib==NULL && arm->id.lib);
if (ob->proxy) {
/* sync proxy layer */
@@ -2606,14 +2603,11 @@
{
bArmature *arm;
- arm = main->armature.first;
-
- while (arm) {
+ for (arm = main->armature.first; arm; arm = arm->id.next) {
if (arm->id.flag & LIB_NEEDLINK) {
if (arm->adt) lib_link_animdata(fd, &arm->id, arm->adt);
arm->id.flag -= LIB_NEEDLINK;
}
- arm = arm->id.next;
}
}
@@ -2645,10 +2639,8 @@
arm->adt = newdataadr(fd, arm->adt);
direct_link_animdata(fd, arm->adt);
- bone = arm->bonebase.first;
- while (bone) {
+ for (bone = arm->bonebase.first; bone; bone = bone->next) {
direct_link_bones(fd, bone);
- bone=bone->next;
}
arm->act_bone = newdataadr(fd, arm->act_bone);
@@ -2661,8 +2653,7 @@
{
Camera *ca;
- ca = main->camera.first;
- while (ca) {
+ for (ca = main->camera.first; ca; ca = ca->id.next) {
if (ca->id.flag & LIB_NEEDLINK) {
if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt);
@@ -2672,7 +2663,6 @@
ca->id.flag -= LIB_NEEDLINK;
}
- ca = ca->id.next;
}
}
@@ -2691,8 +2681,7 @@
MTex *mtex;
int a;
- la = main->lamp.first;
- while (la) {
+ for (la = main->lamp.first; la; la = la->id.next) {
if (la->id.flag & LIB_NEEDLINK) {
if (la->adt) lib_link_animdata(fd, &la->id, la->adt);
@@ -2711,7 +2700,6 @@
la->id.flag -= LIB_NEEDLINK;
}
- la = la->id.next;
}
}
@@ -2743,8 +2731,7 @@
{
Key *key;
- key = main->key.first;
- while (key) {
+ for (key = main->key.first; key; key = key->id.next) {
/*check if we need to generate unique ids for the shapekeys*/
if (!key->uidgen) {
KeyBlock *block;
@@ -2763,7 +2750,6 @@
key->id.flag -= LIB_NEEDLINK;
}
- key = key->id.next;
}
}
@@ -2810,14 +2796,11 @@
key->refkey= newdataadr(fd, key->refkey);
- kb = key->block.first;
- while (kb) {
+ for (kb = key->block.first; kb; kb = kb->next) {
kb->data = newdataadr(fd, kb->data);
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN)
switch_endian_keyblock(key, kb);
-
- kb = kb->next;
}
}
@@ -2828,8 +2811,7 @@
MetaBall *mb;
int a;
- mb = main->mball.first;
- while (mb) {
+ for (mb = main->mball.first; mb; mb = mb->id.next) {
if (mb->id.flag & LIB_NEEDLINK) {
if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt);
@@ -2840,7 +2822,6 @@
mb->id.flag -= LIB_NEEDLINK;
}
- mb = mb->id.next;
}
}
@@ -2869,8 +2850,7 @@
MTex *mtex;
int a;
- wrld = main->world.first;
- while (wrld) {
+ for (wrld = main->world.first; wrld; wrld = wrld->id.next) {
if (wrld->id.flag & LIB_NEEDLINK) {
if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt);
@@ -2879,8 +2859,8 @@
for (a=0; a < MAX_MTEX; a++) {
mtex = wrld->mtex[a];
if (mtex) {
- mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex);
- mtex->object= newlibadr(fd, wrld->id.lib, mtex->object);
+ mtex->tex = newlibadr_us(fd, wrld->id.lib, mtex->tex);
+ mtex->object = newlibadr(fd, wrld->id.lib, mtex->object);
}
}
@@ -2889,7 +2869,6 @@
wrld->id.flag -= LIB_NEEDLINK;
}
- wrld = wrld->id.next;
}
}
@@ -2897,14 +2876,14 @@
{
int a;
- wrld->adt= newdataadr(fd, wrld->adt);
+ wrld->adt = newdataadr(fd, wrld->adt);
direct_link_animdata(fd, wrld->adt);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list