diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-30 15:42:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-30 15:42:56 +0300 |
commit | edef55980818d0e8707ead7d7bda52d0ad364734 (patch) | |
tree | 8e3d3352ebb75af0bfba5105117f9e9cfaf44e58 /source | |
parent | 33d2535189a20fe147abeee8c752af3908fdd9eb (diff) |
Depsgraph: Fix crash on playback of animated objects when CoW is enabled
We should keep base_flags after CoW object datablock was updated. Not entirely
happy with current solution, but it fixes crash and allows us to run tests
again.
More proper solution would be to make CoW operation a per-component thingie,
which will only update corresponding parts.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 99efd633524..235da01a619 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -746,9 +746,15 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, * Note that we never free GPU materials from here since that's not * safe for threading and GPU materials are likely to be re-used. */ + /* TODO(sergey): Either move this to an utility function or redesign + * Copy-on-Write components in a way that only needed parts are being + * copied over. + */ ListBase gpumaterial_backup; ListBase *gpumaterial_ptr = NULL; Mesh *mesh_evaluated = NULL; + IDProperty *base_collection_properties = NULL; + short base_flag = 0; if (check_datablock_expanded(id_cow)) { switch (id_type) { case ID_MA: @@ -778,6 +784,9 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, object->data = mesh_evaluated->id.newid; } } + /* Make a backup of base flags. */ + base_collection_properties = object->base_collection_properties; + base_flag = object->base_flag; break; } default: @@ -795,8 +804,8 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, *gpumaterial_ptr = gpumaterial_backup; } if (id_type == ID_OB) { + Object *object = (Object *)id_cow; if (mesh_evaluated != NULL) { - Object *object = (Object *)id_cow; object->mesh_evaluated = mesh_evaluated; /* Do same thing as object update: override actual object data * pointer with evaluated datablock. @@ -811,6 +820,10 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, ((Mesh *)mesh_evaluated->id.newid)->edit_btmesh; } } + if (base_collection_properties != NULL) { + object->base_collection_properties = base_collection_properties; + object->base_flag = base_flag; + } } return id_cow; } |