Blender  V3.3
depsgraph_type.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
14 #pragma once
15 
16 #include <functional>
17 
18 /* TODO(sergey): Ideally we'll just use char* and statically allocated strings
19  * to avoid any possible overhead caused by string (re)allocation/formatting. */
20 #include <algorithm>
21 #include <deque>
22 #include <map>
23 #include <set>
24 #include <string>
25 #include <vector>
26 
27 #include "BLI_map.hh"
28 #include "BLI_set.hh"
29 #include "BLI_string_ref.hh"
30 #include "BLI_vector.hh"
31 #include "BLI_vector_set.hh"
32 
33 struct Depsgraph;
34 
36 
37 namespace blender::deg {
38 
39 /* Commonly used types. */
40 using std::deque;
41 using std::optional;
42 using std::pair;
43 using std::string;
44 using std::unique_ptr;
45 
46 /* Commonly used functions. */
47 using std::make_pair;
48 using std::max;
49 using std::to_string;
50 
51 /* Function bindings. */
52 using std::function;
53 using namespace std::placeholders;
54 #define function_bind std::bind
55 
56 /* Source of the dependency graph node update tag.
57  *
58  * NOTE: This is a bit mask, so accumulation of sources is possible.
59  *
60  * TODO(sergey): Find a better place for this. */
62  /* Update is caused by a time change. */
64  /* Update caused by user directly or indirectly influencing the node. */
66  /* Update is happening as a special response for the relations update. */
68  /* Update is happening due to visibility change. */
70 };
71 
72 /* C++ wrapper around DNA's CustomData_MeshMasks struct. */
79 
80  DEGCustomDataMeshMasks() : vert_mask(0), edge_mask(0), face_mask(0), loop_mask(0), poly_mask(0)
81  {
82  }
83 
84  explicit DEGCustomDataMeshMasks(const CustomData_MeshMasks *other);
85 
87  {
88  this->vert_mask |= other.vert_mask;
89  this->edge_mask |= other.edge_mask;
90  this->face_mask |= other.face_mask;
91  this->loop_mask |= other.loop_mask;
92  this->poly_mask |= other.poly_mask;
93  return *this;
94  }
95 
97  {
99  result.vert_mask = this->vert_mask | other.vert_mask;
100  result.edge_mask = this->edge_mask | other.edge_mask;
101  result.face_mask = this->face_mask | other.face_mask;
102  result.loop_mask = this->loop_mask | other.loop_mask;
103  result.poly_mask = this->poly_mask | other.poly_mask;
104  return result;
105  }
106 
107  bool operator==(const DEGCustomDataMeshMasks &other) const
108  {
109  return (this->vert_mask == other.vert_mask && this->edge_mask == other.edge_mask &&
110  this->face_mask == other.face_mask && this->loop_mask == other.loop_mask &&
111  this->poly_mask == other.poly_mask);
112  }
113 
114  bool operator!=(const DEGCustomDataMeshMasks &other) const
115  {
116  return !(*this == other);
117  }
118 
119  static DEGCustomDataMeshMasks MaskVert(const uint64_t vert_mask)
120  {
122  result.vert_mask = vert_mask;
123  return result;
124  }
125 
126  static DEGCustomDataMeshMasks MaskEdge(const uint64_t edge_mask)
127  {
129  result.edge_mask = edge_mask;
130  return result;
131  }
132 
133  static DEGCustomDataMeshMasks MaskFace(const uint64_t face_mask)
134  {
136  result.face_mask = face_mask;
137  return result;
138  }
139 
140  static DEGCustomDataMeshMasks MaskLoop(const uint64_t loop_mask)
141  {
143  result.loop_mask = loop_mask;
144  return result;
145  }
146 
147  static DEGCustomDataMeshMasks MaskPoly(const uint64_t poly_mask)
148  {
150  result.poly_mask = poly_mask;
151  return result;
152  }
153 };
154 
155 } // namespace blender::deg
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
@ DEG_UPDATE_SOURCE_USER_EDIT
@ DEG_UPDATE_SOURCE_RELATIONS
@ DEG_UPDATE_SOURCE_VISIBILITY
std::string to_string(const T &n)
unsigned __int64 uint64_t
Definition: stdint.h:90
static DEGCustomDataMeshMasks MaskVert(const uint64_t vert_mask)
static DEGCustomDataMeshMasks MaskFace(const uint64_t face_mask)
static DEGCustomDataMeshMasks MaskLoop(const uint64_t loop_mask)
static DEGCustomDataMeshMasks MaskEdge(const uint64_t edge_mask)
bool operator==(const DEGCustomDataMeshMasks &other) const
bool operator!=(const DEGCustomDataMeshMasks &other) const
DEGCustomDataMeshMasks operator|(const DEGCustomDataMeshMasks &other) const
DEGCustomDataMeshMasks & operator|=(const DEGCustomDataMeshMasks &other)
static DEGCustomDataMeshMasks MaskPoly(const uint64_t poly_mask)
float max