diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2011-07-19 12:31:53 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2011-07-19 12:31:53 +0400 |
commit | 4024b14b43c6409a319d80611bcf8b5e536bda1f (patch) | |
tree | b4ef777fb145a941197e377de05731593c621a88 /source/blender/nodes/intern | |
parent | f4b6d00926cb3ff847ac843a692ef858bccf769d (diff) |
fix for [#28012] Mat ID messy with shader nodes
Issue was that the Shader tree execution changed the ShaderInput.
Changes are that the UI is updated that only the main material will have the pass_index this is displayed in the "render pipeline options" panel.
When the material is not a node material the pass_index will be shown at the "options" panel
To test enable nodes on the material
Add a new input material
change the pass_index of the material (render pipeline options)
Enable RenderPass material ID and use the compositor to read out the material pass
Jeroen
Diffstat (limited to 'source/blender/nodes/intern')
-rw-r--r-- | source/blender/nodes/intern/SHD_util.c | 9 |
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; |