mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 23:19:57 +00:00
Fix #2546 : Editing a material now automatically ends the edition of its material set item if necessary
This commit is contained in:
@@ -503,6 +503,7 @@ class DisableEditingAssignedMaterial(bpy.types.Operator):
|
|||||||
obj: bpy.props.StringProperty()
|
obj: bpy.props.StringProperty()
|
||||||
|
|
||||||
def execute(self, context):
|
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
|
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
||||||
props = obj.BIMObjectMaterialProperties
|
props = obj.BIMObjectMaterialProperties
|
||||||
props.is_editing = False
|
props.is_editing = False
|
||||||
@@ -526,6 +527,9 @@ class EditAssignedMaterial(bpy.types.Operator):
|
|||||||
props = obj.BIMObjectMaterialProperties
|
props = obj.BIMObjectMaterialProperties
|
||||||
product_data = Data.products[obj.BIMObjectProperties.ifc_definition_id]
|
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":
|
if product_data["type"] == "IfcMaterial":
|
||||||
bpy.ops.bim.unassign_material(obj=obj.name)
|
bpy.ops.bim.unassign_material(obj=obj.name)
|
||||||
bpy.ops.bim.assign_material(obj=obj.name, material_type="IfcMaterial")
|
bpy.ops.bim.assign_material(obj=obj.name, material_type="IfcMaterial")
|
||||||
|
|||||||
Reference in New Issue
Block a user