[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58075] trunk/blender/source/blender: Fix #36024. This part fixes user counting for node editor trees. The user count previously would only work correctly for node trees which are part of material , scene, etc. or linked by group nodes. Any

Lukas Toenne lukas.toenne at googlemail.com
Mon Jul 8 13:38:11 CEST 2013


Revision: 58075
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58075
Author:   lukastoenne
Date:     2013-07-08 11:38:11 +0000 (Mon, 08 Jul 2013)
Log Message:
-----------
Fix #36024. This part fixes user counting for node editor trees. The user count previously would only work correctly for node trees which are part of material, scene, etc. or linked by group nodes. Any
custom pynodes tree edited directly as library data would get a 0 user count on reload and subsequently not be saved. Now the node space follows the same pattern as the image space: the node tree(s) user
count gets incremented on file load and opening in the editor ensures a real user. This leads to 1 "unreal" user for the editor (dropped on reload), but seems to be the only viable solution atm.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/space_node/space_node.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2013-07-08 11:38:09 UTC (rev 58074)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2013-07-08 11:38:11 UTC (rev 58075)
@@ -5708,8 +5708,9 @@
 						ntree = nodetree_from_id(snode->id);
 						if (ntree)
 							snode->nodetree = ntree;
-						else
-							snode->nodetree = newlibadr(fd, sc->id.lib, snode->nodetree);
+						else {
+							snode->nodetree = newlibadr_us(fd, sc->id.lib, snode->nodetree);
+						}
 						
 						for (path = snode->treepath.first; path; path = path->next) {
 							if (path == snode->treepath.first) {
@@ -5717,7 +5718,7 @@
 								path->nodetree = snode->nodetree;
 							}
 							else
-								path->nodetree = newlibadr(fd, sc->id.lib, path->nodetree);
+								path->nodetree = newlibadr_us(fd, sc->id.lib, path->nodetree);
 							
 							if (!path->nodetree)
 								break;
@@ -6046,7 +6047,7 @@
 							path->nodetree = snode->nodetree;
 						}
 						else
-							path->nodetree= restore_pointer_by_name(newmain, (ID*)path->nodetree, 0);
+							path->nodetree= restore_pointer_by_name(newmain, (ID*)path->nodetree, 2);
 						
 						if (!path->nodetree)
 							break;

Modified: trunk/blender/source/blender/editors/space_node/space_node.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/space_node.c	2013-07-08 11:38:09 UTC (rev 58074)
+++ trunk/blender/source/blender/editors/space_node/space_node.c	2013-07-08 11:38:11 UTC (rev 58075)
@@ -41,6 +41,7 @@
 #include "BLI_math.h"
 
 #include "BKE_context.h"
+#include "BKE_library.h"
 #include "BKE_screen.h"
 #include "BKE_node.h"
 
@@ -83,6 +84,8 @@
 			BLI_strncpy(path->node_name, id->name + 2, sizeof(path->node_name));
 		
 		BLI_addtail(&snode->treepath, path);
+		
+		id_us_ensure_real(&ntree->id);
 	}
 	
 	/* update current tree */
@@ -116,6 +119,8 @@
 	
 	BLI_addtail(&snode->treepath, path);
 	
+	id_us_ensure_real(&ntree->id);
+	
 	/* update current tree */
 	snode->edittree = ntree;
 	




More information about the Bf-blender-cvs mailing list