From 7fb4cdaa16e03b64d23bc6e8f16d07611c13d1e5 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Mon, 31 Oct 2022 09:35:06 +0100 Subject: [PATCH] Fix #2546 : Editing a material now automatically ends the edition of its material set item if necessary --- src/blenderbim/blenderbim/bim/module/material/operator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/module/material/operator.py b/src/blenderbim/blenderbim/bim/module/material/operator.py index b635f13fa6..2c148012f3 100644 --- a/src/blenderbim/blenderbim/bim/module/material/operator.py +++ b/src/blenderbim/blenderbim/bim/module/material/operator.py @@ -503,6 +503,7 @@ class DisableEditingAssignedMaterial(bpy.types.Operator): obj: bpy.props.StringProperty() def execute(self, context): + bpy.ops.bim.disable_editing_material_set_item() obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object props = obj.BIMObjectMaterialProperties props.is_editing = False @@ -526,6 +527,9 @@ class EditAssignedMaterial(bpy.types.Operator): props = obj.BIMObjectMaterialProperties product_data = Data.products[obj.BIMObjectProperties.ifc_definition_id] + if props.active_material_set_item_id != 0: # We were editing a material layer set item + bpy.ops.bim.edit_material_set_item(material_set_item=props.active_material_set_item_id) + if product_data["type"] == "IfcMaterial": bpy.ops.bim.unassign_material(obj=obj.name) bpy.ops.bim.assign_material(obj=obj.name, material_type="IfcMaterial")