Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/writefile.c
| Show First 20 Lines • Show All 582 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void IDP_WriteProperty(IDProperty *prop, void *wd) | void IDP_WriteProperty(IDProperty *prop, void *wd) | ||||
| { | { | ||||
| writestruct(wd, DATA, "IDProperty", 1, prop); | writestruct(wd, DATA, "IDProperty", 1, prop); | ||||
| IDP_WriteProperty_OnlyData(prop, wd); | IDP_WriteProperty_OnlyData(prop, wd); | ||||
| } | } | ||||
| static void write_previews(WriteData *wd, PreviewImage *prv) | |||||
| { | |||||
| /* Never write previews when doing memsave (i.e. undo/redo)! */ | |||||
| if (prv && !wd->current) { | |||||
| short w = prv->w[1]; | |||||
| short h = prv->h[1]; | |||||
| unsigned int *rect = prv->rect[1]; | |||||
| /* don't write out large previews if not requested */ | |||||
| if (!(U.flag & USER_SAVE_PREVIEWS)) { | |||||
| prv->w[1] = 0; | |||||
| prv->h[1] = 0; | |||||
| prv->rect[1] = NULL; | |||||
| } | |||||
| writestruct(wd, DATA, "PreviewImage", 1, prv); | |||||
| if (prv->rect[0]) writedata(wd, DATA, prv->w[0] * prv->h[0] * sizeof(unsigned int), prv->rect[0]); | |||||
| if (prv->rect[1]) writedata(wd, DATA, prv->w[1] * prv->h[1] * sizeof(unsigned int), prv->rect[1]); | |||||
campbellbarton: *picky* - spaces around ops. | |||||
Not Done Inline ActionsHehe, this is just a raw oving of the function from below in code… But yes, good occasion to clean it up :P mont29: Hehe, this is just a raw oving of the function from below in code… But yes, good occasion to… | |||||
| /* restore preview, we still want to keep it in memory even if not saved to file */ | |||||
| if (!(U.flag & USER_SAVE_PREVIEWS) ) { | |||||
| prv->w[1] = w; | |||||
| prv->h[1] = h; | |||||
| prv->rect[1] = rect; | |||||
| } | |||||
| } | |||||
| } | |||||
| static void write_fmodifiers(WriteData *wd, ListBase *fmodifiers) | static void write_fmodifiers(WriteData *wd, ListBase *fmodifiers) | ||||
| { | { | ||||
| FModifier *fcm; | FModifier *fcm; | ||||
| /* Write all modifiers first (for faster reloading) */ | /* Write all modifiers first (for faster reloading) */ | ||||
| writelist(wd, DATA, "FModifier", fmodifiers); | writelist(wd, DATA, "FModifier", fmodifiers); | ||||
| /* Modifiers */ | /* Modifiers */ | ||||
| ▲ Show 20 Lines • Show All 1,089 Lines • ▼ Show 20 Lines | if (ob->id.us>0 || wd->current) { | ||||
| } | } | ||||
| write_particlesystems(wd, &ob->particlesystem); | write_particlesystems(wd, &ob->particlesystem); | ||||
| write_modifiers(wd, &ob->modifiers); | write_modifiers(wd, &ob->modifiers); | ||||
| writelist(wd, DATA, "LinkData", &ob->pc_ids); | writelist(wd, DATA, "LinkData", &ob->pc_ids); | ||||
| writelist(wd, DATA, "LodLevel", &ob->lodlevels); | writelist(wd, DATA, "LodLevel", &ob->lodlevels); | ||||
| } | } | ||||
| write_previews(wd, ob->preview); | |||||
| ob= ob->id.next; | ob= ob->id.next; | ||||
| } | } | ||||
| /* flush helps the compression for undo-save */ | /* flush helps the compression for undo-save */ | ||||
| mywrite(wd, MYWRITE_FLUSH, 0); | mywrite(wd, MYWRITE_FLUSH, 0); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | if (lt->id.us>0 || wd->current) { | ||||
| write_dverts(wd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert); | write_dverts(wd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert); | ||||
| } | } | ||||
| lt= lt->id.next; | lt= lt->id.next; | ||||
| } | } | ||||
| } | } | ||||
| static void write_previews(WriteData *wd, PreviewImage *prv) | |||||
| { | |||||
| /* Never write previews in undo steps! */ | |||||
| if (prv && !wd->current) { | |||||
| short w = prv->w[1]; | |||||
| short h = prv->h[1]; | |||||
| unsigned int *rect = prv->rect[1]; | |||||
| /* don't write out large previews if not requested */ | |||||
| if (!(U.flag & USER_SAVE_PREVIEWS)) { | |||||
| prv->w[1] = 0; | |||||
| prv->h[1] = 0; | |||||
| prv->rect[1] = NULL; | |||||
| } | |||||
| writestruct(wd, DATA, "PreviewImage", 1, prv); | |||||
| if (prv->rect[0]) writedata(wd, DATA, prv->w[0]*prv->h[0]*sizeof(unsigned int), prv->rect[0]); | |||||
| if (prv->rect[1]) writedata(wd, DATA, prv->w[1]*prv->h[1]*sizeof(unsigned int), prv->rect[1]); | |||||
| /* restore preview, we still want to keep it in memory even if not saved to file */ | |||||
| if (!(U.flag & USER_SAVE_PREVIEWS) ) { | |||||
| prv->w[1] = w; | |||||
| prv->h[1] = h; | |||||
| prv->rect[1] = rect; | |||||
| } | |||||
| } | |||||
| } | |||||
| static void write_images(WriteData *wd, ListBase *idbase) | static void write_images(WriteData *wd, ListBase *idbase) | ||||
| { | { | ||||
| Image *ima; | Image *ima; | ||||
| PackedFile * pf; | PackedFile * pf; | ||||
| ImageView *iv; | ImageView *iv; | ||||
| ImagePackedFile *imapf; | ImagePackedFile *imapf; | ||||
| ima= idbase->first; | ima= idbase->first; | ||||
| ▲ Show 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | while (sce) { | ||||
| /* writing RigidBodyWorld data to the blend file */ | /* writing RigidBodyWorld data to the blend file */ | ||||
| if (sce->rigidbody_world) { | if (sce->rigidbody_world) { | ||||
| writestruct(wd, DATA, "RigidBodyWorld", 1, sce->rigidbody_world); | writestruct(wd, DATA, "RigidBodyWorld", 1, sce->rigidbody_world); | ||||
| writestruct(wd, DATA, "EffectorWeights", 1, sce->rigidbody_world->effector_weights); | writestruct(wd, DATA, "EffectorWeights", 1, sce->rigidbody_world->effector_weights); | ||||
| write_pointcaches(wd, &(sce->rigidbody_world->ptcaches)); | write_pointcaches(wd, &(sce->rigidbody_world->ptcaches)); | ||||
| } | } | ||||
| write_previews(wd, sce->preview); | |||||
| sce= sce->id.next; | sce= sce->id.next; | ||||
| } | } | ||||
| /* flush helps the compression for undo-save */ | /* flush helps the compression for undo-save */ | ||||
| mywrite(wd, MYWRITE_FLUSH, 0); | mywrite(wd, MYWRITE_FLUSH, 0); | ||||
| } | } | ||||
| static void write_gpencils(WriteData *wd, ListBase *lb) | static void write_gpencils(WriteData *wd, ListBase *lb) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 480 Lines • ▼ Show 20 Lines | static void write_groups(WriteData *wd, ListBase *idbase) | ||||
| GroupObject *go; | GroupObject *go; | ||||
| for (group= idbase->first; group; group= group->id.next) { | for (group= idbase->first; group; group= group->id.next) { | ||||
| if (group->id.us>0 || wd->current) { | if (group->id.us>0 || wd->current) { | ||||
| /* write LibData */ | /* write LibData */ | ||||
| writestruct(wd, ID_GR, "Group", 1, group); | writestruct(wd, ID_GR, "Group", 1, group); | ||||
| if (group->id.properties) IDP_WriteProperty(group->id.properties, wd); | if (group->id.properties) IDP_WriteProperty(group->id.properties, wd); | ||||
| write_previews(wd, group->preview); | |||||
| go= group->gobject.first; | go= group->gobject.first; | ||||
| while (go) { | while (go) { | ||||
| writestruct(wd, DATA, "GroupObject", 1, go); | writestruct(wd, DATA, "GroupObject", 1, go); | ||||
| go= go->next; | go= go->next; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | for (brush=idbase->first; brush; brush= brush->id.next) { | ||||
| if (brush->id.us>0 || wd->current) { | if (brush->id.us>0 || wd->current) { | ||||
| writestruct(wd, ID_BR, "Brush", 1, brush); | writestruct(wd, ID_BR, "Brush", 1, brush); | ||||
| if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd); | if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd); | ||||
| if (brush->curve) | if (brush->curve) | ||||
| write_curvemapping(wd, brush->curve); | write_curvemapping(wd, brush->curve); | ||||
| if (brush->gradient) | if (brush->gradient) | ||||
| writestruct(wd, DATA, "ColorBand", 1, brush->gradient); | writestruct(wd, DATA, "ColorBand", 1, brush->gradient); | ||||
| write_previews(wd, brush->preview); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void write_palettes(WriteData *wd, ListBase *idbase) | static void write_palettes(WriteData *wd, ListBase *idbase) | ||||
| { | { | ||||
| Palette *palette; | Palette *palette; | ||||
| ▲ Show 20 Lines • Show All 679 Lines • Show Last 20 Lines | |||||
*picky* - spaces around ops.