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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-27 18:35:34 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-27 18:35:34 +0300
commit57101c4fd26a85f4994d4d4d3f433c37f95367d0 (patch)
tree09d40feb19a41df0f32a05ff1975653f865b743e /source/blender/editors/space_image
parent17777e7cd195318c36a1172647557447330dd3a4 (diff)
Second attempt at committing the different render slot implementation. This
has a fix that hopefully solves the problem on mac/win. Also fixes #21322, render slots not working well with FSA.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c24
-rw-r--r--source/blender/editors/space_image/image_draw.c59
-rw-r--r--source/blender/editors/space_image/image_ops.c18
3 files changed, 50 insertions, 51 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 283d8490028..9f897c4ff2c 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -527,12 +527,12 @@ static char *slot_menu()
char *str;
int a, slot;
- str= MEM_callocN(RE_SLOT_MAX*32, "menu slots");
+ str= MEM_callocN(IMA_MAX_RENDER_SLOT*32, "menu slots");
strcpy(str, "Slot %t");
a= strlen(str);
- for(slot=0; slot<RE_SLOT_MAX; slot++)
+ for(slot=0; slot<IMA_MAX_RENDER_SLOT; slot++)
a += sprintf(str+a, "|Slot %d %%x%d", slot+1, slot);
return str;
@@ -606,7 +606,6 @@ 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);
}
@@ -707,7 +706,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, int render)
+static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, short *render_slot)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiBut *but;
@@ -723,10 +722,9 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
wmenu3= (3*w)/6;
/* menu buts */
- if(render) {
+ if(render_slot) {
strp= slot_menu();
- iuser->menunr= RE_GetViewSlot();
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, &iuser->menunr, 0,0,0,0, "Select Slot");
+ but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, render_slot, 0,0,0,0, "Select Slot");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
}
@@ -745,7 +743,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, int render)
+static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, short *render_slot)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiLayout *row;
@@ -766,7 +764,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);
+ uiblock_layer_pass_buttons(row, rr, iuser, 230, render_slot);
/* decrease, increase arrows */
but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
@@ -875,9 +873,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, RE_SLOT_VIEW);
+ Render *re= RE_GetRender(scene->id.name);
RenderResult *rr= RE_AcquireResultRead(re);
- uiblock_layer_pass_arrow_buttons(layout, rr, iuser, 1);
+ uiblock_layer_pass_arrow_buttons(layout, rr, iuser, &ima->render_slot);
RE_ReleaseResult(re);
}
}
@@ -904,7 +902,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, 0);
+ uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, NULL);
}
else if(ima->source != IMA_SRC_GENERATED) {
if(compact == 0) {
@@ -984,7 +982,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);
+ uiblock_layer_pass_buttons(layout, rr, iuser, 160, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL);
BKE_image_release_renderresult(scene, ima);
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 33dfc99602e..6b2693eb627 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -60,6 +60,8 @@
#include "UI_view2d.h"
+#include "RE_pipeline.h"
+
#include "image_intern.h"
#define HEADER_HEIGHT 18
@@ -86,37 +88,35 @@ static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf,
}
}
-static void draw_render_info(Image *ima, ARegion *ar)
+static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
{
+ RenderResult *rr;
rcti rect;
float colf[3];
- int showspare= 0; // XXX BIF_show_render_spare();
-
- if(ima->render_text==NULL)
- return;
-
- rect= ar->winrct;
- rect.xmin= 0;
- rect.ymin= ar->winrct.ymax - ar->winrct.ymin - HEADER_HEIGHT;
- rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
- rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
-
- /* clear header rect */
- UI_GetThemeColor3fv(TH_BACK, colf);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glColor4f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 0.5f);
- glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1);
- glDisable(GL_BLEND);
- UI_ThemeColor(TH_TEXT_HI);
+ rr= BKE_image_acquire_renderresult(scene, ima);
+
+ if(rr && rr->text) {
+ rect= ar->winrct;
+ rect.xmin= 0;
+ rect.ymin= ar->winrct.ymax - ar->winrct.ymin - HEADER_HEIGHT;
+ rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
+ rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
+
+ /* clear header rect */
+ UI_GetThemeColor3fv(TH_BACK, colf);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 0.5f);
+ glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1);
+ glDisable(GL_BLEND);
+
+ UI_ThemeColor(TH_TEXT_HI);
- if(showspare) {
- UI_DrawString(12, rect.ymin + 5, "(Previous)");
- UI_DrawString(72, rect.ymin + 5, ima->render_text);
+ UI_DrawString(12, rect.ymin + 5, rr->text);
}
- else
- UI_DrawString(12, rect.ymin + 5, ima->render_text);
+
+ BKE_image_release_renderresult(scene, ima);
}
void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf)
@@ -659,10 +659,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
/* paint helpers */
draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy);
- /* render info */
- if(ima && show_render)
- draw_render_info(ima, ar);
-
+
/* XXX integrate this code */
#if 0
if(ibuf) {
@@ -681,5 +678,9 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
#endif
ED_space_image_release_buffer(sima, lock);
+
+ /* render info */
+ if(ima && show_render)
+ draw_render_info(scene, ima, ar);
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 671bbe5f8cd..a223e2481fc 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1979,21 +1979,21 @@ static int cycle_render_slot_poll(bContext *C)
static int cycle_render_slot_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- int a, slot, cur= RE_GetViewSlot();
+ Image *ima= CTX_data_edit_image(C);
+ int a, slot, cur= ima->render_slot;
- for(a=1; a<RE_SLOT_MAX; a++) {
- slot= (cur+a)%RE_SLOT_MAX;
+ for(a=1; a<IMA_MAX_RENDER_SLOT; a++) {
+ slot= (cur+a)%IMA_MAX_RENDER_SLOT;
- if(RE_GetRender(scene->id.name, slot)) {
- RE_SetViewSlot(slot);
+ if(ima->renders[slot] || slot == ima->last_render_slot) {
+ ima->render_slot= slot;
break;
}
}
- if(a == RE_SLOT_MAX)
- RE_SetViewSlot((cur == 1)? 0: 1);
-
+ if(a == IMA_MAX_RENDER_SLOT)
+ ima->render_slot= ((cur == 1)? 0: 1);
+
WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
return OPERATOR_FINISHED;