diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-01 17:56:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-01 17:56:34 +0400 |
commit | 71c0b69e71b18d8d3da6d9de8b58ede0ab48f0d5 (patch) | |
tree | 9df9af87b113a91932168dd81962fa40c01ea40d /source/blender/nodes | |
parent | ee08c27f95908f33a3ed4f97d1d147ca80922b65 (diff) |
Fix #33372: materials linked in node setups did not output alpha values unless
the parent material also had alpha enabled. However it's useful to have it do
this even if the main material does not need alpha, to mix textures.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_material.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index bccf6d349cf..2902bf143c8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -85,7 +85,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, float col[4]; bNodeSocket *sock; char hasinput[NUM_MAT_IN] = {'\0'}; - int i; + int i, mode; /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily * the constant input stack values (e.g. in case material node is inside a group). @@ -142,10 +142,18 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]); } + /* make alpha output give results even if transparency is only enabled on + * the material linked in this not and not on the parent material */ + mode = shi->mode; + if(shi->mat->mode & MA_TRANSP) + shi->mode |= MA_TRANSP; + shi->nodes= 1; /* temp hack to prevent trashadow recursion */ node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */ shi->nodes= 0; + shi->mode = mode; + /* write to outputs */ if (node->custom1 & SH_NODE_MAT_DIFF) { copy_v3_v3(col, shrnode.combined); |