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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
commit3b711a6ed009b35bb69cd0ca878eeb8d55fa0e77 (patch)
treeb3fdb366cb49bdea5b57dfa6ba4a82635c68d0ee /source/blender/blenloader/intern/writefile.c
parenta2ebfc82dbe954acc432ae017ac62a30a11b6a16 (diff)
parente99a23fc6b33b5097eab44aac19c2a089ddebce6 (diff)
Merged changes in the trunk up to revision 45133.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/blenloader/intern/writefile.c source/blender/bmesh/intern/bmesh_construct.c source/blender/bmesh/intern/bmesh_mesh_conv.c source/blender/bmesh/intern/bmesh_mesh_conv.h source/blender/editors/interface/interface_templates.c source/blender/editors/interface/resources.c source/blender/editors/mesh/bmesh_select.c source/blender/editors/mesh/bmesh_tools.c source/blender/editors/space_view3d/drawobject.c source/blender/render/intern/source/shadeoutput.c
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r--source/blender/blenloader/intern/writefile.c547
1 files changed, 276 insertions, 271 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index d7ecd9eac44..c1eab70a3ee 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -136,6 +136,7 @@ Any case: direct data is ALWAYS after the lib block
#include "DNA_movieclip_types.h"
#include "MEM_guardedalloc.h" // MEM_freeN
+#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_bpath.h"
@@ -210,7 +211,7 @@ static void writedata_do_write(WriteData *wd, void *mem, int memlen)
if (wd->error) return;
/* memory based save */
- if(wd->current) {
+ if (wd->current) {
add_memfilechunk(NULL, wd->current, mem, memlen);
}
else {
@@ -244,8 +245,8 @@ static void mywrite( WriteData *wd, void *adr, int len)
if (wd->error) return;
/* flush helps compression for undo-save */
- if(adr==MYWRITE_FLUSH) {
- if(wd->count) {
+ if (adr==MYWRITE_FLUSH) {
+ if (wd->count) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -256,8 +257,8 @@ static void mywrite( WriteData *wd, void *adr, int len)
/* if we have a single big chunk, write existing data in
* buffer and write out big chunk in smaller pieces */
- if(len>MYWRITE_MAX_CHUNK) {
- if(wd->count) {
+ if (len>MYWRITE_MAX_CHUNK) {
+ if (wd->count) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -267,13 +268,13 @@ static void mywrite( WriteData *wd, void *adr, int len)
writedata_do_write(wd, adr, writelen);
adr = (char*)adr + writelen;
len -= writelen;
- } while(len > 0);
+ } while (len > 0);
return;
}
/* if data would overflow buffer, write out the buffer */
- if(len+wd->count>MYWRITE_BUFFER_SIZE-1) {
+ if (len+wd->count>MYWRITE_BUFFER_SIZE-1) {
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
@@ -332,7 +333,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
BHead bh;
short *sp;
- if(adr==NULL || nr==0) return;
+ if (adr==NULL || nr==0) return;
/* init BHead */
bh.code= filecode;
@@ -340,7 +341,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
bh.nr= nr;
bh.SDNAnr= DNA_struct_find_nr(wd->sdna, structname);
- if(bh.SDNAnr== -1) {
+ if (bh.SDNAnr== -1) {
printf("error: can't find SDNA code <%s>\n", structname);
return;
}
@@ -348,7 +349,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
bh.len= nr*wd->sdna->typelens[sp[0]];
- if(bh.len==0) return;
+ if (bh.len==0) return;
mywrite(wd, &bh, sizeof(BHead));
mywrite(wd, adr, bh.len);
@@ -358,8 +359,8 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
{
BHead bh;
- if(adr==NULL) return;
- if(len==0) return;
+ if (adr==NULL) return;
+ if (len==0) return;
len+= 3;
len-= ( len % 4);
@@ -372,7 +373,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
bh.len= len;
mywrite(wd, &bh, sizeof(BHead));
- if(len) mywrite(wd, adr, len);
+ if (len) mywrite(wd, adr, len);
}
/* *************** writing some direct data structs used in more code parts **************** */
@@ -386,11 +387,11 @@ static void IDP_WriteArray(IDProperty *prop, void *wd)
if (prop->data.pointer) {
writedata(wd, DATA, MEM_allocN_len(prop->data.pointer), prop->data.pointer);
- if(prop->subtype == IDP_GROUP) {
+ if (prop->subtype == IDP_GROUP) {
IDProperty **array= prop->data.pointer;
int a;
- for(a=0; a<prop->len; a++)
+ for (a=0; a<prop->len; a++)
IDP_WriteProperty(array[a], wd);
}
}
@@ -405,7 +406,7 @@ static void IDP_WriteIDPArray(IDProperty *prop, void *wd)
writestruct(wd, DATA, "IDProperty", prop->len, array);
- for(a=0; a<prop->len; a++)
+ for (a=0; a<prop->len; a++)
IDP_WriteProperty_OnlyData(&array[a], wd);
}
}
@@ -548,7 +549,7 @@ static void write_actions(WriteData *wd, ListBase *idbase)
bActionGroup *grp;
TimeMarker *marker;
- for(act=idbase->first; act; act= act->id.next) {
+ for (act=idbase->first; act; act= act->id.next) {
if (act->id.us>0 || wd->current) {
writestruct(wd, ID_AC, "bAction", 1, act);
if (act->id.properties) IDP_WriteProperty(act->id.properties, wd);
@@ -649,7 +650,7 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
int a;
writestruct(wd, DATA, "CurveMapping", 1, cumap);
- for(a=0; a<CM_TOT; a++)
+ for (a=0; a<CM_TOT; a++)
writestruct(wd, DATA, "CurveMapPoint", cumap->cm[a].totpoint, cumap->cm[a].curve);
}
@@ -660,7 +661,7 @@ static void write_node_socket(WriteData *wd, bNodeSocket *sock)
/* forward compatibility code, so older blenders still open */
sock->stack_type = 1;
- if(sock->default_value) {
+ if (sock->default_value) {
bNodeSocketValueFloat *valfloat;
bNodeSocketValueVector *valvector;
bNodeSocketValueRGBA *valrgba;
@@ -702,27 +703,27 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
/* for link_list() speed, we write per list */
- if(ntree->adt) write_animdata(wd, ntree->adt);
+ if (ntree->adt) write_animdata(wd, ntree->adt);
- for(node= ntree->nodes.first; node; node= node->next)
+ for (node= ntree->nodes.first; node; node= node->next)
writestruct(wd, DATA, "bNode", 1, node);
- for(node= ntree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next)
+ for (node= ntree->nodes.first; node; node= node->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- for(sock= node->outputs.first; sock; sock= sock->next)
+ for (sock= node->outputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- if(node->storage && node->type!=NODE_DYNAMIC) {
+ if (node->storage && node->type!=NODE_DYNAMIC) {
/* could be handlerized at some point, now only 1 exception still */
- if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
+ if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+ else if (ntree->type==NTREE_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
+ else if (ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
write_curvemapping(wd, node->storage);
- else if(ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
+ else if (ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
/* pass */;
else
writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
@@ -735,13 +736,13 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
}
}
- for(link= ntree->links.first; link; link= link->next)
+ for (link= ntree->links.first; link; link= link->next)
writestruct(wd, DATA, "bNodeLink", 1, link);
/* external sockets */
- for(sock= ntree->inputs.first; sock; sock= sock->next)
+ for (sock= ntree->inputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
- for(sock= ntree->outputs.first; sock; sock= sock->next)
+ for (sock= ntree->outputs.first; sock; sock= sock->next)
write_node_socket(wd, sock);
}
@@ -766,8 +767,8 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) /* for renderdeamon
/* XXX in future, handle multiple windows with multiple screnes? */
current_screen_compat(mainvar, &curscreen);
- for(sce= mainvar->scene.first; sce; sce= sce->id.next) {
- if(sce->id.lib==NULL && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
+ for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
+ if (sce->id.lib==NULL && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
data[0]= sce->r.sfra;
data[1]= sce->r.efra;
@@ -782,7 +783,7 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) /* for renderdeamon
static void write_keymapitem(WriteData *wd, wmKeyMapItem *kmi)
{
writestruct(wd, DATA, "wmKeyMapItem", 1, kmi);
- if(kmi->properties)
+ if (kmi->properties)
IDP_WriteProperty(kmi->properties, wd);
}
@@ -797,28 +798,28 @@ static void write_userdef(WriteData *wd)
writestruct(wd, USER, "UserDef", 1, &U);
- for(btheme= U.themes.first; btheme; btheme=btheme->next)
+ for (btheme= U.themes.first; btheme; btheme=btheme->next)
writestruct(wd, DATA, "bTheme", 1, btheme);
- for(keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
+ for (keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
writestruct(wd, DATA, "wmKeyMap", 1, keymap);
- for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+ for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
writestruct(wd, DATA, "wmKeyMapDiffItem", 1, kmdi);
- if(kmdi->remove_item)
+ if (kmdi->remove_item)
write_keymapitem(wd, kmdi->remove_item);
- if(kmdi->add_item)
+ if (kmdi->add_item)
write_keymapitem(wd, kmdi->add_item);
}
- for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+ for (kmi=keymap->items.first; kmi; kmi=kmi->next)
write_keymapitem(wd, kmi);
}
- for(bext= U.addons.first; bext; bext=bext->next)
+ for (bext= U.addons.first; bext; bext=bext->next)
writestruct(wd, DATA, "bAddon", 1, bext);
- for(style= U.uistyles.first; style; style= style->next) {
+ for (style= U.uistyles.first; style; style= style->next) {
writestruct(wd, DATA, "uiStyle", 1, style);
}
}
@@ -830,7 +831,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
writestruct(wd, DATA, "BoidState", 1, state);
- for(; rule; rule=rule->next) {
+ for (; rule; rule=rule->next) {
switch(rule->type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
@@ -853,7 +854,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
break;
}
}
- //for(; cond; cond=cond->next)
+ //for (; cond; cond=cond->next)
// writestruct(wd, DATA, "BoidCondition", 1, cond);
}
@@ -877,28 +878,28 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
PointCache *cache = ptcaches->first;
int i;
- for(; cache; cache=cache->next) {
+ for (; cache; cache=cache->next) {
writestruct(wd, DATA, "PointCache", 1, cache);
- if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+ if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
PTCacheMem *pm = cache->mem_cache.first;
- for(; pm; pm=pm->next) {
+ for (; pm; pm=pm->next) {
PTCacheExtra *extra = pm->extradata.first;
writestruct(wd, DATA, "PTCacheMem", 1, pm);
- for(i=0; i<BPHYS_TOT_DATA; i++) {
- if(pm->data[i] && pm->data_types & (1<<i)) {
- if(ptcache_data_struct[i][0]=='\0')
+ for (i=0; i<BPHYS_TOT_DATA; i++) {
+ if (pm->data[i] && pm->data_types & (1<<i)) {
+ if (ptcache_data_struct[i][0]=='\0')
writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]);
else
writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]);
}
}
- for(; extra; extra=extra->next) {
- if(ptcache_extra_struct[extra->type][0]=='\0')
+ for (; extra; extra=extra->next) {
+ if (ptcache_extra_struct[extra->type][0]=='\0')
continue;
writestruct(wd, DATA, "PTCacheExtra", 1, extra);
writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data);
@@ -915,8 +916,8 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
int a;
part= idbase->first;
- while(part) {
- if(part->id.us>0 || wd->current) {
+ while (part) {
+ if (part->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_PA, "ParticleSettings", 1, part);
if (part->id.properties) IDP_WriteProperty(part->id.properties, wd);
@@ -926,12 +927,12 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
dw = part->dupliweights.first;
- for(; dw; dw=dw->next) {
+ for (; dw; dw=dw->next) {
/* update indices */
dw->index = 0;
- if(part->dup_group) { /* can be NULL if lining fails or set to None */
+ if (part->dup_group) { /* can be NULL if lining fails or set to None */
go = part->dup_group->gobject.first;
- while(go && go->ob != dw->ob) {
+ while (go && go->ob != dw->ob) {
go=go->next;
dw->index++;
}
@@ -939,20 +940,20 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
}
- if(part->boids && part->phystype == PART_PHYS_BOIDS) {
+ if (part->boids && part->phystype == PART_PHYS_BOIDS) {
BoidState *state = part->boids->states.first;
writestruct(wd, DATA, "BoidSettings", 1, part->boids);
- for(; state; state=state->next)
+ for (; state; state=state->next)
write_boid_state(wd, state);
}
- if(part->fluid && part->phystype == PART_PHYS_FLUID){
+ if (part->fluid && part->phystype == PART_PHYS_FLUID) {
writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid);
}
- for(a=0; a<MAX_MTEX; a++) {
- if(part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
}
}
part= part->id.next;
@@ -964,32 +965,32 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
ParticleTarget *pt;
int a;
- for(; psys; psys=psys->next) {
+ for (; psys; psys=psys->next) {
writestruct(wd, DATA, "ParticleSystem", 1, psys);
- if(psys->particles) {
+ if (psys->particles) {
writestruct(wd, DATA, "ParticleData", psys->totpart ,psys->particles);
- if(psys->particles->hair) {
+ if (psys->particles->hair) {
ParticleData *pa = psys->particles;
- for(a=0; a<psys->totpart; a++, pa++)
+ for (a=0; a<psys->totpart; a++, pa++)
writestruct(wd, DATA, "HairKey", pa->totkey, pa->hair);
}
- if(psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
+ if (psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
writestruct(wd, DATA, "BoidParticle", psys->totpart, psys->particles->boid);
- if(psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
+ if (psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
writestruct(wd, DATA, "ParticleSpring", psys->tot_fluidsprings, psys->fluid_springs);
}
pt = psys->targets.first;
- for(; pt; pt=pt->next)
+ for (; pt; pt=pt->next)
writestruct(wd, DATA, "ParticleTarget", 1, pt);
- if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
+ if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
- if(psys->clmd) {
+ if (psys->clmd) {
writestruct(wd, DATA, "ClothModifierData", 1, psys->clmd);
writestruct(wd, DATA, "ClothSimSettings", 1, psys->clmd->sim_parms);
writestruct(wd, DATA, "ClothCollSettings", 1, psys->clmd->coll_parms);
@@ -1004,10 +1005,10 @@ static void write_properties(WriteData *wd, ListBase *lb)
bProperty *prop;
prop= lb->first;
- while(prop) {
+ while (prop) {
writestruct(wd, DATA, "bProperty", 1, prop);
- if(prop->poin && prop->poin != &prop->data)
+ if (prop->poin && prop->poin != &prop->data)
writedata(wd, DATA, MEM_allocN_len(prop->poin), prop->poin);
prop= prop->next;
@@ -1019,7 +1020,7 @@ static void write_sensors(WriteData *wd, ListBase *lb)
bSensor *sens;
sens= lb->first;
- while(sens) {
+ while (sens) {
writestruct(wd, DATA, "bSensor", 1, sens);
writedata(wd, DATA, sizeof(void *)*sens->totlinks, sens->links);
@@ -1080,7 +1081,7 @@ static void write_controllers(WriteData *wd, ListBase *lb)
bController *cont;
cont= lb->first;
- while(cont) {
+ while (cont) {
writestruct(wd, DATA, "bController", 1, cont);
writedata(wd, DATA, sizeof(void *)*cont->totlinks, cont->links);
@@ -1105,7 +1106,7 @@ static void write_actuators(WriteData *wd, ListBase *lb)
bActuator *act;
act= lb->first;
- while(act) {
+ while (act) {
writestruct(wd, DATA, "bActuator", 1, act);
switch(act->type) {
@@ -1299,7 +1300,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writedata(wd, DATA, sizeof(int)*hmd->totindex, hmd->indexar);
}
- else if(md->type==eModifierType_Cloth) {
+ else if (md->type==eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData*) md;
writestruct(wd, DATA, "ClothSimSettings", 1, clmd->sim_parms);
@@ -1307,12 +1308,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, clmd->sim_parms->effector_weights);
write_pointcaches(wd, &clmd->ptcaches);
}
- else if(md->type==eModifierType_Smoke) {
+ else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
- if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
- if(smd->domain)
+ if (smd->domain)
{
write_pointcaches(wd, &(smd->domain->ptcaches[0]));
@@ -1326,7 +1327,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "SmokeDomainSettings", 1, smd->domain);
- if(smd->domain) {
+ if (smd->domain) {
/* cleanup the fake pointcache */
BKE_ptcache_free_list(&smd->domain->ptcaches[1]);
smd->domain->point_cache[1] = NULL;
@@ -1334,20 +1335,20 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights);
}
}
- else if(smd->type & MOD_SMOKE_TYPE_FLOW)
+ else if (smd->type & MOD_SMOKE_TYPE_FLOW)
writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow);
- else if(smd->type & MOD_SMOKE_TYPE_COLL)
+ else if (smd->type & MOD_SMOKE_TYPE_COLL)
writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll);
}
- else if(md->type==eModifierType_Fluidsim) {
+ else if (md->type==eModifierType_Fluidsim) {
FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
writestruct(wd, DATA, "FluidsimSettings", 1, fluidmd->fss);
}
- else if(md->type==eModifierType_DynamicPaint) {
+ else if (md->type==eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
- if(pmd->canvas)
+ if (pmd->canvas)
{
DynamicPaintSurface *surface;
writestruct(wd, DATA, "DynamicPaintCanvasSettings", 1, pmd->canvas);
@@ -1362,7 +1363,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, surface->effector_weights);
}
}
- if(pmd->brush)
+ if (pmd->brush)
{
writestruct(wd, DATA, "DynamicPaintBrushSettings", 1, pmd->brush);
writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
@@ -1394,7 +1395,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
}
else if (md->type==eModifierType_Warp) {
WarpModifierData *tmd = (WarpModifierData*) md;
- if(tmd->curfalloff) {
+ if (tmd->curfalloff) {
write_curvemapping(wd, tmd->curfalloff);
}
}
@@ -1412,8 +1413,8 @@ static void write_objects(WriteData *wd, ListBase *idbase)
Object *ob;
ob= idbase->first;
- while(ob) {
- if(ob->id.us>0 || wd->current) {
+ while (ob) {
+ if (ob->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_OB, "Object", 1, ob);
@@ -1446,7 +1447,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
- if(ob->soft) {
+ if (ob->soft) {
write_pointcaches(wd, &ob->soft->ptcaches);
writestruct(wd, DATA, "EffectorWeights", 1, ob->soft->effector_weights);
}
@@ -1469,8 +1470,8 @@ static void write_vfonts(WriteData *wd, ListBase *idbase)
PackedFile * pf;
vf= idbase->first;
- while(vf) {
- if(vf->id.us>0 || wd->current) {
+ while (vf) {
+ if (vf->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_VF, "VFont", 1, vf);
if (vf->id.properties) IDP_WriteProperty(vf->id.properties, wd);
@@ -1495,8 +1496,8 @@ static void write_keys(WriteData *wd, ListBase *idbase)
KeyBlock *kb;
key= idbase->first;
- while(key) {
- if(key->id.us>0 || wd->current) {
+ while (key) {
+ if (key->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_KE, "Key", 1, key);
if (key->id.properties) IDP_WriteProperty(key->id.properties, wd);
@@ -1505,9 +1506,9 @@ static void write_keys(WriteData *wd, ListBase *idbase)
/* direct data */
kb= key->block.first;
- while(kb) {
+ while (kb) {
writestruct(wd, DATA, "KeyBlock", 1, kb);
- if(kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
+ if (kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
kb= kb->next;
}
}
@@ -1523,8 +1524,8 @@ static void write_cameras(WriteData *wd, ListBase *idbase)
Camera *cam;
cam= idbase->first;
- while(cam) {
- if(cam->id.us>0 || wd->current) {
+ while (cam) {
+ if (cam->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_CA, "Camera", 1, cam);
if (cam->id.properties) IDP_WriteProperty(cam->id.properties, wd);
@@ -1542,8 +1543,8 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
MetaElem *ml;
mb= idbase->first;
- while(mb) {
- if(mb->id.us>0 || wd->current) {
+ while (mb) {
+ if (mb->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_MB, "MetaBall", 1, mb);
if (mb->id.properties) IDP_WriteProperty(mb->id.properties, wd);
@@ -1553,7 +1554,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
if (mb->adt) write_animdata(wd, mb->adt);
ml= mb->elems.first;
- while(ml) {
+ while (ml) {
writestruct(wd, DATA, "MetaElem", 1, ml);
ml= ml->next;
}
@@ -1575,8 +1576,8 @@ static void write_curves(WriteData *wd, ListBase *idbase)
Nurb *nu;
cu= idbase->first;
- while(cu) {
- if(cu->id.us>0 || wd->current) {
+ while (cu) {
+ if (cu->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_CU, "Curve", 1, cu);
@@ -1585,7 +1586,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
if (cu->id.properties) IDP_WriteProperty(cu->id.properties, wd);
if (cu->adt) write_animdata(wd, cu->adt);
- if(cu->vfont) {
+ if (cu->vfont) {
writedata(wd, DATA, amount_of_chars(cu->str)+1, cu->str);
writestruct(wd, DATA, "CharInfo", cu->len+1, cu->strinfo);
writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb);
@@ -1593,18 +1594,18 @@ static void write_curves(WriteData *wd, ListBase *idbase)
else {
/* is also the order of reading */
nu= cu->nurb.first;
- while(nu) {
+ while (nu) {
writestruct(wd, DATA, "Nurb", 1, nu);
nu= nu->next;
}
nu= cu->nurb.first;
- while(nu) {
- if(nu->type == CU_BEZIER)
+ while (nu) {
+ if (nu->type == CU_BEZIER)
writestruct(wd, DATA, "BezTriple", nu->pntsu, nu->bezt);
else {
writestruct(wd, DATA, "BPoint", nu->pntsu*nu->pntsv, nu->bp);
- if(nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
- if(nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
+ if (nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
+ if (nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
}
nu= nu->next;
}
@@ -1635,15 +1636,19 @@ static void write_dverts(WriteData *wd, int count, MDeformVert *dvlist)
static void write_mdisps(WriteData *wd, int count, MDisps *mdlist, int external)
{
- if(mdlist) {
+ if (mdlist) {
int i;
writestruct(wd, DATA, "MDisps", count, mdlist);
- if(!external) {
- for(i = 0; i < count; ++i) {
- if(mdlist[i].disps)
- writedata(wd, DATA, sizeof(float)*3*mdlist[i].totdisp, mdlist[i].disps);
+ for (i = 0; i < count; ++i) {
+ MDisps *md = &mdlist[i];
+ if (md->disps) {
+ if (!external)
+ writedata(wd, DATA, sizeof(float)*3*md->totdisp, md->disps);
}
+
+ if (md->hidden)
+ writedata(wd, DATA, BLI_BITMAP_SIZE(md->totdisp), md->hidden);
}
}
}
@@ -1653,7 +1658,7 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
int i;
/* write external customdata (not for undo) */
- if(data->external && !wd->current)
+ if (data->external && !wd->current)
CustomData_external_write(data, id, CD_MASK_MESH, count, 0);
writestruct(wd, DATA, "CustomDataLayer", data->maxlayer, data->layers);
@@ -1687,7 +1692,7 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
}
}
- if(data->external)
+ if (data->external)
writestruct(wd, DATA, "CustomDataExternal", 1, data->external);
}
@@ -1701,14 +1706,14 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
#endif
mesh= idbase->first;
- while(mesh) {
- if(mesh->id.us>0 || wd->current) {
+ while (mesh) {
+ if (mesh->id.us>0 || wd->current) {
/* write LibData */
if (!save_for_old_blender) {
#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
Mesh backup_mesh = {{0}};
- /* cache only - dont write */
+ /* cache only - don't write */
backup_mesh.mface = mesh->mface;
mesh->mface = NULL;
/* -- */
@@ -1733,7 +1738,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
- /* cache only - dont write */
+ /* cache only - don't write */
mesh->mface = backup_mesh.mface;
/* -- */
mesh->totface = backup_mesh.totface;
@@ -1833,8 +1838,8 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
Lattice *lt;
lt= idbase->first;
- while(lt) {
- if(lt->id.us>0 || wd->current) {
+ while (lt) {
+ if (lt->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_LT, "Lattice", 1, lt);
if (lt->id.properties) IDP_WriteProperty(lt->id.properties, wd);
@@ -1884,8 +1889,8 @@ static void write_images(WriteData *wd, ListBase *idbase)
ima= idbase->first;
- while(ima) {
- if(ima->id.us>0 || wd->current) {
+ while (ima) {
+ if (ima->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_IM, "Image", 1, ima);
if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd);
@@ -1909,8 +1914,8 @@ static void write_textures(WriteData *wd, ListBase *idbase)
Tex *tex;
tex= idbase->first;
- while(tex) {
- if(tex->id.us>0 || wd->current) {
+ while (tex) {
+ if (tex->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_TE, "Tex", 1, tex);
if (tex->id.properties) IDP_WriteProperty(tex->id.properties, wd);
@@ -1918,19 +1923,19 @@ static void write_textures(WriteData *wd, ListBase *idbase)
if (tex->adt) write_animdata(wd, tex->adt);
/* direct data */
- if(tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
- if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
- if(tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
- if(tex->type == TEX_POINTDENSITY && tex->pd) {
+ if (tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
+ if (tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
+ if (tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
+ if (tex->type == TEX_POINTDENSITY && tex->pd) {
writestruct(wd, DATA, "PointDensity", 1, tex->pd);
- if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
- if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
+ if (tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+ if (tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
}
- if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
- if(tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
+ if (tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
+ if (tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
/* nodetree is integral part of texture, no libdata */
- if(tex->nodetree) {
+ if (tex->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, tex->nodetree);
write_nodetree(wd, tex->nodetree);
}
@@ -1950,8 +1955,8 @@ static void write_materials(WriteData *wd, ListBase *idbase)
int a;
ma= idbase->first;
- while(ma) {
- if(ma->id.us>0 || wd->current) {
+ while (ma) {
+ if (ma->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_MA, "Material", 1, ma);
@@ -1963,15 +1968,15 @@ static void write_materials(WriteData *wd, ListBase *idbase)
if (ma->adt) write_animdata(wd, ma->adt);
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
}
- if(ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
- if(ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
+ if (ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
+ if (ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
/* nodetree is integral part of material, no libdata */
- if(ma->nodetree) {
+ if (ma->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, ma->nodetree);
write_nodetree(wd, ma->nodetree);
}
@@ -1988,20 +1993,20 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
int a;
wrld= idbase->first;
- while(wrld) {
- if(wrld->id.us>0 || wd->current) {
+ while (wrld) {
+ if (wrld->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_WO, "World", 1, wrld);
if (wrld->id.properties) IDP_WriteProperty(wrld->id.properties, wd);
if (wrld->adt) write_animdata(wd, wrld->adt);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
}
/* nodetree is integral part of lamps, no libdata */
- if(wrld->nodetree) {
+ if (wrld->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, wrld->nodetree);
write_nodetree(wd, wrld->nodetree);
}
@@ -2018,8 +2023,8 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
int a;
la= idbase->first;
- while(la) {
- if(la->id.us>0 || wd->current) {
+ while (la) {
+ if (la->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_LA, "Lamp", 1, la);
if (la->id.properties) IDP_WriteProperty(la->id.properties, wd);
@@ -2027,15 +2032,15 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
if (la->adt) write_animdata(wd, la->adt);
/* direct data */
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
+ for (a=0; a<MAX_MTEX; a++) {
+ if (la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
}
- if(la->curfalloff)
+ if (la->curfalloff)
write_curvemapping(wd, la->curfalloff);
/* nodetree is integral part of lamps, no libdata */
- if(la->nodetree) {
+ if (la->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, la->nodetree);
write_nodetree(wd, la->nodetree);
}
@@ -2064,7 +2069,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
ToolSettings *tos;
sce= scebase->first;
- while(sce) {
+ while (sce) {
/* write LibData */
writestruct(wd, ID_SCE, "Scene", 1, sce);
if (sce->id.properties) IDP_WriteProperty(sce->id.properties, wd);
@@ -2074,47 +2079,47 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
/* direct data */
base= sce->base.first;
- while(base) {
+ while (base) {
writestruct(wd, DATA, "Base", 1, base);
base= base->next;
}
tos = sce->toolsettings;
writestruct(wd, DATA, "ToolSettings", 1, tos);
- if(tos->vpaint) {
+ if (tos->vpaint) {
writestruct(wd, DATA, "VPaint", 1, tos->vpaint);
}
- if(tos->wpaint) {
+ if (tos->wpaint) {
writestruct(wd, DATA, "VPaint", 1, tos->wpaint);
}
- if(tos->sculpt) {
+ if (tos->sculpt) {
writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
}
- if(tos->uvsculpt) {
+ if (tos->uvsculpt) {
writestruct(wd, DATA, "UvSculpt", 1, tos->uvsculpt);
}
// write_paint(wd, &tos->imapaint.paint);
ed= sce->ed;
- if(ed) {
+ if (ed) {
writestruct(wd, DATA, "Editing", 1, ed);
/* reset write flags too */
SEQ_BEGIN(ed, seq) {
- if(seq->strip) seq->strip->done= 0;
+ if (seq->strip) seq->strip->done= 0;
writestruct(wd, DATA, "Sequence", 1, seq);
}
SEQ_END
SEQ_BEGIN(ed, seq) {
- if(seq->strip && seq->strip->done==0) {
+ if (seq->strip && seq->strip->done==0) {
/* write strip with 'done' at 0 because readfile */
- if(seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
- if(seq->effectdata) {
- switch(seq->type){
+ if (seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
+ if (seq->effectdata) {
+ switch(seq->type) {
case SEQ_COLOR:
writestruct(wd, DATA, "SolidColorVars", 1, seq->effectdata);
break;
@@ -2135,21 +2140,21 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
strip= seq->strip;
writestruct(wd, DATA, "Strip", 1, strip);
- if(seq->flag & SEQ_USE_CROP && strip->crop) {
+ if (seq->flag & SEQ_USE_CROP && strip->crop) {
writestruct(wd, DATA, "StripCrop", 1, strip->crop);
}
- if(seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
+ if (seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
writestruct(wd, DATA, "StripTransform", 1, strip->transform);
}
- if(seq->flag & SEQ_USE_PROXY && strip->proxy) {
+ if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
}
- if(seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
+ if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
}
- if(seq->type==SEQ_IMAGE)
+ if (seq->type==SEQ_IMAGE)
writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
- else if(seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
+ else if (seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
strip->done= 1;
@@ -2158,7 +2163,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
SEQ_END
/* new; meta stack too, even when its nasty restore code */
- for(ms= ed->metastack.first; ms; ms= ms->next) {
+ for (ms= ed->metastack.first; ms; ms= ms->next) {
writestruct(wd, DATA, "MetaStack", 1, ms);
}
}
@@ -2178,14 +2183,14 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
}
/* writing dynamic list of TimeMarkers to the blend file */
- for(marker= sce->markers.first; marker; marker= marker->next)
+ for (marker= sce->markers.first; marker; marker= marker->next)
writestruct(wd, DATA, "TimeMarker", 1, marker);
/* writing dynamic list of TransformOrientations to the blend file */
- for(ts = sce->transform_spaces.first; ts; ts = ts->next)
+ for (ts = sce->transform_spaces.first; ts; ts = ts->next)
writestruct(wd, DATA, "TransformOrientation", 1, ts);
- for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
for(fmc= srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
@@ -2198,7 +2203,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
}
- if(sce->nodetree) {
+ if (sce->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);
write_nodetree(wd, sce->nodetree);
}
@@ -2245,10 +2250,10 @@ static void write_windowmanagers(WriteData *wd, ListBase *lb)
wmWindowManager *wm;
wmWindow *win;
- for(wm= lb->first; wm; wm= wm->id.next) {
+ for (wm= lb->first; wm; wm= wm->id.next) {
writestruct(wd, ID_WM, "wmWindowManager", 1, wm);
- for(win= wm->windows.first; win; win= win->next)
+ for (win= wm->windows.first; win; win= win->next)
writestruct(wd, DATA, "wmWindow", 1, win);
}
}
@@ -2257,16 +2262,16 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
{
writestruct(wd, DATA, "ARegion", 1, ar);
- if(ar->regiondata) {
+ if (ar->regiondata) {
switch(spacetype) {
case SPACE_VIEW3D:
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
writestruct(wd, DATA, "RegionView3D", 1, rv3d);
- if(rv3d->localvd)
+ if (rv3d->localvd)
writestruct(wd, DATA, "RegionView3D", 1, rv3d->localvd);
- if(rv3d->clipbb)
+ if (rv3d->clipbb)
writestruct(wd, DATA, "BoundBox", 1, rv3d->clipbb);
}
@@ -2287,7 +2292,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
ScrEdge *se;
sc= scrbase->first;
- while(sc) {
+ while (sc) {
/* write LibData */
/* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
@@ -2296,40 +2301,40 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
IDP_WriteProperty(sc->id.properties, wd);
/* direct data */
- for(sv= sc->vertbase.first; sv; sv= sv->next)
+ for (sv= sc->vertbase.first; sv; sv= sv->next)
writestruct(wd, DATA, "ScrVert", 1, sv);
- for(se= sc->edgebase.first; se; se= se->next)
+ for (se= sc->edgebase.first; se; se= se->next)
writestruct(wd, DATA, "ScrEdge", 1, se);
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
Panel *pa;
ARegion *ar;
writestruct(wd, DATA, "ScrArea", 1, sa);
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
write_region(wd, ar, sa->spacetype);
- for(pa= ar->panels.first; pa; pa= pa->next)
+ for (pa= ar->panels.first; pa; pa= pa->next)
writestruct(wd, DATA, "Panel", 1, pa);
}
sl= sa->spacedata.first;
- while(sl) {
- for(ar= sl->regionbase.first; ar; ar= ar->next)
+ while (sl) {
+ for (ar= sl->regionbase.first; ar; ar= ar->next)
write_region(wd, ar, sl->spacetype);
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *) sl;
BGpic *bgpic;
writestruct(wd, DATA, "View3D", 1, v3d);
for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
writestruct(wd, DATA, "BGpic", 1, bgpic);
- if(v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
+ if (v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
}
- else if(sl->spacetype==SPACE_IPO) {
+ else if (sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo *)sl;
ListBase tmpGhosts = sipo->ghostCurves;
@@ -2337,70 +2342,70 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
sipo->ghostCurves.first= sipo->ghostCurves.last= NULL;
writestruct(wd, DATA, "SpaceIpo", 1, sl);
- if(sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
+ if (sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
/* reenable ghost curves */
sipo->ghostCurves= tmpGhosts;
}
- else if(sl->spacetype==SPACE_BUTS) {
+ else if (sl->spacetype==SPACE_BUTS) {
writestruct(wd, DATA, "SpaceButs", 1, sl);
}
- else if(sl->spacetype==SPACE_FILE) {
+ else if (sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
writestruct(wd, DATA, "SpaceFile", 1, sl);
- if(sfile->params)
+ if (sfile->params)
writestruct(wd, DATA, "FileSelectParams", 1, sfile->params);
}
- else if(sl->spacetype==SPACE_SEQ) {
+ else if (sl->spacetype==SPACE_SEQ) {
writestruct(wd, DATA, "SpaceSeq", 1, sl);
}
- else if(sl->spacetype==SPACE_OUTLINER) {
+ else if (sl->spacetype==SPACE_OUTLINER) {
SpaceOops *so= (SpaceOops *)sl;
writestruct(wd, DATA, "SpaceOops", 1, so);
/* outliner */
- if(so->treestore) {
+ if (so->treestore) {
writestruct(wd, DATA, "TreeStore", 1, so->treestore);
- if(so->treestore->data)
+ if (so->treestore->data)
writestruct(wd, DATA, "TreeStoreElem", so->treestore->usedelem, so->treestore->data);
}
}
- else if(sl->spacetype==SPACE_IMAGE) {
+ else if (sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sl;
writestruct(wd, DATA, "SpaceImage", 1, sl);
- if(sima->cumap)
+ if (sima->cumap)
write_curvemapping(wd, sima->cumap);
}
- else if(sl->spacetype==SPACE_TEXT) {
+ else if (sl->spacetype==SPACE_TEXT) {
writestruct(wd, DATA, "SpaceText", 1, sl);
}
- else if(sl->spacetype==SPACE_SCRIPT) {
+ else if (sl->spacetype==SPACE_SCRIPT) {
SpaceScript *scr = (SpaceScript*)sl;
scr->but_refs = NULL;
writestruct(wd, DATA, "SpaceScript", 1, sl);
}
- else if(sl->spacetype==SPACE_ACTION) {
+ else if (sl->spacetype==SPACE_ACTION) {
writestruct(wd, DATA, "SpaceAction", 1, sl);
}
- else if(sl->spacetype==SPACE_NLA){
+ else if (sl->spacetype==SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
writestruct(wd, DATA, "SpaceNla", 1, snla);
- if(snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
+ if (snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
}
- else if(sl->spacetype==SPACE_TIME){
+ else if (sl->spacetype==SPACE_TIME) {
writestruct(wd, DATA, "SpaceTime", 1, sl);
}
- else if(sl->spacetype==SPACE_NODE){
+ else if (sl->spacetype==SPACE_NODE) {
writestruct(wd, DATA, "SpaceNode", 1, sl);
}
- else if(sl->spacetype==SPACE_LOGIC){
+ else if (sl->spacetype==SPACE_LOGIC) {
writestruct(wd, DATA, "SpaceLogic", 1, sl);
}
- else if(sl->spacetype==SPACE_CONSOLE) {
+ else if (sl->spacetype==SPACE_CONSOLE) {
SpaceConsole *con = (SpaceConsole*)sl;
ConsoleLine *cl;
@@ -2412,10 +2417,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
writestruct(wd, DATA, "SpaceConsole", 1, sl);
}
- else if(sl->spacetype==SPACE_USERPREF) {
+ else if (sl->spacetype==SPACE_USERPREF) {
writestruct(wd, DATA, "SpaceUserPref", 1, sl);
}
- else if(sl->spacetype==SPACE_CLIP) {
+ else if (sl->spacetype==SPACE_CLIP) {
writestruct(wd, DATA, "SpaceClip", 1, sl);
}
@@ -2433,28 +2438,28 @@ static void write_libraries(WriteData *wd, Main *main)
ID *id;
int a, tot, foundone;
- for(; main; main= main->next) {
+ for (; main; main= main->next) {
a=tot= set_listbasepointers(main, lbarray);
/* test: is lib being used */
foundone= 0;
- while(tot--) {
- for(id= lbarray[tot]->first; id; id= id->next) {
- if(id->us>0 && (id->flag & LIB_EXTERN)) {
+ while (tot--) {
+ for (id= lbarray[tot]->first; id; id= id->next) {
+ if (id->us>0 && (id->flag & LIB_EXTERN)) {
foundone= 1;
break;
}
}
- if(foundone) break;
+ if (foundone) break;
}
- if(foundone) {
+ if (foundone) {
writestruct(wd, ID_LI, "Library", 1, main->curlib);
- while(a--) {
- for(id= lbarray[a]->first; id; id= id->next) {
- if(id->us>0 && (id->flag & LIB_EXTERN)) {
+ while (a--) {
+ for (id= lbarray[a]->first; id; id= id->next) {
+ if (id->us>0 && (id->flag & LIB_EXTERN)) {
writestruct(wd, ID_ID, "ID", 1, id);
}
}
@@ -2480,7 +2485,7 @@ static void write_bone(WriteData *wd, Bone* bone)
// Write Children
cbone= bone->childbase.first;
- while(cbone) {
+ while (cbone) {
write_bone(wd, cbone);
cbone= cbone->next;
}
@@ -2501,7 +2506,7 @@ static void write_armatures(WriteData *wd, ListBase *idbase)
/* Direct data */
bone= arm->bonebase.first;
- while(bone) {
+ while (bone) {
write_bone(wd, bone);
bone=bone->next;
}
@@ -2520,15 +2525,15 @@ static void write_texts(WriteData *wd, ListBase *idbase)
TextMarker *mrk;
text= idbase->first;
- while(text) {
+ while (text) {
if ( (text->flags & TXT_ISMEM) && (text->flags & TXT_ISEXT)) text->flags &= ~TXT_ISEXT;
/* write LibData */
writestruct(wd, ID_TXT, "Text", 1, text);
- if(text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
+ if (text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
if (text->id.properties) IDP_WriteProperty(text->id.properties, wd);
- if(!(text->flags & TXT_ISEXT)) {
+ if (!(text->flags & TXT_ISEXT)) {
/* now write the text data, in two steps for optimization in the readfunction */
tmp= text->lines.first;
while (tmp) {
@@ -2563,8 +2568,8 @@ static void write_speakers(WriteData *wd, ListBase *idbase)
Speaker *spk;
spk= idbase->first;
- while(spk) {
- if(spk->id.us>0 || wd->current) {
+ while (spk) {
+ if (spk->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_SPK, "Speaker", 1, spk);
if (spk->id.properties) IDP_WriteProperty(spk->id.properties, wd);
@@ -2582,8 +2587,8 @@ static void write_sounds(WriteData *wd, ListBase *idbase)
PackedFile * pf;
sound= idbase->first;
- while(sound) {
- if(sound->id.us>0 || wd->current) {
+ while (sound) {
+ if (sound->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_SO, "bSound", 1, sound);
if (sound->id.properties) IDP_WriteProperty(sound->id.properties, wd);
@@ -2606,14 +2611,14 @@ static void write_groups(WriteData *wd, ListBase *idbase)
Group *group;
GroupObject *go;
- for(group= idbase->first; group; group= group->id.next) {
- if(group->id.us>0 || wd->current) {
+ for (group= idbase->first; group; group= group->id.next) {
+ if (group->id.us>0 || wd->current) {
/* write LibData */
writestruct(wd, ID_GR, "Group", 1, group);
if (group->id.properties) IDP_WriteProperty(group->id.properties, wd);
go= group->gobject.first;
- while(go) {
+ while (go) {
writestruct(wd, DATA, "GroupObject", 1, go);
go= go->next;
}
@@ -2625,7 +2630,7 @@ static void write_nodetrees(WriteData *wd, ListBase *idbase)
{
bNodeTree *ntree;
- for(ntree=idbase->first; ntree; ntree= ntree->id.next) {
+ for (ntree=idbase->first; ntree; ntree= ntree->id.next) {
if (ntree->id.us>0 || wd->current) {
writestruct(wd, ID_NT, "bNodeTree", 1, ntree);
write_nodetree(wd, ntree);
@@ -2641,14 +2646,14 @@ static void write_brushes(WriteData *wd, ListBase *idbase)
{
Brush *brush;
- for(brush=idbase->first; brush; brush= brush->id.next) {
- if(brush->id.us>0 || wd->current) {
+ for (brush=idbase->first; brush; brush= brush->id.next) {
+ if (brush->id.us>0 || wd->current) {
writestruct(wd, ID_BR, "Brush", 1, brush);
if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd);
writestruct(wd, DATA, "MTex", 1, &brush->mtex);
- if(brush->curve)
+ if (brush->curve)
write_curvemapping(wd, brush->curve);
}
}
@@ -2658,8 +2663,8 @@ static void write_scripts(WriteData *wd, ListBase *idbase)
{
Script *script;
- for(script=idbase->first; script; script= script->id.next) {
- if(script->id.us>0 || wd->current) {
+ for (script=idbase->first; script; script= script->id.next) {
+ if (script->id.us>0 || wd->current) {
writestruct(wd, ID_SCRIPT, "Script", 1, script);
if (script->id.properties) IDP_WriteProperty(script->id.properties, wd);
}
@@ -2671,10 +2676,10 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
MovieTrackingTrack *track;
track= tracks->first;
- while(track) {
+ while (track) {
writestruct(wd, DATA, "MovieTrackingTrack", 1, track);
- if(track->markers)
+ if (track->markers)
writestruct(wd, DATA, "MovieTrackingMarker", track->markersnr, track->markers);
track= track->next;
@@ -2683,7 +2688,7 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
static void write_movieReconstruction(WriteData *wd, MovieTrackingReconstruction *reconstruction)
{
- if(reconstruction->camnr)
+ if (reconstruction->camnr)
writestruct(wd, DATA, "MovieReconstructedCamera", reconstruction->camnr, reconstruction->cameras);
}
@@ -2692,20 +2697,20 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
MovieClip *clip;
clip= idbase->first;
- while(clip) {
- if(clip->id.us>0 || wd->current) {
+ while (clip) {
+ if (clip->id.us>0 || wd->current) {
MovieTracking *tracking= &clip->tracking;
MovieTrackingObject *object;
writestruct(wd, ID_MC, "MovieClip", 1, clip);
- if(clip->adt)
+ if (clip->adt)
write_animdata(wd, clip->adt);
write_movieTracks(wd, &tracking->tracks);
write_movieReconstruction(wd, &tracking->reconstruction);
object= tracking->objects.first;
- while(object) {
+ while (object) {
writestruct(wd, DATA, "MovieTrackingObject", 1, object);
write_movieTracks(wd, &object->tracks);
@@ -2971,7 +2976,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
*/
static void write_thumb(WriteData *wd, int *img)
{
- if(img)
+ if (img)
writedata(wd, TEST, (2 + img[0] * img[1]) * sizeof(int), img);
}
@@ -3000,7 +3005,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
write_global(wd, write_flags, mainvar);
/* no UI save in undo */
- if(current==NULL) {
+ if (current==NULL) {
write_windowmanagers(wd, &mainvar->wm);
write_screens (wd, &mainvar->screen);
}
@@ -3057,17 +3062,17 @@ static int do_history(const char *name, ReportList *reports)
char tempname1[FILE_MAX], tempname2[FILE_MAX];
int hisnr= U.versions;
- if(U.versions==0) return 0;
- if(strlen(name)<2) {
+ if (U.versions==0) return 0;
+ if (strlen(name)<2) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
return 1;
}
- while(hisnr > 1) {
+ while (hisnr > 1) {
BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1);
BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr);
- if(BLI_rename(tempname1, tempname2)) {
+ if (BLI_rename(tempname1, tempname2)) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
return 1;
}
@@ -3077,7 +3082,7 @@ static int do_history(const char *name, ReportList *reports)
/* is needed when hisnr==1 */
BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr);
- if(BLI_rename(name, tempname1)) {
+ if (BLI_rename(name, tempname1)) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
return 1;
}
@@ -3095,14 +3100,14 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
/* open temporary file, so we preserve the original in case we crash */
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
- file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
- if(file == -1) {
+ file = BLI_open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ if (file == -1) {
BKE_reportf(reports, RPT_ERROR, "Can't open file %s for writing: %s.", tempname, strerror(errno));
return 0;
}
/* remapping of relative paths to new file location */
- if(write_flags & G_FILE_RELATIVE_REMAP) {
+ if (write_flags & G_FILE_RELATIVE_REMAP) {
char dir1[FILE_MAX];
char dir2[FILE_MAX];
BLI_split_dir_part(filepath, dir1, sizeof(dir1));
@@ -3112,15 +3117,15 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_cleanup_dir(mainvar->name, dir1);
BLI_cleanup_dir(mainvar->name, dir2);
- if(BLI_path_cmp(dir1, dir2)==0) {
+ if (BLI_path_cmp(dir1, dir2)==0) {
write_flags &= ~G_FILE_RELATIVE_REMAP;
}
else {
- if(G.relbase_valid) {
+ if (G.relbase_valid) {
/* blend may not have been saved before. Tn this case
* we should not have any relative paths, but if there
* is somehow, an invalid or empty G.main->name it will
- * print an error, dont try make the absolute in this case. */
+ * print an error, don't try make the absolute in this case. */
makeFilesAbsolute(mainvar, G.main->name, NULL);
}
}
@@ -3129,7 +3134,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= (BLI_path_cmp(filepath, userfilename) == 0);
- if(write_flags & G_FILE_RELATIVE_REMAP)
+ if (write_flags & G_FILE_RELATIVE_REMAP)
makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
@@ -3153,7 +3158,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
}
}
- if(write_flags & G_FILE_COMPRESS) {
+ if (write_flags & G_FILE_COMPRESS) {
/* compressed files have the same ending as regular files... only from 2.4!!! */
char gzname[FILE_MAX+4];
int ret;
@@ -3162,25 +3167,25 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath);
ret = BLI_file_gzip(tempname, gzname);
- if(0==ret) {
+ if (0==ret) {
/* now rename to real file name, and delete temp @ file too */
- if(BLI_rename(gzname, filepath) != 0) {
+ if (BLI_rename(gzname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @.");
return 0;
}
BLI_delete(tempname, 0, 0);
}
- else if(-1==ret) {
+ else if (-1==ret) {
BKE_report(reports, RPT_ERROR, "Failed opening .gz file.");
return 0;
}
- else if(-2==ret) {
+ else if (-2==ret) {
BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression.");
return 0;
}
}
- else if(BLI_rename(tempname, filepath) != 0) {
+ else if (BLI_rename(tempname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @");
return 0;
}
@@ -3195,6 +3200,6 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr
err= write_file_handle(mainvar, 0, compare, current, 0, write_flags, NULL);
- if(err==0) return 1;
+ if (err==0) return 1;
return 0;
}