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:
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r--source/blender/blenloader/intern/writefile.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f5d35e45fc0..2dfb100cc62 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -588,6 +588,33 @@ void IDP_WriteProperty(IDProperty *prop, void *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]);
+
+ /* 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)
{
FModifier *fcm;
@@ -1698,6 +1725,9 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writelist(wd, DATA, "LinkData", &ob->pc_ids);
writelist(wd, DATA, "LodLevel", &ob->lodlevels);
}
+
+ write_previews(wd, ob->preview);
+
ob= ob->id.next;
}
@@ -2138,32 +2168,6 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
}
}
-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)
{
Image *ima;
@@ -2572,6 +2576,8 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
write_pointcaches(wd, &(sce->rigidbody_world->ptcaches));
}
+ write_previews(wd, sce->preview);
+
sce= sce->id.next;
}
/* flush helps the compression for undo-save */
@@ -3068,6 +3074,8 @@ static void write_groups(WriteData *wd, ListBase *idbase)
writestruct(wd, ID_GR, "Group", 1, group);
if (group->id.properties) IDP_WriteProperty(group->id.properties, wd);
+ write_previews(wd, group->preview);
+
go= group->gobject.first;
while (go) {
writestruct(wd, DATA, "GroupObject", 1, go);