Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-26 22:57:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-26 22:57:02 +0400
commit7ea523d8d30d96c92c5dfc097746a5ad77a63bd3 (patch)
tree87ed8f71e6c6cb8f3982ad04eae2dbabd0d0a82f /io_scene_fbx/cycles_shader_compat.py
parent6e62352c9b9e0d7425a1762180f5f373b955cd08 (diff)
use the alpha of an image for the alpha channel when using FBX/Cycles
Diffstat (limited to 'io_scene_fbx/cycles_shader_compat.py')
-rw-r--r--io_scene_fbx/cycles_shader_compat.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/io_scene_fbx/cycles_shader_compat.py b/io_scene_fbx/cycles_shader_compat.py
index ae050ec9..e9874d59 100644
--- a/io_scene_fbx/cycles_shader_compat.py
+++ b/io_scene_fbx/cycles_shader_compat.py
@@ -269,7 +269,7 @@ class CyclesShaderWrapper():
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 @@ class CyclesShaderWrapper():
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 @@ class CyclesShaderWrapper():
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