diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 13:46:14 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 13:54:16 +0300 |
commit | 064273a4ae7101f937cf2e16b0e2f1efcd2f0e38 (patch) | |
tree | b10ee52c452decf2cd3ba760794609ee6795043b /source/blender | |
parent | 2c0da4a3db96d4aeeeec1cfba4a0a9f5bf0fa970 (diff) |
Sound: Port more cases to be a part of dependency graph
Mainly covers RNA callbacks which were still doing direct scene update,
which was causing crashes. Now corresponding ID_RECALC flags are used,
so all scenes can update accordingly.
Also tested animated volume/pitch on strips, which now works as well.
Fixes T64133: Assert after changing FPS
Fixes T64154: Immediate crash when changing the current frame on the timeline
Fixes T64185: Client Crashes when the frame position value is changed
Fixes T64190: Blender Crash using Timeline Editor
Fixes T64128: Click to close bug type on timeline
Fixes T64147: Crash when setting current frame from Python
Fixes T64152: Blender Auto-Close on timeline change
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sound.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 22 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_rna.cc | 2 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 23 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 13 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 12 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 29 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 43 |
17 files changed, 103 insertions, 113 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index f526dd579ce..8d17380592e 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -144,10 +144,6 @@ void BKE_sound_stop_scene(struct Scene *scene); void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene); -/* Use this after original scene's frame has been changed. It will take care of doing all the - * updates required for BKE_sound_seek_scene(). */ -void BKE_sound_update_and_seek(struct Main *bmain, struct Depsgraph *depsgraph); - float BKE_sound_sync_scene(struct Scene *scene); int BKE_sound_scene_playing(struct Scene *scene); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 1e43aee64eb..7cd89705a1e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1510,7 +1510,24 @@ static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_ static void scene_update_sound(Depsgraph *depsgraph, Main *bmain) { Scene *scene = DEG_get_evaluated_scene(depsgraph); + const int recalc = scene->id.recalc; BKE_sound_ensure_scene(scene); + if (recalc & ID_RECALC_AUDIO_SEEK) { + BKE_sound_seek_scene(bmain, scene); + } + if (recalc & ID_RECALC_AUDIO_FPS) { + BKE_sound_update_fps(scene); + } + if (recalc & ID_RECALC_AUDIO_VOLUME) { + BKE_sound_set_scene_volume(scene, scene->audio.volume); + } + if (recalc & ID_RECALC_AUDIO_MUTE) { + const bool is_mute = (scene->audio.flag & AUDIO_MUTE); + BKE_sound_mute_scene(scene, is_mute); + } + if (recalc & ID_RECALC_AUDIO_LISTENER) { + BKE_sound_update_scene_listener(scene); + } BKE_sound_update_scene(bmain, scene); } @@ -2407,6 +2424,14 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene) if (seq->sound != NULL && seq->scene_sound == NULL) { seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq); } + if (seq->scene_sound) { + BKE_sound_set_scene_sound_volume( + seq->scene_sound, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); + BKE_sound_set_scene_sound_pitch( + seq->scene_sound, seq->pitch, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); + BKE_sound_set_scene_sound_pan( + seq->scene_sound, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); + } } SEQ_END; BKE_sequencer_update_muting(scene->ed); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 9ccb90b5cdc..f45c53426b9 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -57,7 +57,6 @@ #include "BKE_scene.h" #include "DEG_depsgraph.h" -#include "DEG_depsgraph_query.h" #ifdef WITH_AUDASPACE /* evil globals ;-) */ @@ -689,7 +688,6 @@ void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated) void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated) { - printf("%s\n", __func__); AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated); } @@ -798,10 +796,9 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene) } } - Scene *scene_orig = (Scene *)DEG_get_original_id(&scene->id); - if (scene_orig->audio.flag & AUDIO_SCRUB && !animation_playing) { + if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) { AUD_Handle_setPosition(scene->playback_handle, cur_time); - if (scene_orig->audio.flag & AUDIO_SYNC) { + if (scene->audio.flag & AUDIO_SYNC) { AUD_seekSynchronizer(scene->playback_handle, cur_time); } AUD_Handle_resume(scene->playback_handle); @@ -817,7 +814,7 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene) } } else { - if (scene_orig->audio.flag & AUDIO_SYNC) { + if (scene->audio.flag & AUDIO_SYNC) { AUD_seekSynchronizer(scene->playback_handle, cur_time); } else { @@ -1227,19 +1224,6 @@ void BKE_sound_load_audio(Main *UNUSED(bmain), bSound *UNUSED(sound)) #endif /* WITH_AUDASPACE */ -void BKE_sound_update_and_seek(Main *bmain, Depsgraph *depsgraph) -{ - Scene *scene_orig = DEG_get_input_scene(depsgraph); - Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); - /* NOTE: We don't do copy-on-write or anything like that here because we need to know scene's - * flags like "scrubbing" in the BKE_sound_seek_scene(). So we simply update frame to which - * seek needs to happen. - * - * TODO(sergey): Might change API so the frame is passes explicitly. */ - scene_eval->r.cfra = scene_orig->r.cfra; - BKE_sound_seek_scene(bmain, scene_eval); -} - void BKE_sound_reset_scene_runtime(Scene *scene) { scene->sound_scene = NULL; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index ea5f86a31a8..ca60e4370cd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -309,10 +309,8 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, return node_identifier; } else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) { - const Sequence *seq = static_cast<Sequence *>(ptr->data); /* Sequencer strip */ node_identifier.type = NodeType::SEQUENCER; - node_identifier.component_name = seq->name; return node_identifier; } else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) { diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index f7d7b76cb69..f932011ccab 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -215,9 +215,16 @@ void depsgraph_tag_to_component_opcode(const ID *id, /* There is no such node in depsgraph, this tag is to be handled * separately. */ break; - case ID_RECALC_SEQUENCER: + case ID_RECALC_SEQUENCER_STRIPS: *component_type = NodeType::SEQUENCER; break; + case ID_RECALC_AUDIO_SEEK: + case ID_RECALC_AUDIO_FPS: + case ID_RECALC_AUDIO_VOLUME: + case ID_RECALC_AUDIO_MUTE: + case ID_RECALC_AUDIO_LISTENER: + *component_type = NodeType::AUDIO; + break; case ID_RECALC_ALL: case ID_RECALC_PSYS_ALL: BLI_assert(!"Should not happen"); @@ -618,8 +625,18 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) return "POINT_CACHE"; case ID_RECALC_EDITORS: return "EDITORS"; - case ID_RECALC_SEQUENCER: - return "SEQUENCER"; + case ID_RECALC_SEQUENCER_STRIPS: + return "SEQUENCER_STRIPS"; + case ID_RECALC_AUDIO_SEEK: + return "AUDIO_SEEK"; + case ID_RECALC_AUDIO_FPS: + return "AUDIO_FPS"; + case ID_RECALC_AUDIO_VOLUME: + return "AUDIO_VOLUME"; + case ID_RECALC_AUDIO_MUTE: + return "AUDIO_MUTE"; + case ID_RECALC_AUDIO_LISTENER: + return "AUDIO_LISTENER"; case ID_RECALC_ALL: return "ALL"; } diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 97ba7132c3d..377179b88ef 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -36,7 +36,6 @@ #include "BKE_sequencer.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_sound.h" #include "BKE_scene.h" #include "UI_view2d.h" @@ -116,7 +115,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) FRAMENUMBER_MIN_CLAMP(CFRA); /* do updates */ - BKE_sound_update_and_seek(CTX_data_main(C), CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 61fa05f243f..04bdaaa9482 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2759,7 +2759,6 @@ static void areas_do_frame_follow(bContext *C, bool middle) /* function to be called outside UI context, or for redo */ static int frame_offset_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); int delta; @@ -2771,7 +2770,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, false); - BKE_sound_update_and_seek(bmain, CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -2803,7 +2802,6 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int frame_jump_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); wmTimer *animtimer = CTX_wm_screen(C)->animtimer; @@ -2833,7 +2831,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, true); - BKE_sound_update_and_seek(bmain, CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } @@ -2866,7 +2864,6 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int keyframe_jump_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); bDopeSheet ads = {NULL}; @@ -2949,7 +2946,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) else { areas_do_frame_follow(C, true); - BKE_sound_update_and_seek(bmain, CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -2982,7 +2979,6 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int marker_jump_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); TimeMarker *marker; int closest = CFRA; @@ -3016,7 +3012,7 @@ static int marker_jump_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, true); - BKE_sound_update_and_seek(bmain, CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -4403,7 +4399,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv } if (sad->flag & ANIMPLAY_FLAG_JUMPED) { - BKE_sound_update_and_seek(bmain, depsgraph); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); #ifdef PROFILE_AUDIO_SYNCH old_frame = CFRA; #endif diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 8b3f221f3a5..b698535a521 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -52,7 +52,6 @@ #include "BKE_main.h" #include "BKE_movieclip.h" #include "BKE_report.h" -#include "BKE_sound.h" #include "BKE_tracking.h" #include "WM_api.h" @@ -74,6 +73,7 @@ #include "PIL_time.h" +#include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "clip_intern.h" // own include @@ -971,7 +971,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) SUBFRA = 0.0f; /* do updates */ - BKE_sound_update_and_seek(CTX_data_main(C), CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 441e65cefe4..1cb2e3c2ccf 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -35,7 +35,6 @@ #include "BKE_movieclip.h" #include "BKE_tracking.h" #include "BKE_report.h" -#include "BKE_sound.h" #include "DEG_depsgraph.h" @@ -1350,7 +1349,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) if (CFRA != sc->user.framenr) { CFRA = sc->user.framenr; - BKE_sound_update_and_seek(CTX_data_main(C), CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 054a1e3d8ee..bf0d5f1c224 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -33,7 +33,6 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_sound.h" #include "UI_view2d.h" @@ -49,6 +48,8 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "DEG_depsgraph.h" + #include "WM_api.h" #include "WM_types.h" @@ -74,7 +75,6 @@ static bool graphview_cursor_poll(bContext *C) /* Set the new frame number */ static void graphview_cursor_apply(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SpaceGraph *sipo = CTX_wm_space_graph(C); /* this isn't technically "frame", but it'll do... */ @@ -105,7 +105,7 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op) } SUBFRA = 0.0f; - BKE_sound_update_and_seek(bmain, CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); } /* set the cursor value */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0710ecf3bd6..fc579c59b5b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -59,7 +59,6 @@ #include "BKE_paint.h" #include "BKE_report.h" #include "BKE_screen.h" -#include "BKE_sound.h" #include "BKE_scene.h" #include "DEG_depsgraph.h" @@ -3542,7 +3541,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) SUBFRA = 0.0f; /* do updates */ - BKE_sound_update_and_seek(CTX_data_main(C), CTX_data_depsgraph(C)); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 1cad9e4f734..272a4f0e8ea 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -357,7 +357,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) sequencer_add_apply_replace_sel(C, op, seq); sequencer_add_apply_overlap(C, op, seq); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -444,7 +444,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) sequencer_add_apply_replace_sel(C, op, seq); sequencer_add_apply_overlap(C, op, seq); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -531,7 +531,7 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) sequencer_add_apply_replace_sel(C, op, seq); sequencer_add_apply_overlap(C, op, seq); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -644,9 +644,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } BKE_sequencer_sort(scene); - BKE_sequencer_update_muting(ed); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -974,7 +973,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) MEM_freeN(op->customdata); } - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1130,7 +1129,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) * it was NOT called in blender 2.4x, but wont hurt */ BKE_sequencer_sort(scene); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 0f5c02327cc..882737739cb 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1820,7 +1820,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) } } - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1871,7 +1871,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) } } - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2381,7 +2381,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) ms = ms->prev; } - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2637,7 +2637,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) MEM_freeN(ms); } - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2702,7 +2702,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) BKE_sequence_base_shuffle(ed->seqbasep, seqm, scene); } - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seqm); @@ -2789,7 +2789,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) } BKE_sequencer_sort(scene); - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 05bb9785112..2383d8e0a78 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1173,7 +1173,7 @@ static void recalcData_sequencer(TransInfo *t) seq_prev = seq; } - DEG_id_tag_update(&t->scene->id, ID_RECALC_SEQUENCER); + DEG_id_tag_update(&t->scene->id, ID_RECALC_SEQUENCER_STRIPS); flushTransSeq(t); } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 14b3d97cef4..139cb298710 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -604,7 +604,13 @@ typedef enum IDRecalcFlag { /* Sequences in the sequencer did change. * Use this tag with a scene ID which owns the sequences. */ - ID_RECALC_SEQUENCER = (1 << 14), + ID_RECALC_SEQUENCER_STRIPS = (1 << 14), + + ID_RECALC_AUDIO_SEEK = (1 << 15), + ID_RECALC_AUDIO_FPS = (1 << 16), + ID_RECALC_AUDIO_VOLUME = (1 << 17), + ID_RECALC_AUDIO_MUTE = (1 << 18), + ID_RECALC_AUDIO_LISTENER = (1 << 19), /*************************************************************************** * Pseudonyms, to have more semantic meaning in the actual code without diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f1452d001bc..42d44ee2e37 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -669,7 +669,6 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { # include "BKE_pointcache.h" # include "BKE_scene.h" # include "BKE_mesh.h" -# include "BKE_sound.h" # include "BKE_screen.h" # include "BKE_sequencer.h" # include "BKE_animsys.h" @@ -815,22 +814,17 @@ static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), Po static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - BKE_sound_update_fps(scene); - BKE_sequencer_update_sound_bounds_all(scene); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_FPS | ID_RECALC_SEQUENCER_STRIPS); } static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - BKE_sound_update_scene_listener(scene); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_LISTENER); } -static void rna_Scene_volume_set(PointerRNA *ptr, float value) +static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - Scene *scene = (Scene *)(ptr->data); - - scene->audio.volume = value; - if (scene->sound_scene) - BKE_sound_set_scene_volume(scene, value); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME); } static const char *rna_Scene_statistics_string_get(Scene *scene, @@ -956,10 +950,12 @@ static void rna_Scene_show_subframe_update(Main *UNUSED(bmain), scene->r.subframe = 0.0f; } -static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr) +static void rna_Scene_frame_update(Main *UNUSED(bmain), + Scene *UNUSED(current_scene), + PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - BKE_sound_seek_scene(bmain, scene); + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); WM_main_add_notifier(NC_SCENE | ND_FRAME, scene); } @@ -1790,8 +1786,11 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value) scene->audio.flag |= AUDIO_MUTE; else scene->audio.flag &= ~AUDIO_MUTE; +} - BKE_sound_mute_scene(scene, value); +static void rna_Scene_use_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_MUTE); } static int rna_Scene_sync_mode_get(PointerRNA *ptr) @@ -7519,7 +7518,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set"); RNA_def_property_ui_text( prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted"); - RNA_def_property_update(prop, NC_SCENE, NULL); + RNA_def_property_update(prop, NC_SCENE, "rna_Scene_use_audio_update"); # if 0 /* XXX: Is this actually needed? */ prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE); @@ -7566,7 +7565,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Volume", "Audio volume"); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_SCENE, NULL); - RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL); + RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); /* Statistics */ func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 0b1e35e3a74..ca4ab07fc58 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -75,6 +75,8 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { # include "WM_api.h" +# include "DEG_depsgraph.h" + # include "IMB_imbuf.h" typedef struct SequenceSearchData { @@ -691,34 +693,9 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) return strlen(path); } -static void rna_Sequence_volume_set(PointerRNA *ptr, float value) +static void rna_Sequence_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - Sequence *seq = (Sequence *)(ptr->data); - - seq->volume = value; - if (seq->scene_sound) - BKE_sound_set_scene_sound_volume( - seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); -} - -static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) -{ - Sequence *seq = (Sequence *)(ptr->data); - - seq->pitch = value; - if (seq->scene_sound) - BKE_sound_set_scene_sound_pitch( - seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); -} - -static void rna_Sequence_pan_set(PointerRNA *ptr, float value) -{ - Sequence *seq = (Sequence *)(ptr->data); - - seq->pan = value; - if (seq->scene_sound) - BKE_sound_set_scene_sound_pan( - seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); } static int rna_Sequence_input_count_get(PointerRNA *ptr) @@ -762,9 +739,8 @@ static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - Editing *ed = BKE_sequencer_editing_get(scene, false); - BKE_sequencer_update_muting(ed); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); rna_Sequence_update(bmain, scene, ptr); } @@ -2334,23 +2310,20 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); - RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update"); prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pitch"); RNA_def_property_range(prop, 0.1f, 10.0f); RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound"); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); - RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update"); prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pan"); RNA_def_property_range(prop, -2.0f, 2.0f); RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)"); - RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update"); prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM); |