Fix #5955. Regression in 0983f812fd where you couldn't remove a style that wasn't being edited.

This commit is contained in:
Dion Moult
2025-01-11 14:51:18 +11:00
parent d88adf2d02
commit 2e7cbb759e
4 changed files with 7 additions and 1 deletions
@@ -80,7 +80,6 @@ class RemoveStyle(bpy.types.Operator, tool.Ifc.Operator):
style: bpy.props.IntProperty()
def _execute(self, context):
core.disable_editing_style(tool.Style) # So we don't end up soft-locking style edition
core.remove_style(tool.Ifc, tool.Style, style=tool.Ifc.get().by_id(self.style), reload_styles_ui=True)
+2
View File
@@ -65,6 +65,8 @@ def remove_style(
avoid unnecessary reloads.
"""
obj = ifc.get_object(style)
if style_tool.is_editing_style() and obj == style_tool.get_currently_edited_material():
style_tool.disable_editing()
# Get style_type before removing object as later StylesData might fail to load
# due object not yet removed completely.
style_type = style_tool.get_active_style_type()
+1
View File
@@ -1013,6 +1013,7 @@ class Style:
def get_uv_maps(cls, representation): pass
def import_presentation_styles(cls, style_type): pass
def import_surface_attributes(cls, style): pass
def is_editing_style(cls): pass
def is_editing_styles(cls): pass
def reload_material_from_ifc(cls, obj): pass
def is_style_side_attribute_edited(cls, style, new_attributes): pass
+4
View File
@@ -550,6 +550,10 @@ class Style(bonsai.core.tool.Style):
def is_editing_styles(cls) -> bool:
return bpy.context.scene.BIMStylesProperties.is_editing
@classmethod
def is_editing_style(cls) -> bool:
return bpy.context.scene.BIMStylesProperties.is_editing_style
@classmethod
def select_elements(cls, elements: list[ifcopenshell.entity_instance]) -> None:
for element in elements: