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:
authorDamien Picard <dam.pic@free.fr>2020-11-30 11:57:04 +0300
committerDamien Picard <dam.pic@free.fr>2020-11-30 13:28:07 +0300
commitce3a7fc885a0a26c570e8f4a9f9de8a0806cab01 (patch)
treeebb9cb8a16003c8b2cc581dde46dcea7afb3a604 /io_import_images_as_planes.py
parent866dcad5aa6e45737f0634b835adcbc0871201e5 (diff)
Import images as planes: use Principled BSDF for emission mode
Since Blender 2.91, the Principled BSDF node has an Emission Strength input. It can thus replace the previous setup used to import images as emissive planes. This can improve export compatibility. Reviewed By: Bastien Montagne (mont29) Differential revision: https://developer.blender.org/D9669
Diffstat (limited to 'io_import_images_as_planes.py')
-rw-r--r--io_import_images_as_planes.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index e5b2eae2..d842566e 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, 2),
+ "version": (3, 4, 0),
"blender": (2, 91, 0),
"location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
"description": "Imports images and creates planes with the appropriate aspect ratio. "
@@ -1014,15 +1014,20 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
core_shader = node_tree.nodes.new('ShaderNodeBsdfPrincipled')
elif self.shader == 'SHADELESS':
core_shader = get_shadeless_node(node_tree)
- else: # Emission Shading
- core_shader = node_tree.nodes.new('ShaderNodeEmission')
- core_shader.inputs['Strength'].default_value = self.emit_strength
+ elif self.shader == 'EMISSION':
+ core_shader = node_tree.nodes.new('ShaderNodeBsdfPrincipled')
+ core_shader.inputs['Emission Strength'].default_value = self.emit_strength
+ core_shader.inputs['Base Color'].default_value = (0.0, 0.0, 0.0, 1.0)
+ core_shader.inputs['Specular'].default_value = 0.0
# Connect color from texture
- node_tree.links.new(core_shader.inputs[0], tex_image.outputs['Color'])
+ if self.shader in {'PRINCIPLED', 'SHADELESS'}:
+ node_tree.links.new(core_shader.inputs[0], tex_image.outputs['Color'])
+ elif self.shader == 'EMISSION':
+ node_tree.links.new(core_shader.inputs['Emission'], tex_image.outputs['Color'])
if self.use_transparency:
- if self.shader == 'PRINCIPLED':
+ if self.shader in {'PRINCIPLED', 'EMISSION'}:
node_tree.links.new(core_shader.inputs['Alpha'], tex_image.outputs['Alpha'])
else:
bsdf_transparent = node_tree.nodes.new('ShaderNodeBsdfTransparent')