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:
authorJulien Duroure <julien.duroure@gmail.com>2019-05-31 08:25:56 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-05-31 08:25:56 +0300
commitb2b97906fbe0f7930e1afc3d86bd64bc932b1d48 (patch)
tree8808231eba162359149b9e63508b699ef7b72945 /io_scene_gltf2/blender/imp/gltf2_blender_material.py
parent2bbd76ce994615b918de2866953ff50ade072261 (diff)
glTF exporter: Fix T64760, T65234: preserve alpha when exists, and image exporting enhancements
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_material.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_material.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_material.py b/io_scene_gltf2/blender/imp/gltf2_blender_material.py
index 390b84f4..cdfc34c1 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_material.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_material.py
@@ -123,7 +123,7 @@ class BlenderMaterial():
material.blend_method = 'BLEND'
elif alpha_mode == "MASK":
material.blend_method = 'CLIP'
- alpha_cutoff = 1.0 - pymaterial.alpha_cutoff if pymaterial.alpha_cutoff is not None else 0.5
+ alpha_cutoff = pymaterial.alpha_cutoff if pymaterial.alpha_cutoff is not None else 0.5
material.alpha_threshold = alpha_cutoff
node_tree = material.node_tree
@@ -175,6 +175,7 @@ class BlenderMaterial():
mult = node_tree.nodes.new('ShaderNodeMath')
mult.operation = 'MULTIPLY' if pymaterial.alpha_mode == 'BLEND' else 'GREATER_THAN'
mult.location = 500, -250
+ # Note that `1.0 - pymaterial.alpha_cutoff` is used due to the invert node above.
alpha_cutoff = 1.0 if pymaterial.alpha_mode == 'BLEND' else \
1.0 - pymaterial.alpha_cutoff if pymaterial.alpha_cutoff is not None else 0.5
mult.inputs[1].default_value = alpha_cutoff