diff options
author | Ton Roosendaal <ton@blender.org> | 2011-03-10 20:34:27 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-03-10 20:34:27 +0300 |
commit | 9a622f18ac5b8a58597fd2b02472d95cb6262c55 (patch) | |
tree | c23f6c49f9955c963efb8531efffab7d33d82775 /source/blender | |
parent | a836390426e9e7f6fa323c0cd37b9bec45b0199f (diff) |
Bugfix #26424
More problems with Undo and Render Slots (Image editor)
- Undo storage for operator is now back, but only when new
buffers were added (not when viewing existing)
- A real bug: On undo/redo, the stored buffers were never
retrieved, but always freed entirely.
Note however that when you undo back to a state before you
rendered (or added slots), the render buffers that didn't
exist back then also get freed. A redo doesn't bring it back.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 7 |
2 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f80118c3c4e..27690cb595f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1200,7 +1200,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) OldNew *entry= fd->imamap->entries; Image *ima= oldmain->image.first; Scene *sce= oldmain->scene.first; - int i, a; + int i; /* used entries were restored, so we put them to zero */ for (i=0; i<fd->imamap->nentries; i++, entry++) { @@ -1220,10 +1220,10 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) ima->gputexture= NULL; } } + for(i=0; i<IMA_MAX_RENDER_SLOT; i++) + ima->renders[i]= newimaadr(fd, ima->renders[i]); ima->gputexture= newimaadr(fd, ima->gputexture); - for(a=0; a<IMA_MAX_RENDER_SLOT; a++) - ima->renders[a]= newimaadr(fd, ima->renders[a]); } for(; sce; sce= sce->id.next) { if(sce->nodetree) { @@ -2773,8 +2773,18 @@ static void direct_link_image(FileData *fd, Image *ima) ima->anim= NULL; ima->rr= NULL; ima->repbind= NULL; - memset(ima->renders, 0, sizeof(ima->renders)); - ima->last_render_slot= ima->render_slot; + + /* undo system, try to restore render buffers */ + if(fd->imamap) { + int a; + + for(a=0; a<IMA_MAX_RENDER_SLOT; a++) + ima->renders[a]= newimaadr(fd, ima->renders[a]); + } + else { + memset(ima->renders, 0, sizeof(ima->renders)); + ima->last_render_slot= ima->render_slot; + } ima->packedfile = direct_link_packedfile(fd, ima->packedfile); ima->preview = direct_link_preview_image(fd, ima->preview); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 34b0bffde8e..3990f0916b1 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2133,6 +2133,10 @@ static int cycle_render_slot_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); + /* no undo push for browsing existing */ + if(ima->renders[ima->render_slot]) + return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } @@ -2146,7 +2150,8 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot) ot->exec= cycle_render_slot_exec; ot->poll= cycle_render_slot_poll; - /* no registry or undo flags, this is a UI option */ + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_boolean(ot->srna, "reverse", 0, "Cycle in Reverse", ""); } |