Code refactor: split code for render updates and opening render view into
separate files, no functional changes.
This commit is contained in:
@@ -41,6 +41,8 @@ set(SRC
|
||||
render_ops.c
|
||||
render_preview.c
|
||||
render_shading.c
|
||||
render_update.c
|
||||
render_view.c
|
||||
|
||||
render_intern.h
|
||||
)
|
||||
|
||||
@@ -65,13 +65,16 @@ void TEXTURE_OT_envmap_clear(struct wmOperatorType *ot);
|
||||
void TEXTURE_OT_envmap_clear_all(struct wmOperatorType *ot);
|
||||
|
||||
/* render_internal.c */
|
||||
void RENDER_OT_view_show(struct wmOperatorType *ot);
|
||||
void RENDER_OT_render(struct wmOperatorType *ot);
|
||||
void RENDER_OT_view_cancel(struct wmOperatorType *ot);
|
||||
|
||||
/*render_opengl.c uses these */
|
||||
/* render_opengl.c uses this */
|
||||
void image_buffer_rect_update(struct Scene *scene, struct RenderResult *rr, struct ImBuf *ibuf, volatile struct rcti *renrect);
|
||||
void screen_set_image_output(struct bContext *C, int mx, int my);
|
||||
|
||||
/* render_view.c */
|
||||
void render_view_open(struct bContext *C, int mx, int my);
|
||||
|
||||
void RENDER_OT_view_show(struct wmOperatorType *ot);
|
||||
void RENDER_OT_view_cancel(struct wmOperatorType *ot);
|
||||
|
||||
/* render_opengl.c */
|
||||
void RENDER_OT_opengl(struct wmOperatorType *ot);
|
||||
|
||||
@@ -73,17 +73,14 @@
|
||||
|
||||
#include "render_intern.h"
|
||||
|
||||
static ScrArea *biggest_area(bContext *C);
|
||||
static ScrArea *biggest_non_image_area(bContext *C);
|
||||
static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win);
|
||||
static ScrArea *find_area_image_empty(bContext *C);
|
||||
/* Render Callbacks */
|
||||
|
||||
/* called inside thread! */
|
||||
void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volatile rcti *renrect)
|
||||
{
|
||||
float x1, y1, *rectf= NULL;
|
||||
int ymin, ymax, xmin, xmax;
|
||||
int rymin, rxmin;
|
||||
int rymin, rxmin, do_color_management;
|
||||
char *rectc;
|
||||
|
||||
/* if renrect argument, we only refresh scanlines */
|
||||
@@ -95,7 +92,8 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
|
||||
/* xmin here is first subrect x coord, xmax defines subrect width */
|
||||
xmin = renrect->xmin + rr->crop;
|
||||
xmax = renrect->xmax - xmin + rr->crop;
|
||||
if (xmax<2) return;
|
||||
if(xmax<2)
|
||||
return;
|
||||
|
||||
ymin= renrect->ymin + rr->crop;
|
||||
ymax= renrect->ymax - ymin + rr->crop;
|
||||
@@ -141,270 +139,56 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
|
||||
|
||||
rectf+= 4*(rr->rectx*ymin + xmin);
|
||||
rectc= (char *)(ibuf->rect + ibuf->x*rymin + rxmin);
|
||||
|
||||
do_color_management = (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT));
|
||||
|
||||
/* XXX make nice consistent functions for this */
|
||||
if (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
|
||||
for(y1= 0; y1<ymax; y1++) {
|
||||
float *rf= rectf;
|
||||
float srgb[3];
|
||||
char *rc= rectc;
|
||||
const float dither = ibuf->dither / 255.0f;
|
||||
for(y1= 0; y1<ymax; y1++) {
|
||||
float *rf= rectf;
|
||||
float srgb[3];
|
||||
char *rc= rectc;
|
||||
const float dither = ibuf->dither / 255.0f;
|
||||
|
||||
/* XXX temp. because crop offset */
|
||||
if( rectc >= (char *)(ibuf->rect)) {
|
||||
for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
|
||||
/* XXX temp. because crop offset */
|
||||
if(rectc >= (char *)(ibuf->rect)) {
|
||||
for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
|
||||
/* color management */
|
||||
if(do_color_management) {
|
||||
srgb[0]= linearrgb_to_srgb(rf[0]);
|
||||
srgb[1]= linearrgb_to_srgb(rf[1]);
|
||||
srgb[2]= linearrgb_to_srgb(rf[2]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(srgb, rf);
|
||||
}
|
||||
|
||||
/* dither */
|
||||
if(dither != 0.0f) {
|
||||
const float d = (BLI_frand()-0.5f)*dither;
|
||||
srgb[0]= d + linearrgb_to_srgb(rf[0]);
|
||||
srgb[1]= d + linearrgb_to_srgb(rf[1]);
|
||||
srgb[2]= d + linearrgb_to_srgb(rf[2]);
|
||||
|
||||
rc[0]= FTOCHAR(srgb[0]);
|
||||
rc[1]= FTOCHAR(srgb[1]);
|
||||
rc[2]= FTOCHAR(srgb[2]);
|
||||
rc[3]= FTOCHAR(rf[3]);
|
||||
srgb[0] += d;
|
||||
srgb[1] += d;
|
||||
srgb[2] += d;
|
||||
}
|
||||
}
|
||||
rectf += 4*rr->rectx;
|
||||
rectc += 4*ibuf->x;
|
||||
}
|
||||
} else {
|
||||
for(y1= 0; y1<ymax; y1++) {
|
||||
float *rf= rectf;
|
||||
char *rc= rectc;
|
||||
float rgb[3];
|
||||
const float dither = ibuf->dither / 255.0f;
|
||||
|
||||
/* XXX temp. because crop offset */
|
||||
if( rectc >= (char *)(ibuf->rect)) {
|
||||
for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
|
||||
const float d = (BLI_frand()-0.5f)*dither;
|
||||
|
||||
rgb[0] = d + rf[0];
|
||||
rgb[1] = d + rf[1];
|
||||
rgb[2] = d + rf[2];
|
||||
|
||||
rc[0]= FTOCHAR(rgb[0]);
|
||||
rc[1]= FTOCHAR(rgb[1]);
|
||||
rc[2]= FTOCHAR(rgb[2]);
|
||||
rc[3]= FTOCHAR(rf[3]);
|
||||
}
|
||||
/* write */
|
||||
rc[0]= FTOCHAR(srgb[0]);
|
||||
rc[1]= FTOCHAR(srgb[1]);
|
||||
rc[2]= FTOCHAR(srgb[2]);
|
||||
rc[3]= FTOCHAR(rf[3]);
|
||||
}
|
||||
rectf += 4*rr->rectx;
|
||||
rectc += 4*ibuf->x;
|
||||
}
|
||||
}
|
||||
|
||||
rectf += 4*rr->rectx;
|
||||
rectc += 4*ibuf->x;
|
||||
}
|
||||
}
|
||||
|
||||
/* new window uses x,y to set position */
|
||||
void screen_set_image_output(bContext *C, int mx, int my)
|
||||
{
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ScrArea *sa= NULL;
|
||||
SpaceImage *sima;
|
||||
int area_was_image=0;
|
||||
|
||||
if(scene->r.displaymode==R_OUTPUT_NONE)
|
||||
return;
|
||||
|
||||
if(scene->r.displaymode==R_OUTPUT_WINDOW) {
|
||||
rcti rect;
|
||||
int sizex, sizey;
|
||||
|
||||
sizex= 10 + (scene->r.xsch*scene->r.size)/100;
|
||||
sizey= 40 + (scene->r.ysch*scene->r.size)/100;
|
||||
|
||||
/* arbitrary... miniature image window views don't make much sense */
|
||||
if(sizex < 320) sizex= 320;
|
||||
if(sizey < 256) sizey= 256;
|
||||
|
||||
/* XXX some magic to calculate postition */
|
||||
rect.xmin= mx + win->posx - sizex/2;
|
||||
rect.ymin= my + win->posy - sizey/2;
|
||||
rect.xmax= rect.xmin + sizex;
|
||||
rect.ymax= rect.ymin + sizey;
|
||||
|
||||
/* changes context! */
|
||||
WM_window_open_temp(C, &rect, WM_WINDOW_RENDER);
|
||||
|
||||
sa= CTX_wm_area(C);
|
||||
}
|
||||
else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
|
||||
if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
|
||||
area_was_image = 1;
|
||||
|
||||
/* this function returns with changed context */
|
||||
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
|
||||
sa= CTX_wm_area(C);
|
||||
}
|
||||
|
||||
if(!sa) {
|
||||
sa= find_area_showing_r_result(C, &win);
|
||||
if(sa==NULL)
|
||||
sa= find_area_image_empty(C);
|
||||
|
||||
/* if area found in other window, we make that one show in front */
|
||||
if(win && win!=CTX_wm_window(C))
|
||||
wm_window_raise(win);
|
||||
|
||||
if(sa==NULL) {
|
||||
/* find largest open non-image area */
|
||||
sa= biggest_non_image_area(C);
|
||||
if(sa) {
|
||||
ED_area_newspace(C, sa, SPACE_IMAGE);
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* makes ESC go back to prev space */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
}
|
||||
else {
|
||||
/* use any area of decent size */
|
||||
sa= biggest_area(C);
|
||||
if(sa->spacetype!=SPACE_IMAGE) {
|
||||
// XXX newspace(sa, SPACE_IMAGE);
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* makes ESC go back to prev space */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* get the correct image, and scale it */
|
||||
sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
|
||||
|
||||
|
||||
/* if we're rendering to full screen, set appropriate hints on image editor
|
||||
* so it can restore properly on pressing esc */
|
||||
if(sa->full) {
|
||||
sima->flag |= SI_FULLWINDOW;
|
||||
|
||||
/* Tell the image editor to revert to previous space in space list on close
|
||||
* _only_ if it wasn't already an image editor when the render was invoked */
|
||||
if (area_was_image == 0)
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
else {
|
||||
/* Leave it alone so the image editor will just go back from
|
||||
* full screen to the original tiled setup */
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ****************************** render invoking ***************** */
|
||||
|
||||
/* set callbacks, exported to sequence render too.
|
||||
Only call in foreground (UI) renders. */
|
||||
|
||||
/* returns biggest area that is not uv/image editor. Note that it uses buttons */
|
||||
/* window as the last possible alternative. */
|
||||
static ScrArea *biggest_non_image_area(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa, *big= NULL;
|
||||
int size, maxsize= 0, bwmaxsize= 0;
|
||||
short foundwin= 0;
|
||||
|
||||
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->winx > 30 && sa->winy > 30) {
|
||||
size= sa->winx*sa->winy;
|
||||
if(sa->spacetype == SPACE_BUTS) {
|
||||
if(foundwin == 0 && size > bwmaxsize) {
|
||||
bwmaxsize= size;
|
||||
big= sa;
|
||||
}
|
||||
}
|
||||
else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
|
||||
maxsize= size;
|
||||
big= sa;
|
||||
foundwin= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return big;
|
||||
}
|
||||
|
||||
static ScrArea *biggest_area(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa, *big= NULL;
|
||||
int size, maxsize= 0;
|
||||
|
||||
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
||||
size= sa->winx*sa->winy;
|
||||
if(size > maxsize) {
|
||||
maxsize= size;
|
||||
big= sa;
|
||||
}
|
||||
}
|
||||
return big;
|
||||
}
|
||||
|
||||
|
||||
static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
ScrArea *sa = NULL;
|
||||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for(*win=wm->windows.first; *win; *win= (*win)->next) {
|
||||
for(sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_IMAGE) {
|
||||
sima= sa->spacedata.first;
|
||||
if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sa)
|
||||
break;
|
||||
}
|
||||
|
||||
return sa;
|
||||
}
|
||||
|
||||
static ScrArea *find_area_image_empty(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa;
|
||||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for(sa=sc->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_IMAGE) {
|
||||
sima= sa->spacedata.first;
|
||||
if(!sima->image)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sa;
|
||||
}
|
||||
|
||||
#if 0 // XXX not used
|
||||
static ScrArea *find_empty_image_area(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa;
|
||||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for(sa=sc->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_IMAGE) {
|
||||
sima= sa->spacedata.first;
|
||||
if(!sima->image)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sa;
|
||||
}
|
||||
#endif // XXX not used
|
||||
|
||||
static void render_error_reports(void *reports, const char *str)
|
||||
{
|
||||
BKE_report(reports, RPT_ERROR, str);
|
||||
@@ -428,10 +212,6 @@ static int screen_render_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if(re==NULL) {
|
||||
re= RE_NewRender(scene->id.name);
|
||||
}
|
||||
|
||||
G.afbreek= 0;
|
||||
RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
|
||||
RE_error_cb(re, op->reports, render_error_reports);
|
||||
@@ -558,7 +338,7 @@ static void render_progress_update(void *rjv, float progress)
|
||||
{
|
||||
RenderJob *rj= rjv;
|
||||
|
||||
if (rj->progress)
|
||||
if(rj->progress)
|
||||
*rj->progress = progress;
|
||||
}
|
||||
|
||||
@@ -731,7 +511,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
// store spare
|
||||
|
||||
/* ensure at least 1 area shows result */
|
||||
screen_set_image_output(C, event->x, event->y);
|
||||
render_view_open(C, event->x, event->y);
|
||||
|
||||
jobflag= WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS;
|
||||
|
||||
@@ -835,119 +615,3 @@ void RENDER_OT_render(wmOperatorType *ot)
|
||||
RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene", "Re-render single layer in this scene");
|
||||
}
|
||||
|
||||
/* ****************************** opengl render *************************** */
|
||||
|
||||
|
||||
/* *********************** cancel render viewer *************** */
|
||||
|
||||
static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
SpaceImage *sima= sa->spacedata.first;
|
||||
|
||||
/* test if we have a temp screen in front */
|
||||
if(CTX_wm_window(C)->screen->temp) {
|
||||
wm_window_lower(CTX_wm_window(C));
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* determine if render already shows */
|
||||
else if(sima->flag & SI_PREVSPACE) {
|
||||
sima->flag &= ~SI_PREVSPACE;
|
||||
|
||||
if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_prevspace(C, sa);
|
||||
}
|
||||
else
|
||||
ED_area_prevspace(C, sa);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_toggle(C, win, sa);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
void RENDER_OT_view_cancel(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Cancel Render View";
|
||||
ot->description= "Cancel show render view";
|
||||
ot->idname= "RENDER_OT_view_cancel";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= render_view_cancel_exec;
|
||||
ot->poll= ED_operator_image_active;
|
||||
}
|
||||
|
||||
/* *********************** show render viewer *************** */
|
||||
|
||||
static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
{
|
||||
wmWindow *wincur = CTX_wm_window(C);
|
||||
|
||||
/* test if we have currently a temp screen active */
|
||||
if(wincur->screen->temp) {
|
||||
wm_window_lower(wincur);
|
||||
}
|
||||
else {
|
||||
wmWindow *win, *winshow;
|
||||
ScrArea *sa= find_area_showing_r_result(C, &winshow);
|
||||
|
||||
/* is there another window showing result? */
|
||||
for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
|
||||
if(win->screen->temp || (win==winshow && winshow!=wincur)) {
|
||||
wm_window_raise(win);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
/* determine if render already shows */
|
||||
if(sa) {
|
||||
/* but don't close it when rendering */
|
||||
if(!G.rendering) {
|
||||
SpaceImage *sima= sa->spacedata.first;
|
||||
|
||||
if(sima->flag & SI_PREVSPACE) {
|
||||
sima->flag &= ~SI_PREVSPACE;
|
||||
|
||||
if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_prevspace(C, sa);
|
||||
}
|
||||
else if(sima->next) {
|
||||
/* workaround for case of double prevspace, render window
|
||||
with a file browser on top of it (same as in ED_area_prevspace) */
|
||||
if(sima->next->spacetype == SPACE_FILE && sima->next->next)
|
||||
ED_area_newspace(C, sa, sima->next->next->spacetype);
|
||||
else
|
||||
ED_area_newspace(C, sa, sima->next->spacetype);
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
screen_set_image_output(C, event->x, event->y);
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void RENDER_OT_view_show(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Show/Hide Render View";
|
||||
ot->description= "Toggle show render view";
|
||||
ot->idname= "RENDER_OT_view_show";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= render_view_show_invoke;
|
||||
ot->poll= ED_operator_screenactive;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *eve
|
||||
}
|
||||
|
||||
oglrender= op->customdata;
|
||||
screen_set_image_output(C, event->x, event->y);
|
||||
render_view_open(C, event->x, event->y);
|
||||
|
||||
WM_event_add_modal_handler(C, op);
|
||||
oglrender->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
|
||||
|
||||
@@ -97,15 +97,6 @@
|
||||
|
||||
#include "render_intern.h"
|
||||
|
||||
#define PR_XMIN 10
|
||||
#define PR_YMIN 5
|
||||
#define PR_XMAX 200
|
||||
#define PR_YMAX 195
|
||||
|
||||
/* XXX */
|
||||
static int qtest(void) {return 0;}
|
||||
/* XXX */
|
||||
|
||||
ImBuf* get_brush_icon(Brush *brush)
|
||||
{
|
||||
static const int flags = IB_rect|IB_multilayer|IB_metadata;
|
||||
@@ -170,123 +161,6 @@ typedef struct ShaderPreview {
|
||||
|
||||
} ShaderPreview;
|
||||
|
||||
|
||||
|
||||
/* unused now */
|
||||
void draw_tex_crop(Tex *tex)
|
||||
{
|
||||
rcti rct;
|
||||
int ret= 0;
|
||||
|
||||
if(tex==NULL) return;
|
||||
|
||||
if(tex->type==TEX_IMAGE) {
|
||||
if(tex->cropxmin==0.0f) ret++;
|
||||
if(tex->cropymin==0.0f) ret++;
|
||||
if(tex->cropxmax==1.0f) ret++;
|
||||
if(tex->cropymax==1.0f) ret++;
|
||||
if(ret==4) return;
|
||||
|
||||
rct.xmin= PR_XMIN+2+tex->cropxmin*(PR_XMAX-PR_XMIN-4);
|
||||
rct.xmax= PR_XMIN+2+tex->cropxmax*(PR_XMAX-PR_XMIN-4);
|
||||
rct.ymin= PR_YMIN+2+tex->cropymin*(PR_YMAX-PR_YMIN-4);
|
||||
rct.ymax= PR_YMIN+2+tex->cropymax*(PR_YMAX-PR_YMIN-4);
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
glColor3ub(0, 0, 0);
|
||||
glRecti(rct.xmin+1, rct.ymin-1, rct.xmax+1, rct.ymax-1);
|
||||
|
||||
glColor3ub(255, 255, 255);
|
||||
glRecti(rct.xmin, rct.ymin, rct.xmax, rct.ymax);
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* temporal abuse; if id_code is -1 it only does texture.... solve! */
|
||||
void BIF_preview_changed(short UNUSED(id_code))
|
||||
{
|
||||
#if 0
|
||||
ScrArea *sa;
|
||||
|
||||
for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_BUTS) {
|
||||
SpaceButs *sbuts= sa->spacedata.first;
|
||||
if(sbuts->mainb==CONTEXT_SHADING) {
|
||||
int tab= sbuts->tab[CONTEXT_SHADING];
|
||||
if(tab==TAB_SHADING_MAT && (id_code==ID_MA || id_code==ID_TE)) {
|
||||
if (sbuts->ri) sbuts->ri->curtile= 0;
|
||||
addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
else if(tab==TAB_SHADING_TEX && (id_code==ID_TE || id_code==-1)) {
|
||||
if (sbuts->ri) sbuts->ri->curtile= 0;
|
||||
addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
else if(tab==TAB_SHADING_LAMP && (id_code==ID_LA || id_code==ID_TE)) {
|
||||
if (sbuts->ri) sbuts->ri->curtile= 0;
|
||||
addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
else if(tab==TAB_SHADING_WORLD && (id_code==ID_WO || id_code==ID_TE)) {
|
||||
if (sbuts->ri) sbuts->ri->curtile= 0;
|
||||
addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
}
|
||||
else if (sbuts->ri)
|
||||
sbuts->ri->curtile= 0; /* ensure changes always result in re-render when context is restored */
|
||||
}
|
||||
else if(sa->spacetype==SPACE_NODE) {
|
||||
SpaceNode *snode= sa->spacedata.first;
|
||||
if(snode->treetype==NTREE_SHADER && (id_code==ID_MA || id_code==ID_TE)) {
|
||||
snode_tag_dirty(snode);
|
||||
}
|
||||
}
|
||||
else if(sa->spacetype==SPACE_VIEW3D) {
|
||||
View3D *vd= sa->spacedata.first;
|
||||
/* if is has a renderinfo, we consider that reason for signalling */
|
||||
if (vd->ri) {
|
||||
vd->ri->curtile= 0;
|
||||
addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ELEM4(id_code, ID_MA, ID_TE, ID_LA, ID_WO)) {
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
if(id_code == ID_WO) {
|
||||
for(ma=G.main->mat.first; ma; ma=ma->id.next) {
|
||||
if(ma->gpumaterial.first) {
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(id_code == ID_LA) {
|
||||
for(ob=G.main->object.first; ob; ob=ob->id.next) {
|
||||
if(ob->gpulamp.first) {
|
||||
GPU_lamp_free(ob);
|
||||
}
|
||||
}
|
||||
|
||||
for(ma=G.main->mat.first; ma; ma=ma->id.next) {
|
||||
if(ma->gpumaterial.first) {
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
}
|
||||
} else if(OBACT) {
|
||||
Object *ob = OBACT;
|
||||
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
if(ma && ma->gpumaterial.first) {
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* *************************** Preview for buttons *********************** */
|
||||
|
||||
static Main *pr_main= NULL;
|
||||
@@ -636,321 +510,6 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************************** Icon Preview **************************** */
|
||||
|
||||
void ED_preview_icon_draw(const bContext *UNUSED(C), void *UNUSED(idp), void *UNUSED(arg1), void *UNUSED(arg2), rcti *UNUSED(rect))
|
||||
{
|
||||
}
|
||||
|
||||
/* *************************** Preview for 3d window *********************** */
|
||||
|
||||
void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect)
|
||||
{
|
||||
// ScrArea *sa= NULL; // XXX
|
||||
// View3D *v3d= NULL; // XXX
|
||||
RenderLayer *rl;
|
||||
int ofsx=0, ofsy=0;
|
||||
|
||||
if(renrect) return;
|
||||
|
||||
rl= rr->layers.first;
|
||||
|
||||
/* this case is when we render envmaps... */
|
||||
// if(rr->rectx > v3d->ri->pr_rectx || rr->recty > v3d->ri->pr_recty)
|
||||
// return;
|
||||
|
||||
// ofsx= v3d->ri->disprect.xmin + rr->tilerect.xmin;
|
||||
// ofsy= v3d->ri->disprect.ymin + rr->tilerect.ymin;
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
// glaDefine2DArea(&sa->winrct);
|
||||
glaDrawPixelsSafe_to32(ofsx, ofsy, rr->rectx, rr->recty, rr->rectx, rl->rectf, 0);
|
||||
bglFlush();
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
}
|
||||
|
||||
void BIF_view3d_previewrender_signal(ScrArea *UNUSED(sa), short UNUSED(signal))
|
||||
{
|
||||
#if 0
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
|
||||
/* this can be called from other window... solve! */
|
||||
if(sa->spacetype!=SPACE_VIEW3D)
|
||||
return; // XXX
|
||||
|
||||
if(v3d && v3d->ri) {
|
||||
RenderInfo *ri= v3d->ri;
|
||||
ri->status &= ~signal;
|
||||
ri->curtile= 0;
|
||||
//printf("preview signal %d\n", signal);
|
||||
if(ri->re && (signal & PR_DBASE))
|
||||
RE_Database_Free(ri->re);
|
||||
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BIF_view3d_previewrender_free(View3D *UNUSED(v3d))
|
||||
{
|
||||
#if 0
|
||||
if(v3d->ri) {
|
||||
RenderInfo *ri= v3d->ri;
|
||||
if(ri->re) {
|
||||
// printf("free render\n");
|
||||
RE_Database_Free(ri->re);
|
||||
RE_FreeRender(ri->re);
|
||||
ri->re= NULL;
|
||||
}
|
||||
if (v3d->ri->rect) MEM_freeN(v3d->ri->rect);
|
||||
MEM_freeN(v3d->ri);
|
||||
v3d->ri= NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* returns 1 if OK, do not call while in panel space! */
|
||||
static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderInfo *ri, float *clipsta, float *clipend, int *ortho, float *pixsize)
|
||||
{
|
||||
View3D *v3d= NULL; // XXX
|
||||
RegionView3D *rv3d= NULL; // XXX
|
||||
int rectx, recty;
|
||||
// uiBlock *block;
|
||||
|
||||
// block= uiFindOpenPanelBlockName(&sa->uiblocks, "Preview");
|
||||
// if(block==NULL) return 0;
|
||||
|
||||
/* calculate preview rect size */
|
||||
// BLI_init_rctf(viewplane, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
|
||||
// uiPanelPush(block);
|
||||
// ui_graphics_to_window_rct(sa->win, viewplane, &ri->disprect);
|
||||
// uiPanelPop(block);
|
||||
|
||||
/* correction for gla draw */
|
||||
// BLI_translate_rcti(&ri->disprect, -sa->winrct.xmin, -sa->winrct.ymin);
|
||||
|
||||
*ortho= get_view3d_viewplane(v3d, rv3d, sa->winx, sa->winy, viewplane, clipsta, clipend, pixsize);
|
||||
|
||||
rectx= ri->disprect.xmax - ri->disprect.xmin;
|
||||
recty= ri->disprect.ymax - ri->disprect.ymin;
|
||||
|
||||
if(rectx<4 || recty<4) return 0;
|
||||
|
||||
if(ri->rect && (rectx!=ri->pr_rectx || recty!=ri->pr_recty)) {
|
||||
MEM_freeN(ri->rect);
|
||||
ri->rect= NULL;
|
||||
ri->curtile= 0;
|
||||
printf("changed size\n");
|
||||
}
|
||||
ri->pr_rectx= rectx;
|
||||
ri->pr_recty= recty;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* called before a panel gets moved/scaled, makes sure we can see through */
|
||||
void BIF_view3d_previewrender_clear(ScrArea *UNUSED(sa))
|
||||
{
|
||||
#if 0
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
|
||||
if(v3d->ri) {
|
||||
RenderInfo *ri= v3d->ri;
|
||||
ri->curtile= 0;
|
||||
if(ri->rect)
|
||||
MEM_freeN(ri->rect);
|
||||
ri->rect= NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* afterqueue call */
|
||||
void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa)
|
||||
{
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
RegionView3D *rv3d= NULL; // XXX
|
||||
Render *re;
|
||||
RenderInfo *ri=NULL; /* preview struct! */
|
||||
RenderStats *rstats;
|
||||
RenderData rdata;
|
||||
rctf viewplane;
|
||||
float clipsta, clipend, pixsize;
|
||||
int orth;
|
||||
|
||||
/* first get the render info right */
|
||||
// if (!v3d->ri) {
|
||||
// ri= v3d->ri= MEM_callocN(sizeof(RenderInfo), "butsrenderinfo");
|
||||
// ri->tottile= 10000;
|
||||
// }
|
||||
// ri= v3d->ri;
|
||||
|
||||
if(0==view3d_previewrender_get_rects(sa, &viewplane, ri, &clipsta, &clipend, &orth, &pixsize))
|
||||
return;
|
||||
|
||||
/* render is finished, so return */
|
||||
if(ri->tottile && ri->curtile>=ri->tottile) return;
|
||||
|
||||
/* or return with a new event */
|
||||
if(qtest()) {
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
return;
|
||||
}
|
||||
//printf("Enter previewrender\n");
|
||||
/* ok, are we rendering all over? */
|
||||
if(ri->re==NULL) {
|
||||
char name[32];
|
||||
|
||||
ri->status= 0;
|
||||
|
||||
sprintf(name, "View3dPreview %p", (void *)sa);
|
||||
re= ri->re= RE_NewRender(name);
|
||||
//RE_display_draw_cb(re, view3d_previewrender_progress);
|
||||
//RE_stats_draw_cb(re, view3d_previewrender_stats);
|
||||
//RE_test_break_cb(re, qtest);
|
||||
|
||||
/* no osa, blur, seq, layers, etc for preview render */
|
||||
rdata= scene->r;
|
||||
rdata.mode &= ~(R_OSA|R_MBLUR);
|
||||
rdata.scemode &= ~(R_DOSEQ|R_DOCOMP|R_FREE_IMAGE);
|
||||
rdata.layers.first= rdata.layers.last= NULL;
|
||||
rdata.renderer= R_INTERN;
|
||||
|
||||
RE_InitState(re, NULL, &rdata, NULL, sa->winx, sa->winy, &ri->disprect);
|
||||
|
||||
if(orth)
|
||||
RE_SetOrtho(re, &viewplane, clipsta, clipend);
|
||||
else
|
||||
RE_SetWindow(re, &viewplane, clipsta, clipend);
|
||||
RE_SetPixelSize(re, pixsize);
|
||||
|
||||
/* until here are no escapes */
|
||||
ri->status |= PR_DISPRECT;
|
||||
ri->curtile= 0;
|
||||
//printf("new render\n");
|
||||
}
|
||||
|
||||
re= ri->re;
|
||||
|
||||
PIL_sleep_ms(100); /* wait 0.1 second if theres really no event... */
|
||||
if(qtest()==0) {
|
||||
|
||||
/* check status */
|
||||
if((ri->status & PR_DISPRECT)==0) {
|
||||
RE_SetDispRect(ri->re, &ri->disprect);
|
||||
if(orth)
|
||||
RE_SetOrtho(ri->re, &viewplane, clipsta, clipend);
|
||||
else
|
||||
RE_SetWindow(ri->re, &viewplane, clipsta, clipend);
|
||||
RE_SetPixelSize(re, pixsize);
|
||||
ri->status |= PR_DISPRECT;
|
||||
ri->curtile= 0;
|
||||
//printf("disprect update\n");
|
||||
}
|
||||
if((ri->status & PR_DBASE)==0) {
|
||||
unsigned int lay= scene->lay;
|
||||
|
||||
RE_SetView(re, rv3d->viewmat);
|
||||
|
||||
/* allow localview render for objects with lights in normal layers */
|
||||
if(v3d->lay & 0xFF000000)
|
||||
lay |= v3d->lay;
|
||||
else lay= v3d->lay;
|
||||
|
||||
RE_Database_FromScene(re, bmain, scene, lay, 0); // 0= dont use camera view
|
||||
|
||||
rstats= RE_GetStats(re);
|
||||
if(rstats->convertdone)
|
||||
ri->status |= PR_DBASE|PR_PROJECTED|PR_ROTATED;
|
||||
ri->curtile= 0;
|
||||
|
||||
/* database can have created render-resol data... */
|
||||
if(rstats->convertdone)
|
||||
DAG_scene_flush_update(bmain, scene, scene->lay, 0);
|
||||
|
||||
//printf("dbase update\n");
|
||||
}
|
||||
if((ri->status & PR_PROJECTED)==0) {
|
||||
if(ri->status & PR_DBASE) {
|
||||
if(orth)
|
||||
RE_SetOrtho(ri->re, &viewplane, clipsta, clipend);
|
||||
else
|
||||
RE_SetWindow(ri->re, &viewplane, clipsta, clipend);
|
||||
RE_DataBase_ApplyWindow(re);
|
||||
ri->status |= PR_PROJECTED;
|
||||
}
|
||||
ri->curtile= 0;
|
||||
//printf("project update\n");
|
||||
}
|
||||
|
||||
/* OK, can we enter render code? */
|
||||
if(ri->status==(PR_DISPRECT|PR_DBASE|PR_PROJECTED|PR_ROTATED)) {
|
||||
//printf("curtile %d tottile %d\n", ri->curtile, ri->tottile);
|
||||
RE_TileProcessor(ri->re); //, ri->curtile, 0);
|
||||
|
||||
if(ri->rect==NULL)
|
||||
ri->rect= MEM_mallocN(sizeof(int)*ri->pr_rectx*ri->pr_recty, "preview view3d rect");
|
||||
|
||||
RE_ResultGet32(ri->re, ri->rect);
|
||||
}
|
||||
|
||||
rstats= RE_GetStats(ri->re);
|
||||
// if(rstats->totpart==rstats->partsdone && rstats->partsdone)
|
||||
// addqueue(sa->win, REDRAW, 1);
|
||||
// else
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
|
||||
ri->curtile= rstats->partsdone;
|
||||
ri->tottile= rstats->totpart;
|
||||
}
|
||||
else {
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
}
|
||||
|
||||
//printf("\n");
|
||||
}
|
||||
|
||||
/* in panel space! */
|
||||
static void view3d_previewdraw_rect(ScrArea *UNUSED(sa), uiBlock *UNUSED(block), RenderInfo *ri)
|
||||
{
|
||||
// rctf dispf;
|
||||
|
||||
if(ri->rect==NULL)
|
||||
return;
|
||||
|
||||
// BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
|
||||
// ui_graphics_to_window_rct(sa->win, &dispf, &ri->disprect);
|
||||
|
||||
/* correction for gla draw */
|
||||
// BLI_translate_rcti(&ri->disprect, -sa->winrct.xmin, -sa->winrct.ymin);
|
||||
|
||||
/* when panel scale changed, free rect */
|
||||
if(ri->disprect.xmax-ri->disprect.xmin != ri->pr_rectx ||
|
||||
ri->disprect.ymax-ri->disprect.ymin != ri->pr_recty) {
|
||||
MEM_freeN(ri->rect);
|
||||
ri->rect= NULL;
|
||||
}
|
||||
else {
|
||||
// glaDefine2DArea(&sa->winrct);
|
||||
glaDrawPixelsSafe(ri->disprect.xmin, ri->disprect.ymin, ri->pr_rectx, ri->pr_recty, ri->pr_rectx, GL_RGBA, GL_UNSIGNED_BYTE, ri->rect);
|
||||
}
|
||||
}
|
||||
|
||||
/* is panel callback, supposed to be called with correct panel offset matrix */
|
||||
void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block)
|
||||
{
|
||||
RegionView3D *rv3d= NULL;
|
||||
|
||||
// if (v3d->ri==NULL || v3d->ri->rect==NULL)
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
// else {
|
||||
view3d_previewdraw_rect(sa, block, rv3d->ri);
|
||||
// if(v3d->ri->curtile==0)
|
||||
// addafterqueue(sa->win, RENDERPREVIEW, 1);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/* **************************** new shader preview system ****************** */
|
||||
|
||||
/* inside thread, called by renderer, sets job update value */
|
||||
|
||||
@@ -87,180 +87,6 @@
|
||||
|
||||
#include "render_intern.h" // own include
|
||||
|
||||
/***************************** Updates ***********************************
|
||||
* ED_render_id_flush_update gets called from DAG_id_tag_update, to do *
|
||||
* editor level updates when the ID changes. when these ID blocks are in *
|
||||
* the dependency graph, we can get rid of the manual dependency checks */
|
||||
|
||||
static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
|
||||
{
|
||||
int a;
|
||||
|
||||
if(!mtex)
|
||||
return 0;
|
||||
|
||||
for(a=0; a<tot; a++)
|
||||
if(mtex[a] && mtex[a]->tex == tex)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for(node=ntree->nodes.first; node; node= node->next) {
|
||||
if(node->id) {
|
||||
if(node->id == (ID*)tex) {
|
||||
return 1;
|
||||
}
|
||||
else if(node->type==NODE_GROUP) {
|
||||
if(nodes_use_tex((bNodeTree *)node->id, tex))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void material_changed(Main *UNUSED(bmain), Material *ma)
|
||||
{
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
/* glsl */
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void texture_changed(Main *bmain, Tex *tex)
|
||||
{
|
||||
Material *ma;
|
||||
Lamp *la;
|
||||
World *wo;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&tex->id));
|
||||
|
||||
/* find materials */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next) {
|
||||
if(mtex_use_tex(ma->mtex, MAX_MTEX, tex));
|
||||
else if(ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
/* find lamps */
|
||||
for(la=bmain->lamp.first; la; la=la->id.next) {
|
||||
if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
}
|
||||
|
||||
/* find worlds */
|
||||
for(wo=bmain->world.first; wo; wo=wo->id.next) {
|
||||
if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
}
|
||||
}
|
||||
|
||||
static void lamp_changed(Main *bmain, Lamp *la)
|
||||
{
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
|
||||
/* glsl */
|
||||
for(ob=bmain->object.first; ob; ob=ob->id.next)
|
||||
if(ob->data == la && ob->gpulamp.first)
|
||||
GPU_lamp_free(ob);
|
||||
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void world_changed(Main *bmain, World *wo)
|
||||
{
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
|
||||
/* glsl */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void image_changed(Main *bmain, Image *ima)
|
||||
{
|
||||
Tex *tex;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&ima->id));
|
||||
|
||||
/* textures */
|
||||
for(tex=bmain->tex.first; tex; tex=tex->id.next)
|
||||
if(tex->ima == ima)
|
||||
texture_changed(bmain, tex);
|
||||
}
|
||||
|
||||
static void scene_changed(Main *bmain, Scene *UNUSED(scene))
|
||||
{
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
/* glsl */
|
||||
for(ob=bmain->object.first; ob; ob=ob->id.next)
|
||||
if(ob->gpulamp.first)
|
||||
GPU_lamp_free(ob);
|
||||
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
void ED_render_id_flush_update(Main *bmain, ID *id)
|
||||
{
|
||||
if(!id)
|
||||
return;
|
||||
|
||||
switch(GS(id->name)) {
|
||||
case ID_MA:
|
||||
material_changed(bmain, (Material*)id);
|
||||
break;
|
||||
case ID_TE:
|
||||
texture_changed(bmain, (Tex*)id);
|
||||
break;
|
||||
case ID_WO:
|
||||
world_changed(bmain, (World*)id);
|
||||
break;
|
||||
case ID_LA:
|
||||
lamp_changed(bmain, (Lamp*)id);
|
||||
break;
|
||||
case ID_IM:
|
||||
image_changed(bmain, (Image*)id);
|
||||
break;
|
||||
case ID_SCE:
|
||||
scene_changed(bmain, (Scene*)id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/********************** material slot operators *********************/
|
||||
|
||||
static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
@@ -1259,3 +1085,4 @@ void TEXTURE_OT_slot_paste(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
238
source/blender/editors/render/render_update.c
Normal file
238
source/blender/editors/render/render_update.c
Normal file
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/editors/render/render_shading.c
|
||||
* \ingroup edrend
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_icons.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "render_intern.h" // own include
|
||||
|
||||
/***************************** Updates ***********************************
|
||||
* ED_render_id_flush_update gets called from DAG_id_tag_update, to do *
|
||||
* editor level updates when the ID changes. when these ID blocks are in *
|
||||
* the dependency graph, we can get rid of the manual dependency checks */
|
||||
|
||||
static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
|
||||
{
|
||||
int a;
|
||||
|
||||
if(!mtex)
|
||||
return 0;
|
||||
|
||||
for(a=0; a<tot; a++)
|
||||
if(mtex[a] && mtex[a]->tex == tex)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for(node=ntree->nodes.first; node; node= node->next) {
|
||||
if(node->id) {
|
||||
if(node->id == (ID*)tex) {
|
||||
return 1;
|
||||
}
|
||||
else if(node->type==NODE_GROUP) {
|
||||
if(nodes_use_tex((bNodeTree *)node->id, tex))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void material_changed(Main *UNUSED(bmain), Material *ma)
|
||||
{
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
/* glsl */
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void texture_changed(Main *bmain, Tex *tex)
|
||||
{
|
||||
Material *ma;
|
||||
Lamp *la;
|
||||
World *wo;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&tex->id));
|
||||
|
||||
/* find materials */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next) {
|
||||
if(mtex_use_tex(ma->mtex, MAX_MTEX, tex));
|
||||
else if(ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
/* find lamps */
|
||||
for(la=bmain->lamp.first; la; la=la->id.next) {
|
||||
if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
}
|
||||
|
||||
/* find worlds */
|
||||
for(wo=bmain->world.first; wo; wo=wo->id.next) {
|
||||
if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
}
|
||||
}
|
||||
|
||||
static void lamp_changed(Main *bmain, Lamp *la)
|
||||
{
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
|
||||
/* glsl */
|
||||
for(ob=bmain->object.first; ob; ob=ob->id.next)
|
||||
if(ob->data == la && ob->gpulamp.first)
|
||||
GPU_lamp_free(ob);
|
||||
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void world_changed(Main *bmain, World *wo)
|
||||
{
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
|
||||
/* glsl */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void image_changed(Main *bmain, Image *ima)
|
||||
{
|
||||
Tex *tex;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&ima->id));
|
||||
|
||||
/* textures */
|
||||
for(tex=bmain->tex.first; tex; tex=tex->id.next)
|
||||
if(tex->ima == ima)
|
||||
texture_changed(bmain, tex);
|
||||
}
|
||||
|
||||
static void scene_changed(Main *bmain, Scene *UNUSED(scene))
|
||||
{
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
/* glsl */
|
||||
for(ob=bmain->object.first; ob; ob=ob->id.next)
|
||||
if(ob->gpulamp.first)
|
||||
GPU_lamp_free(ob);
|
||||
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
void ED_render_id_flush_update(Main *bmain, ID *id)
|
||||
{
|
||||
if(!id)
|
||||
return;
|
||||
|
||||
switch(GS(id->name)) {
|
||||
case ID_MA:
|
||||
material_changed(bmain, (Material*)id);
|
||||
break;
|
||||
case ID_TE:
|
||||
texture_changed(bmain, (Tex*)id);
|
||||
break;
|
||||
case ID_WO:
|
||||
world_changed(bmain, (World*)id);
|
||||
break;
|
||||
case ID_LA:
|
||||
lamp_changed(bmain, (Lamp*)id);
|
||||
break;
|
||||
case ID_IM:
|
||||
image_changed(bmain, (Image*)id);
|
||||
break;
|
||||
case ID_SCE:
|
||||
scene_changed(bmain, (Scene*)id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
359
source/blender/editors/render/render_view.c
Normal file
359
source/blender/editors/render/render_view.c
Normal file
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/editors/render/render_view.c
|
||||
* \ingroup edrend
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "wm_window.h"
|
||||
|
||||
#include "render_intern.h"
|
||||
|
||||
/*********************** utilities for finding areas *************************/
|
||||
|
||||
/* returns biggest area that is not uv/image editor. Note that it uses buttons */
|
||||
/* window as the last possible alternative. */
|
||||
static ScrArea *biggest_non_image_area(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa, *big= NULL;
|
||||
int size, maxsize= 0, bwmaxsize= 0;
|
||||
short foundwin= 0;
|
||||
|
||||
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->winx > 30 && sa->winy > 30) {
|
||||
size= sa->winx*sa->winy;
|
||||
if(sa->spacetype == SPACE_BUTS) {
|
||||
if(foundwin == 0 && size > bwmaxsize) {
|
||||
bwmaxsize= size;
|
||||
big= sa;
|
||||
}
|
||||
}
|
||||
else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
|
||||
maxsize= size;
|
||||
big= sa;
|
||||
foundwin= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return big;
|
||||
}
|
||||
|
||||
static ScrArea *biggest_area(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa, *big= NULL;
|
||||
int size, maxsize= 0;
|
||||
|
||||
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
||||
size= sa->winx*sa->winy;
|
||||
if(size > maxsize) {
|
||||
maxsize= size;
|
||||
big= sa;
|
||||
}
|
||||
}
|
||||
return big;
|
||||
}
|
||||
|
||||
static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
ScrArea *sa = NULL;
|
||||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for(*win=wm->windows.first; *win; *win= (*win)->next) {
|
||||
for(sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_IMAGE) {
|
||||
sima= sa->spacedata.first;
|
||||
if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sa)
|
||||
break;
|
||||
}
|
||||
|
||||
return sa;
|
||||
}
|
||||
|
||||
static ScrArea *find_area_image_empty(bContext *C)
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
ScrArea *sa;
|
||||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for(sa=sc->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->spacetype==SPACE_IMAGE) {
|
||||
sima= sa->spacedata.first;
|
||||
if(!sima->image)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return sa;
|
||||
}
|
||||
|
||||
/********************** open image editor for render *************************/
|
||||
|
||||
/* new window uses x,y to set position */
|
||||
void render_view_open(bContext *C, int mx, int my)
|
||||
{
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ScrArea *sa= NULL;
|
||||
SpaceImage *sima;
|
||||
int area_was_image=0;
|
||||
|
||||
if(scene->r.displaymode==R_OUTPUT_NONE)
|
||||
return;
|
||||
|
||||
if(scene->r.displaymode==R_OUTPUT_WINDOW) {
|
||||
rcti rect;
|
||||
int sizex, sizey;
|
||||
|
||||
sizex= 10 + (scene->r.xsch*scene->r.size)/100;
|
||||
sizey= 40 + (scene->r.ysch*scene->r.size)/100;
|
||||
|
||||
/* arbitrary... miniature image window views don't make much sense */
|
||||
if(sizex < 320) sizex= 320;
|
||||
if(sizey < 256) sizey= 256;
|
||||
|
||||
/* XXX some magic to calculate postition */
|
||||
rect.xmin= mx + win->posx - sizex/2;
|
||||
rect.ymin= my + win->posy - sizey/2;
|
||||
rect.xmax= rect.xmin + sizex;
|
||||
rect.ymax= rect.ymin + sizey;
|
||||
|
||||
/* changes context! */
|
||||
WM_window_open_temp(C, &rect, WM_WINDOW_RENDER);
|
||||
|
||||
sa= CTX_wm_area(C);
|
||||
}
|
||||
else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
|
||||
if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
|
||||
area_was_image = 1;
|
||||
|
||||
/* this function returns with changed context */
|
||||
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
|
||||
sa= CTX_wm_area(C);
|
||||
}
|
||||
|
||||
if(!sa) {
|
||||
sa= find_area_showing_r_result(C, &win);
|
||||
if(sa==NULL)
|
||||
sa= find_area_image_empty(C);
|
||||
|
||||
/* if area found in other window, we make that one show in front */
|
||||
if(win && win!=CTX_wm_window(C))
|
||||
wm_window_raise(win);
|
||||
|
||||
if(sa==NULL) {
|
||||
/* find largest open non-image area */
|
||||
sa= biggest_non_image_area(C);
|
||||
if(sa) {
|
||||
ED_area_newspace(C, sa, SPACE_IMAGE);
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* makes ESC go back to prev space */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
}
|
||||
else {
|
||||
/* use any area of decent size */
|
||||
sa= biggest_area(C);
|
||||
if(sa->spacetype!=SPACE_IMAGE) {
|
||||
// XXX newspace(sa, SPACE_IMAGE);
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* makes ESC go back to prev space */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sima= sa->spacedata.first;
|
||||
|
||||
/* get the correct image, and scale it */
|
||||
sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
|
||||
|
||||
|
||||
/* if we're rendering to full screen, set appropriate hints on image editor
|
||||
* so it can restore properly on pressing esc */
|
||||
if(sa->full) {
|
||||
sima->flag |= SI_FULLWINDOW;
|
||||
|
||||
/* Tell the image editor to revert to previous space in space list on close
|
||||
* _only_ if it wasn't already an image editor when the render was invoked */
|
||||
if (area_was_image == 0)
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
else {
|
||||
/* Leave it alone so the image editor will just go back from
|
||||
* full screen to the original tiled setup */
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************** cancel render viewer **********************/
|
||||
|
||||
static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
SpaceImage *sima= sa->spacedata.first;
|
||||
|
||||
/* test if we have a temp screen in front */
|
||||
if(CTX_wm_window(C)->screen->temp) {
|
||||
wm_window_lower(CTX_wm_window(C));
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* determine if render already shows */
|
||||
else if(sima->flag & SI_PREVSPACE) {
|
||||
sima->flag &= ~SI_PREVSPACE;
|
||||
|
||||
if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_prevspace(C, sa);
|
||||
}
|
||||
else
|
||||
ED_area_prevspace(C, sa);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_toggle(C, win, sa);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
void RENDER_OT_view_cancel(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Cancel Render View";
|
||||
ot->description= "Cancel show render view";
|
||||
ot->idname= "RENDER_OT_view_cancel";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= render_view_cancel_exec;
|
||||
ot->poll= ED_operator_image_active;
|
||||
}
|
||||
|
||||
/************************* show render viewer *****************/
|
||||
|
||||
static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
{
|
||||
wmWindow *wincur = CTX_wm_window(C);
|
||||
|
||||
/* test if we have currently a temp screen active */
|
||||
if(wincur->screen->temp) {
|
||||
wm_window_lower(wincur);
|
||||
}
|
||||
else {
|
||||
wmWindow *win, *winshow;
|
||||
ScrArea *sa= find_area_showing_r_result(C, &winshow);
|
||||
|
||||
/* is there another window showing result? */
|
||||
for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
|
||||
if(win->screen->temp || (win==winshow && winshow!=wincur)) {
|
||||
wm_window_raise(win);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
/* determine if render already shows */
|
||||
if(sa) {
|
||||
/* but don't close it when rendering */
|
||||
if(!G.rendering) {
|
||||
SpaceImage *sima= sa->spacedata.first;
|
||||
|
||||
if(sima->flag & SI_PREVSPACE) {
|
||||
sima->flag &= ~SI_PREVSPACE;
|
||||
|
||||
if(sima->flag & SI_FULLWINDOW) {
|
||||
sima->flag &= ~SI_FULLWINDOW;
|
||||
ED_screen_full_prevspace(C, sa);
|
||||
}
|
||||
else if(sima->next) {
|
||||
/* workaround for case of double prevspace, render window
|
||||
with a file browser on top of it (same as in ED_area_prevspace) */
|
||||
if(sima->next->spacetype == SPACE_FILE && sima->next->next)
|
||||
ED_area_newspace(C, sa, sima->next->next->spacetype);
|
||||
else
|
||||
ED_area_newspace(C, sa, sima->next->spacetype);
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
render_view_open(C, event->x, event->y);
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void RENDER_OT_view_show(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Show/Hide Render View";
|
||||
ot->description= "Toggle show render view";
|
||||
ot->idname= "RENDER_OT_view_show";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= render_view_show_invoke;
|
||||
ot->poll= ED_operator_screenactive;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user