diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-15 11:43:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-15 11:43:18 +0300 |
commit | c4046e9082f61bfef87173d20c566a065f2602d7 (patch) | |
tree | d04eb7411cb107ed05c3e6e9a83a54065b4a46a4 /source/blender/blenkernel | |
parent | 400d59be9b058d4bfa31a84547591275f7c700b9 (diff) |
Move ID recalc flags into dedicated field in ID
Currently this is a no-visible-changes change, but the idea is to use this
dedicated flag to tell which exact components of ID changed, make it more
granular than just OBJECT and OBJECT_DATA. Allow setting this field based
on what components new dependency graph flushed on evaluation.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 4 |
5 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 6107bb1e32e..ba8f454aa47 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -74,6 +74,8 @@ #include "nla_private.h" +#include "atomic_ops.h" + /* ***************************************** */ /* AnimData API */ @@ -1663,8 +1665,11 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val /* for cases like duplifarmes it's only a temporary so don't * notify anyone of updates */ - if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) { - BKE_id_tag_set_atomic(id, LIB_TAG_ID_RECALC); + if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) { + /* NOTE: This is a bit annoying to use atomic API here, but this + * code is at it's EOL and removed already in 2.8 branch. + */ + atomic_fetch_and_or_int32(&id->recalc, ID_RECALC); DAG_id_type_tag(G.main, GS(id->name)); } } @@ -2618,8 +2623,8 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData */ if (ptr->id.data != NULL) { ID *id = ptr->id.data; - if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) { - id->tag |= LIB_TAG_ID_RECALC; + if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) { + id->recalc |= ID_RECALC; DAG_id_type_tag(G.main, GS(id->name)); } } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index e9b83b27ef2..81e88bd3019 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1532,7 +1532,7 @@ static bool check_object_tagged_for_update(Object *object) if (ELEM(object->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) { ID *data_id = object->data; - return (data_id->tag & LIB_TAG_ID_RECALC_ALL) != 0; + return (data_id->recalc & ID_RECALC_ALL) != 0; } return false; @@ -1780,13 +1780,13 @@ void DAG_scene_free(Scene *sce) static void lib_id_recalc_tag(Main *bmain, ID *id) { - id->tag |= LIB_TAG_ID_RECALC; + id->recalc |= ID_RECALC; DAG_id_type_tag(bmain, GS(id->name)); } static void lib_id_recalc_data_tag(Main *bmain, ID *id) { - id->tag |= LIB_TAG_ID_RECALC_DATA; + id->recalc |= ID_RECALC_DATA; DAG_id_type_tag(bmain, GS(id->name)); } @@ -2825,7 +2825,7 @@ void DAG_ids_flush_tagged(Main *bmain) if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { for (; id; id = id->next) { - if (id->tag & LIB_TAG_ID_RECALC_ALL) { + if (id->recalc & ID_RECALC_ALL) { for (dsl = listbase.first; dsl; dsl = dsl->next) dag_id_flush_update(bmain, dsl->scene, id); @@ -2945,12 +2945,12 @@ void DAG_ids_clear_recalc(Main *bmain) if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { for (; id; id = id->next) { - id->tag &= ~LIB_TAG_ID_RECALC_ALL; + id->recalc &= ~ID_RECALC_ALL; /* some ID's contain semi-datablock nodetree */ ntree = ntreeFromID(id); if (ntree) - ntree->id.tag &= ~LIB_TAG_ID_RECALC_ALL; + ntree->id.recalc &= ~ID_RECALC_ALL; } } } diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index cd697cadc0e..ff4e7f36018 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1463,8 +1463,8 @@ void BKE_mask_update_scene(Main *bmain, Scene *scene) Mask *mask; for (mask = bmain->mask.first; mask; mask = mask->id.next) { - if (mask->id.tag & LIB_TAG_ID_RECALC_ALL) { - bool do_new_frame = (mask->id.tag & LIB_TAG_ID_RECALC_DATA) != 0; + if (mask->id.recalc & ID_RECALC_ALL) { + bool do_new_frame = (mask->id.recalc & ID_RECALC_DATA) != 0; BKE_mask_evaluate_all_masks(bmain, CFRA, do_new_frame); } } diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index b49e481b068..93bc79095d7 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -379,7 +379,7 @@ static void make_duplis_frames(const DupliContext *ctx) /* special flag to avoid setting recalc flags to notify the depsgraph of * updates, as this is not a permanent change to the object */ - ob->id.tag |= LIB_TAG_ANIM_NO_RECALC; + ob->id.recalc |= ID_RECALC_SKIP_ANIM_TAG; for (scene->r.cfra = ob->dupsta; scene->r.cfra <= dupend; scene->r.cfra++) { int ok = 1; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9ce578a9105..e45d2887250 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1841,8 +1841,8 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene) if (obedit) { Mesh *mesh = obedit->data; if ((obedit->type == OB_MESH) && - ((obedit->id.tag & LIB_TAG_ID_RECALC_ALL) || - (mesh->id.tag & LIB_TAG_ID_RECALC_ALL))) + ((obedit->id.recalc & ID_RECALC_ALL) || + (mesh->id.recalc & ID_RECALC_ALL))) { if (check_rendered_viewport_visible(bmain)) { BMesh *bm = mesh->edit_btmesh->bm; |