[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53200] trunk/blender/source/blender/ blenkernel/intern/node.c: Associate Node RNA subtypes with their respective bNodeType on registration .

Lukas Toenne lukas.toenne at googlemail.com
Thu Dec 20 10:49:12 CET 2012


Revision: 53200
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53200
Author:   lukastoenne
Date:     2012-12-20 09:49:11 +0000 (Thu, 20 Dec 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/node.c

Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c	2012-12-20 09:33:12 UTC (rev 53199)
+++ trunk/blender/source/blender/blenkernel/intern/node.c	2012-12-20 09:49:11 UTC (rev 53200)
@@ -2162,6 +2162,24 @@
 	
 	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)




More information about the Bf-blender-cvs mailing list