diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-30 08:14:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-30 08:14:36 +0300 |
commit | 093ab05bcd6efd3e08409f4ca2edb9e84cf75bd1 (patch) | |
tree | d3ba26ad0dd650f4decfb8dd75d6067239dc445f /intern | |
parent | d1cdbbc5fdb9e25798bb5953849407b0346dbee8 (diff) | |
parent | 39226cd437c4d68134369740bdab945c4b4d4364 (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/graph/node_type.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h index 2a741d9b06f..8b37398fa17 100644 --- a/intern/cycles/graph/node_type.h +++ b/intern/cycles/graph/node_type.h @@ -148,16 +148,17 @@ struct NodeType { #define NODE_DECLARE \ static const NodeType *get_node_type(); \ template<typename T> static const NodeType *register_type(); \ - static Node *create(const NodeType *type); + static Node *create(const NodeType *type); \ + static const NodeType *node_type; #define NODE_DEFINE(structname) \ + const NodeType *structname::node_type = structname::register_type<structname>(); \ Node *structname::create(const NodeType *) \ { \ return new structname(); \ } \ const NodeType *structname::get_node_type() \ { \ - static const NodeType *node_type = register_type<structname>(); \ return node_type; \ } \ template<typename T> const NodeType *structname::register_type() @@ -169,6 +170,8 @@ struct NodeType { #define NODE_ABSTRACT_DEFINE(structname) \ const NodeType *structname::get_node_base_type() \ { \ + /* Base types constructed in this getter to ensure correct initialization \ + * order. Regular types are not so they are auto-registered for XML parsing. */ \ static const NodeType *node_base_type = register_base_type<structname>(); \ return node_base_type; \ } \ |