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:
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r--source/blender/editors/render/render_internal.c100
-rw-r--r--source/blender/editors/render/render_opengl.c94
-rw-r--r--source/blender/editors/render/render_preview.c229
-rw-r--r--source/blender/editors/render/render_shading.c116
-rw-r--r--source/blender/editors/render/render_update.c116
-rw-r--r--source/blender/editors/render/render_view.c76
6 files changed, 366 insertions, 365 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index f3ef0f3cd64..465a2e37269 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -82,20 +82,20 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
unsigned char *rectc;
/* if renrect argument, we only refresh scanlines */
- if(renrect) {
+ if (renrect) {
/* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
- if(rr->renlay==NULL || renrect->ymax>=rr->recty)
+ if (rr->renlay==NULL || renrect->ymax>=rr->recty)
return;
/* 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)
+ if (xmax<2)
return;
ymin= renrect->ymin + rr->crop;
ymax= renrect->ymax - ymin + rr->crop;
- if(ymax<2)
+ if (ymax<2)
return;
renrect->ymin = renrect->ymax;
@@ -108,37 +108,37 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
/* xmin ymin is in tile coords. transform to ibuf */
rxmin= rr->tilerect.xmin + xmin;
- if(rxmin >= ibuf->x) return;
+ if (rxmin >= ibuf->x) return;
rymin= rr->tilerect.ymin + ymin;
- if(rymin >= ibuf->y) return;
+ if (rymin >= ibuf->y) return;
- if(rxmin + xmax > ibuf->x)
+ if (rxmin + xmax > ibuf->x)
xmax= ibuf->x - rxmin;
- if(rymin + ymax > ibuf->y)
+ if (rymin + ymax > ibuf->y)
ymax= ibuf->y - rymin;
- if(xmax < 1 || ymax < 1) return;
+ if (xmax < 1 || ymax < 1) return;
/* find current float rect for display, first case is after composite... still weak */
- if(rr->rectf)
+ if (rr->rectf)
rectf= rr->rectf;
else {
- if(rr->rect32)
+ if (rr->rect32)
return;
else {
- if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
+ if (rr->renlay==NULL || rr->renlay->rectf==NULL) return;
rectf= rr->renlay->rectf;
}
}
- if(rectf==NULL) return;
+ if (rectf==NULL) return;
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
imb_addrectImBuf(ibuf);
rectf+= 4*(rr->rectx*ymin + xmin);
rectc= (unsigned char*)(ibuf->rect + ibuf->x*rymin + rxmin);
- if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
+ if (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
profile_from= IB_PROFILE_LINEAR_RGB;
predivide= (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
}
@@ -160,7 +160,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
{
/* single layer re-render */
- if(RNA_struct_property_is_set(op->ptr, "scene")) {
+ if (RNA_struct_property_is_set(op->ptr, "scene")) {
Scene *scn;
char scene_name[MAX_ID_NAME-2];
@@ -176,7 +176,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s
}
}
- if(RNA_struct_property_is_set(op->ptr, "layer")) {
+ if (RNA_struct_property_is_set(op->ptr, "layer")) {
SceneRenderLayer *rl;
char rl_name[RE_MAXNAME];
@@ -205,7 +205,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
@@ -228,7 +228,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
RE_SetReports(re, op->reports);
- if(is_animation)
+ if (is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay, scene->r.cfra, is_write_still);
@@ -283,40 +283,40 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
megs_peak_memory = (peak_memory)/(1024.0*1024.0);
- if(scene->lay & 0xFF000000)
+ if (scene->lay & 0xFF000000)
spos+= sprintf(spos, "Localview | ");
- else if(scene->r.scemode & R_SINGLE_LAYER)
+ else if (scene->r.scemode & R_SINGLE_LAYER)
spos+= sprintf(spos, "Single Layer | ");
- if(rs->statstr) {
+ if (rs->statstr) {
spos+= sprintf(spos, "%s ", rs->statstr);
}
else {
spos+= sprintf(spos, "Fra:%d ", (scene->r.cfra));
- if(rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert);
- if(rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface);
- if(rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
- if(rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
- if(rs->totlamp) spos+= sprintf(spos, "La:%d ", rs->totlamp);
+ if (rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert);
+ if (rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface);
+ if (rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
+ if (rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
+ if (rs->totlamp) spos+= sprintf(spos, "La:%d ", rs->totlamp);
spos+= sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
- if(rs->curfield)
+ if (rs->curfield)
spos+= sprintf(spos, "Field %d ", rs->curfield);
- if(rs->curblur)
+ if (rs->curblur)
spos+= sprintf(spos, "Blur %d ", rs->curblur);
}
BLI_timestr(rs->lastframetime, info_time_str);
spos+= sprintf(spos, "Time:%s ", info_time_str);
- if(rs->curfsa)
+ if (rs->curfsa)
spos+= sprintf(spos, "| Full Sample %d ", rs->curfsa);
- if(rs->infostr && rs->infostr[0])
+ if (rs->infostr && rs->infostr[0])
spos+= sprintf(spos, "| %s ", rs->infostr);
/* very weak... but 512 characters is quite safe */
- if(spos >= str+IMA_MAX_RENDER_TEXT)
+ if (spos >= str+IMA_MAX_RENDER_TEXT)
if (G.f & G_DEBUG)
printf("WARNING! renderwin text beyond limit \n");
@@ -329,9 +329,9 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
rr= RE_AcquireResultRead(rj->re);
- if(rr) {
+ if (rr) {
/* malloc OK here, stats_draw is not in tile threads */
- if(rr->text==NULL)
+ if (rr->text==NULL)
rr->text= MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
make_renderinfo_string(rs, rj->scene, rr->text);
@@ -348,7 +348,7 @@ static void render_progress_update(void *rjv, float progress)
{
RenderJob *rj= rjv;
- if(rj->progress && *rj->progress != progress) {
+ if (rj->progress && *rj->progress != progress) {
*rj->progress = progress;
/* make jobs timer to send notifier */
@@ -364,11 +364,11 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
void *lock;
/* only update if we are displaying the slot being rendered */
- if(ima->render_slot != ima->last_render_slot)
+ if (ima->render_slot != ima->last_render_slot)
return;
ibuf= BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
image_buffer_rect_update(rj->scene, rr, ibuf, renrect);
/* make jobs timer to send notifier */
@@ -387,7 +387,7 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
RE_SetReports(rj->re, rj->reports);
- if(rj->anim)
+ if (rj->anim)
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
else
RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
@@ -403,11 +403,11 @@ static void render_endjob(void *rjv)
* would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
RE_InitRenderCB(rj->re);
- if(rj->main != G.main)
+ if (rj->main != G.main)
free_main(rj->main);
/* else the frame will not update for the original value */
- if(!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
+ if (!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
/* XXX above function sets all tags in nodes */
@@ -416,7 +416,7 @@ static void render_endjob(void *rjv)
/* potentially set by caller */
rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
- if(rj->srl) {
+ if (rj->srl) {
nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene);
}
@@ -431,9 +431,9 @@ static int render_breakjob(void *rjv)
{
RenderJob *rj= rjv;
- if(G.afbreek)
+ if (G.afbreek)
return 1;
- if(rj->stop && *(rj->stop))
+ if (rj->stop && *(rj->stop))
return 1;
return 0;
}
@@ -450,7 +450,7 @@ static void render_drawlock(void *UNUSED(rjv), int lock)
static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running blender, remove handler and pass through */
- if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
@@ -483,14 +483,14 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
const char *name;
/* only one render job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
- if(!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
+ if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
return OPERATOR_CANCELLED;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
@@ -499,7 +499,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_jobs_stop_all(CTX_wm_manager(C));
/* get main */
- if(G.rt == 101) {
+ if (G.rt == 101) {
/* thread-safety experiment, copy main from the undo buffer */
mainp= BKE_undo_get_main(&scene);
}
@@ -537,7 +537,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
- if(RNA_struct_property_is_set(op->ptr, "layer"))
+ if (RNA_struct_property_is_set(op->ptr, "layer"))
jobflag |= WM_JOB_SUSPEND;
/* job custom data */
@@ -555,7 +555,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->reports= op->reports;
/* setup job */
- if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
+ if (RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
else name= "Render";
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 53c4b232326..26996893ae5 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -104,7 +104,7 @@ typedef struct OGLRender {
/* added because v3d is not always valid */
static unsigned int screen_opengl_layers(OGLRender *oglrender)
{
- if(oglrender->v3d) {
+ if (oglrender->v3d) {
return oglrender->scene->lay | oglrender->v3d->lay;
}
else {
@@ -129,11 +129,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rr= RE_AcquireResultRead(oglrender->re);
- if(view_context) {
+ if (view_context) {
GPU_offscreen_bind(oglrender->ofs); /* bind */
/* render 3d view */
- if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
+ if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
/*int is_ortho= scene->r.mode & R_ORTHO;*/
camera= v3d->camera;
RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
@@ -144,11 +144,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
float clipsta, clipend;
int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
- if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
+ if (is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
}
- if((scene->r.mode & R_OSA) == 0) {
+ if ((scene->r.mode & R_OSA) == 0) {
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE);
GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
}
@@ -167,7 +167,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
/* skip the first sample */
- for(j=1; j < scene->r.osa; j++) {
+ for (j=1; j < scene->r.osa; j++) {
copy_m4_m4(winmat_jitter, winmat);
window_translate_m4(winmat_jitter, rv3d->persmat,
(jit_ofs[j][0] * 2.0f) / sizex,
@@ -192,7 +192,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, TRUE, err_out);
camera= scene->camera;
- if(ibuf_view) {
+ if (ibuf_view) {
memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
IMB_freeImBuf(ibuf_view);
}
@@ -203,7 +203,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* rr->rectf is now filled with image data */
- if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
+ if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
/* note on color management:
@@ -214,7 +214,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
* sRGB again, and so that e.g. openexr saving also saves the correct linear
* float buffer. */
- if(oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if (oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
int predivide= 0; /* no alpha */
IMB_buffer_float_from_float(rr->rectf, rr->rectf,
@@ -227,20 +227,20 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* update byte from float buffer */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
image_buffer_rect_update(scene, rr, ibuf, NULL);
- if(oglrender->write_still) {
+ if (oglrender->write_still) {
char name[FILE_MAX];
int ok;
- if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
+ if (scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
IMB_color_to_bw(ibuf);
}
BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
ok= BKE_write_ibuf_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */
- if(ok) printf("OpenGL Render written to '%s'\n", name);
+ if (ok) printf("OpenGL Render written to '%s'\n", name);
else printf("OpenGL Render failed to write '%s'\n", name);
}
}
@@ -263,28 +263,28 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
char err_out[256]= "unknown";
- if(G.background) {
+ if (G.background) {
BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)");
return 0;
}
/* ensure we have a 3d view */
- if(!ED_view3d_context_activate(C)) {
+ if (!ED_view3d_context_activate(C)) {
RNA_boolean_set(op->ptr, "view_context", FALSE);
is_view_context = 0;
}
/* only one render job at a time */
- if(WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene))
return 0;
- if(!is_view_context && scene->camera==NULL) {
+ if (!is_view_context && scene->camera==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene has no camera");
return 0;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return 0;
}
@@ -302,7 +302,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
ofs= GPU_offscreen_create(sizex, sizey, err_out);
- if(!ofs) {
+ if (!ofs) {
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
return 0;
}
@@ -326,7 +326,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->prevsa= prevsa;
oglrender->prevar= prevar;
- if(is_view_context) {
+ if (is_view_context) {
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
oglrender->rv3d= oglrender->ar->regiondata;
@@ -355,7 +355,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
rr= RE_AcquireResultWrite(oglrender->re);
- if(rr->rectf==NULL)
+ if (rr->rectf==NULL)
rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
RE_ReleaseResult(oglrender->re);
@@ -367,12 +367,12 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
Main *bmain= CTX_data_main(C);
Scene *scene= oglrender->scene;
- if(oglrender->mh) {
- if(BKE_imtype_is_movie(scene->r.im_format.imtype))
+ if (oglrender->mh) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype))
oglrender->mh->end_movie();
}
- if(oglrender->timer) { /* exec will not have a timer */
+ if (oglrender->timer) { /* exec will not have a timer */
scene->r.cfra= oglrender->cfrao;
scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
@@ -413,8 +413,8 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
oglrender->reports= op->reports;
oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype);
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
- if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
screen_opengl_render_end(C, oglrender);
return 0;
}
@@ -443,10 +443,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
ED_image_update_frame(bmain, scene->r.cfra);
/* go to next frame */
- while(CFRA<oglrender->nfra) {
+ while (CFRA<oglrender->nfra) {
unsigned int lay= screen_opengl_layers(oglrender);
- if(lay & 0xFF000000)
+ if (lay & 0xFF000000)
lay &= 0xFF000000;
scene_update_for_newframe(bmain, scene, lay);
@@ -455,11 +455,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
- if(view_context) {
- if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
+ if (view_context) {
+ if (oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
/* since scene_update_for_newframe() is used rather
* then ED_update_for_newframe() the camera needs to be set */
- if(scene_camera_switch_update(scene)) {
+ if (scene_camera_switch_update(scene)) {
oglrender->v3d->camera= scene->camera;
}
@@ -478,10 +478,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
/* save to disk */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
- if(ibuf) {
+ if (ibuf) {
/* color -> greyscale */
/* editing directly would alter the render view */
- if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
+ if (scene->r.im_format.planes == R_IMF_PLANES_BW) {
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
IMB_color_to_bw(ibuf_bw);
// IMB_freeImBuf(ibuf); /* owned by the image */
@@ -497,10 +497,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
ibuf= ibuf_cpy;
}
- if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+ if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
ok= oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int*)ibuf->rect,
oglrender->sizex, oglrender->sizey, oglrender->reports);
- if(ok) {
+ if (ok) {
printf("Append frame %d", scene->r.cfra);
BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra);
}
@@ -509,7 +509,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
- if(ok==0) {
+ if (ok==0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(op->reports, RPT_ERROR, "Write error: cannot save %s", name);
}
@@ -533,7 +533,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
scene->r.cfra++;
/* stop at the end or on error */
- if(scene->r.cfra > PEFRA || !ok) {
+ if (scene->r.cfra > PEFRA || !ok) {
screen_opengl_render_end(C, op->customdata);
return 0;
}
@@ -555,7 +555,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED;
case TIMER:
/* render frame? */
- if(oglrender->timer == event->customdata)
+ if (oglrender->timer == event->customdata)
break;
default:
/* nothing to do */
@@ -565,7 +565,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
/* run first because screen_opengl_render_anim_step can free oglrender */
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
- if(anim == 0) {
+ if (anim == 0) {
screen_opengl_render_apply(op->customdata);
screen_opengl_render_end(C, op->customdata);
return OPERATOR_FINISHED;
@@ -574,7 +574,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
ret= screen_opengl_render_anim_step(C, op);
/* stop at the end or on error */
- if(ret == 0) {
+ if (ret == 0) {
return OPERATOR_FINISHED;
}
@@ -586,11 +586,11 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *eve
OGLRender *oglrender;
int anim= RNA_boolean_get(op->ptr, "animation");
- if(!screen_opengl_render_init(C, op))
+ if (!screen_opengl_render_init(C, op))
return OPERATOR_CANCELLED;
- if(anim) {
- if(!screen_opengl_render_anim_initialize(C, op))
+ if (anim) {
+ if (!screen_opengl_render_anim_initialize(C, op))
return OPERATOR_CANCELLED;
}
@@ -608,10 +608,10 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
{
const short is_animation= RNA_boolean_get(op->ptr, "animation");
- if(!screen_opengl_render_init(C, op))
+ if (!screen_opengl_render_init(C, op))
return OPERATOR_CANCELLED;
- if(!is_animation) { /* same as invoke */
+ if (!is_animation) { /* same as invoke */
/* render image */
screen_opengl_render_apply(op->customdata);
screen_opengl_render_end(C, op->customdata);
@@ -621,10 +621,10 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
else {
int ret= 1;
- if(!screen_opengl_render_anim_initialize(C, op))
+ if (!screen_opengl_render_anim_initialize(C, op))
return OPERATOR_CANCELLED;
- while(ret) {
+ while (ret) {
ret= screen_opengl_render_anim_step(C, op);
}
}
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 8cdde5f160f..9ba961302f1 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -202,29 +202,29 @@ void ED_preview_init_dbase(void)
void ED_preview_free_dbase(void)
{
- if(pr_main)
+ if (pr_main)
free_main(pr_main);
}
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
{
- if(mat) {
- if(mat->sss_flag & MA_DIFF_SSS)
+ if (mat) {
+ if (mat->sss_flag & MA_DIFF_SSS)
return 1;
- if(mat->nodetree)
- if( preview_mat_has_sss(NULL, mat->nodetree))
+ if (mat->nodetree)
+ if ( preview_mat_has_sss(NULL, mat->nodetree))
return 1;
}
- else if(ntree) {
+ else if (ntree) {
bNode *node;
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==NODE_GROUP && node->id) {
- if( preview_mat_has_sss(NULL, (bNodeTree *)node->id))
+ for (node= ntree->nodes.first; node; node= node->next) {
+ if (node->type==NODE_GROUP && node->id) {
+ if ( preview_mat_has_sss(NULL, (bNodeTree *)node->id))
return 1;
}
- else if(node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+ else if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
mat= (Material *)node->id;
- if(mat->sss_flag & MA_DIFF_SSS)
+ if (mat->sss_flag & MA_DIFF_SSS)
return 1;
}
}
@@ -239,17 +239,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
Scene *sce;
Base *base;
- if(pr_main==NULL) return NULL;
+ if (pr_main==NULL) return NULL;
sce= pr_main->scene.first;
- if(sce) {
+ if (sce) {
/* this flag tells render to not execute depsgraph or ipos etc */
sce->r.scemode |= R_PREVIEWBUTS;
/* set world always back, is used now */
sce->world= pr_main->world.first;
/* now: exposure copy */
- if(scene->world) {
+ if (scene->world) {
sce->world->exp= scene->world->exp;
sce->world->range= scene->world->range;
}
@@ -257,16 +257,16 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.color_mgt_flag = scene->r.color_mgt_flag;
/* prevent overhead for small renders and icons (32) */
- if(id && sp->sizex < 40)
+ if (id && sp->sizex < 40)
sce->r.xparts= sce->r.yparts= 1;
else
sce->r.xparts= sce->r.yparts= 4;
/* exception: don't color manage texture previews or icons */
- if((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
+ if ((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
- if((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
+ if ((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
sce->r.alphamode= R_ALPHAPREMUL;
else
sce->r.alphamode= R_ADDSKY;
@@ -274,10 +274,10 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.cfra= scene->r.cfra;
BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
- if(id_type==ID_MA) {
+ if (id_type==ID_MA) {
Material *mat= NULL, *origmat= (Material *)id;
- if(origmat) {
+ if (origmat) {
/* work on a copy */
mat= localize_material(origmat);
sp->matcopy= mat;
@@ -287,27 +287,27 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
end_render_material(mat);
/* un-useful option */
- if(sp->pr_method==PR_ICON_RENDER)
+ if (sp->pr_method==PR_ICON_RENDER)
mat->shade_flag &= ~MA_OBCOLOR;
/* turn on raytracing if needed */
- if(mat->mode_l & MA_RAYMIRROR)
+ if (mat->mode_l & MA_RAYMIRROR)
sce->r.mode |= R_RAYTRACE;
- if(mat->material_type == MA_TYPE_VOLUME)
+ if (mat->material_type == MA_TYPE_VOLUME)
sce->r.mode |= R_RAYTRACE;
- if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
+ if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
sce->r.mode |= R_RAYTRACE;
- if(preview_mat_has_sss(mat, NULL))
+ if (preview_mat_has_sss(mat, NULL))
sce->r.mode |= R_SSS;
/* turn off fake shadows if needed */
/* this only works in a specific case where the preview.blend contains
* an object starting with 'c' which has a material linked to it (not the obdata)
* and that material has a fake shadow texture in the active texture slot */
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='c') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='c') {
Material *shadmat= give_current_material(base->object, base->object->actcol);
- if(shadmat) {
+ if (shadmat) {
if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
else shadmat->septex |= 1;
}
@@ -316,11 +316,11 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
/* turn off bounce lights for volume,
* doesn't make much visual difference and slows it down too */
- if(mat->material_type == MA_TYPE_VOLUME) {
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->type == OB_LAMP) {
+ if (mat->material_type == MA_TYPE_VOLUME) {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->type == OB_LAMP) {
/* if doesn't match 'Lamp.002' --> main key light */
- if( strcmp(base->object->id.name+2, "Lamp.002") != 0 ) {
+ if ( strcmp(base->object->id.name+2, "Lamp.002") != 0 ) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
}
}
@@ -328,7 +328,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
if (mat->material_type == MA_TYPE_HALO) {
sce->lay= 1<<MA_FLAT;
}
@@ -338,7 +338,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
else {
sce->lay= 1<<mat->pr_type;
- if(mat->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (mat->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(mat->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(origmat->nodetree, sp->sizex, sp->sizey);
@@ -350,45 +350,46 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='p') {
/* copy over object color, in case material uses it */
copy_v4_v4(base->object->col, sp->col);
- if(OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
+ if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
Material ***matar= give_matarar(base->object);
int actcol= MAX2(base->object->actcol > 0, 1) - 1;
- if(matar && actcol < base->object->totcol)
+ if (matar && actcol < base->object->totcol)
(*matar)[actcol]= mat;
- } else if (base->object->type == OB_LAMP) {
+ }
+ else if (base->object->type == OB_LAMP) {
base->object->restrictflag &= ~OB_RESTRICT_RENDER;
}
}
}
}
- else if(id_type==ID_TE) {
+ else if (id_type==ID_TE) {
Tex *tex= NULL, *origtex= (Tex *)id;
- if(origtex) {
+ if (origtex) {
tex= localize_texture(origtex);
sp->texcopy= tex;
BLI_addtail(&pr_main->tex, tex);
}
sce->lay= 1<<MA_TEXTURE;
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='t') {
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='t') {
Material *mat= give_current_material(base->object, base->object->actcol);
- if(mat && mat->mtex[0]) {
+ if (mat && mat->mtex[0]) {
mat->mtex[0]->tex= tex;
- if(tex && sp->slot)
+ if (tex && sp->slot)
mat->mtex[0]->which_output = sp->slot->which_output;
/* show alpha in this case */
- if(tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
+ if (tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
mat->mtex[0]->mapto |= MAP_ALPHA;
mat->alpha= 0.0f;
}
@@ -400,23 +401,23 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
}
- if(tex && tex->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (tex && tex->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(origtex->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(tex->nodetree, sp->sizex, sp->sizey);
}
}
- else if(id_type==ID_LA) {
+ else if (id_type==ID_LA) {
Lamp *la= NULL, *origla= (Lamp *)id;
/* work on a copy */
- if(origla) {
+ if (origla) {
la= localize_lamp(origla);
sp->lampcopy= la;
BLI_addtail(&pr_main->lamp, la);
}
- if(la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
+ if (la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
sce->lay= 1<<MA_ATMOS;
sce->world= scene->world;
sce->camera= (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name)+2);
@@ -428,23 +429,23 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
sce->r.mode &= ~R_SHADOW;
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
- if(base->object->type==OB_LAMP)
+ for (base= sce->base.first; base; base= base->next) {
+ if (base->object->id.name[2]=='p') {
+ if (base->object->type==OB_LAMP)
base->object->data= la;
}
}
- if(la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(origla->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(la->nodetree, sp->sizex, sp->sizey);
}
}
- else if(id_type==ID_WO) {
+ else if (id_type==ID_WO) {
World *wrld= NULL, *origwrld= (World *)id;
- if(origwrld) {
+ if (origwrld) {
wrld= localize_world(origwrld);
sp->worldcopy= wrld;
BLI_addtail(&pr_main->world, wrld);
@@ -453,7 +454,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->lay= 1<<MA_SKY;
sce->world= wrld;
- if(wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ if (wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
/* two previews, they get copied by wmJob */
ntreeInitPreview(wrld->nodetree, sp->sizex, sp->sizey);
ntreeInitPreview(origwrld->nodetree, sp->sizex, sp->sizey);
@@ -484,11 +485,11 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
}
}
- if(!split || first) sprintf(name, "Preview %p", (void *)sa);
+ if (!split || first) sprintf(name, "Preview %p", (void *)sa);
else sprintf(name, "SecondPreview %p", (void *)sa);
- if(split) {
- if(first) {
+ if (split) {
+ if (first) {
offx= 0;
newx= newx/2;
}
@@ -501,14 +502,14 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
re= RE_GetRender(name);
RE_AcquireResultImage(re, &rres);
- if(rres.rectf) {
+ if (rres.rectf) {
- if(ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
+ if (ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty);
- if(rres.rectx && rres.recty) {
+ if (rres.rectx && rres.recty) {
/* temporary conversion to byte for drawing */
float fx= rect->xmin + offx;
float fy= rect->ymin;
@@ -538,7 +539,7 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, rcti *rect)
{
- if(idp) {
+ if (idp) {
ScrArea *sa= CTX_wm_area(C);
Scene *sce = CTX_data_scene(C);
ID *id = (ID *)idp;
@@ -554,23 +555,23 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
newrect.ymin = rect->ymin;
newrect.ymax = rect->ymin;
- if(parent) {
+ if (parent) {
ok = ed_preview_draw_rect(sa, sce, id, 1, 1, rect, &newrect);
ok &= ed_preview_draw_rect(sa, sce, parent, 1, 0, rect, &newrect);
}
else
ok = ed_preview_draw_rect(sa, sce, id, 0, 0, rect, &newrect);
- if(ok)
+ if (ok)
*rect= newrect;
/* check for spacetype... */
- if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
+ if (sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
sbuts->preview= 0;
ok= 0;
}
- if(ok==0) {
+ if (ok==0) {
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
}
}
@@ -599,30 +600,30 @@ static void shader_preview_updatejob(void *spv)
{
ShaderPreview *sp= spv;
- if(sp->id) {
- if(sp->pr_method==PR_NODE_RENDER) {
- if( GS(sp->id->name) == ID_MA) {
+ if (sp->id) {
+ if (sp->pr_method==PR_NODE_RENDER) {
+ if ( GS(sp->id->name) == ID_MA) {
Material *mat= (Material *)sp->id;
- if(sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
+ if (sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
ntreeLocalSync(sp->matcopy->nodetree, mat->nodetree);
}
- else if( GS(sp->id->name) == ID_TE) {
+ else if ( GS(sp->id->name) == ID_TE) {
Tex *tex= (Tex *)sp->id;
- if(sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
+ if (sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
ntreeLocalSync(sp->texcopy->nodetree, tex->nodetree);
}
- else if( GS(sp->id->name) == ID_WO) {
+ else if ( GS(sp->id->name) == ID_WO) {
World *wrld= (World *)sp->id;
- if(sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
+ if (sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
}
- else if( GS(sp->id->name) == ID_LA) {
+ else if ( GS(sp->id->name) == ID_LA) {
Lamp *la= (Lamp *)sp->id;
- if(sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
+ if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
}
}
@@ -640,27 +641,27 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* get the stuff from the builtin preview dbase */
sce= preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
- if(sce==NULL) return;
+ if (sce==NULL) return;
- if(!split || first) sprintf(name, "Preview %p", sp->owner);
+ if (!split || first) sprintf(name, "Preview %p", sp->owner);
else sprintf(name, "SecondPreview %p", sp->owner);
re= RE_GetRender(name);
/* full refreshed render from first tile */
- if(re==NULL)
+ if (re==NULL)
re= RE_NewRender(name);
/* sce->r gets copied in RE_InitState! */
sce->r.scemode &= ~(R_MATNODE_PREVIEW|R_TEXNODE_PREVIEW);
sce->r.scemode &= ~R_NO_IMAGE_LOAD;
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
sce->r.scemode |= R_NO_IMAGE_LOAD;
sce->r.mode |= R_OSA;
}
- else if(sp->pr_method==PR_NODE_RENDER) {
- if(idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
- else if(idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
+ else if (sp->pr_method==PR_NODE_RENDER) {
+ if (idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
+ else if (idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
sce->r.mode &= ~R_OSA;
}
else { /* PR_BUTS_RENDER */
@@ -668,8 +669,8 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
}
/* in case of split preview, use border render */
- if(split) {
- if(first) sizex= sp->sizex/2;
+ if (split) {
+ if (first) sizex= sp->sizex/2;
else sizex= sp->sizex - sp->sizex/2;
}
else sizex= sp->sizex;
@@ -680,7 +681,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
sce->r.size= 100;
/* callbacs are cleared on GetRender() */
- if(ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
+ if (ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
RE_display_draw_cb(re, sp, shader_preview_draw);
}
/* set this for all previews, default is react to G.afbreek still */
@@ -688,7 +689,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* lens adjust */
oldlens= ((Camera *)sce->camera->data)->lens;
- if(sizex > sp->sizey)
+ if (sizex > sp->sizey)
((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex;
/* entire cycle for render engine */
@@ -697,10 +698,10 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
((Camera *)sce->camera->data)->lens= oldlens;
/* handle results */
- if(sp->pr_method==PR_ICON_RENDER) {
+ if (sp->pr_method==PR_ICON_RENDER) {
// char *rct= (char *)(sp->pr_rect + 32*16 + 16);
- if(sp->pr_rect)
+ if (sp->pr_rect)
RE_ResultGet32(re, sp->pr_rect);
}
else {
@@ -714,9 +715,9 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
preview_prepare_scene(sp->scene, NULL, GS(id->name), sp);
/* XXX bad exception, end-exec is not being called in render, because it uses local main */
-// if(idtype == ID_TE) {
+// if (idtype == ID_TE) {
// Tex *tex= (Tex *)id;
-// if(tex->use_nodes && tex->nodetree)
+// if (tex->use_nodes && tex->nodetree)
// ntreeEndExecTree(tex->nodetree);
// }
@@ -730,7 +731,7 @@ static void shader_preview_startjob(void *customdata, short *stop, short *do_upd
sp->stop= stop;
sp->do_update= do_update;
- if(sp->parent) {
+ if (sp->parent) {
shader_preview_render(sp, sp->id, 1, 1);
shader_preview_render(sp, sp->parent, 1, 0);
}
@@ -744,7 +745,7 @@ static void shader_preview_free(void *customdata)
{
ShaderPreview *sp= customdata;
- if(sp->matcopy) {
+ if (sp->matcopy) {
struct IDProperty *properties;
int a;
@@ -755,9 +756,9 @@ static void shader_preview_free(void *customdata)
BLI_remlink(&pr_main->mat, sp->matcopy);
/* free_material decrements texture, prevent this. hack alert! */
- for(a=0; a<MAX_MTEX; a++) {
+ for (a=0; a<MAX_MTEX; a++) {
MTex *mtex= sp->matcopy->mtex[a];
- if(mtex && mtex->tex) mtex->tex= NULL;
+ if (mtex && mtex->tex) mtex->tex= NULL;
}
free_material(sp->matcopy);
@@ -769,7 +770,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->matcopy);
}
- if(sp->texcopy) {
+ if (sp->texcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -785,7 +786,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->texcopy);
}
- if(sp->worldcopy) {
+ if (sp->worldcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -801,7 +802,7 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->worldcopy);
}
- if(sp->lampcopy) {
+ if (sp->lampcopy) {
struct IDProperty *properties;
/* node previews */
shader_preview_updatejob(sp);
@@ -831,7 +832,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
short ex, ey, dx, dy;
/* paranoia test */
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+ if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return;
/* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */
@@ -858,14 +859,14 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
IMB_scalefastImBuf(ima, ex, ey);
/* if needed, convert to 32 bits */
- if(ima->rect==NULL)
+ if (ima->rect==NULL)
IMB_rect_from_float(ima);
srect = ima->rect;
drect = rect;
drect+= dy*w+dx;
- for (;ey > 0; ey--){
+ for (;ey > 0; ey--) {
memcpy(drect,srect, ex * sizeof(int));
drect += w;
srect += ima->x;
@@ -878,7 +879,7 @@ static void set_alpha(char *cp, int sizex, int sizey, char alpha)
{
int a, size= sizex*sizey;
- for(a=0; a<size; a++, cp+=4)
+ for (a=0; a<size; a++, cp+=4)
cp[3]= alpha;
}
@@ -888,13 +889,13 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
ID *id= sp->id;
short idtype= GS(id->name);
- if(idtype == ID_IM) {
+ if (idtype == ID_IM) {
Image *ima= (Image*)id;
ImBuf *ibuf= NULL;
ImageUser iuser= {NULL};
/* ima->ok is zero when Image cannot load */
- if(ima==NULL || ima->ok==0)
+ if (ima==NULL || ima->ok==0)
return;
/* setup dummy image user */
@@ -905,21 +906,21 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
* already there. Very expensive for large images. Need to find a way to
* only get existing ibuf */
ibuf = BKE_image_get_ibuf(ima, &iuser);
- if(ibuf==NULL || ibuf->rect==NULL)
+ if (ibuf==NULL || ibuf->rect==NULL)
return;
icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
*do_update= 1;
}
- else if(idtype == ID_BR) {
+ else if (idtype == ID_BR) {
Brush *br= (Brush*)id;
br->icon_imbuf= get_brush_icon(br);
memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
- if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
+ if (!(br->icon_imbuf) || !(br->icon_imbuf->rect))
return;
icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
@@ -932,13 +933,13 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
/* world is rendered with alpha=0, so it wasn't displayed
* this could be render option for sky to, for later */
- if(idtype == ID_WO) {
+ if (idtype == ID_WO) {
set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
}
- else if(idtype == ID_MA) {
+ else if (idtype == ID_MA) {
Material* ma = (Material*)id;
- if(ma->material_type == MA_TYPE_HALO)
+ if (ma->material_type == MA_TYPE_HALO)
set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
}
}
@@ -951,7 +952,7 @@ static void common_preview_startjob(void *customdata, short *stop, short *do_upd
{
ShaderPreview *sp= customdata;
- if(sp->pr_method == PR_ICON_RENDER)
+ if (sp->pr_method == PR_ICON_RENDER)
icon_preview_startjob(customdata, stop, do_update);
else
shader_preview_startjob(customdata, stop, do_update);
@@ -1069,7 +1070,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->id = id;
sp->parent= parent;
sp->slot= slot;
- if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
+ if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
/* setup job */
@@ -1083,7 +1084,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
void ED_preview_kill_jobs(const struct bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
- if(wm)
+ if (wm)
WM_jobs_kill(wm, NULL, common_preview_startjob);
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 2529e91d301..0aeeb0f71e2 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -95,7 +95,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
object_add_material_slot(ob);
@@ -124,11 +124,11 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
/* Removing material slots in edit mode screws things up, see bug #21822.*/
- if(ob == CTX_data_edit_object(C)) {
+ if (ob == CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode");
return OPERATOR_CANCELLED;
}
@@ -160,38 +160,38 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(ob && ob->actcol>0) {
- if(ob->type == OB_MESH) {
+ if (ob && ob->actcol>0) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
BMFace *efa;
BMIter iter;
- if(em) {
+ if (em) {
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT))
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT))
efa->mat_nr= ob->actcol-1;
}
}
}
- else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Nurb *nu;
ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
- if(nurbs) {
- for(nu= nurbs->first; nu; nu= nu->next)
- if(isNurbsel(nu))
+ if (nurbs) {
+ for (nu= nurbs->first; nu; nu= nu->next)
+ if (isNurbsel(nu))
nu->mat_nr= nu->charidx= ob->actcol-1;
}
}
- else if(ob->type == OB_FONT) {
+ else if (ob->type == OB_FONT) {
EditFont *ef= ((Curve*)ob->data)->editfont;
int i, selstart, selend;
- if(ef && BKE_font_getselection(ob, &selstart, &selend)) {
- for(i=selstart; i<=selend; i++)
+ if (ef && BKE_font_getselection(ob, &selstart, &selend)) {
+ for (i=selstart; i<=selend; i++)
ef->textbufinfo[i].mat_nr = ob->actcol;
}
}
@@ -222,13 +222,13 @@ static int material_slot_de_select(bContext *C, int select)
{
Object *ob = ED_object_context(C);
- if(!ob)
+ if (!ob)
return OPERATOR_CANCELLED;
- if(ob->type == OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
- if(em) {
+ if (em) {
EDBM_deselect_by_material(em, ob->actcol-1, select);
}
}
@@ -239,15 +239,15 @@ static int material_slot_de_select(bContext *C, int select)
BezTriple *bezt;
int a;
- if(nurbs) {
- for(nu= nurbs->first; nu; nu=nu->next) {
- if(nu->mat_nr==ob->actcol-1) {
- if(nu->bezt) {
+ if (nurbs) {
+ for (nu= nurbs->first; nu; nu=nu->next) {
+ if (nu->mat_nr==ob->actcol-1) {
+ if (nu->bezt) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if(select) {
+ while (a--) {
+ if (bezt->hide==0) {
+ if (select) {
bezt->f1 |= SELECT;
bezt->f2 |= SELECT;
bezt->f3 |= SELECT;
@@ -261,12 +261,12 @@ static int material_slot_de_select(bContext *C, int select)
bezt++;
}
}
- else if(nu->bp) {
+ else if (nu->bp) {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if(select) bp->f1 |= SELECT;
+ while (a--) {
+ if (bp->hide==0) {
+ if (select) bp->f1 |= SELECT;
else bp->f1 &= ~SELECT;
}
bp++;
@@ -326,15 +326,15 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Material ***matar;
- if(!ob || !(matar= give_matarar(ob)))
+ if (!ob || !(matar= give_matarar(ob)))
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
- if(ob != ob_iter && give_matarar(ob_iter)) {
+ if (ob != ob_iter && give_matarar(ob_iter)) {
if (ob->data != ob_iter->data)
assign_matarar(ob_iter, matar, ob->totcol);
- if(ob_iter->totcol==ob->totcol) {
+ if (ob_iter->totcol==ob->totcol) {
ob_iter->actcol= ob->actcol;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
}
@@ -370,13 +370,13 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy material */
- if(ma) {
+ if (ma) {
ma= copy_material(ma);
}
else {
ma= add_material("Material");
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &ma->id);
ma->use_nodes= 1;
}
@@ -385,7 +385,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
ma->id.us--;
@@ -423,7 +423,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy texture */
- if(tex)
+ if (tex)
tex= copy_texture(tex);
else
tex= add_texture("Texture");
@@ -431,7 +431,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
tex->id.us--;
@@ -470,13 +470,13 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
PropertyRNA *prop;
/* add or copy world */
- if(wo) {
+ if (wo) {
wo= copy_world(wo);
}
else {
wo= add_world("World");
- if(scene_use_new_shading_nodes(scene)) {
+ if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &wo->id);
wo->use_nodes= 1;
}
@@ -485,7 +485,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
- if(prop) {
+ if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
wo->id.us--;
@@ -547,7 +547,7 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay);
- if(!scene_remove_render_layer(CTX_data_main(C), scene, rl))
+ if (!scene_remove_render_layer(CTX_data_main(C), scene, rl))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
@@ -573,7 +573,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id) {
+ if (id) {
MTex **mtex_ar, *mtexswap;
short act;
int type= RNA_enum_get(op->ptr, "type");
@@ -581,8 +581,8 @@ static int texture_slot_move(bContext *C, wmOperator *op)
give_active_mtex(id, &mtex_ar, &act);
- if(type == -1) { /* Up */
- if(act > 0) {
+ if (type == -1) { /* Up */
+ if (act > 0) {
mtexswap = mtex_ar[act];
mtex_ar[act] = mtex_ar[act-1];
mtex_ar[act-1] = mtexswap;
@@ -591,7 +591,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act-1, 0);
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
- if(GS(id->name)==ID_MA) {
+ if (GS(id->name)==ID_MA) {
Material *ma= (Material *)id;
int mtexuse = ma->septex & (1<<act);
ma->septex &= ~(1<<act);
@@ -604,7 +604,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
}
}
else { /* Down */
- if(act < MAX_MTEX-1) {
+ if (act < MAX_MTEX-1) {
mtexswap = mtex_ar[act];
mtex_ar[act] = mtex_ar[act+1];
mtex_ar[act+1] = mtexswap;
@@ -613,7 +613,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act+1, 0);
BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
- if(GS(id->name)==ID_MA) {
+ if (GS(id->name)==ID_MA) {
Material *ma= (Material *)id;
int mtexuse = ma->septex & (1<<act);
ma->septex &= ~(1<<act);
@@ -686,7 +686,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
- if(scene->r.scemode & R_EXTENSION) {
+ if (scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, imtype);
}
@@ -705,7 +705,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
{
//Scene *scene= CTX_data_scene(C);
- if(RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath"))
return envmap_save_exec(C, op);
//RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype);
@@ -828,7 +828,7 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- if(ma==NULL)
+ if (ma==NULL)
return OPERATOR_CANCELLED;
copy_matcopybuf(ma);
@@ -854,7 +854,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- if(ma==NULL)
+ if (ma==NULL)
return OPERATOR_CANCELLED;
paste_matcopybuf(ma);
@@ -908,7 +908,7 @@ static void copy_mtex_copybuf(ID *id)
break;
}
- if(mtex && *mtex) {
+ if (mtex && *mtex) {
memcpy(&mtexcopybuf, *mtex, sizeof(MTex));
mtexcopied= 1;
}
@@ -921,7 +921,7 @@ static void paste_mtex_copybuf(ID *id)
{
MTex **mtex= NULL;
- if(mtexcopied == 0 || mtexcopybuf.tex==NULL)
+ if (mtexcopied == 0 || mtexcopybuf.tex==NULL)
return;
switch(GS(id->name)) {
@@ -944,11 +944,11 @@ static void paste_mtex_copybuf(ID *id)
return;
}
- if(mtex) {
- if(*mtex==NULL) {
+ if (mtex) {
+ if (*mtex==NULL) {
*mtex= MEM_mallocN(sizeof(MTex), "mtex copy");
}
- else if((*mtex)->tex) {
+ else if ((*mtex)->tex) {
(*mtex)->tex->id.us--;
}
@@ -963,7 +963,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id==NULL) {
+ if (id==NULL) {
/* copying empty slot */
ED_render_clear_mtex_copybuf();
return OPERATOR_CANCELLED;
@@ -1000,7 +1000,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
- if(id==NULL) {
+ if (id==NULL) {
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Lamp *la= CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data;
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 4483d7d8ba1..72b29c56811 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -77,7 +77,7 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
/* don't do this render engine update if we're updating the scene from
* other threads doing e.g. rendering or baking jobs */
- if(!BLI_thread_is_main())
+ if (!BLI_thread_is_main())
return;
C= CTX_create();
@@ -86,22 +86,22 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
CTX_wm_manager_set(C, bmain->wm.first);
- for(sc=bmain->screen.first; sc; sc=sc->id.next) {
- for(sa=sc->areabase.first; sa; sa=sa->next) {
- if(sa->spacetype != SPACE_VIEW3D)
+ for (sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for (sa=sc->areabase.first; sa; sa=sa->next) {
+ if (sa->spacetype != SPACE_VIEW3D)
continue;
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ for (ar=sa->regionbase.first; ar; ar=ar->next) {
RegionView3D *rv3d;
RenderEngine *engine;
- if(ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
continue;
rv3d= ar->regiondata;
engine= rv3d->render_engine;
- if(engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
+ if (engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
CTX_wm_screen_set(C, sc);
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
@@ -123,20 +123,20 @@ void ED_render_engine_changed(Main *bmain)
ScrArea *sa;
ARegion *ar;
- for(sc=bmain->screen.first; sc; sc=sc->id.next) {
- for(sa=sc->areabase.first; sa; sa=sa->next) {
- if(sa->spacetype != SPACE_VIEW3D)
+ for (sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for (sa=sc->areabase.first; sa; sa=sa->next) {
+ if (sa->spacetype != SPACE_VIEW3D)
continue;
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ for (ar=sa->regionbase.first; ar; ar=ar->next) {
RegionView3D *rv3d;
- if(ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
continue;
rv3d= ar->regiondata;
- if(rv3d->render_engine) {
+ if (rv3d->render_engine) {
RE_engine_free(rv3d->render_engine);
rv3d->render_engine= NULL;
}
@@ -154,11 +154,11 @@ static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
{
int a;
- if(!mtex)
+ if (!mtex)
return 0;
- for(a=0; a<tot; a++)
- if(mtex[a] && mtex[a]->tex == tex)
+ for (a=0; a<tot; a++)
+ if (mtex[a] && mtex[a]->tex == tex)
return 1;
return 0;
@@ -168,17 +168,17 @@ 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) {
+ for (node=ntree->nodes.first; node; node= node->next) {
+ if (node->id) {
+ if (node->id == (ID*)tex) {
return 1;
}
- else if(GS(node->id->name) == ID_MA) {
- if(mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex))
+ else if (GS(node->id->name) == ID_MA) {
+ if (mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex))
return 1;
}
- else if(node->type==NODE_GROUP) {
- if(nodes_use_tex((bNodeTree *)node->id, tex))
+ else if (node->type==NODE_GROUP) {
+ if (nodes_use_tex((bNodeTree *)node->id, tex))
return 1;
}
}
@@ -191,13 +191,13 @@ static int nodes_use_material(bNodeTree *ntree, Material *ma)
{
bNode *node;
- for(node=ntree->nodes.first; node; node= node->next) {
- if(node->id) {
- if(node->id == (ID*)ma) {
+ for (node=ntree->nodes.first; node; node= node->next) {
+ if (node->id) {
+ if (node->id == (ID*)ma) {
return 1;
}
- else if(node->type==NODE_GROUP) {
- if(nodes_use_material((bNodeTree *)node->id, ma))
+ else if (node->type==NODE_GROUP) {
+ if (nodes_use_material((bNodeTree *)node->id, ma))
return 1;
}
}
@@ -214,17 +214,17 @@ static void material_changed(Main *bmain, Material *ma)
BKE_icon_changed(BKE_icon_getid(&ma->id));
/* glsl */
- if(ma->gpumaterial.first)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
/* find node materials using this */
- for(parent=bmain->mat.first; parent; parent=parent->id.next) {
- if(parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma));
+ for (parent=bmain->mat.first; parent; parent=parent->id.next) {
+ if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma));
else continue;
BKE_icon_changed(BKE_icon_getid(&parent->id));
- if(parent->gpumaterial.first)
+ if (parent->gpumaterial.first)
GPU_material_free(parent);
}
}
@@ -241,40 +241,40 @@ static void texture_changed(Main *bmain, Tex *tex)
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));
+ 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)
+ 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 if(la->nodetree && nodes_use_tex(la->nodetree, tex));
+ for (la=bmain->lamp.first; la; la=la->id.next) {
+ if (mtex_use_tex(la->mtex, MAX_MTEX, tex));
+ else if (la->nodetree && nodes_use_tex(la->nodetree, 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 if(wo->nodetree && nodes_use_tex(wo->nodetree, tex));
+ for (wo=bmain->world.first; wo; wo=wo->id.next) {
+ if (mtex_use_tex(wo->mtex, MAX_MTEX, tex));
+ else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&wo->id));
}
/* find compositing nodes */
- for(scene=bmain->scene.first; scene; scene=scene->id.next) {
- if(scene->use_nodes && scene->nodetree) {
- for(node=scene->nodetree->nodes.first; node; node=node->next) {
- if(node->id == &tex->id)
+ for (scene=bmain->scene.first; scene; scene=scene->id.next) {
+ if (scene->use_nodes && scene->nodetree) {
+ for (node=scene->nodetree->nodes.first; node; node=node->next) {
+ if (node->id == &tex->id)
ED_node_changed_update(&scene->id, node);
}
}
@@ -290,12 +290,12 @@ static void lamp_changed(Main *bmain, Lamp *la)
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)
+ 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)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
@@ -307,8 +307,8 @@ static void world_changed(Main *bmain, World *wo)
BKE_icon_changed(BKE_icon_getid(&wo->id));
/* glsl */
- for(ma=bmain->mat.first; ma; ma=ma->id.next)
- if(ma->gpumaterial.first)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
@@ -320,8 +320,8 @@ static void image_changed(Main *bmain, Image *ima)
BKE_icon_changed(BKE_icon_getid(&ima->id));
/* textures */
- for(tex=bmain->tex.first; tex; tex=tex->id.next)
- if(tex->ima == ima)
+ for (tex=bmain->tex.first; tex; tex=tex->id.next)
+ if (tex->ima == ima)
texture_changed(bmain, tex);
}
@@ -331,12 +331,12 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
Material *ma;
/* glsl */
- for(ob=bmain->object.first; ob; ob=ob->id.next)
- if(ob->gpulamp.first)
+ 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)
+ for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ if (ma->gpumaterial.first)
GPU_material_free(ma);
}
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 64f54e63cb9..31b53fcabe1 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -66,16 +66,16 @@ static ScrArea *biggest_non_image_area(bContext *C)
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) {
+ 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) {
+ if (sa->spacetype == SPACE_BUTS) {
+ if (foundwin == 0 && size > bwmaxsize) {
bwmaxsize= size;
big= sa;
}
}
- else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
+ else if (sa->spacetype != SPACE_IMAGE && size > maxsize) {
maxsize= size;
big= sa;
foundwin= 1;
@@ -93,15 +93,15 @@ static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
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) {
+ 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)
+ if (sima->image && sima->image->type==IMA_TYPE_R_RESULT)
break;
}
}
- if(sa)
+ if (sa)
break;
}
@@ -115,10 +115,10 @@ static ScrArea *find_area_image_empty(bContext *C)
SpaceImage *sima;
/* find an imagewindow showing render result */
- for(sa=sc->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
+ for (sa=sc->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype==SPACE_IMAGE) {
sima= sa->spacedata.first;
- if(!sima->image)
+ if (!sima->image)
break;
}
}
@@ -137,10 +137,10 @@ void render_view_open(bContext *C, int mx, int my)
SpaceImage *sima;
int area_was_image=0;
- if(scene->r.displaymode==R_OUTPUT_NONE)
+ if (scene->r.displaymode==R_OUTPUT_NONE)
return;
- if(scene->r.displaymode==R_OUTPUT_WINDOW) {
+ if (scene->r.displaymode==R_OUTPUT_WINDOW) {
rcti rect;
int sizex, sizey;
@@ -148,8 +148,8 @@ void render_view_open(bContext *C, int mx, int my)
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;
+ if (sizex < 320) sizex= 320;
+ if (sizey < 256) sizey= 256;
/* XXX some magic to calculate postition */
rect.xmin = mx + win->posx - sizex/2;
@@ -162,7 +162,7 @@ void render_view_open(bContext *C, int mx, int my)
sa= CTX_wm_area(C);
}
- else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
+ else if (scene->r.displaymode==R_OUTPUT_SCREEN) {
if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
area_was_image = 1;
@@ -170,19 +170,19 @@ void render_view_open(bContext *C, int mx, int my)
sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
}
- if(!sa) {
+ if (!sa) {
sa= find_area_showing_r_result(C, &win);
- if(sa==NULL)
+ 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))
+ if (win && win!=CTX_wm_window(C))
wm_window_raise(win);
- if(sa==NULL) {
+ if (sa==NULL) {
/* find largest open non-image area */
sa= biggest_non_image_area(C);
- if(sa) {
+ if (sa) {
ED_area_newspace(C, sa, SPACE_IMAGE);
sima= sa->spacedata.first;
@@ -192,7 +192,7 @@ void render_view_open(bContext *C, int mx, int my)
else {
/* use any area of decent size */
sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0);
- if(sa->spacetype!=SPACE_IMAGE) {
+ if (sa->spacetype!=SPACE_IMAGE) {
// XXX newspace(sa, SPACE_IMAGE);
sima= sa->spacedata.first;
@@ -210,7 +210,7 @@ void render_view_open(bContext *C, int mx, int my)
/* if we're rendering to full screen, set appropriate hints on image editor
* so it can restore properly on pressing esc */
- if(sa->full) {
+ if (sa->full) {
sima->flag |= SI_FULLWINDOW;
/* Tell the image editor to revert to previous space in space list on close
@@ -234,15 +234,15 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
SpaceImage *sima= sa->spacedata.first;
/* test if we have a temp screen in front */
- if(CTX_wm_window(C)->screen->temp) {
+ 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) {
+ else if (sima->flag & SI_PREVSPACE) {
sima->flag &= ~SI_PREVSPACE;
- if(sima->flag & SI_FULLWINDOW) {
+ if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
@@ -251,7 +251,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else if(sima->flag & SI_FULLWINDOW) {
+ else if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_toggle(C, win, sa);
return OPERATOR_FINISHED;
@@ -279,7 +279,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
wmWindow *wincur = CTX_wm_window(C);
/* test if we have currently a temp screen active */
- if(wincur->screen->temp) {
+ if (wincur->screen->temp) {
wm_window_lower(wincur);
}
else {
@@ -287,30 +287,30 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
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)) {
+ 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) {
+ if (sa) {
/* but don't close it when rendering */
- if(!G.rendering) {
+ if (!G.rendering) {
SpaceImage *sima= sa->spacedata.first;
- if(sima->flag & SI_PREVSPACE) {
+ if (sima->flag & SI_PREVSPACE) {
sima->flag &= ~SI_PREVSPACE;
- if(sima->flag & SI_FULLWINDOW) {
+ if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
- else if(sima->next) {
+ 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)
+ 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);