Depsgraph: tag depsgraph for copy-on-write flush when RNA changes

Fixes bug with changes to properties not being flushed to the COW data.
It fixes T55144.

This is the part of rBb4b745b72064 that is required although slow.
Which was partially addressed but the rest of the commit, which in
turn broke things. So for now let's get RNA to flush slow cow, and
deal with the consequences.
This commit is contained in:
Dalai Felinto 2018-05-24 12:04:04 +02:00
parent cb3c9cba49
commit c1361d2651
Notes: blender-bot 2023-02-14 11:35:46 +01:00
Referenced by issue #55179, Camera doesn't display limits
Referenced by issue #55181, Crash when calling spacebar menu after calling an operator that opens a new window via spacebar menu
Referenced by issue #55182, Crash wheh changing the mesh datablock used by one object to another mesh
Referenced by issue #55144, Message bus to tag dependency graph for copy-on-write update
2 changed files with 10 additions and 0 deletions

View File

@ -397,6 +397,10 @@ typedef enum ID_Type {
ID_IS_STATIC_OVERRIDE((_id)) && \
(((ID *)(_id))->override_static->flag & STATICOVERRIDE_AUTO))
/* No copy-on-write for these types. */
#define ID_TYPE_IS_COW(_id_type) \
(!ELEM(_id_type, ID_WM, ID_SCR, ID_SCRN, ID_IM, ID_MC, ID_LI))
#ifdef GS
# undef GS
#endif

View File

@ -2075,6 +2075,12 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
/* we could add NULL check, for now don't */
WM_msg_publish_rna(mbus, ptr, prop);
}
if (ptr->id.data != NULL) {
const short id_type = GS(((ID *)ptr->id.data)->name);
if (ID_TYPE_IS_COW(id_type)) {
DEG_id_tag_update(ptr->id.data, DEG_TAG_COPY_ON_WRITE);
}
}
#endif
}