diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking_auto.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 20 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 4 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 18 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 35 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 25 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 |
16 files changed, 148 insertions, 54 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 532334c31ff..2264167eca1 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -421,12 +421,22 @@ struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seq struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); /* view3d draw callback, run when not in background view */ +/* NOTE: Keep in sync with V3D_OFSDRAW_* flags. */ +enum { + SEQ_OFSDRAW_NONE = (0), + SEQ_OFSDRAW_USE_BACKGROUND = (1 << 0), + SEQ_OFSDRAW_USE_FULL_SAMPLE = (1 << 1), + SEQ_OFSDRAW_USE_GPENCIL = (1 << 2), + SEQ_OFSDRAW_USE_SOLID_TEX = (1 << 2), + SEQ_OFSDRAW_USE_CAMERA_DOF = (1 << 3), +}; + typedef struct ImBuf *(*SequencerDrawView)( - const struct EvaluationContext *eval_ctx, struct Scene *, - struct ViewLayer *view_layer, struct Object *, int, int, - unsigned int, int, bool, bool, bool, - int, int, bool, const char *, - struct GPUFX *, struct GPUOffScreen *, char[256]); + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct ViewLayer *view_layer, struct Object *camera, int width, int height, + 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]); extern SequencerDrawView sequencer_view3d_cb; /* copy/paste */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a83eba145c9..ced94af26d2 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3303,11 +3303,18 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq if ((sequencer_view3d_cb && do_seq_gl && camera) && is_thread_main) { char err_out[256] = "unknown"; - int width = (scene->r.xsch * scene->r.size) / 100; - int height = (scene->r.ysch * scene->r.size) / 100; + const int width = (scene->r.xsch * scene->r.size) / 100; + const int height = (scene->r.ysch * scene->r.size) / 100; const bool use_background = (scene->r.alphamode == R_ADDSKY); const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id); + unsigned int draw_flags = SEQ_OFSDRAW_NONE; + draw_flags |= (use_gpencil) ? SEQ_OFSDRAW_USE_GPENCIL : 0; + draw_flags |= (use_background) ? SEQ_OFSDRAW_USE_BACKGROUND : 0; + draw_flags |= (context->gpu_full_samples) ? SEQ_OFSDRAW_USE_FULL_SAMPLE : 0; + draw_flags |= (context->scene->r.seq_flag & R_SEQ_SOLID_TEX) ? SEQ_OFSDRAW_USE_SOLID_TEX : 0; + draw_flags |= (context->scene->r.seq_flag & R_SEQ_CAMERA_DOF) ? SEQ_OFSDRAW_USE_CAMERA_DOF : 0; + /* for old scene this can be uninitialized, * should probably be added to do_versions at some point if the functionality stays */ if (context->scene->r.seq_prev_type == 0) @@ -3319,10 +3326,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq ibuf = sequencer_view3d_cb( /* set for OpenGL render (NULL when scrubbing) */ context->eval_ctx, scene, view_layer, camera, width, height, IB_rect, - context->scene->r.seq_prev_type, - (context->scene->r.seq_flag & R_SEQ_SOLID_TEX) != 0, - use_gpencil, use_background, scene->r.alphamode, - context->gpu_samples, context->gpu_full_samples, viewname, + draw_flags, context->scene->r.seq_prev_type, + scene->r.alphamode, context->gpu_samples, viewname, context->gpu_fx, context->gpu_offscreen, err_out); if (ibuf == NULL) { fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out); diff --git a/source/blender/blenkernel/intern/tracking_auto.c b/source/blender/blenkernel/intern/tracking_auto.c index 50451b90581..4ff4a129768 100644 --- a/source/blender/blenkernel/intern/tracking_auto.c +++ b/source/blender/blenkernel/intern/tracking_auto.c @@ -449,8 +449,10 @@ static void autotrack_context_step_cb(void *userdata, int track) options->failed_frame = frame + frame_delta; } - /* Note: Atomic is probably not actually needed here, I doubt we could get any other result than a true bool anyway. - * But for sake of consistency, and since it costs nothing... */ + /* Note: Atomic is probably not actually needed here, I doubt we could get + * any other result than a true bool anyway. + * But for sake of consistency, and since it costs nothing... + */ atomic_fetch_and_or_uint8((uint8_t *)&context->step_ok, true); } @@ -459,7 +461,10 @@ bool BKE_autotrack_context_step(AutoTrackContext *context) const int frame_delta = context->backwards ? -1 : 1; context->step_ok = false; - BLI_task_parallel_range(0, context->num_tracks, context, autotrack_context_step_cb, context->num_tracks > 1); + BLI_task_parallel_range(0, context->num_tracks, + context, + autotrack_context_step_cb, + context->num_tracks > 1); /* Advance the frame. */ BLI_spin_lock(&context->spin_lock); @@ -567,8 +572,9 @@ void BKE_autotrack_context_finish(AutoTrackContext *context) if ((plane_track->flag & PLANE_TRACK_AUTOKEY) == 0) { int track; for (track = 0; track < context->num_tracks; ++track) { - if (BKE_tracking_plane_track_has_point_track(plane_track, - context->options[track].track)) + if (BKE_tracking_plane_track_has_point_track( + plane_track, + context->options[track].track)) { BKE_tracking_track_plane_from_existing_motion( plane_track, diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 065e0871a3d..57dab868752 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7480,7 +7480,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) sseq->scopes.sep_waveform_ibuf = NULL; sseq->scopes.vector_ibuf = NULL; sseq->scopes.histogram_ibuf = NULL; - + sseq->compositor = NULL; } else if (sl->spacetype == SPACE_BUTS) { SpaceButs *sbuts = (SpaceButs *)sl; 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); } /** \} */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 1a843a0a372..d25391ca95d 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1747,9 +1747,12 @@ typedef struct Scene { #define R_USE_WS_SHADING 0x8000000 /* use world space interpretation of lighting data */ /* seq_flag */ -// #define R_SEQ_GL_PREV 1 // UNUSED, we just use setting from seq_prev_type now. -// #define R_SEQ_GL_REND 2 // UNUSED, opengl render has its own operator now. -#define R_SEQ_SOLID_TEX 4 +enum { + // R_SEQ_GL_PREV = (1 << 1), // UNUSED, we just use setting from seq_prev_type now. + // R_SEQ_GL_REND = (1 << 2), // UNUSED, opengl render has its own operator now. + R_SEQ_SOLID_TEX = (1 << 3), + R_SEQ_CAMERA_DOF = (1 << 4), +}; /* displaymode */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 34679e04f8d..a1db47e54f2 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -516,6 +516,9 @@ typedef struct SpaceSeq { char multiview_eye; /* multiview current eye - for internal use */ char pad2[7]; + + struct GPUFX *compositor; + void *pad3; } SpaceSeq; diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 777585d3386..146a8e2738d 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -42,6 +42,7 @@ #include "BKE_camera.h" #include "BKE_object.h" +#include "BKE_sequencer.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -127,6 +128,14 @@ static void rna_Camera_background_images_clear(Camera *cam) WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam); } +static void rna_Camera_dof_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + /* TODO(sergey): Can be more selective here. */ + BKE_sequencer_cache_cleanup(); + BKE_sequencer_preprocessed_cache_cleanup(); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); +} + #else static void rna_def_camera_background_image(BlenderRNA *brna) @@ -511,7 +520,7 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2); RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dof_update"); /* Stereo Settings */ prop = RNA_def_property(srna, "stereo", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 682e0ff3404..5600935c567 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1943,6 +1943,14 @@ static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value) dofsettings->num_blades = value; } +static void rna_GPUDOFSettings_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + /* TODO(sergey): Can be more selective here. */ + BKE_sequencer_cache_cleanup(); + BKE_sequencer_preprocessed_cache_cleanup(); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); +} + static void rna_Stereo3dFormat_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; @@ -4720,32 +4728,32 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Focus distance", "Viewport depth of field focus distance"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_DISTANCE_CAMERA); RNA_def_property_ui_text(prop, "Focal Length", "Focal length for dof effect"); RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); prop = RNA_def_property(srna, "sensor", PROP_FLOAT, PROP_DISTANCE_CAMERA); RNA_def_property_ui_text(prop, "Sensor", "Size of sensor"); RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "F-stop", "F-stop for dof effect"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); prop = RNA_def_property(srna, "blades", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "num_blades"); RNA_def_property_ui_text(prop, "Blades", "Blades for dof effect"); RNA_def_property_range(prop, 0, 16); RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_ui_text(prop, "Rotation", "Rotation of blades in apperture"); @@ -4761,7 +4769,7 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) prop = RNA_def_property(srna, "use_high_quality", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1); RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); /* NOTE: high quality is always supported */ prop = RNA_def_property(srna, "is_hq_supported", PROP_BOOLEAN, PROP_NONE); @@ -6253,6 +6261,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Textured Solid", "Draw face-assigned textures in solid draw method"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update"); + prop = RNA_def_property(srna, "use_sequencer_gl_dof", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_CAMERA_DOF); + RNA_def_property_ui_text(prop, "Depth of Field", "Use depth of field using the values from scene strip active camera"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update"); + prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 372b34f9df2..c3ae4af1964 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1038,14 +1038,14 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_ ibuf = ED_view3d_draw_offscreen_imbuf_simple( &eval_ctx, scene, view_layer, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, - IB_rect, OB_SOLID, false, false, false, R_ALPHAPREMUL, 0, false, NULL, + IB_rect, OB_SOLID, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, NULL, NULL, err_out); } else { ibuf = ED_view3d_draw_offscreen_imbuf( &eval_ctx, scene, view_layer, v3d, ar, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, - IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, + IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, NULL, NULL, err_out); } |