[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4703] trunk/py/scripts/addons/ io_scene_fbx/cycles_shader_compat.py: use the alpha of an image for the alpha channel when using FBX/Cycles
Campbell Barton
ideasman42 at gmail.com
Mon Aug 26 20:57:02 CEST 2013
Revision: 4703
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4703
Author: campbellbarton
Date: 2013-08-26 18:57:02 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
use the alpha of an image for the alpha channel when using FBX/Cycles
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_fbx/cycles_shader_compat.py
Modified: trunk/py/scripts/addons/io_scene_fbx/cycles_shader_compat.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/cycles_shader_compat.py 2013-08-26 17:56:34 UTC (rev 4702)
+++ trunk/py/scripts/addons/io_scene_fbx/cycles_shader_compat.py 2013-08-26 18:57:02 UTC (rev 4703)
@@ -269,7 +269,7 @@
self.node_out.inputs["Displacement"])
@staticmethod
- def _image_create_helper(image, node_dst, sockets_dst):
+ def _image_create_helper(image, node_dst, sockets_dst, use_alpha=False):
tree = node_dst.id_data
nodes = tree.nodes
links = tree.links
@@ -279,7 +279,7 @@
node.location = node_dst.location
node.location.x -= CyclesShaderWrapper._col_size
for socket in sockets_dst:
- links.new(node.outputs["Color"],
+ links.new(node.outputs["Alpha" if use_alpha else "Color"],
socket)
return node
@@ -334,7 +334,10 @@
def alpha_image_set(self, image):
self.node_bsdf_alpha.mute = False
node = self.node_mix_color_alpha
- self._image_create_helper(image, node, (node.inputs["Color2"],))
+ # note: use_alpha may need to be configurable
+ # its not always the case that alpha channels use the image alpha
+ # a greyscale image may also be used.
+ self._image_create_helper(image, node, (node.inputs["Color2"],), use_alpha=True)
def alpha_image_set_from_diffuse(self):
tree = self.node_mix_color_diff.id_data
More information about the Bf-extensions-cvs
mailing list