diff options
Diffstat (limited to 'intern/cycles/graph/node_type.h')
-rw-r--r-- | intern/cycles/graph/node_type.h | 16 |
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) |