[Bf-blender-cvs] [a30be36] object_nodes: Added a graphviz debug dump function for the object modifier node tree.

Lukas Tönne noreply at git.blender.org
Tue Nov 24 09:44:30 CET 2015


Commit: a30be3603008e7dc3dbf6736e13a18c39e0cd380
Author: Lukas Tönne
Date:   Thu Nov 19 16:42:03 2015 +0100
Branches: object_nodes
https://developer.blender.org/rBa30be3603008e7dc3dbf6736e13a18c39e0cd380

Added a graphviz debug dump function for the object modifier node tree.

===================================================================

M	source/blender/makesrna/intern/rna_object_api.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 628dd98..f212803 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -35,6 +35,7 @@
 #include <time.h>
 
 #include "BLI_utildefines.h"
+#include "BLI_path_util.h"
 
 #include "RNA_define.h"
 
@@ -77,6 +78,8 @@ static EnumPropertyItem space_items[] = {
 #include "BKE_object.h"
 #include "BKE_report.h"
 
+#include "BVM_api.h"
+
 #include "ED_object.h"
 
 #include "DNA_curve_types.h"
@@ -451,6 +454,26 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
 }
 #endif /* NDEBUG */
 
+static void rna_Object_debug_nodes_graphviz(struct Object *ob, const char *filename)
+{
+	FILE *f = fopen(filename, "w");
+	if (f == NULL)
+		return;
+	
+	if (ob->nodetree) {
+		struct BVMEvalGlobals *globals;
+		struct BVMFunction *fn;
+		
+		globals = BVM_globals_create();
+		fn = BVM_gen_modifier_function(globals, ob, ob->nodetree, f);
+		
+		BVM_function_free(fn);
+		BVM_globals_free(globals);
+	}
+	
+	fclose(f);
+}
+
 static int rna_Object_update_from_editmode(Object *ob)
 {
 	if (ob->mode & OB_MODE_EDIT) {
@@ -675,6 +698,11 @@ void RNA_api_object(StructRNA *srna)
 	RNA_def_function_output(func, parm);
 #endif /* NDEBUG */
 
+	func = RNA_def_function(srna, "debug_nodes_graphviz", "rna_Object_debug_nodes_graphviz");
+	parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
+	                                "File in which to store graphviz debug output");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+
 	func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
 	RNA_def_function_ui_description(func, "Load the objects edit-mode data intp the object data");
 	parm = RNA_def_boolean(func, "result", 0, "", "Success");




More information about the Bf-blender-cvs mailing list