[Bf-blender-cvs] [f33cb522dd5] master: Cleanup: Few more validation of G_MAIN usages...

Bastien Montagne noreply at git.blender.org
Mon Jun 25 12:33:20 CEST 2018


Commit: f33cb522dd5793c685dcd681f7c7e13ff60f920a
Author: Bastien Montagne
Date:   Mon Jun 25 12:02:20 2018 +0200
Branches: master
https://developer.blender.org/rBf33cb522dd5793c685dcd681f7c7e13ff60f920a

Cleanup: Few more validation of G_MAIN usages...

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

M	source/blender/freestyle/intern/system/PythonInterpreter.h
M	source/blender/nodes/composite/node_composite_tree.c
M	source/blender/nodes/intern/node_exec.c

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

diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index 79ba9421cda..4f5e94ef7a0 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -81,7 +81,7 @@ public:
 		bool ok = BPY_execute_filepath(_context, fn, reports);
 #else
 		bool ok;
-		Text *text = BKE_text_load(&_freestyle_bmain, fn, G.main->name);
+		Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name);
 		if (text) {
 			ok = BPY_execute_text(_context, text, reports, false);
 			BKE_libblock_delete(&_freestyle_bmain, text);
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index ab9d041198c..1312b764546 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -280,7 +280,10 @@ void ntreeCompositTagRender(Scene *curscene)
 {
 	Scene *sce;
 
-	for (sce = G.main->scene.first; sce; sce = sce->id.next) {
+	/* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes,
+	 * not the ones in temp main generated for rendering?
+	 * This is still rather weak though, ideally render struct would store own main AND original G_MAIN... */
+	for (sce = G_MAIN->scene.first; sce; sce = sce->id.next) {
 		if (sce->nodetree) {
 			bNode *node;
 
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index a5be5dad534..4f7f5b5ab1c 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -163,6 +163,8 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
 	/* XXX texnodes have threading issues with muting, have to disable it there ... */
 
 	/* ensure all sock->link pointers and node levels are correct */
+	/* Using global main here is likely totally wrong, not sure what to do about that one though...
+	 * We cannot even check ntree is in global main, since most of the time it won't be (thanks to ntree design)!!! */
 	ntreeUpdateTree(G.main, ntree);
 
 	/* get a dependency-sorted list of nodes */



More information about the Bf-blender-cvs mailing list