[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52698] trunk/blender/source/blender/nodes /shader/nodes/node_shader_material.c: Fix #33372: materials linked in node setups did not output alpha values unless

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Dec 1 14:56:35 CET 2012


Revision: 52698
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52698
Author:   blendix
Date:     2012-12-01 13:56:34 +0000 (Sat, 01 Dec 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/shader/nodes/node_shader_material.c

Modified: trunk/blender/source/blender/nodes/shader/nodes/node_shader_material.c
===================================================================
--- trunk/blender/source/blender/nodes/shader/nodes/node_shader_material.c	2012-12-01 08:47:39 UTC (rev 52697)
+++ trunk/blender/source/blender/nodes/shader/nodes/node_shader_material.c	2012-12-01 13:56:34 UTC (rev 52698)
@@ -85,7 +85,7 @@
 		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 @@
 				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);




More information about the Bf-blender-cvs mailing list