Temporarily disable material listeners as they need to be rewritten anyway (ideally without listeners) with the new style system

At least now we can create types for testing
This commit is contained in:
Dion Moult
2024-06-29 21:39:38 +10:00
parent 9a871f1459
commit 0544bbc886
3 changed files with 4 additions and 10 deletions
@@ -514,6 +514,7 @@ def regenerate_profile_usage(usecase_path, ifc_file, settings):
def ensure_material_assigned(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str, Any]) -> None:
return # TODO ensure this now works with the new approach of styles
elements = settings["products"]
material = settings.get("material")
if material:
@@ -544,6 +545,7 @@ def ensure_material_assigned(usecase_path: str, ifc_file: ifcopenshell.file, set
def ensure_material_unassigned(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str, Any]) -> None:
return # TODO ensure this now works with the new approach of styles
elements = settings["products"]
# unassign_material could be called when product is about to get removed
@@ -264,7 +264,6 @@ class BIM_PT_project(Panel):
row = self.layout.row(align=True)
row.prop(props, "ifc_file", text="")
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
row.operator("bim.unload_project", text="", icon="CANCEL")
class BIM_PT_new_project_wizard(Panel):
@@ -310,7 +310,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
if materials:
material = materials[0] # Arbitrarily pick a material
else:
material = self.add_default_material()
material = ifcopenshell.api.run("material.add_material", tool.Ifc.get(), name="Unknown")
rel = ifcopenshell.api.run(
"material.assign_material", ifc_file, products=[element], type="IfcMaterialLayerSet"
)
@@ -344,7 +344,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
if materials:
material = materials[0] # Arbitrarily pick a material
else:
material = self.add_default_material()
material = ifcopenshell.api.run("material.add_material", tool.Ifc.get(), name="Unknown")
if template == "PROFILESET":
named_profiles = [p for p in ifc_file.by_type("IfcProfileDef") if p.ProfileName]
if named_profiles:
@@ -495,13 +495,6 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
props.type_class = props.type_class
return {"FINISHED"}
def add_default_material(self):
material = ifcopenshell.api.run("material.add_material", tool.Ifc.get(), name="Unknown")
blender_material = bpy.data.materials.new(material.Name)
tool.Ifc.link(material, blender_material)
blender_material.use_fake_user = True
return material
class RemoveType(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_type"