diff options
Diffstat (limited to 'source/blender/editors/space_image/image_buttons.c')
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index bd5f8754990..01c53961f66 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -538,12 +538,12 @@ static char *slot_menu() char *str; int a, slot; - str= MEM_callocN(IMA_MAX_RENDER_SLOT*32, "menu slots"); + str= MEM_callocN(RE_SLOT_MAX*32, "menu slots"); strcpy(str, "Slot %t"); a= strlen(str); - for(slot=0; slot<IMA_MAX_RENDER_SLOT; slot++) + for(slot=0; slot<RE_SLOT_MAX; slot++) a += sprintf(str+a, "|Slot %d %%x%d", slot+1, slot); return str; @@ -617,6 +617,7 @@ static void image_multi_cb(bContext *C, void *rr_v, void *iuser_v) { ImageUser *iuser= iuser_v; + RE_SetViewSlot(iuser->menunr); BKE_image_multilayer_index(rr_v, iuser); WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); } @@ -717,7 +718,7 @@ static void image_user_change(bContext *C, void *iuser_v, void *unused) } #endif -static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, short *render_slot) +static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, int render) { uiBlock *block= uiLayoutGetBlock(layout); uiBut *but; @@ -733,9 +734,10 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image wmenu3= (3*w)/6; /* menu buts */ - if(render_slot) { + if(render) { strp= slot_menu(); - but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, render_slot, 0,0,0,0, "Select Slot"); + iuser->menunr= RE_GetViewSlot(); + but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, &iuser->menunr, 0,0,0,0, "Select Slot"); uiButSetFunc(but, image_multi_cb, rr, iuser); MEM_freeN(strp); } @@ -754,7 +756,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image } } -static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, short *render_slot) +static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int render) { uiBlock *block= uiLayoutGetBlock(layout); uiLayout *row; @@ -775,7 +777,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer"); uiButSetFunc(but, image_multi_inclay_cb, rr, iuser); - uiblock_layer_pass_buttons(row, rr, iuser, 230, render_slot); + uiblock_layer_pass_buttons(row, rr, iuser, 230, render); /* decrease, increase arrows */ but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass"); @@ -884,9 +886,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn } else if(ima->type==IMA_TYPE_R_RESULT) { /* browse layer/passes */ - Render *re= RE_GetRender(scene->id.name); + Render *re= RE_GetRender(scene->id.name, RE_SLOT_VIEW); RenderResult *rr= RE_AcquireResultRead(re); - uiblock_layer_pass_arrow_buttons(layout, rr, iuser, &ima->render_slot); + uiblock_layer_pass_arrow_buttons(layout, rr, iuser, 1); RE_ReleaseResult(re); } } @@ -913,7 +915,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn /* multilayer? */ if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) { - uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, NULL); + uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, 0); } else if(ima->source != IMA_SRC_GENERATED) { if(compact == 0) { @@ -993,7 +995,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser /* render layers and passes */ if(ima && iuser) { rr= BKE_image_acquire_renderresult(scene, ima); - uiblock_layer_pass_buttons(layout, rr, iuser, 160, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL); + uiblock_layer_pass_buttons(layout, rr, iuser, 160, ima->type==IMA_TYPE_R_RESULT); BKE_image_release_renderresult(scene, ima); } } |