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:
Diffstat (limited to 'source/blender/nodes/intern/SHD_util.c')
-rw-r--r--source/blender/nodes/intern/SHD_util.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/nodes/intern/SHD_util.c b/source/blender/nodes/intern/SHD_util.c
index cf7c64c9d5e..190f68ce19a 100644
--- a/source/blender/nodes/intern/SHD_util.c
+++ b/source/blender/nodes/intern/SHD_util.c
@@ -83,7 +83,11 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
{
ShaderCallData scd;
-
+ /*
+ @note: preserve material from ShadeInput for material id, nodetree execs change it
+ fix for bug "[#28012] Mat ID messy with shader nodes"
+ */
+ Material *mat = shi->mat;
/* convert caller data to struct */
scd.shi= shi;
scd.shr= shr;
@@ -92,7 +96,8 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
memset(shr, 0, sizeof(ShadeResult));
ntreeExecTree(ntree, &scd, shi->thread); /* threads */
-
+ // @note: set material back to preserved material
+ shi->mat = mat;
/* better not allow negative for now */
if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;