diff options
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 25 |
1 files changed, 17 insertions, 8 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 447a8af6235..794cc22f4e3 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 @@ -70,6 +70,8 @@ extern "C" { #include "DNA_object_types.h" #include "DNA_particle_types.h" +#include "DRW_engine.h" + #ifdef NESTED_ID_NASTY_WORKAROUND # include "DNA_curve_types.h" # include "DNA_key_types.h" @@ -713,7 +715,6 @@ typedef struct ObjectRuntimeBackup { CurveCache *curve_cache; Object_Runtime runtime; short base_flag; - ListBase drawdata; } ObjectRuntimeBackup; /* Make a backup of object's evaluation runtime data, additionally @@ -740,9 +741,6 @@ static void deg_backup_object_runtime( object->curve_cache = NULL; /* Make a backup of base flags. */ object_runtime_backup->base_flag = object->base_flag; - /* Make backup of object draw data.*/ - object_runtime_backup->drawdata = object->drawdata; - BLI_listbase_clear(&object->drawdata); } static void deg_restore_object_runtime( @@ -782,8 +780,6 @@ static void deg_restore_object_runtime( object->curve_cache = object_runtime_backup->curve_cache; } object->base_flag = object_runtime_backup->base_flag; - /* Restore draw data. */ - object->drawdata = object_runtime_backup->drawdata; } ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, @@ -812,6 +808,8 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, */ ListBase gpumaterial_backup; ListBase *gpumaterial_ptr = NULL; + DrawDataList drawdata_backup; + DrawDataList *drawdata_ptr = NULL; ObjectRuntimeBackup object_runtime_backup = {NULL}; if (check_datablock_expanded(id_cow)) { switch (id_type) { @@ -847,9 +845,11 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, break; } case ID_OB: - deg_backup_object_runtime((Object *)id_cow, - &object_runtime_backup); + { + Object *ob = (Object *)id_cow; + deg_backup_object_runtime(ob, &object_runtime_backup); break; + } default: break; } @@ -857,6 +857,11 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, gpumaterial_backup = *gpumaterial_ptr; gpumaterial_ptr->first = gpumaterial_ptr->last = NULL; } + drawdata_ptr = DRW_drawdatalist_from_id(id_cow); + if (drawdata_ptr != NULL) { + drawdata_backup = *drawdata_ptr; + drawdata_ptr->first = drawdata_ptr->last = NULL; + } } deg_free_copy_on_write_datablock(id_cow); deg_expand_copy_on_write_datablock(depsgraph, id_node); @@ -864,6 +869,10 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, if (gpumaterial_ptr != NULL) { *gpumaterial_ptr = gpumaterial_backup; } + /* Restore DrawData. */ + if (drawdata_ptr != NULL) { + *drawdata_ptr = drawdata_backup; + } if (id_type == ID_OB) { deg_restore_object_runtime((Object *)id_cow, &object_runtime_backup); } |