diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/render | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_internal.c | 118 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 12 | ||||
-rw-r--r-- | source/blender/editors/render/render_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_preview.c | 132 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 128 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 38 | ||||
-rw-r--r-- | source/blender/editors/render/render_view.c | 12 |
7 files changed, 221 insertions, 221 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index c7d80bd1761..8a15179a46e 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -264,7 +264,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s RNA_string_get(op->ptr, "scene", scene_name); scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2); - + if (scn) { /* camera switch wont have updated */ scn->r.cfra = (*scene)->r.cfra; @@ -280,7 +280,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s RNA_string_get(op->ptr, "layer", rl_name); rl = (SceneRenderLayer *)BLI_findstring(&(*scene)->r.layers, rl_name, offsetof(SceneRenderLayer, name)); - + if (rl) *srl = rl; } @@ -427,7 +427,7 @@ static void make_renderinfo_string(const RenderStats *rs, /* full sample */ if (rs->curfsa) spos += sprintf(spos, IFACE_("| Full Sample %d "), rs->curfsa); - + /* extra info */ if (rs->infostr && rs->infostr[0]) { spos += sprintf(spos, "| %s ", rs->infostr); @@ -469,7 +469,7 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs) static void render_progress_update(void *rjv, float progress) { RenderJob *rj = rjv; - + if (rj->progress && *rj->progress != progress) { *rj->progress = progress; @@ -555,10 +555,10 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec *(rj->do_update) = true; return; } - + if (rr == NULL) return; - + /* update part of render */ render_image_update_pass_and_layer(rj, rr, &rj->iuser); ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock); @@ -577,7 +577,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec { image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, renrect, viewname); } - + /* make jobs timer to send notifier */ *(rj->do_update) = true; } @@ -663,13 +663,13 @@ static void render_endjob(void *rjv) ED_update_for_newframe(G.main, rj->scene, 1); } } - + /* XXX above function sets all tags in nodes */ ntreeCompositClearTags(rj->scene->nodetree); - + /* potentially set by caller */ rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE; - + if (rj->srl) { nodeUpdateID(rj->scene->nodetree, &rj->scene->id); WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene); @@ -846,7 +846,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL; const char *name; ScrArea *sa; - + /* only one render job at a time */ if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) return OPERATOR_CANCELLED; @@ -862,7 +862,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); return OPERATOR_CANCELLED; } - + /* stop all running jobs, except screen one. currently previews frustrate Render */ WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); @@ -878,7 +878,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even /* cancel animation playback */ if (ED_screen_animation_playing(CTX_wm_manager(C))) ED_screen_animation_play(C, 0, 0); - + /* handle UI stuff */ WM_cursor_wait(1); @@ -899,7 +899,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even sa = render_view_open(C, event->x, event->y, op->reports); jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS; - + /* custom scene and single layer re-render */ screen_render_scene_layer_set(op, mainp, &scene, &srl); @@ -1055,7 +1055,7 @@ typedef struct RenderPreview { void *owner; short *stop, *do_update; wmJob *job; - + Scene *scene; ScrArea *sa; ARegion *ar; @@ -1063,7 +1063,7 @@ typedef struct RenderPreview { RegionView3D *rv3d; Main *bmain; RenderEngine *engine; - + float viewmat[4][4]; int start_resolution_divider; @@ -1076,7 +1076,7 @@ static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, Region /* copied code from view3d_draw.c */ rctf viewborder; int draw_border; - + if (rv3d->persp == RV3D_CAMOB) draw_border = (scene->r.mode & R_BORDER) != 0; else @@ -1085,7 +1085,7 @@ static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, Region if (draw_border) { if (rv3d->persp == RV3D_CAMOB) { ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); - + disprect->xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder); disprect->ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder); disprect->xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder); @@ -1097,10 +1097,10 @@ static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, Region disprect->ymin = v3d->render_border.ymin * ar->winy; disprect->ymax = v3d->render_border.ymax * ar->winy; } - + return 1; } - + BLI_rcti_init(disprect, 0, 0, 0, 0); return 0; } @@ -1109,11 +1109,11 @@ static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, Region static bool render_view3d_get_rects(ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewplane, RenderEngine *engine, float *r_clipsta, float *r_clipend, float *r_pixsize, bool *r_ortho) { - + if (ar->winx < 4 || ar->winy < 4) return false; - + *r_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, viewplane, r_clipsta, r_clipend, r_pixsize); - + engine->resolution_x = ar->winx; engine->resolution_y = ar->winy; @@ -1129,22 +1129,22 @@ static bool render_view3d_is_valid(RenderPreview *rp) static int render_view3d_break(void *rpv) { RenderPreview *rp = rpv; - + if (G.is_break) return 1; - + /* during render, rv3d->engine can get freed */ if (render_view3d_is_valid(rp) == false) { *rp->stop = 1; } - + return *(rp->stop); } static void render_view3d_display_update(void *rpv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) { RenderPreview *rp = rpv; - + *(rp->do_update) = true; } @@ -1158,7 +1158,7 @@ static void render_view3d_renderinfo_cb(void *rjp, RenderStats *rs) } else { make_renderinfo_string(rs, rp->scene, false, NULL, rp->engine->text); - + /* make jobs timer to send notifier */ *(rp->do_update) = true; } @@ -1218,24 +1218,24 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda //printf("ma %d res %d view %d db %d\n", update_flag & PR_UPDATE_MATERIAL, update_flag & PR_UPDATE_RENDERSIZE, update_flag & PR_UPDATE_VIEW, update_flag & PR_UPDATE_DATABASE); G.is_break = false; - + if (false == render_view3d_get_rects(rp->ar, rp->v3d, rp->rv3d, &viewplane, rp->engine, &clipsta, &clipend, &pixsize, &orth)) return; - + rp->stop = stop; rp->do_update = do_update; // printf("Enter previewrender\n"); - + /* ok, are we rendering all over? */ sprintf(name, "View3dPreview %p", (void *)rp->ar); re = rp->engine->re = RE_GetRender(name); - + /* set this always, rp is different for each job */ RE_test_break_cb(re, rp, render_view3d_break); RE_display_update_cb(re, rp, render_view3d_display_update); RE_stats_draw_cb(re, rp, render_view3d_renderinfo_cb); - + rstats = RE_GetStats(re); if (update_flag & PR_UPDATE_VIEW) { @@ -1282,7 +1282,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda RE_SetWindow(re, &viewplane, clipsta, clipend); RE_SetPixelSize(re, pixsize); - + if ((update_flag & PR_UPDATE_DATABASE) || rstats->convertdone == 0) { unsigned int lay = rp->scene->lay; @@ -1290,7 +1290,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda if (rp->v3d->lay & 0xFF000000) lay |= rp->v3d->lay; else lay = rp->v3d->lay; - + RE_SetView(re, rp->viewmat); /* copying blender data while main thread is locked, to avoid crashes */ @@ -1366,7 +1366,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda static void render_view3d_free(void *customdata) { RenderPreview *rp = customdata; - + MEM_freeN(rp); } @@ -1384,7 +1384,7 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) bool orth; int job_update_flag = 0; char name[32]; - + /* ensure render engine exists */ re = engine->re; @@ -1400,10 +1400,10 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) /* check update_flag */ if (engine->update_flag & RE_ENGINE_UPDATE_MA) job_update_flag |= PR_UPDATE_MATERIAL; - + if (engine->update_flag & RE_ENGINE_UPDATE_OTHER) job_update_flag |= PR_UPDATE_MATERIAL; - + if (engine->update_flag & RE_ENGINE_UPDATE_DATABASE) { job_update_flag |= PR_UPDATE_DATABASE; @@ -1411,9 +1411,9 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) if (scene->obedit) ED_object_editmode_load(bmain, scene->obedit); } - + engine->update_flag = 0; - + /* check if viewport changed */ if (engine->last_winx != ar->winx || engine->last_winy != ar->winy) { engine->last_winx = ar->winx; @@ -1425,14 +1425,14 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) copy_m4_m4(engine->last_viewmat, rv3d->viewmat); job_update_flag |= PR_UPDATE_VIEW; } - + render_view3d_get_rects(ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, NULL, &orth); - + if (BLI_rctf_compare(&viewplane, &engine->last_viewplane, 0.00001f) == 0) { engine->last_viewplane = viewplane; job_update_flag |= PR_UPDATE_VIEW; } - + render_view3d_disprect(scene, ar, v3d, rv3d, &disprect); if (BLI_rcti_compare(&disprect, &engine->last_disprect) == 0) { engine->last_disprect = disprect; @@ -1487,23 +1487,23 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C) rp->start_resolution_divider = divider; rp->has_freestyle = (scene->r.mode & R_EDGE_FRS) != 0; copy_m4_m4(rp->viewmat, rp->rv3d->viewmat); - + /* clear info text */ engine->text[0] = '\0'; - + /* setup job */ WM_jobs_customdata_set(wm_job, rp, render_view3d_free); WM_jobs_timer(wm_job, 0.1, NC_SPACE | ND_SPACE_VIEW3D, NC_SPACE | ND_SPACE_VIEW3D); WM_jobs_callbacks(wm_job, render_view3d_startjob, NULL, NULL, NULL); - + WM_jobs_start(CTX_wm_manager(C), wm_job); - + engine->flag &= ~RE_ENGINE_DO_UPDATE; } /* callback for render engine, on changes */ void render_view3d_update(RenderEngine *engine, const bContext *C) -{ +{ /* this shouldn't be needed and causes too many database rebuilds, but we * aren't actually tracking updates for all relevant datablocks so this is * a catch-all for updates */ @@ -1517,19 +1517,19 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C) Render *re = engine->re; RenderResult rres; char name[32]; - + render_view3d_do(engine, C); - + if (re == NULL) { sprintf(name, "View3dPreview %p", (void *)CTX_wm_region(C)); re = RE_GetRender(name); - + if (re == NULL) return; } - + /* Viewport render preview doesn't support multiview, view hardcoded to 0 */ RE_AcquireResultImage(re, &rres, 0); - + if (rres.rectf) { RegionView3D *rv3d = CTX_wm_region_view3d(C); View3D *v3d = CTX_wm_view3d(C); @@ -1617,13 +1617,13 @@ void ED_viewport_render_kill_jobs(wmWindowManager *wm, for (sa = sc->areabase.first; sa; sa = sa->next) { if (sa->spacetype != SPACE_VIEW3D) continue; - + for (ar = sa->regionbase.first; ar; ar = ar->next) { RegionView3D *rv3d; - + if (ar->regiontype != RGN_TYPE_WINDOW) continue; - + rv3d = ar->regiondata; if (rv3d->render_engine) { @@ -1656,10 +1656,10 @@ Scene *ED_render_job_get_scene(const bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER); - + if (rj) return rj->scene; - + return NULL; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 1133b5f79d1..cdbfac06422 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -458,7 +458,7 @@ static void add_gpencil_renderpass(OGLRender *oglrender, RenderResult *rr, Rende short oldalphamode = scene->r.alphamode; /* set alpha transparent for gp */ scene->r.alphamode = R_ALPHAPREMUL; - + /* saves layer status */ short *oldsts = MEM_mallocN(BLI_listbase_count(&gpd->layers) * sizeof(short), "temp_gplayers_flag"); int i = 0; @@ -480,7 +480,7 @@ static void add_gpencil_renderpass(OGLRender *oglrender, RenderResult *rr, Rende /* render this gp layer */ screen_opengl_render_doit(oglrender, rr); - + /* add RendePass composite */ RenderPass *rp = RE_create_gp_pass(rr, gpl->info, rv->name); @@ -1105,7 +1105,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent /* 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) { screen_opengl_render_apply(op->customdata); screen_opengl_render_end(C, op->customdata); @@ -1135,16 +1135,16 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven if (!screen_opengl_render_anim_initialize(C, op)) return OPERATOR_CANCELLED; } - + oglrender = op->customdata; render_view_open(C, event->x, event->y, op->reports); - + /* view may be changed above (R_OUTPUT_WINDOW) */ oglrender->win = CTX_wm_window(C); WM_event_add_modal_handler(C, op); oglrender->timer = WM_event_add_timer(oglrender->wm, oglrender->win, TIMER, 0.01f); - + return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c index 963153c559e..9a2549fca81 100644 --- a/source/blender/editors/render/render_ops.c +++ b/source/blender/editors/render/render_ops.c @@ -52,7 +52,7 @@ void ED_operatortypes_render(void) WM_operatortype_append(MATERIAL_OT_new); WM_operatortype_append(TEXTURE_OT_new); WM_operatortype_append(WORLD_OT_new); - + WM_operatortype_append(MATERIAL_OT_copy); WM_operatortype_append(MATERIAL_OT_paste); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index d236a7ba93d..dc79d5d9847 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -40,7 +40,7 @@ #include <unistd.h> #else #include <io.h> -#endif +#endif #include "MEM_guardedalloc.h" #include "BLI_math.h" @@ -147,20 +147,20 @@ typedef struct ShaderPreview { /* from wmJob */ void *owner; short *stop, *do_update; - + Scene *scene; ID *id; ID *parent; MTex *slot; - + /* datablocks with nodes need full copy during preview render, glsl uses it too */ Material *matcopy; Tex *texcopy; Lamp *lampcopy; World *worldcopy; - + float col[4]; /* active object color */ - + int sizex, sizey; unsigned int *pr_rect; int pr_method; @@ -265,7 +265,7 @@ static int preview_mat_has_sss(Material *mat, bNodeTree *ntree) static Scene *preview_get_scene(Main *pr_main) { if (pr_main == NULL) return NULL; - + return pr_main->scene.first; } @@ -282,7 +282,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce = preview_get_scene(pr_main); if (sce) { - + /* this flag tells render to not execute depsgraph or ipos etc */ sce->r.scemode |= R_BUTS_PREVIEW; /* set world always back, is used now */ @@ -292,13 +292,13 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->world->exp = scene->world->exp; sce->world->range = scene->world->range; } - + sce->r.color_mgt_flag = scene->r.color_mgt_flag; BKE_color_managed_display_settings_copy(&sce->display_settings, &scene->display_settings); BKE_color_managed_view_settings_free(&sce->view_settings); BKE_color_managed_view_settings_copy(&sce->view_settings, &scene->view_settings); - + /* prevent overhead for small renders and icons (32) */ if (id && sp->sizex < 40) { sce->r.tilex = sce->r.tiley = 64; @@ -307,7 +307,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->r.tilex = sce->r.xsch / 4; sce->r.tiley = sce->r.ysch / 4; } - + if ((id && sp->pr_method == PR_ICON_RENDER) && id_type != ID_WO) sce->r.alphamode = R_ALPHAPREMUL; else @@ -325,20 +325,20 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty else { BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); } - + if (id_type == ID_MA) { Material *mat = NULL, *origmat = (Material *)id; - + if (origmat) { /* work on a copy */ mat = BKE_material_localize(origmat); sp->matcopy = mat; BLI_addtail(&pr_main->mat, mat); - + if (!BKE_scene_use_new_shading_nodes(scene)) { init_render_material(bmain, mat, 0, NULL); /* call that retrieves mode_l */ end_render_material(mat); - + /* un-useful option */ if (sp->pr_method == PR_ICON_RENDER) mat->shade_flag &= ~MA_OBCOLOR; @@ -352,7 +352,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->r.mode |= R_RAYTRACE; 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) @@ -366,8 +366,8 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty } } } - - /* turn off bounce lights for volume, + + /* turn off bounce lights for volume, * doesn't make much visual difference and slows it down too */ for (base = sce->base.first; base; base = base->next) { if (base->object->type == OB_LAMP) { @@ -395,7 +395,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->world->horb = 0.5f; } } - + if (sp->pr_method == PR_ICON_RENDER) { if (mat->material_type == MA_TYPE_HALO) { sce->lay = 1 << MA_FLAT; @@ -415,14 +415,14 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty } else { sce->r.mode &= ~(R_OSA | R_RAYTRACE | R_SSS); - + } - + 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)) { /* don't use assign_material, it changed mat->id.us, which shows in the UI */ Material ***matar = give_matarar(base->object); @@ -439,20 +439,20 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty } else if (id_type == ID_TE) { Tex *tex = NULL, *origtex = (Tex *)id; - + if (origtex) { tex = BKE_texture_localize(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') { Material *mat = give_current_material(base->object, base->object->actcol); if (mat && mat->mtex[0]) { mat->mtex[0]->tex = tex; - + if (tex && sp->slot) mat->mtex[0]->which_output = sp->slot->which_output; @@ -508,7 +508,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->world->horb = 0.0f; } } - + for (base = sce->base.first; base; base = base->next) { if (base->object->id.name[2] == 'p') { if (base->object->type == OB_LAMP) @@ -543,7 +543,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty return sce; } - + return NULL; } @@ -592,7 +592,7 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, } if (rv && rv->rectf) { - + if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) { newrect->xmax = max_ii(newrect->xmax, rect->xmin + rres.rectx + offx); @@ -608,9 +608,9 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, RE_AcquiredResultGet32(re, &rres, (unsigned int *)rect_byte, 0); glaDrawPixelsSafe(fx, fy, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect_byte); - + MEM_freeN(rect_byte); - + ok = 1; } } @@ -672,7 +672,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r static void shader_preview_update(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) { ShaderPreview *sp = spv; - + *(sp->do_update) = true; } @@ -688,30 +688,30 @@ static int shader_preview_break(void *spv) 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) { Material *mat = (Material *)sp->id; - + if (sp->matcopy && mat->nodetree && sp->matcopy->nodetree) ntreeLocalSync(sp->matcopy->nodetree, mat->nodetree); } else if (GS(sp->id->name) == ID_TE) { Tex *tex = (Tex *)sp->id; - + if (sp->texcopy && tex->nodetree && sp->texcopy->nodetree) ntreeLocalSync(sp->texcopy->nodetree, tex->nodetree); } else if (GS(sp->id->name) == ID_WO) { World *wrld = (World *)sp->id; - + if (sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree) ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree); } else if (GS(sp->id->name) == ID_LA) { Lamp *la = (Lamp *)sp->id; - + if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree) ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree); } @@ -728,7 +728,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs char name[32]; int sizex; Main *pr_main = sp->pr_main; - + /* in case of split preview, use border render */ if (split) { if (first) sizex = sp->sizex / 2; @@ -745,19 +745,19 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs sce->r.ysch = sp->sizey; sce->r.size = 100; } - + /* get the stuff from the builtin preview dbase */ sce = preview_prepare_scene(sp->bmain, sp->scene, id, idtype, sp); if (sce == NULL) return; - + 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) 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; @@ -782,7 +782,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs } /* set this for all previews, default is react to G.is_break still */ RE_test_break_cb(re, sp, shader_preview_break); - + /* lens adjust */ oldlens = ((Camera *)sce->camera->data)->lens; if (sizex > sp->sizey) @@ -796,14 +796,14 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs /* handle results */ if (sp->pr_method == PR_ICON_RENDER) { // char *rct= (char *)(sp->pr_rect + 32*16 + 16); - + if (sp->pr_rect) RE_ResultGet32(re, sp->pr_rect); } /* unassign the pointers, reset vars */ preview_prepare_scene(sp->bmain, 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) { // Tex *tex= (Tex *)id; @@ -835,16 +835,16 @@ static void shader_preview_free(void *customdata) { ShaderPreview *sp = customdata; Main *pr_main = sp->pr_main; - + if (sp->matcopy) { struct IDProperty *properties; - + /* node previews */ shader_preview_updatejob(sp); - + /* get rid of copied material */ BLI_remlink(&pr_main->mat, sp->matcopy); - + BKE_material_free(sp->matcopy); properties = IDP_GetProperties((ID *)sp->matcopy, false); @@ -858,11 +858,11 @@ static void shader_preview_free(void *customdata) struct IDProperty *properties; /* node previews */ shader_preview_updatejob(sp); - + /* get rid of copied texture */ BLI_remlink(&pr_main->tex, sp->texcopy); BKE_texture_free(sp->texcopy); - + properties = IDP_GetProperties((ID *)sp->texcopy, false); if (properties) { IDP_FreeProperty(properties); @@ -874,11 +874,11 @@ static void shader_preview_free(void *customdata) struct IDProperty *properties; /* node previews */ shader_preview_updatejob(sp); - + /* get rid of copied world */ BLI_remlink(&pr_main->world, sp->worldcopy); BKE_world_free(sp->worldcopy); - + properties = IDP_GetProperties((ID *)sp->worldcopy, false); if (properties) { IDP_FreeProperty(properties); @@ -890,11 +890,11 @@ static void shader_preview_free(void *customdata) struct IDProperty *properties; /* node previews */ shader_preview_updatejob(sp); - + /* get rid of copied lamp */ BLI_remlink(&pr_main->lamp, sp->lampcopy); BKE_lamp_free(sp->lampcopy); - + properties = IDP_GetProperties((ID *)sp->lampcopy, false); if (properties) { IDP_FreeProperty(properties); @@ -902,7 +902,7 @@ static void shader_preview_free(void *customdata) } MEM_freeN(sp->lampcopy); } - + MEM_freeN(sp); } @@ -918,13 +918,13 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned /* paranoia test */ 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) */ ima = IMB_dupImBuf(ibuf); - - if (!ima) + + if (!ima) return; - + if (ima->x > ima->y) { scaledx = (float)w; scaledy = ( (float)ima->y / (float)ima->x) * (float)w; @@ -933,15 +933,15 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned scaledx = ( (float)ima->x / (float)ima->y) * (float)h; scaledy = (float)h; } - + ex = (short)scaledx; ey = (short)scaledy; - + dx = (w - ex) / 2; dy = (h - ey) / 2; - + IMB_scalefastImBuf(ima, ex, ey); - + /* if needed, convert to 32 bits */ if (ima->rect == NULL) IMB_rect_from_float(ima); @@ -959,7 +959,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned IMB_freeImBuf(ima); } -static void set_alpha(char *cp, int sizex, int sizey, char alpha) +static void set_alpha(char *cp, int sizex, int sizey, char alpha) { int a, size = sizex * sizey; @@ -1148,7 +1148,7 @@ static void icon_preview_endjob(void *customdata) if (GS(ip->id->name) == ID_BR) WM_main_add_notifier(NC_BRUSH | NA_EDITED, ip->id); -#if 0 +#if 0 if (GS(ip->id->name) == ID_MA) { Material *ma = (Material *)ip->id; PreviewImage *prv_img = ma->preview; @@ -1290,12 +1290,12 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M 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 */ WM_jobs_customdata_set(wm_job, sp, shader_preview_free); WM_jobs_timer(wm_job, 0.1, NC_MATERIAL, NC_MATERIAL); WM_jobs_callbacks(wm_job, common_preview_startjob, NULL, shader_preview_updatejob, NULL); - + WM_jobs_start(CTX_wm_manager(C), wm_job); } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 820042ac172..fe87f8bdbb2 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -102,7 +102,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) if (!ob) return OPERATOR_CANCELLED; - + BKE_object_material_slot_add(bmain, ob); if (ob->mode & OB_MODE_TEXTURE_PAINT) { @@ -110,11 +110,11 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } - + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob); - + return OPERATOR_FINISHED; } @@ -124,7 +124,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot) ot->name = "Add Material Slot"; ot->idname = "OBJECT_OT_material_slot_add"; ot->description = "Add a new material slot"; - + /* api callbacks */ ot->exec = material_slot_add_exec; ot->poll = ED_operator_object_active_editable; @@ -145,7 +145,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode"); return OPERATOR_CANCELLED; } - + BKE_object_material_slot_remove(CTX_data_main(C), ob); if (ob->mode & OB_MODE_TEXTURE_PAINT) { @@ -153,12 +153,12 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } - + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob); - + return OPERATOR_FINISHED; } @@ -168,7 +168,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot) ot->name = "Remove Material Slot"; ot->idname = "OBJECT_OT_material_slot_remove"; ot->description = "Remove the selected material slot"; - + /* api callbacks */ ot->exec = material_slot_remove_exec; ot->poll = ED_operator_object_active_editable; @@ -222,7 +222,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); - + return OPERATOR_FINISHED; } @@ -232,7 +232,7 @@ void OBJECT_OT_material_slot_assign(wmOperatorType *ot) ot->name = "Assign Material Slot"; ot->idname = "OBJECT_OT_material_slot_assign"; ot->description = "Assign active material slot to selection"; - + /* api callbacks */ ot->exec = material_slot_assign_exec; ot->poll = ED_operator_object_active_editable; @@ -316,7 +316,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot) ot->name = "Select Material Slot"; ot->idname = "OBJECT_OT_material_slot_select"; ot->description = "Select by active material slot"; - + /* api callbacks */ ot->exec = material_slot_select_exec; @@ -335,7 +335,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) ot->name = "Deselect Material Slot"; ot->idname = "OBJECT_OT_material_slot_deselect"; ot->description = "Deselect by active material slot"; - + /* api callbacks */ ot->exec = material_slot_deselect_exec; @@ -358,7 +358,7 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) if (ob != ob_iter && give_matarar(ob_iter)) { if (ob->data != ob_iter->data) assign_matarar(bmain, ob_iter, matar, ob->totcol); - + if (ob_iter->totcol == ob->totcol) { ob_iter->actcol = ob->actcol; DAG_id_tag_update(&ob_iter->id, OB_RECALC_DATA); @@ -493,7 +493,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_MATERIAL | NA_ADDED, ma); - + return OPERATOR_FINISHED; } @@ -503,7 +503,7 @@ void MATERIAL_OT_new(wmOperatorType *ot) ot->name = "New Material"; ot->idname = "MATERIAL_OT_new"; ot->description = "Add a new material"; - + /* api callbacks */ ot->exec = new_material_exec; @@ -550,7 +550,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, tex); - + return OPERATOR_FINISHED; } @@ -560,7 +560,7 @@ void TEXTURE_OT_new(wmOperatorType *ot) ot->name = "New Texture"; ot->idname = "TEXTURE_OT_new"; ot->description = "Add a new texture"; - + /* api callbacks */ ot->exec = new_texture_exec; @@ -605,7 +605,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_WORLD | NA_ADDED, wo); - + return OPERATOR_FINISHED; } @@ -615,7 +615,7 @@ void WORLD_OT_new(wmOperatorType *ot) ot->name = "New World"; ot->idname = "WORLD_OT_new"; ot->description = "Create a new world Data-Block"; - + /* api callbacks */ ot->exec = new_world_exec; @@ -634,7 +634,7 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&scene->id, 0); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); - + return OPERATOR_FINISHED; } @@ -644,7 +644,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot) ot->name = "Add Render Layer"; ot->idname = "SCENE_OT_render_layer_add"; ot->description = "Add a render layer"; - + /* api callbacks */ ot->exec = render_layer_add_exec; @@ -662,7 +662,7 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&scene->id, 0); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); - + return OPERATOR_FINISHED; } @@ -672,7 +672,7 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) ot->name = "Remove Render Layer"; ot->idname = "SCENE_OT_render_layer_remove"; ot->description = "Remove the selected render layer"; - + /* api callbacks */ ot->exec = render_layer_remove_exec; @@ -1451,7 +1451,7 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) mtexswap = mtex_ar[act]; mtex_ar[act] = mtex_ar[act - 1]; mtex_ar[act - 1] = mtexswap; - + BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act - 1, -1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act - 1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0); @@ -1464,7 +1464,7 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) ma->septex &= ~(1 << (act - 1)); ma->septex |= mtexuse >> 1; } - + set_active_mtex(id, act - 1); } } @@ -1473,7 +1473,7 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) mtexswap = mtex_ar[act]; mtex_ar[act] = mtex_ar[act + 1]; mtex_ar[act + 1] = mtexswap; - + BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act + 1, -1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act + 1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0); @@ -1486,7 +1486,7 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) ma->septex &= ~(1 << (act + 1)); ma->septex |= mtexuse << 1; } - + set_active_mtex(id, act + 1); } } @@ -1552,35 +1552,35 @@ static int envmap_save_exec(bContext *C, wmOperator *op) //int imtype = RNA_enum_get(op->ptr, "file_type"); char imtype = scene->r.im_format.imtype; char path[FILE_MAX]; - + RNA_string_get(op->ptr, "filepath", path); - + if (scene->r.scemode & R_EXTENSION) { BKE_image_path_ensure_ext_from_imformat(path, &scene->r.im_format); } - + WM_cursor_wait(1); - + save_envmap(op, scene, tex->env, path, imtype); - + WM_cursor_wait(0); - + WM_event_add_notifier(C, NC_TEXTURE, tex); - + return OPERATOR_FINISHED; } static int envmap_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { //Scene *scene= CTX_data_scene(C); - + 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); RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); - + return OPERATOR_RUNNING_MODAL; } @@ -1588,13 +1588,13 @@ static int envmap_save_poll(bContext *C) { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - if (!tex) + if (!tex) return 0; if (!tex->env || !tex->env->ok) return 0; if (tex->env->cube[1] == NULL) return 0; - + return 1; } @@ -1605,15 +1605,15 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) ot->name = "Save Environment Map"; ot->idname = "TEXTURE_OT_envmap_save"; ot->description = "Save the current generated Environment map to an image file"; - + /* api callbacks */ ot->exec = envmap_save_exec; ot->invoke = envmap_save_invoke; ot->poll = envmap_save_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo since this doesnt modify the env-map */ - + /* properties */ prop = RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", @@ -1630,25 +1630,25 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - + BKE_texture_envmap_free_data(tex->env); - + WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); - + return OPERATOR_FINISHED; } static int envmap_clear_poll(bContext *C) { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - - if (!tex) + + if (!tex) return 0; if (!tex->env || !tex->env->ok) return 0; if (tex->env->cube[1] == NULL) return 0; - + return 1; } @@ -1658,11 +1658,11 @@ void TEXTURE_OT_envmap_clear(wmOperatorType *ot) ot->name = "Clear Environment Map"; ot->idname = "TEXTURE_OT_envmap_clear"; ot->description = "Discard the environment map and free it from memory"; - + /* api callbacks */ ot->exec = envmap_clear_exec; ot->poll = envmap_clear_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; } @@ -1671,13 +1671,13 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Tex *tex; - + for (tex = bmain->tex.first; tex; tex = tex->id.next) if (tex->env) BKE_texture_envmap_free_data(tex->env); - + WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); - + return OPERATOR_FINISHED; } @@ -1687,11 +1687,11 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot) ot->name = "Clear All Environment Maps"; ot->idname = "TEXTURE_OT_envmap_clear_all"; ot->description = "Discard all environment maps in the .blend file and free them from memory"; - + /* api callbacks */ ot->exec = envmap_clear_all_exec; ot->poll = envmap_clear_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -1765,7 +1765,7 @@ void ED_render_clear_mtex_copybuf(void) static void copy_mtex_copybuf(ID *id) { MTex **mtex = NULL; - + switch (GS(id->name)) { case ID_MA: mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]); @@ -1787,7 +1787,7 @@ static void copy_mtex_copybuf(ID *id) default: break; } - + if (mtex && *mtex) { memcpy(&mtexcopybuf, *mtex, sizeof(MTex)); mtexcopied = 1; @@ -1800,10 +1800,10 @@ static void copy_mtex_copybuf(ID *id) static void paste_mtex_copybuf(ID *id) { MTex **mtex = NULL; - + if (mtexcopied == 0 || mtexcopybuf.tex == NULL) return; - + switch (GS(id->name)) { case ID_MA: mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]); @@ -1826,7 +1826,7 @@ static void paste_mtex_copybuf(ID *id) BLI_assert(!"invalid id type"); return; } - + if (mtex) { if (*mtex == NULL) { *mtex = MEM_mallocN(sizeof(MTex), "mtex copy"); @@ -1834,9 +1834,9 @@ static void paste_mtex_copybuf(ID *id) else if ((*mtex)->tex) { id_us_min(&(*mtex)->tex->id); } - + memcpy(*mtex, &mtexcopybuf, sizeof(MTex)); - + id_us_plus((ID *)mtexcopybuf.tex); } } @@ -1860,7 +1860,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) static int copy_mtex_poll(bContext *C) { ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; - + return (id != NULL); } @@ -1874,7 +1874,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) /* api callbacks */ ot->exec = copy_mtex_exec; ot->poll = copy_mtex_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the mtex */ } @@ -1900,7 +1900,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) id = &psys->part->id; else if (linestyle) id = &linestyle->id; - + if (id == NULL) return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 084e3fce8e6..ceb4c0b27ba 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -100,14 +100,14 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated) CTX_wm_manager_set(C, bmain->wm.first); wm = bmain->wm.first; - + for (win = wm->windows.first; win; win = win->next) { bScreen *sc = win->screen; ScrArea *sa; ARegion *ar; - + CTX_wm_window_set(C, win); - + for (sa = sc->areabase.first; sa; sa = sa->next) { if (sa->spacetype != SPACE_VIEW3D) continue; @@ -207,22 +207,22 @@ static void render_engine_flag_changed(Main *bmain, int update_flag) bScreen *sc; 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) continue; - + for (ar = sa->regionbase.first; ar; ar = ar->next) { RegionView3D *rv3d; - + if (ar->regiontype != RGN_TYPE_WINDOW) continue; - + rv3d = ar->regiondata; if (rv3d->render_engine) rv3d->render_engine->update_flag |= update_flag; - + } } } @@ -238,7 +238,7 @@ static int mtex_use_tex(MTex **mtex, int tot, Tex *tex) for (a = 0; a < tot; a++) if (mtex[a] && mtex[a]->tex == tex) return 1; - + return 0; } @@ -368,7 +368,7 @@ static int material_uses_texture(Material *ma, Tex *tex) return true; else if (ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex)) return true; - + return false; } @@ -426,9 +426,9 @@ static void texture_changed(Main *bmain, Tex *tex) } BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); - + if (wo->gpumaterial.first) - GPU_material_free(&wo->gpumaterial); + GPU_material_free(&wo->gpumaterial); } /* find compositing nodes */ @@ -474,7 +474,7 @@ static void world_changed(Main *bmain, World *wo) /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); - + /* glsl */ for (ma = bmain->mat.first; ma; ma = ma->id.next) if (ma->gpumaterial.first) @@ -482,7 +482,7 @@ static void world_changed(Main *bmain, World *wo) if (defmaterial.gpumaterial.first) GPU_material_free(&defmaterial.gpumaterial); - + if (wo->gpumaterial.first) GPU_material_free(&wo->gpumaterial); } @@ -510,7 +510,7 @@ static void scene_changed(Main *bmain, Scene *scene) for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->gpulamp.first) GPU_lamp_free(ob); - + if (ob->mode & OB_MODE_TEXTURE_PAINT) { BKE_texpaint_slots_refresh_object(scene, ob); BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); @@ -525,7 +525,7 @@ static void scene_changed(Main *bmain, Scene *scene) for (wo = bmain->world.first; wo; wo = wo->id.next) if (wo->gpumaterial.first) GPU_material_free(&wo->gpumaterial); - + if (defmaterial.gpumaterial.first) GPU_material_free(&defmaterial.gpumaterial); } @@ -563,15 +563,15 @@ void ED_render_id_flush_update(Main *bmain, ID *id) render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER); break; } - + } void ED_render_internal_init(void) { RenderEngineType *ret = RE_engines_find(RE_engine_id_BLENDER_RENDER); - + ret->view_update = render_view3d_update; ret->view_draw = render_view3d_draw; - + } diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index c4a9af79ec2..de1194fe93d 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -102,7 +102,7 @@ static ScrArea *find_area_showing_r_result(bContext *C, Scene *scene, wmWindow * break; } } - + return sa; } @@ -137,7 +137,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) if (scene->r.displaymode == R_OUTPUT_NONE) return NULL; - + if (scene->r.displaymode == R_OUTPUT_WINDOW) { int sizex = 30 * UI_DPI_FAC + (scene->r.xsch * scene->r.size) / 100; int sizey = 60 * UI_DPI_FAC + (scene->r.ysch * scene->r.size) / 100; @@ -175,7 +175,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) sa = find_area_showing_r_result(C, scene, &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); @@ -290,7 +290,7 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot) static int render_view_show_invoke(bContext *C, wmOperator *op, const 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); @@ -298,7 +298,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e else { wmWindow *win, *winshow; ScrArea *sa = find_area_showing_r_result(C, CTX_data_scene(C), &winshow); - + /* is there another window on current scene showing result? */ for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) { bScreen *sc = win->screen; @@ -309,7 +309,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_FINISHED; } } - + /* determine if render already shows */ if (sa) { /* but don't close it when rendering */ |