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:
authorAntony Riakiotakis <kalast@gmail.com>2014-06-18 21:40:27 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-06-18 21:40:50 +0400
commit34b8d22275280963cb89471346a211e069780cb9 (patch)
treef740af752990cc5d24499acda5a0c16777447f4e /source/blender/nodes
parent72b607ab7428d7900acc52e6b40dbd579a72241c (diff)
Fix T40585, group textures cannot be selected for painting.
Issue here is that if there's a texture in the tree, chances are it has already been set as active texture so groups are never traversed. Now changed logic so that if a group node is active, its own active texture takes priority over the parent group active texture.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/node_shader_util.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index b00d96de935..49881381253 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -195,24 +195,48 @@ static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNode
bNode *nodeGetActiveTexture(bNodeTree *ntree)
{
/* this is the node we texture paint and draw in textured draw */
- bNode *node, *tnode, *inactivenode = NULL;
+ bNode *node, *tnode, *inactivenode = NULL, *activetexnode = NULL, *activegroup = NULL;
+ bool hasgroup = false;
if (!ntree)
return NULL;
for (node = ntree->nodes.first; node; node = node->next) {
- if (node->flag & NODE_ACTIVE_TEXTURE)
- return node;
+ if (node->flag & NODE_ACTIVE_TEXTURE) {
+ activetexnode = node;
+ /* if active we can return immediately */
+ if (node->flag & NODE_ACTIVE)
+ return node;
+ }
else if (!inactivenode && node->typeinfo->nclass == NODE_CLASS_TEXTURE)
inactivenode = node;
+ else if (node->type == NODE_GROUP) {
+ if (node->flag & NODE_ACTIVE)
+ activegroup = node;
+ else
+ hasgroup = true;
+ }
+ }
+
+ /* first, check active group for textures */
+ if (activegroup) {
+ tnode = nodeGetActiveTexture((bNodeTree *)activegroup->id);
+ /* active node takes priority, so ignore any other possible nodes here */
+ if (tnode)
+ return tnode;
}
+
+ if (activetexnode)
+ return activetexnode;
- /* node active texture node in this tree, look inside groups */
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == NODE_GROUP) {
- tnode = nodeGetActiveTexture((bNodeTree *)node->id);
- if (tnode && ((tnode->flag & NODE_ACTIVE_TEXTURE) || !inactivenode))
- return tnode;
+ if (hasgroup) {
+ /* node active texture node in this tree, look inside groups */
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == NODE_GROUP) {
+ tnode = nodeGetActiveTexture((bNodeTree *)node->id);
+ if (tnode && ((tnode->flag & NODE_ACTIVE_TEXTURE) || !inactivenode))
+ return tnode;
+ }
}
}