mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
Fix #965. Improve canonicalisation of material names to fix import failure.
This commit is contained in:
@@ -114,8 +114,8 @@ class MaterialCreator():
|
|||||||
continue
|
continue
|
||||||
elif 'surface-style-' in material:
|
elif 'surface-style-' in material:
|
||||||
material = material.split('-')[2]
|
material = material.split('-')[2]
|
||||||
if len(material) > 63: # Blender material names are up to 63 characters
|
if len(bytes(material, 'utf-8')) > 63: # Blender material names are up to 63 UTF-8 bytes
|
||||||
material = material[0:63]
|
material = bytes(material, 'utf-8')[0:63].decode('utf-8')
|
||||||
try:
|
try:
|
||||||
material_to_slot[i] = slots.index(material)
|
material_to_slot[i] = slots.index(material)
|
||||||
except:
|
except:
|
||||||
@@ -130,7 +130,7 @@ class MaterialCreator():
|
|||||||
mesh.polygons.foreach_set('material_index', material_index)
|
mesh.polygons.foreach_set('material_index', material_index)
|
||||||
|
|
||||||
def canonicalise_material_name(self, name):
|
def canonicalise_material_name(self, name):
|
||||||
return re.sub(r'\.[0-9]{3}', '', name)
|
return re.sub(r'\.[0-9]{3}$', '', name)
|
||||||
|
|
||||||
def parse_material(self, element):
|
def parse_material(self, element):
|
||||||
for association in element.HasAssociations:
|
for association in element.HasAssociations:
|
||||||
|
|||||||
Reference in New Issue
Block a user