mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Provide support of upgrading a deprecated material list as a constituent set during import
This commit is contained in:
@@ -240,12 +240,15 @@ class MaterialCreator:
|
|||||||
new.category = profile.Category or ""
|
new.category = profile.Category or ""
|
||||||
|
|
||||||
def create_material_list(self, material_list):
|
def create_material_list(self, material_list):
|
||||||
|
props = self.obj.BIMObjectProperties
|
||||||
|
props.material_type = "IfcMaterialConstituentSet" # Constituent sets are the recommended upgrade path
|
||||||
for material in material_list.Materials:
|
for material in material_list.Materials:
|
||||||
if material.Material:
|
new = props.material_set.material_constituents.add()
|
||||||
if material.Material.Name not in self.materials:
|
if material.Name not in self.materials:
|
||||||
# TODO import rest of the layer set data
|
# TODO import rest of the layer set data
|
||||||
self.create_new_single(material.Material)
|
self.create_new_single(material)
|
||||||
self.assign_material_to_mesh(self.materials[material.Material.Name])
|
self.assign_material_to_mesh(self.materials[material.Name])
|
||||||
|
new.material = self.materials[material.Name]
|
||||||
|
|
||||||
def create_new_single(self, material):
|
def create_new_single(self, material):
|
||||||
self.materials[material.Name] = obj = bpy.data.materials.new(material.Name)
|
self.materials[material.Name] = obj = bpy.data.materials.new(material.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user