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
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-07-08 15:38:11 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-07-08 15:38:11 +0400
commitd75e0f320b4af13d5a35c5787a8ff992b959149e (patch)
tree0228762468e5093a3310994a38cc463f30c4dd32 /source/blender/editors/space_node/space_node.c
parentfa7e690a91258cfcfd266d48a4b084ba734d7b5f (diff)
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.
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r--source/blender/editors/space_node/space_node.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 07fa6997e99..8d6363d3bbe 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -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 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
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 @@ void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
BLI_addtail(&snode->treepath, path);
+ id_us_ensure_real(&ntree->id);
+
/* update current tree */
snode->edittree = ntree;