ModelTranslator: dedupe sanitized material names, set alphaIsTransparency for alpha-test textures

This commit is contained in:
ud18010
2026-07-15 12:00:50 +08:00
parent 073ae48a61
commit 0b068dbaa0
4 changed files with 29 additions and 10 deletions
+4 -3
View File
@@ -33,7 +33,7 @@ def safe_name(name):
return re.sub(r"[^0-9A-Za-z_\-]", "_", name).strip("_") or "mat"
def texture_meta(guid, srgb, max_size):
def texture_meta(guid, srgb, max_size, alpha_is_transparency=False):
return """fileFormatVersion: 2
guid: {guid}
TextureImporter:
@@ -88,7 +88,7 @@ TextureImporter:
spriteBorder: {{x: 0, y: 0, z: 0, w: 0}}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: {ait}
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
@@ -135,7 +135,8 @@ TextureImporter:
userData:
assetBundleName:
assetBundleVariant:
""".format(guid=guid, srgb=1 if srgb else 0, max_size=max_size)
""".format(guid=guid, srgb=1 if srgb else 0, max_size=max_size,
ait=1 if alpha_is_transparency else 0)
def material_yaml(name, shader_guid, base_tex_guid, mix_tex_guid, alpha_test):