diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-27 16:08:35 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-27 16:08:35 +0300 |
commit | 408515810e99d40a6dd53c3d50f1e4be7eb52c87 (patch) | |
tree | 0aaf16e6011b472bb3b12d92c996268b58ec3080 /source/blender/editors | |
parent | 3bd6c8bfa256793170a21130d398c16da1192473 (diff) | |
parent | 9b42b3e11462e96bf24970971ab181122c6b33df (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors')
7 files changed, 70 insertions, 25 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 12f72bcff3a..feb3686db9f 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -385,17 +385,29 @@ void ED_view3d_draw_setup_view( struct wmWindow *win, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); +enum { + V3D_OFSDRAW_NONE = (0), + + V3D_OFSDRAW_USE_BACKGROUND = (1 << 0), + V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 1), + + /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ + V3D_OFSDRAW_USE_GPENCIL = (1 << 2), + V3D_OFSDRAW_USE_SOLID_TEX = (1 << 2), + V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 3), +}; + struct ImBuf *ED_view3d_draw_offscreen_imbuf( const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ViewLayer *view_layer, struct View3D *v3d, struct ARegion *ar, - int sizex, int sizey, unsigned int flag, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + int sizex, int sizey, unsigned int flag, unsigned int draw_flags, + int alpha_mode, int samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ViewLayer *view_layer, struct Object *camera, int width, int height, - unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, + int samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 021fd5a82fd..9502eea83f7 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1538,7 +1538,9 @@ void MESH_OT_flip_normals(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* only accepts 1 selected edge, or 2 selected faces */ +/** + * Rotate the edges between selected faces, otherwise rotate the selected edges. + */ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a445f8dafea..77535a65e58 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -352,11 +352,15 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R ImBuf *ibuf_view; const int alpha_mode = (draw_sky) ? R_ADDSKY : R_ALPHAPREMUL; + unsigned int draw_flags = V3D_OFSDRAW_NONE; + draw_flags |= (oglrender->ofs_full_samples) ? V3D_OFSDRAW_USE_FULL_SAMPLE : 0; + if (view_context) { + draw_flags |= (draw_bgpic) ? V3D_OFSDRAW_USE_BACKGROUND : 0; + ibuf_view = ED_view3d_draw_offscreen_imbuf( &eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, - IB_rect, draw_bgpic, - alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname, + IB_rect, draw_flags, alpha_mode, oglrender->ofs_samples, viewname, oglrender->fx, oglrender->ofs, err_out); /* for stamp only */ @@ -365,10 +369,11 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R } } else { + draw_flags |= (V3D_OFSDRAW_USE_GPENCIL | V3D_OFSDRAW_USE_BACKGROUND); ibuf_view = ED_view3d_draw_offscreen_imbuf_simple( &eval_ctx, scene, view_layer, scene->camera, oglrender->sizex, oglrender->sizey, - IB_rect, OB_SOLID, false, true, true, - alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname, + IB_rect, draw_flags, OB_SOLID, + alpha_mode, oglrender->ofs_samples, viewname, oglrender->fx, oglrender->ofs, err_out); camera = scene->camera; } @@ -700,6 +705,11 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->fx = GPU_fx_compositor_create(); } } + else if (is_sequencer) { + if (scene->r.seq_flag & R_SEQ_CAMERA_DOF) { + oglrender->fx = GPU_fx_compositor_create(); + } + } /* create render */ oglrender->re = RE_NewSceneRender(scene); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 89b5107fdfc..900ca844dbf 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5474,7 +5474,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) ibuf = ED_view3d_draw_offscreen_imbuf( &eval_ctx, scene, view_layer, CTX_wm_view3d(C), CTX_wm_region(C), - w, h, IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, + w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, NULL, NULL, err_out); if (!ibuf) { /* Mostly happens when OpenGL offscreen buffer was failed to create, */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 01b7c8793ba..399e76e71b8 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -58,6 +58,7 @@ #include "BIF_glutil.h" +#include "GPU_compositing.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" @@ -894,7 +895,7 @@ void ED_sequencer_special_preview_clear(void) ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int cfra, int frame_ofs, const char *viewname) { - SeqRenderData context; + SeqRenderData context = {0}; ImBuf *ibuf; int rectx, recty; float render_size; @@ -921,6 +922,12 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int rectx, recty, proxy_size, &context); context.view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname); + if (scene->r.seq_flag & R_SEQ_CAMERA_DOF) { + if (sseq->compositor == NULL) { + sseq->compositor = GPU_fx_compositor_create(); + } + context.gpu_fx = sseq->compositor; + } /* sequencer could start rendering, in this case we need to be sure it wouldn't be canceled * by Esc pressed somewhere in the past diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index da16ac5acaa..23387f291e6 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -60,6 +60,8 @@ #include "IMB_imbuf.h" +#include "GPU_compositing.h" + #include "sequencer_intern.h" // own include /**************************** common state *****************************/ @@ -218,6 +220,11 @@ static void sequencer_free(SpaceLink *sl) if (scopes->histogram_ibuf) IMB_freeImBuf(scopes->histogram_ibuf); + + if (sseq->compositor != NULL) { + GPU_fx_compositor_destroy(sseq->compositor); + sseq->compositor = NULL; + } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 4bc4c373df4..8024a733f40 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1611,7 +1611,6 @@ static void view3d_draw_grease_pencil(const bContext *UNUSED(C)) /* TODO viewport */ } - /** * Viewport Name */ @@ -2084,13 +2083,15 @@ void ED_view3d_draw_offscreen( ImBuf *ED_view3d_draw_offscreen_imbuf( const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, int sizex, int sizey, - unsigned int flag, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + unsigned int flag, unsigned int draw_flags, + int alpha_mode, int samples, const char *viewname, /* output vars */ GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) { RegionView3D *rv3d = ar->regiondata; const bool draw_sky = (alpha_mode == R_ADDSKY); + const bool draw_background = (draw_flags & V3D_OFSDRAW_USE_BACKGROUND); + const bool use_full_sample = (draw_flags & V3D_OFSDRAW_USE_FULL_SAMPLE); /* view state */ GPUFXSettings fx_settings = v3d->fx_settings; @@ -2106,7 +2107,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( if (own_ofs) { /* bind */ - ofs = GPU_offscreen_create(sizex, sizey, full_samples ? 0 : samples, err_out); + ofs = GPU_offscreen_create(sizex, sizey, use_full_sample ? 0 : samples, err_out); if (ofs == NULL) { return NULL; } @@ -2151,7 +2152,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( } } - if ((samples && full_samples) == 0) { + if ((samples && use_full_sample) == 0) { /* Single-pass render, common case */ ED_view3d_draw_offscreen( eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, NULL, winmat, @@ -2250,8 +2251,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( ImBuf *ED_view3d_draw_offscreen_imbuf_simple( const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, Object *camera, int width, int height, - unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + unsigned int flag, unsigned int draw_flags, int drawtype, + int alpha_mode, int samples, const char *viewname, GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) { View3D v3d = {NULL}; @@ -2268,14 +2269,21 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( v3d.drawtype = drawtype; v3d.flag2 = V3D_RENDER_OVERRIDE; - if (use_gpencil) + if (draw_flags & V3D_OFSDRAW_USE_GPENCIL) { v3d.flag2 |= V3D_SHOW_GPENCIL; - - if (use_solid_tex) + } + if (draw_flags & V3D_OFSDRAW_USE_SOLID_TEX) { v3d.flag2 |= V3D_SOLID_TEX; - - if (draw_background) + } + if (draw_flags & V3D_OFSDRAW_USE_BACKGROUND) { v3d.flag3 |= V3D_SHOW_WORLD; + } + if (draw_flags & V3D_OFSDRAW_USE_CAMERA_DOF) { + if (camera->type == OB_CAMERA) { + v3d.fx_settings.dof = &((Camera *)camera->data)->gpu_dof; + v3d.fx_settings.fx_flag |= GPU_FX_FLAG_DOF; + } + } rv3d.persp = RV3D_CAMOB; @@ -2304,8 +2312,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( return ED_view3d_draw_offscreen_imbuf( eval_ctx, scene, view_layer, &v3d, &ar, width, height, flag, - draw_background, alpha_mode, samples, full_samples, viewname, - fx, ofs, err_out); + draw_flags, alpha_mode, samples, viewname, fx, ofs, err_out); } /** \} */ |