[Bf-extensions-cvs] [9f3bea45] master: Fix (unreported) ImportImagesAsPlanes: broken alpha handling for shadeless/emit shaders.
Bastien Montagne
noreply at git.blender.org
Thu Aug 29 13:02:08 CEST 2019
Commit: 9f3bea45726e50b01491596993779e1e05306b99
Author: Bastien Montagne
Date: Thu Aug 29 13:00:41 2019 +0200
Branches: master
https://developer.blender.org/rBA9f3bea45726e50b01491596993779e1e05306b99
Fix (unreported) ImportImagesAsPlanes: broken alpha handling for shadeless/emit shaders.
Recent adding of Principled shader just removed the old alpha handling,
but that one is still needed for the otehr shaders...
===================================================================
M io_import_images_as_planes.py
===================================================================
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index 742623cb..c707c0af 100644
--- a/io_import_images_as_planes.py
+++ b/io_import_images_as_planes.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Import Images as Planes",
"author": "Florian Meyer (tstscr), mont29, matali, Ted Schundler (SpkyElctrc)",
- "version": (3, 3, 0),
+ "version": (3, 3, 1),
"blender": (2, 80, 0),
"location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
"description": "Imports images and creates planes with the appropriate aspect ratio. "
@@ -1021,7 +1021,16 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
node_tree.links.new(core_shader.inputs[0], tex_image.outputs[0])
if self.use_transparency:
- node_tree.links.new(core_shader.inputs[18], tex_image.outputs[1])
+ if self.shader == 'PRINCIPLED':
+ node_tree.links.new(core_shader.inputs[18], tex_image.outputs[1])
+ else:
+ bsdf_transparent = node_tree.nodes.new('ShaderNodeBsdfTransparent')
+
+ mix_shader = node_tree.nodes.new('ShaderNodeMixShader')
+ node_tree.links.new(mix_shader.inputs[0], tex_image.outputs[1])
+ node_tree.links.new(mix_shader.inputs[1], bsdf_transparent.outputs[0])
+ node_tree.links.new(mix_shader.inputs[2], core_shader.outputs[0])
+ core_shader = mix_shader
node_tree.links.new(out_node.inputs[0], core_shader.outputs[0])
More information about the Bf-extensions-cvs
mailing list