Blender  V3.3
deg_builder_map.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "intern/depsgraph_type.h"
11 
12 struct ID;
13 
14 namespace blender::deg {
15 
16 class BuilderMap {
17  public:
18  enum {
19  TAG_ANIMATION = (1 << 0),
20  TAG_PARAMETERS = (1 << 1),
21  TAG_TRANSFORM = (1 << 2),
22  TAG_GEOMETRY = (1 << 3),
23 
25  TAG_SCENE_SEQUENCER = (1 << 5),
26  TAG_SCENE_AUDIO = (1 << 6),
27 
28  /* All ID components has been built. */
31  };
32 
33  /* Check whether given ID is already handled by builder (or if it's being handled). */
34  bool checkIsBuilt(ID *id, int tag = TAG_COMPLETE) const;
35 
36  /* Tag given ID as handled/built. */
37  void tagBuild(ID *id, int tag = TAG_COMPLETE);
38 
39  /* Combination of previous two functions, returns truth if ID was already handled, or tags is
40  * handled otherwise and return false. */
41  bool checkIsBuiltAndTag(ID *id, int tag = TAG_COMPLETE);
42 
43  template<typename T> bool checkIsBuilt(T *datablock, int tag = TAG_COMPLETE) const
44  {
45  return checkIsBuilt(&datablock->id, tag);
46  }
47  template<typename T> void tagBuild(T *datablock, int tag = TAG_COMPLETE)
48  {
49  tagBuild(&datablock->id, tag);
50  }
51  template<typename T> bool checkIsBuiltAndTag(T *datablock, int tag = TAG_COMPLETE)
52  {
53  return checkIsBuiltAndTag(&datablock->id, tag);
54  }
55 
56  protected:
57  int getIDTag(ID *id) const;
58 
60 };
61 
62 } // namespace blender::deg
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:368