提交 10bef8e6 编写于 作者: M Mr.doob

convert_obj_three: split d and Tr. Removed TRANSPARENCY. See #7520

上级 fea7d9b8
...@@ -138,7 +138,6 @@ import glob ...@@ -138,7 +138,6 @@ import glob
ALIGN = "none" # center centerxz bottom top none ALIGN = "none" # center centerxz bottom top none
SHADING = "smooth" # smooth flat SHADING = "smooth" # smooth flat
TYPE = "ascii" # ascii binary TYPE = "ascii" # ascii binary
TRANSPARENCY = "normal" # normal invert
TRUNCATE = False TRUNCATE = False
SCALE = 1.0 SCALE = 1.0
...@@ -428,14 +427,19 @@ def parse_mtl(fname): ...@@ -428,14 +427,19 @@ def parse_mtl(fname):
if chunks[0] == "Ns" and len(chunks) == 2: if chunks[0] == "Ns" and len(chunks) == 2:
materials[identifier]["specularCoef"] = float(chunks[1]) 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 # Transparency
# Tr 0.9 or d 0.9 # Tr 0.1
if (chunks[0] == "Tr" or chunks[0] == "d") and len(chunks) == 2: if chunks[0] == "Tr" and len(chunks) == 2:
materials[identifier]["transparent"] = True materials[identifier]["opacity"] = 1.0 - float(chunks[1])
if TRANSPARENCY == "invert": if materials[identifier]["opacity"] < 1.0:
materials[identifier]["opacity"] = float(chunks[1]) materials[identifier]["transparent"] = True
else:
materials[identifier]["opacity"] = 1.0 - float(chunks[1])
# Optical density # Optical density
# Ni 1.0 # Ni 1.0
...@@ -1574,10 +1578,6 @@ if __name__ == "__main__": ...@@ -1574,10 +1578,6 @@ if __name__ == "__main__":
if a in ("binary", "ascii"): if a in ("binary", "ascii"):
TYPE = a TYPE = a
elif o in ("-d", "--dissolve"):
if a in ("normal", "invert"):
TRANSPARENCY = a
elif o in ("-b", "--bakecolors"): elif o in ("-b", "--bakecolors"):
BAKE_COLORS = True BAKE_COLORS = True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册