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
path: root/source
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-12-20 13:49:11 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-12-20 13:49:11 +0400
commita83cdfe41a1af28df6836e971e19835cb5b338e6 (patch)
treea99913426f10e8ba601ac46d29eab7e7a71b8ad1 /source
parent35c2267aee84d086c00574496b52e9c0641e320d (diff)
Associate Node RNA subtypes with their respective bNodeType on registration. This has to be done in blenkernel, since RNA node types are actually registered before the node types. Future dynamic node types registered using the API will register their own explicit RNA types and don't need this hack.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/node.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 17dcf34b71f..8babdf2402f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2162,6 +2162,24 @@ void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype)
if (found == NULL)
BLI_addtail(typelist, ntype);
+
+ /* Associate the RNA struct type with the bNodeType.
+ * Dynamically registered nodes will create an RNA type at runtime
+ * and call RNA_struct_blender_type_set, so this only needs to be done for old RNA types
+ * created in makesrna, which can not be associated to a bNodeType immediately,
+ * since bNodeTypes are registered afterward ...
+ */
+ #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ if (ID == ntype->type) { \
+ StructRNA *srna = RNA_struct_find(STRINGIFY_ARG(Category##StructName)); \
+ BLI_assert(srna != NULL); \
+ RNA_struct_blender_type_set(srna, ntype); \
+ }
+
+ /* XXX hack, this file will be moved to the nodes folder in customnodes branch,
+ * then this stupid include path is not needed any more.
+ */
+ #include "intern/rna_nodetree_types.h"
}
static void registerCompositNodes(bNodeTreeType *ttype)