Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/node_shader_tree.c
| Show First 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | |||||
| * private here. | * private here. | ||||
| */ | */ | ||||
| bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target) | bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target) | ||||
| { | { | ||||
| /* Make sure we only have single node tagged as output. */ | /* Make sure we only have single node tagged as output. */ | ||||
| ntreeSetOutput(ntree); | ntreeSetOutput(ntree); | ||||
| /* Find output node that matches type and target. If there are | /* Find output node that matches type and target. If there are | ||||
| * multiple, we prefer exact target match and active nodes. */ | * multiple, we prefer active nodes. */ | ||||
| bNode *output_node = NULL; | bNode *output_node = NULL; | ||||
| for (bNode *node = ntree->nodes.first; node; node = node->next) { | for (bNode *node = ntree->nodes.first; node; node = node->next) { | ||||
| if (!ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, | if (!ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, | ||||
| SH_NODE_OUTPUT_WORLD, | SH_NODE_OUTPUT_WORLD, | ||||
| SH_NODE_OUTPUT_LIGHT)) | SH_NODE_OUTPUT_LIGHT)) | ||||
| { | { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (node->custom1 == SHD_OUTPUT_ALL) { | if (ELEM(node->custom1, SHD_OUTPUT_ALL, target)) { | ||||
| if (output_node == NULL) { | if (node->flag & NODE_DO_OUTPUT) | ||||
| output_node = node; | |||||
| } | |||||
| else if (output_node->custom1 == SHD_OUTPUT_ALL) { | |||||
| if ((node->flag & NODE_DO_OUTPUT) && | |||||
| !(output_node->flag & NODE_DO_OUTPUT)) | |||||
| { | { | ||||
| output_node = node; | return node; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| else if (node->custom1 == target) { | |||||
| if (output_node == NULL) { | if (output_node == NULL) { | ||||
| output_node = node; | output_node = node; | ||||
| } | } | ||||
| else if (output_node->custom1 == SHD_OUTPUT_ALL) { | if (output_node->custom1 == SHD_OUTPUT_ALL && node->custom1 == target) { | ||||
| output_node = node; | |||||
| } | |||||
| else if ((node->flag & NODE_DO_OUTPUT) && | |||||
| !(output_node->flag & NODE_DO_OUTPUT)) | |||||
| { | |||||
| output_node = node; | output_node = node; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return output_node; | return output_node; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 589 Lines • Show Last 20 Lines | |||||