From 10bef8e6a9d76b9ed90a7a98cdd666fcd4d5230c Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 2 Nov 2015 18:27:02 -0500 Subject: [PATCH] convert_obj_three: split d and Tr. Removed TRANSPARENCY. See #7520 --- utils/converters/obj/convert_obj_three.py | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/utils/converters/obj/convert_obj_three.py b/utils/converters/obj/convert_obj_three.py index a36b9cf87d..c0e30b4a76 100644 --- a/utils/converters/obj/convert_obj_three.py +++ b/utils/converters/obj/convert_obj_three.py @@ -138,7 +138,6 @@ import glob ALIGN = "none" # center centerxz bottom top none SHADING = "smooth" # smooth flat TYPE = "ascii" # ascii binary -TRANSPARENCY = "normal" # normal invert TRUNCATE = False SCALE = 1.0 @@ -428,14 +427,19 @@ def parse_mtl(fname): if chunks[0] == "Ns" and len(chunks) == 2: materials[identifier]["specularCoef"] = float(chunks[1]) + # Dissolves + # d 0.9 + if chunks[0] == "d" and len(chunks) == 2: + materials[identifier]["opacity"] = float(chunks[1]) + if materials[identifier]["opacity"] < 1.0: + materials[identifier]["transparent"] = True + # Transparency - # Tr 0.9 or d 0.9 - if (chunks[0] == "Tr" or chunks[0] == "d") and len(chunks) == 2: - materials[identifier]["transparent"] = True - if TRANSPARENCY == "invert": - materials[identifier]["opacity"] = float(chunks[1]) - else: - materials[identifier]["opacity"] = 1.0 - float(chunks[1]) + # Tr 0.1 + if chunks[0] == "Tr" and len(chunks) == 2: + materials[identifier]["opacity"] = 1.0 - float(chunks[1]) + if materials[identifier]["opacity"] < 1.0: + materials[identifier]["transparent"] = True # Optical density # Ni 1.0 @@ -1574,10 +1578,6 @@ if __name__ == "__main__": if a in ("binary", "ascii"): TYPE = a - elif o in ("-d", "--dissolve"): - if a in ("normal", "invert"): - TRANSPARENCY = a - elif o in ("-b", "--bakecolors"): BAKE_COLORS = True -- GitLab