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-05-16 19:06:18 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-05-16 19:06:18 +0400
commita8964d865f387dc04b2e4c34c91269ac22edb98b (patch)
tree51bd2391f76f0b554d28d888adebfc04083a5a51 /source/blender/blenkernel/intern/node.c
parentb881dd9e7f92b0198c965bb5b70dbf5f5844a865 (diff)
Fix #35388, grouped nodes not editable in properties ui.
The issue here was that the "active" material node depends on the editor context. Previously (< 2.67) there was only 1 edited node group possible globally throughout Blender, so the active material in the context could be resolved more easily. The solution now involves the active_viewer_key variable (first introduced for compositor viewer nodes in r56271, naming is a bit awkward but hard to change in DNA). This key defines the "last modified" node tree to resolve ambiguity of active context items. For single editors the result is the same as in 2.66, if multiple editors are used with different node groups the last modified tree is used.
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r--source/blender/blenkernel/intern/node.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 03d4fc35f42..75bf594a976 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2278,30 +2278,41 @@ bNode *nodeGetActive(bNodeTree *ntree)
return node;
}
-/* two active flags, ID nodes have special flag for buttons display */
-bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
+static bNode *node_get_active_id_recursive(bNodeInstanceKey active_key, bNodeInstanceKey parent_key, bNodeTree *ntree, short idtype)
{
- bNode *node, *tnode;
-
- if (ntree == NULL) return NULL;
-
- for (node = ntree->nodes.first; node; node = node->next)
- if (node->id && GS(node->id->name) == idtype)
- if (node->flag & NODE_ACTIVE_ID)
- return node;
-
- /* no node with active ID in this tree, look inside groups */
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == NODE_GROUP) {
- tnode = nodeGetActiveID((bNodeTree *)node->id, idtype);
- if (tnode)
- return tnode;
+ if (parent_key.value == active_key.value) {
+ bNode *node;
+ for (node = ntree->nodes.first; node; node = node->next)
+ if (node->id && GS(node->id->name) == idtype)
+ if (node->flag & NODE_ACTIVE_ID)
+ return node;
+ }
+ else {
+ bNode *node, *tnode;
+ /* no node with active ID in this tree, look inside groups */
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == NODE_GROUP) {
+ bNodeTree *group = (bNodeTree *)node->id;
+ bNodeInstanceKey group_key = BKE_node_instance_key(parent_key, ntree, node);
+ tnode = node_get_active_id_recursive(active_key, group_key, group, idtype);
+ if (tnode)
+ return tnode;
+ }
}
}
return NULL;
}
+/* two active flags, ID nodes have special flag for buttons display */
+bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
+{
+ if (ntree)
+ return node_get_active_id_recursive(ntree->active_viewer_key, NODE_INSTANCE_KEY_BASE, ntree, idtype);
+ else
+ return NULL;
+}
+
bool nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
{
bNode *node;