Spaces:
Running
on
A10G
Running
on
A10G
Commit
·
49e7cc1
1
Parent(s):
9f99e23
loadldraw material error fix
Browse files
ImportLDraw/loadldraw/loadldraw.py
CHANGED
|
@@ -677,8 +677,17 @@ class LegoColours:
|
|
| 677 |
subline = line_split[line_split.index("MATERIAL"):]
|
| 678 |
|
| 679 |
colour["material"] = LegoColours.__getValue(subline, "MATERIAL")
|
| 680 |
-
|
| 681 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
colour["fraction"] = LegoColours.__getValue(subline, "FRACTION")
|
| 683 |
colour["vfraction"] = LegoColours.__getValue(subline, "VFRACTION")
|
| 684 |
colour["size"] = LegoColours.__getValue(subline, "SIZE")
|
|
@@ -4775,4 +4784,4 @@ def loadFromFile(context, filename, isFullFilepath=True):
|
|
| 4775 |
Configure.tempDir.cleanup()
|
| 4776 |
|
| 4777 |
debugPrint("Load Done")
|
| 4778 |
-
return rootOb
|
|
|
|
| 677 |
subline = line_split[line_split.index("MATERIAL"):]
|
| 678 |
|
| 679 |
colour["material"] = LegoColours.__getValue(subline, "MATERIAL")
|
| 680 |
+
|
| 681 |
+
# current `FABRIC [VELVET | CANVAS | STRING | FUR]` is not yet supported.
|
| 682 |
+
if colour["material"] == "FABRIC":
|
| 683 |
+
debugPrint(f"Unsupported material finish: {colour['material']} for [colour: {name} code: {code}] in line: {subline}")
|
| 684 |
+
|
| 685 |
+
# Note, not all finishes have a secondary value
|
| 686 |
+
finishValue = LegoColours.__getValue(subline, "VALUE")
|
| 687 |
+
if finishValue is not None:
|
| 688 |
+
hexDigits = finishValue[1:]
|
| 689 |
+
colour["secondary_colour"] = LegoColours.hexDigitsToLinearRGBA(hexDigits, 1.0)
|
| 690 |
+
|
| 691 |
colour["fraction"] = LegoColours.__getValue(subline, "FRACTION")
|
| 692 |
colour["vfraction"] = LegoColours.__getValue(subline, "VFRACTION")
|
| 693 |
colour["size"] = LegoColours.__getValue(subline, "SIZE")
|
|
|
|
| 4784 |
Configure.tempDir.cleanup()
|
| 4785 |
|
| 4786 |
debugPrint("Load Done")
|
| 4787 |
+
return rootOb
|