Fix (unreported) Scene Collection runtime data not cleared on write.
This commit is contained in:
@@ -312,6 +312,10 @@ bool BKE_collection_validate(struct Collection *collection);
|
||||
|
||||
/* .blend file I/O */
|
||||
|
||||
/** Perform some pre-writing cleanup on the COllection data itself (_not_ in any sub-data
|
||||
* referenced by pointers). To be called before writing the Collection struct itself. */
|
||||
void BKE_collection_blend_write_prepare_nolib(struct BlendWriter *writer,
|
||||
struct Collection *collection);
|
||||
void BKE_collection_blend_write_nolib(struct BlendWriter *writer, struct Collection *collection);
|
||||
void BKE_collection_blend_read_data(struct BlendDataReader *reader,
|
||||
struct Collection *collection,
|
||||
|
||||
@@ -232,6 +232,13 @@ static ID **collection_owner_pointer_get(ID *id)
|
||||
return &master_collection->owner_id;
|
||||
}
|
||||
|
||||
void BKE_collection_blend_write_prepare_nolib(BlendWriter * /*writer*/, Collection *collection)
|
||||
{
|
||||
memset(&collection->runtime, 0, sizeof(collection->runtime));
|
||||
/* Clean up, important in undo case to reduce false detection of changed data-blocks. */
|
||||
collection->flag &= ~COLLECTION_FLAG_ALL_RUNTIME;
|
||||
}
|
||||
|
||||
void BKE_collection_blend_write_nolib(BlendWriter *writer, Collection *collection)
|
||||
{
|
||||
BKE_id_blend_write(writer, &collection->id);
|
||||
@@ -252,9 +259,7 @@ static void collection_blend_write(BlendWriter *writer, ID *id, const void *id_a
|
||||
{
|
||||
Collection *collection = (Collection *)id;
|
||||
|
||||
memset(&collection->runtime, 0, sizeof(collection->runtime));
|
||||
/* Clean up, important in undo case to reduce false detection of changed data-blocks. */
|
||||
collection->flag &= ~COLLECTION_FLAG_ALL_RUNTIME;
|
||||
BKE_collection_blend_write_prepare_nolib(writer, collection);
|
||||
|
||||
/* write LibData */
|
||||
BLO_write_id_struct(writer, Collection, id_address, &collection->id);
|
||||
|
||||
@@ -1186,6 +1186,9 @@ static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
||||
if (sce->master_collection) {
|
||||
BLO_write_init_id_buffer_from_id(
|
||||
temp_embedded_id_buffer, &sce->master_collection->id, BLO_write_is_undo(writer));
|
||||
BKE_collection_blend_write_prepare_nolib(
|
||||
writer,
|
||||
reinterpret_cast<Collection *>(BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer)));
|
||||
BLO_write_struct_at_address(writer,
|
||||
Collection,
|
||||
sce->master_collection,
|
||||
|
||||
Reference in New Issue
Block a user