From 347a466e1571cc2e2aaae02a31cbd8758e758aea Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 19 Jul 2023 21:54:39 +0300 Subject: [PATCH] Depsgraph: tag relations update when marker camera refs are changed. Since markers are used to animate scene.camera, changing their camera links carries the same consequences as changing scene.camera directly. This means relations need rebuilding in case a new camera was added. Pull Request #110139 --- .../blender/editors/animation/anim_markers.cc | 2 ++ .../blender/makesrna/intern/rna_timeline.cc | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/source/blender/editors/animation/anim_markers.cc b/source/blender/editors/animation/anim_markers.cc index b2fc6197074..4f21d8e27dd 100644 --- a/source/blender/editors/animation/anim_markers.cc +++ b/source/blender/editors/animation/anim_markers.cc @@ -55,6 +55,7 @@ #include "ED_util.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" /* -------------------------------------------------------------------- */ /** \name Marker API @@ -1870,6 +1871,7 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op) /* camera may have changes */ BKE_scene_camera_switch_update(scene); BKE_screen_view3d_scene_sync(screen, scene); + DEG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, nullptr); WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, nullptr); diff --git a/source/blender/makesrna/intern/rna_timeline.cc b/source/blender/makesrna/intern/rna_timeline.cc index daf8a873895..e55666a1a65 100644 --- a/source/blender/makesrna/intern/rna_timeline.cc +++ b/source/blender/makesrna/intern/rna_timeline.cc @@ -19,8 +19,12 @@ #ifdef RNA_RUNTIME # include "BKE_idprop.h" +# include "BKE_scene.h" +# include "BKE_screen.h" # include "WM_api.h" +# include "DEG_depsgraph_build.h" + static IDProperty **rna_TimelineMarker_idprops(PointerRNA *ptr) { TimeMarker *marker = static_cast(ptr->data); @@ -33,6 +37,20 @@ static void rna_TimelineMarker_update(Main * /*bmain*/, Scene * /*scene*/, Point WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, nullptr); } +static void rna_TimelineMarker_camera_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) +{ + wmWindowManager *wm = static_cast(bmain->wm.first); + Scene *scene = (Scene *)ptr->owner_id; + + BKE_scene_camera_switch_update(scene); + WM_windows_scene_data_sync(&wm->windows, scene); + DEG_relations_tag_update(bmain); + + WM_main_add_notifier(NC_SCENE | ND_MARKERS, nullptr); + WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, nullptr); + WM_main_add_notifier(NC_SCENE | NA_EDITED, scene); /* so we get view3d redraws */ +} + #else static void rna_def_timeline_marker(BlenderRNA *brna) @@ -66,6 +84,7 @@ static void rna_def_timeline_marker(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Camera", "Camera that becomes active on this frame"); + RNA_def_property_update(prop, 0, "rna_TimelineMarker_camera_update"); # endif }