diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-10 13:17:04 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-10 13:17:04 +0300 |
commit | 9a145481041c51c17d6ec1fba2b10621dc93ecce (patch) | |
tree | e191bcd78569b5e3d7604941f7aaa56ff8b22c54 /source/blender/blenloader/intern/readblenentry.c | |
parent | a54bd4993fa825df60e43f307c58d47981b37cea (diff) |
Old feature request: undo system now restores images without reloading.
Was surprisingly easy to add, compiant with file reading and undo code.
Currently only the Image->ibuf gets restored, and its opengl binding, so
for realtime texture it works nicely. Also texture images are not freed
inbetween undo steps
Notes:
- Painting textures will just keep the painted image, there's no undo
yet for that
- If this works satisfying, I'll extend it to compositing previews
TEST IT WELL PLEASE! :)
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.c')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 4e3c674c2f5..17549485025 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -289,6 +289,7 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, BlendReadError *erro return bfd; } + BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, BlendReadError *error_r) { BlendFileData *bfd = NULL; @@ -297,11 +298,19 @@ BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, Ble fd = blo_openblendermemfile(memfile, error_r); if (fd) { strcpy(fd->filename, filename); + + /* makes lookup of existing images in G.main */ + blo_make_image_pointer_map(fd); + bfd= blo_read_file_internal(fd, error_r); if (bfd) { bfd->type= BLENFILETYPE_BLEND; strcpy(bfd->main->name, ""); } + + /* ensures relinked images are not freed */ + blo_end_image_pointer_map(fd); + blo_freefiledata(fd); } |