Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-03 11:02:00 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-07 14:18:15 +0300
commitad489b71646a2e03e2ce9b0d193d541e3987b4cd (patch)
tree90c267c776585606c65156253ec3ce5b96101588 /intern/cycles/graph/node_type.h
parentb1f1a1ca6035e23d66656c97c16fe081caafcae8 (diff)
Cleanup: add type inheritance for Cycles nodes
Diffstat (limited to 'intern/cycles/graph/node_type.h')
-rw-r--r--intern/cycles/graph/node_type.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h
index e9496a42658..a4461ec7abb 100644
--- a/intern/cycles/graph/node_type.h
+++ b/intern/cycles/graph/node_type.h
@@ -103,7 +103,7 @@ struct SocketType {
struct NodeType {
enum Type { NONE, SHADER };
- explicit NodeType(Type type = NONE);
+ explicit NodeType(Type type = NONE, const NodeType *base = NULL);
~NodeType();
void register_input(ustring name,
@@ -124,11 +124,15 @@ struct NodeType {
ustring name;
Type type;
+ const NodeType *base;
vector<SocketType, std::allocator<SocketType>> inputs;
vector<SocketType, std::allocator<SocketType>> outputs;
CreateFunc create;
- static NodeType *add(const char *name, CreateFunc create, Type type = NONE);
+ static NodeType *add(const char *name,
+ CreateFunc create,
+ Type type = NONE,
+ const NodeType *base = NULL);
static const NodeType *find(ustring name);
static unordered_map<ustring, NodeType, ustringHash> &types();
};
@@ -148,6 +152,14 @@ struct NodeType {
} \
template<typename T> const NodeType *structname::register_type()
+#define NODE_ABSTRACT_DECLARE \
+ template<typename T> static const NodeType *register_type(); \
+ static const NodeType *node_type;
+
+#define NODE_ABSTRACT_DEFINE(structname) \
+ const NodeType *structname::node_type = structname::register_type<structname>(); \
+ template<typename T> const NodeType *structname::register_type()
+
/* Sock Definition Macros */
#define SOCKET_OFFSETOF(T, name) (((char *)&(((T *)1)->name)) - (char *)1)