Blender  V2.93
BKE_node_ui_storage.hh
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 
17 #pragma once
18 
19 #include <mutex>
20 
21 #include "BLI_hash.hh"
22 #include "BLI_map.hh"
23 #include "BLI_session_uuid.h"
24 #include "BLI_set.hh"
25 
26 #include "DNA_ID.h"
27 #include "DNA_customdata_types.h"
28 #include "DNA_modifier_types.h"
29 #include "DNA_session_uuid_types.h"
30 
31 #include "BKE_attribute.h"
32 
33 struct ModifierData;
34 struct Object;
35 struct bNode;
36 struct bNodeTree;
37 struct bContext;
38 
47  private:
48  std::string object_name_;
49  SessionUUID modifier_session_uuid_;
50 
51  public:
52  NodeTreeEvaluationContext(const Object &object, const ModifierData &modifier)
53  {
54  object_name_ = reinterpret_cast<const ID &>(object).name;
55  modifier_session_uuid_ = modifier.session_uuid;
56  }
57 
58  uint64_t hash() const
59  {
60  return blender::get_default_hash_2(object_name_, modifier_session_uuid_);
61  }
62 
64  {
65  return a.object_name_ == b.object_name_ &&
66  BLI_session_uuid_is_equal(&a.modifier_session_uuid_, &b.modifier_session_uuid_);
67  }
68 };
69 
70 enum class NodeWarningType {
71  Error,
72  Warning,
73  Info,
74 };
75 
76 struct NodeWarning {
78  std::string message;
79 };
80 
82  std::string name;
85 
86  uint64_t hash() const
87  {
89  }
90 
92  {
93  return a.name == b.name;
94  }
95 };
96 
97 struct NodeUIStorage {
100 };
101 
105 
113 };
114 
116  const bNodeTree &ntree,
117  const bNode &node);
118 
121 
124  const bNode &node,
125  const NodeWarningType type,
126  std::string message);
127 
130  const bNode &node,
131  const blender::StringRef attribute_name,
132  const AttributeDomain domain,
133  const CustomDataType data_type);
Generic geometry attributes built on CustomData.
AttributeDomain
Definition: BKE_attribute.h:41
void BKE_nodetree_ui_storage_free_for_context(bNodeTree &ntree, const NodeTreeEvaluationContext &context)
const NodeUIStorage * BKE_node_tree_ui_storage_get_from_context(const bContext *C, const bNodeTree &ntree, const bNode &node)
void BKE_nodetree_attribute_hint_add(bNodeTree &ntree, const NodeTreeEvaluationContext &context, const bNode &node, const blender::StringRef attribute_name, const AttributeDomain domain, const CustomDataType data_type)
NodeWarningType
void BKE_nodetree_error_message_add(bNodeTree &ntree, const NodeTreeEvaluationContext &context, const bNode &node, const NodeWarningType type, std::string message)
bool BLI_session_uuid_is_equal(const SessionUUID *lhs, const SessionUUID *rhs)
Definition: session_uuid.c:57
ThreadMutex mutex
ID and Library types, which are fundamental for sdna.
CustomDataType
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define C
Definition: RandGen.cpp:39
NodeTreeEvaluationContext(const Object &object, const ModifierData &modifier)
friend bool operator==(const NodeTreeEvaluationContext &a, const NodeTreeEvaluationContext &b)
OperationNode * node
bNodeTree * ntree
static unsigned a[3]
Definition: RandGen.cpp:92
uint64_t get_default_hash(const T &v)
Definition: BLI_hash.hh:209
uint64_t get_default_hash_2(const T1 &v1, const T2 &v2)
Definition: BLI_hash.hh:214
struct SELECTID_Context context
Definition: select_engine.c:47
unsigned __int64 uint64_t
Definition: stdint.h:93
friend bool operator==(const AvailableAttributeInfo &a, const AvailableAttributeInfo &b)
Definition: DNA_ID.h:273
SessionUUID session_uuid
AvailableAttributeInfo dummy_info_for_search
blender::Map< NodeTreeEvaluationContext, blender::Map< std::string, NodeUIStorage > > context_map
blender::Vector< NodeWarning > warnings
blender::Set< AvailableAttributeInfo > attribute_hints
std::string message
NodeWarningType type