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
This commit is contained in:
Alexander Gavrilov
2023-07-19 21:54:39 +03:00
parent cc7dcfcfd5
commit 347a466e15
2 changed files with 21 additions and 0 deletions

View File

@@ -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);

View File

@@ -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<TimeMarker *>(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<wmWindowManager *>(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
}