small fixes

This commit is contained in:
Andrej730
2024-03-11 10:55:26 +05:00
parent 2d0e4f52a6
commit 6cbc0e0564
2 changed files with 9 additions and 1 deletions
@@ -34,6 +34,7 @@ from blenderbim.bim.ifc import IfcStore
class LoadMaterials(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_materials"
bl_label = "Load Materials"
bl_description = "Display list of named materials"
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
@@ -762,6 +763,11 @@ class EditMaterialStyle(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run("style.assign_material_style", ifc_file, material=material, style=style, context=context)
tool.Material.disable_editing_material()
core.load_materials(tool.Material, props.material_type)
# NOTE: Update all elements that has this material and
# not just the ones that are using it in IfcMaterialConstituent,
# to handle cases where Style is connected to geometry implicitly:
# e.g. RepItem->IfcElement->IfcMaterial->Style
# instead of RepItem->ShapeAspect->Constituent->Style.
tool.Material.update_elements_using_material(material)
@@ -17,6 +17,8 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.element
class Usecase:
@@ -139,7 +141,7 @@ class Usecase:
def modify_existing_definition_representation(self):
# NOTE: while it's theoritically possible to have multiple styles per 1 material
# (either with multiple styled items or multiple styles in 1 item)
# we use an implicit convention that
# we use an implicit convention that there is only 1 style per material.
definition_representation = self.settings["material"].HasRepresentation[0]
representation = self.get_styled_representation(definition_representation)
if representation: