Page MenuHome
Paste P1086

Unable to create a diff
ActivePublic

Authored by Himanshi Kalra (calra) on Aug 27 2019, 4:23 PM.
diff --git a/newImageAsPlane.py b/io_import_images_as_planes.py
index c110613..ca55ef7 100644
--- a/newImageAsPlane.py
+++ b/io_import_images_as_planes.py
@@ -19,11 +19,11 @@
# <pep8 compliant>
bl_info = {
- "name": "Import Images as Planes 2",
+ "name": "Import Images as Planes",
"author": "Florian Meyer (tstscr), mont29, matali, Ted Schundler (SpkyElctrc)",
"version": (3, 2, 2),
"blender": (2, 80, 0),
- "location": "File > Import > Images as Planes 2 or Add > Mesh > Images as Planes 2",
+ "location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
"description": "Imports images and creates planes with the appropriate aspect ratio. "
"The images are mapped to the planes.",
"warning": "",
@@ -341,10 +341,7 @@ def get_shadeless_node(dest_node_tree):
# This could be faster as a transparent shader, but then no ambient occlusion
diffuse_shader = node_tree.nodes.new('ShaderNodeBsdfDiffuse')
-
-
node_tree.links.new(diffuse_shader.inputs[0], input_node.outputs[0])
-
emission_shader = node_tree.nodes.new('ShaderNodeEmission')
node_tree.links.new(emission_shader.inputs[0], input_node.outputs[0])
@@ -395,7 +392,9 @@ def get_shadeless_node(dest_node_tree):
node_tree.links.new(mix_shader.inputs[0], shadow_or_reflect_or_refract.outputs[0])
node_tree.links.new(mix_shader.inputs[1], diffuse_shader.outputs[0])
node_tree.links.new(mix_shader.inputs[2], emission_shader.outputs[0])
-
+
+ node_tree.links.new(output_node.inputs[0], mix_shader.outputs[0])
+
auto_align_nodes(node_tree)
group_node = dest_node_tree.nodes.new("ShaderNodeGroup")
@@ -609,7 +608,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
"""Create mesh plane(s) from image files with the appropriate aspect ratio"""
bl_idname = "import_image.to_plane"
- bl_label = "Import Images as Planes 2"
+ bl_label = "Import Images as Planes"
bl_options = {'REGISTER', 'PRESET', 'UNDO'}
# ----------------------
@@ -731,11 +730,8 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
('DIFFUSE', "Diffuse", "Diffuse Shader"),
('SHADELESS', "Shadeless", "Only visible to camera and reflections"),
('EMISSION', "Emit", "Emission Shader"),
- ('PRINCIPLED',"Principled","Principled Shader"),
)
-
shader: EnumProperty(name="Shader", items=SHADERS, default='DIFFUSE', description="Node shader to use")
-
emit_strength: FloatProperty(
name="Strength", min=0.0, default=1.0, soft_max=10.0,
@@ -985,7 +981,6 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
material.transparency_method = 'Z_TRANSPARENCY'
material.use_shadeless = (shader == 'SHADELESS')
material.use_transparent_shadows = (shader == 'DIFFUSE')
-
material.emit = self.emit_strength if shader == 'EMISSION' else 0.0
# -------------------------------------------------------------------------
@@ -1014,14 +1009,8 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
tex_image = self.create_cycles_texnode(context, node_tree, img_spec)
- #if self.shader == 'DIFFUSE':
- #core_shader = node_tree.nodes.new('ShaderNodeBsdfDiffuse')
-
- #Edit 1
- #Because default in enum property is DIFFUSE, but we add the Principled Shader node
if self.shader == 'DIFFUSE':
- core_shader = node_tree.nodes.new('ShaderNodeBsdfPrincipled')
-
+ core_shader = node_tree.nodes.new('ShaderNodeBsdfDiffuse')
elif self.shader == 'SHADELESS':
core_shader = get_shadeless_node(node_tree)
else: # Emission Shading
@@ -1032,16 +1021,13 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
node_tree.links.new(core_shader.inputs[0], tex_image.outputs[0])
if self.use_transparency:
- #EditSSS 2
- node_tree.links.new(core_shader.inputs[18], tex_image.outputs[1])
-
- """bsdf_transparent = node_tree.nodes.new('ShaderNodeBsdfTransparent')
+ 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"""
+ core_shader = mix_shader
node_tree.links.new(out_node.inputs[0], core_shader.outputs[0])

Event Timeline