diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
commit | 95011f6d484b369db92ae13c674a6522d664ea8f (patch) | |
tree | 91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/render | |
parent | 0911acb5cf49c5ba05b1df045b41697704aa288a (diff) | |
parent | 44505b38df557a5711703613685a1dec9fc2c3d9 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_internal.c | 30 | ||||
-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 | 120 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 72 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 14 | ||||
-rw-r--r-- | source/blender/editors/render/render_view.c | 12 |
7 files changed, 131 insertions, 131 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 9c56f4f7754..2d65b361f99 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -272,7 +272,7 @@ static void screen_render_single_layer_set(wmOperator *op, Main *mainp, WorkSpac 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; @@ -288,7 +288,7 @@ static void screen_render_single_layer_set(wmOperator *op, Main *mainp, WorkSpac RNA_string_get(op->ptr, "layer", rl_name); rl = (ViewLayer *)BLI_findstring(&(*scene)->view_layers, rl_name, offsetof(ViewLayer, name)); - + if (rl) *single_layer = rl; } @@ -445,7 +445,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); @@ -487,7 +487,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; @@ -574,10 +574,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); @@ -596,7 +596,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; } @@ -683,13 +683,13 @@ static void render_endjob(void *rjv) ED_update_for_newframe(G.main, rj->depsgraph); } } - + /* 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->single_layer) { nodeUpdateID(rj->scene->nodetree, &rj->scene->id); WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene); @@ -902,14 +902,14 @@ 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)); /* 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); @@ -930,7 +930,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; - + if (RNA_struct_property_is_set(op->ptr, "layer")) jobflag |= WM_JOB_SUSPEND; @@ -1075,10 +1075,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 c2bc6170137..bb979087400 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -455,7 +455,7 @@ static void add_gpencil_renderpass(const bContext *C, OGLRender *oglrender, Rend 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; @@ -477,7 +477,7 @@ static void add_gpencil_renderpass(const bContext *C, OGLRender *oglrender, Rend /* render this gp layer */ screen_opengl_render_doit(C, oglrender, rr); - + /* add RendePass composite */ RenderPass *rp = RE_create_gp_pass(rr, gpl->info, rv->name); @@ -1108,7 +1108,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(C, op->customdata); screen_opengl_render_end(C, op->customdata); @@ -1138,16 +1138,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 799264ce74e..dd5ed5b78f1 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 946da6f1ed8..b3601226932 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" @@ -155,21 +155,21 @@ typedef struct ShaderPreview { /* from wmJob */ void *owner; short *stop, *do_update; - + Scene *scene; Depsgraph *depsgraph; 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; @@ -249,7 +249,7 @@ void ED_preview_free_dbase(void) static Scene *preview_get_scene(Main *pr_main) { if (pr_main == NULL) return NULL; - + return pr_main->scene.first; } @@ -334,13 +334,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; @@ -349,7 +349,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 @@ -367,16 +367,16 @@ 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); - + /* use current scene world to light sphere */ if (mat->pr_type == MA_SPHERE_A && sp->pr_method == PR_BUTS_RENDER) { /* Use current scene world to light sphere. */ @@ -390,7 +390,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->world->horg = 0.5f; sce->world->horb = 0.5f; } - + if (sp->pr_method == PR_ICON_RENDER) { set_preview_collection(sce, view_layer, MA_SPHERE_A); } @@ -406,14 +406,14 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty } else { sce->r.mode &= ~(R_OSA); - + } - + for (Base *base = view_layer->object_bases.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); @@ -430,14 +430,14 @@ 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); } set_preview_collection(sce, view_layer, MA_TEXTURE); - + if (tex && tex->nodetree && sp->pr_method == PR_NODE_RENDER) { /* two previews, they get copied by wmJob */ BKE_node_preview_init_tree(origtex->nodetree, sp->sizex, sp->sizey, true); @@ -463,7 +463,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty sce->world->horg = 0.0f; sce->world->horb = 0.0f; } - + for (Base *base = view_layer->object_bases.first; base; base = base->next) { if (base->object->id.name[2] == 'p') { if (base->object->type == OB_LAMP) @@ -498,7 +498,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty return sce; } - + return NULL; } @@ -547,7 +547,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); @@ -565,9 +565,9 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); immDrawPixelsTex(&state, fx, fy, rres.rectx, rres.recty, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect_byte, 1.0f, 1.0f, NULL); - + MEM_freeN(rect_byte); - + ok = 1; } } @@ -629,7 +629,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; } @@ -645,30 +645,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); } @@ -686,7 +686,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs int sizex; Main *pr_main = sp->pr_main; ID *id_eval = DEG_get_evaluated_id(sp->depsgraph, id); - + /* in case of split preview, use border render */ if (split) { if (first) sizex = sp->sizex / 2; @@ -703,19 +703,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_eval, 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; @@ -740,7 +740,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) @@ -754,14 +754,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; @@ -793,16 +793,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); @@ -816,11 +816,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); @@ -832,11 +832,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); @@ -848,11 +848,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); @@ -860,7 +860,7 @@ static void shader_preview_free(void *customdata) } MEM_freeN(sp->lampcopy); } - + MEM_freeN(sp); } @@ -876,13 +876,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; @@ -891,15 +891,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); @@ -917,7 +917,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; @@ -1101,7 +1101,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; @@ -1246,12 +1246,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 e2c4335dca9..3f32242cd1b 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -105,7 +105,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) { @@ -113,11 +113,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; } @@ -127,7 +127,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; @@ -148,7 +148,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) { @@ -156,12 +156,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); } - + DEG_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; } @@ -171,7 +171,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; @@ -225,7 +225,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); - + return OPERATOR_FINISHED; } @@ -235,7 +235,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; @@ -319,7 +319,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; @@ -338,7 +338,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; @@ -361,7 +361,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; DEG_id_tag_update(&ob_iter->id, OB_RECALC_DATA); @@ -492,7 +492,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_MATERIAL | NA_ADDED, ma); - + return OPERATOR_FINISHED; } @@ -502,7 +502,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; @@ -541,7 +541,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, tex); - + return OPERATOR_FINISHED; } @@ -551,7 +551,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; @@ -592,7 +592,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_WORLD | NA_ADDED, wo); - + return OPERATOR_FINISHED; } @@ -602,7 +602,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; @@ -625,7 +625,7 @@ static int view_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) DEG_id_tag_update(&scene->id, 0); DEG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); - + return OPERATOR_FINISHED; } @@ -635,7 +635,7 @@ void SCENE_OT_view_layer_add(wmOperatorType *ot) ot->name = "Add View Layer"; ot->idname = "SCENE_OT_view_layer_add"; ot->description = "Add a view layer"; - + /* api callbacks */ ot->exec = view_layer_add_exec; @@ -664,7 +664,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot) ot->name = "Remove View Layer"; ot->idname = "SCENE_OT_view_layer_remove"; ot->description = "Remove the selected view layer"; - + /* api callbacks */ ot->exec = view_layer_remove_exec; @@ -1433,11 +1433,11 @@ 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); - + set_active_mtex(id, act - 1); } } @@ -1446,11 +1446,11 @@ 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); - + set_active_mtex(id, act + 1); } } @@ -1555,7 +1555,7 @@ void ED_render_clear_mtex_copybuf(void) static void copy_mtex_copybuf(ID *id) { MTex **mtex = NULL; - + switch (GS(id->name)) { case ID_PA: mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); @@ -1566,7 +1566,7 @@ static void copy_mtex_copybuf(ID *id) default: break; } - + if (mtex && *mtex) { memcpy(&mtexcopybuf, *mtex, sizeof(MTex)); mtexcopied = 1; @@ -1579,10 +1579,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_PA: mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); @@ -1594,7 +1594,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"); @@ -1602,9 +1602,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); } } @@ -1628,7 +1628,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); } @@ -1642,7 +1642,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 */ } @@ -1668,7 +1668,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 de731888e4b..b7e6508117e 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -111,12 +111,12 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update CTX_wm_manager_set(C, bmain->wm.first); wm = bmain->wm.first; - + for (win = wm->windows.first; win; win = win->next) { bScreen *sc = WM_window_get_active_screen(win); ScrArea *sa; ARegion *ar; - + CTX_wm_window_set(C, win); for (sa = sc->areabase.first; sa; sa = sa->next) { @@ -220,22 +220,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; - + } } } diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index e4bae9d78ea..a522817825a 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -104,7 +104,7 @@ static ScrArea *find_area_showing_r_result(bContext *C, Scene *scene, wmWindow * break; } } - + return sa; } @@ -139,7 +139,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; @@ -177,7 +177,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); @@ -292,7 +292,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 (WM_window_is_temp_screen(wincur)) { wm_window_lower(wincur); @@ -300,7 +300,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) { const bScreen *sc = WM_window_get_active_screen(win); @@ -312,7 +312,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 */ |