Update
This commit is contained in:
commit
2d6a8a867d
1093 files changed
+2424571
No files matched your search
@@ -0,0 +1,39 @@
|
||||
# Turn material_table.json into per-object Roblox styles: {object name: [RobloxMaterial, r, g, b, glow]}
|
||||
import json, os
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
t = json.load(open(os.path.join(HERE, "material_table.json"), encoding="utf-8"))
|
||||
|
||||
def roblox_material(name, info):
|
||||
n = name.lower()
|
||||
if info.get("emit", 0) > 0.5:
|
||||
return "Neon"
|
||||
if "snow" in n:
|
||||
return "SmoothPlastic"
|
||||
if "asphalt" in n:
|
||||
return "Asphalt"
|
||||
if "rock" in n or "cliff" in n:
|
||||
return "Rock"
|
||||
if "curb" in n or "stone" in n:
|
||||
return "Slate"
|
||||
if "wood" in n or "cedar" in n or "trunk" in n or "timber" in n:
|
||||
return "Wood"
|
||||
if "bronze" in n or "gold" in n and info.get("metal", 0) > 0.3:
|
||||
return "Metal"
|
||||
return "SmoothPlastic"
|
||||
|
||||
styles = {}
|
||||
multi = 0
|
||||
for obj, mats in t["objects"].items():
|
||||
mats = [m for m in mats if m]
|
||||
if not mats:
|
||||
continue
|
||||
if len(mats) > 1:
|
||||
multi += 1
|
||||
# one Roblox part = one material: pick the one that reads best for multi-material objects
|
||||
PREF = ("Pine_Facet_1", "Candy_Red", "Snow", "Asphalt_Stylized_BlueGrey", "Light_Bulb")
|
||||
m = next((p for p in PREF if p in mats), mats[0])
|
||||
info = t["materials"][m]
|
||||
col = info.get("emit_color", info["color"]) if info.get("emit", 0) > 0.5 else info["color"]
|
||||
styles[obj] = [roblox_material(m, info), col[0], col[1], col[2], 1 if info.get("emit", 0) > 0.5 else 0, m]
|
||||
json.dump(styles, open(os.path.join(HERE, "part_styles.json"), "w", encoding="utf-8"), ensure_ascii=False)
|
||||
print("styles", len(styles), "multi-material objects", multi)
|
||||
Reference in new issue
Block a user