Blender  V2.93
deg_builder_map.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2018 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "intern/depsgraph_type.h"
27 
28 struct ID;
29 
30 namespace blender {
31 namespace deg {
32 
33 class BuilderMap {
34  public:
35  enum {
36  TAG_ANIMATION = (1 << 0),
37  TAG_PARAMETERS = (1 << 1),
38  TAG_TRANSFORM = (1 << 2),
39  TAG_GEOMETRY = (1 << 3),
40 
42  TAG_SCENE_SEQUENCER = (1 << 5),
43  TAG_SCENE_AUDIO = (1 << 6),
44 
45  /* All ID components has been built. */
48  };
49 
50  /* Check whether given ID is already handled by builder (or if it's being handled). */
51  bool checkIsBuilt(ID *id, int tag = TAG_COMPLETE) const;
52 
53  /* Tag given ID as handled/built. */
54  void tagBuild(ID *id, int tag = TAG_COMPLETE);
55 
56  /* Combination of previous two functions, returns truth if ID was already handled, or tags is
57  * handled otherwise and return false. */
58  bool checkIsBuiltAndTag(ID *id, int tag = TAG_COMPLETE);
59 
60  template<typename T> bool checkIsBuilt(T *datablock, int tag = TAG_COMPLETE) const
61  {
62  return checkIsBuilt(&datablock->id, tag);
63  }
64  template<typename T> void tagBuild(T *datablock, int tag = TAG_COMPLETE)
65  {
66  tagBuild(&datablock->id, tag);
67  }
68  template<typename T> bool checkIsBuiltAndTag(T *datablock, int tag = TAG_COMPLETE)
69  {
70  return checkIsBuiltAndTag(&datablock->id, tag);
71  }
72 
73  protected:
74  int getIDTag(ID *id) const;
75 
77 };
78 
79 } // namespace deg
80 } // namespace blender
int getIDTag(ID *id) const
bool checkIsBuiltAndTag(T *datablock, int tag=TAG_COMPLETE)
void tagBuild(ID *id, int tag=TAG_COMPLETE)
bool checkIsBuiltAndTag(ID *id, int tag=TAG_COMPLETE)
bool checkIsBuilt(T *datablock, int tag=TAG_COMPLETE) const
Map< ID *, int > id_tags_
void tagBuild(T *datablock, int tag=TAG_COMPLETE)
bool checkIsBuilt(ID *id, int tag=TAG_COMPLETE) const
#define T
Definition: DNA_ID.h:273