Skip to content

Commit ae8bc78

Browse files
Merge pull request #347 from Simarilius-uk/main
Fix the decal texture getting shared when it shouldnt
2 parents 633c2da + 4194d0c commit ae8bc78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

i_scene_cp77_gltf/importers/import_with_materials.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ def import_mats(BasePath, DepotPath, exclude_unused_mats, existingMeshes, gltf_i
420420
DiffuseMap = m['Data']['DiffuseMap']
421421
elif 'BaseColor' in m['Data'].keys():
422422
DiffuseMap = m['Data']['BaseColor']
423+
elif 'DiffuseTexture' in m['Data'].keys():
424+
DiffuseMap = m['Data']['DiffuseTexture']
423425
else:
424426
DiffuseMap = 'None'
425427

@@ -465,7 +467,8 @@ def import_mats(BasePath, DepotPath, exclude_unused_mats, existingMeshes, gltf_i
465467

466468
# print('matname: ',matname, validmats[matname])
467469
m = validmats[matname]
468-
470+
if matname=='decal_diffuse1':
471+
print('debug')
469472
# Should create a list of mis that dont play nice with this and just check if the mat is using one.
470473
if ( matname in bpy_mats.keys() and 'm' in bpy_mats[matname].keys() and dict(bpy_mats[matname]['m']) == m ):
471474
bpy.data.meshes[name].materials.append(bpy_mats[matname])
@@ -482,7 +485,10 @@ def import_mats(BasePath, DepotPath, exclude_unused_mats, existingMeshes, gltf_i
482485
bpymat['BaseMaterial'] = validmats[matname]['BaseMaterial']
483486
bpymat['GlobalNormal'] = validmats[matname]['GlobalNormal']
484487
bpymat['MultilayerMask'] = validmats[matname]['MultilayerMask']
485-
bpymat['DiffuseMap'] = validmats[matname]['DiffuseMap']
488+
if 'DiffuseMap' in validmats[matname].keys():
489+
bpymat['DiffuseMap'] = validmats[matname]['DiffuseMap']
490+
if 'DiffuseTexture' in validmats[matname].keys():
491+
bpymat['DiffuseTexture'] = validmats[matname]['DiffuseTexture']
486492
bpy.data.meshes[name].materials.append(bpymat)
487493
if 'no_shadows' in bpymat.keys() and bpymat['no_shadows'] and name in bpy.data.objects.keys():
488494
bpy.data.objects[name].visible_shadow = False

0 commit comments

Comments
 (0)