diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-07-10 15:14:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-07-10 16:31:34 +0300 |
commit | 873d7f7e14e080f75e75ed7c6c07f326e588cecb (patch) | |
tree | b0147308da930199bbdfea7a2cc4a5c17938b10f /source/blender/depsgraph | |
parent | dfd192ce41f7e4923db0642f22a587862656bbdd (diff) |
DrawData: Change drawdata to a generic struct shared accross ID types
This makes tagging much more generic and make the world updates more in
line with the new tagging system (Depsgraph).
Diffstat (limited to 'source/blender/depsgraph')
4 files changed, 25 insertions, 15 deletions
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 0673a3177b7..185a98f2a2b 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC ../blenkernel ../blenlib ../bmesh + ../draw ../makesdna ../makesrna ../modifiers diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index cb455130d4c..ab7ddb507a0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -873,9 +873,7 @@ void DepsgraphNodeBuilder::build_world(World *world) /* world itself */ add_operation_node(&world->id, DEG_NODE_TYPE_SHADING, - function_bind(BKE_world_eval, - _1, - get_cow_datablock(world)), + NULL, DEG_OPCODE_WORLD_UPDATE); /* world's nodetree */ if (world->nodetree != NULL) { 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); } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index bd31931d0a9..16cb1b394f6 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -46,6 +46,8 @@ extern "C" { #include "DNA_object_types.h" + +#include "DRW_engine.h" } /* extern "C" */ #include "DEG_depsgraph.h" @@ -219,12 +221,12 @@ BLI_INLINE OperationDepsNode *flush_schedule_children( void flush_engine_data_update(ID *id) { - if (GS(id->name) != ID_OB) { + DrawDataList *drawdata = DRW_drawdatalist_from_id(id); + if (drawdata == NULL) { return; } - Object *object = (Object *)id; - LISTBASE_FOREACH(ObjectEngineData *, engine_data, &object->drawdata) { - engine_data->recalc |= id->recalc; + LISTBASE_FOREACH(DrawData *, dd, drawdata) { + dd->recalc |= id->recalc; } } |