diff options
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 809b45d4b36..1fec725dbb7 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1148,7 +1148,7 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode /* parses the geom+tex nodes */ ntreeShaderGetTexcoMode(ntree, r_mode, &basemat->texco, &basemat->mode_l); - + basemat->nmap_tangent_names_count = 0; for (node = ntree->nodes.first; node; node = node->next) { if (node->id) { if (GS(node->id->name) == ID_MA) { @@ -1170,6 +1170,21 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode else if (node->type == NODE_GROUP) init_render_nodetree((bNodeTree *)node->id, basemat, r_mode, amb); } + else if (node->typeinfo->type == SH_NODE_NORMAL_MAP) { + basemat->mode2_l |= MA_TANGENT_CONCRETE; + NodeShaderNormalMap *nm = node->storage; + bool taken_into_account = false; + for (int i = 0; i < basemat->nmap_tangent_names_count; i++) { + if (STREQ(basemat->nmap_tangent_names[i], nm->uv_map)) { + taken_into_account = true; + break; + } + } + if (!taken_into_account) { + BLI_assert(basemat->nmap_tangent_names_count < MAX_MTFACE + 1); + strcpy(basemat->nmap_tangent_names[basemat->nmap_tangent_names_count++], nm->uv_map); + } + } } } |