diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-20 13:03:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-23 17:22:25 +0300 |
commit | b88f1d3491a7ce202e4b72ba6b05281147c316d3 (patch) | |
tree | 3f00047de71054d94c8b28d2dff409e78617b528 /source/blender/depsgraph/intern/builder/deg_builder_map.h | |
parent | 026c8ddd2a04bde5b9a92251734d4d0fd17c64b8 (diff) |
Depsgraph: Allow having ID built checks be more granular
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_map.h')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_map.h | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h index c1db1d9d2bb..1199b517f0c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h @@ -23,6 +23,8 @@ #pragma once +#include "intern/depsgraph_type.h" + struct GSet; struct ID; @@ -30,34 +32,47 @@ namespace DEG { class BuilderMap { public: + enum { + TAG_ANIMATION = (1 << 0), + TAG_PARAMETERS = (1 << 1), + TAG_TRANSFORM = (1 << 2), + TAG_GEOMETRY = (1 << 3), + + /* All ID components has been built. */ + TAG_COMPLETE = (TAG_ANIMATION | TAG_PARAMETERS | TAG_TRANSFORM | TAG_GEOMETRY), + }; + BuilderMap(); ~BuilderMap(); - /* Check whether given ID is already handled by builder (or if it's being - * handled). */ - bool checkIsBuilt(ID *id); + /* Check whether given ID is already handled by builder (or if it's being handled). */ + bool checkIsBuilt(ID *id, int tag = TAG_COMPLETE) const; /* Tag given ID as handled/built. */ - void tagBuild(ID *id); + void tagBuild(ID *id, int tag = TAG_COMPLETE); - /* Combination of previous two functions, returns truth if ID was already - * handled, or tags is handled otherwise and return false. */ - bool checkIsBuiltAndTag(ID *id); + /* Combination of previous two functions, returns truth if ID was already handled, or tags is + * handled otherwise and return false. */ + bool checkIsBuiltAndTag(ID *id, int tag = TAG_COMPLETE); - template<typename T> bool checkIsBuilt(T *datablock) + template<typename T> bool checkIsBuilt(T *datablock, int tag = TAG_COMPLETE) const { - return checkIsBuilt(&datablock->id); + return checkIsBuilt(&datablock->id, tag); } - template<typename T> void tagBuild(T *datablock) + template<typename T> void tagBuild(T *datablock, int tag = TAG_COMPLETE) { - tagBuild(&datablock->id); + tagBuild(&datablock->id, tag); } - template<typename T> bool checkIsBuiltAndTag(T *datablock) + template<typename T> bool checkIsBuiltAndTag(T *datablock, int tag = TAG_COMPLETE) { - return checkIsBuiltAndTag(&datablock->id); + return checkIsBuiltAndTag(&datablock->id, tag); } - GSet *set; + protected: + int getIDTag(ID *id) const; + + typedef map<ID *, int> IDTagMap; + IDTagMap id_tags_; }; } // namespace DEG |