Renaming style from UI not to add .xxx Blender suffix to style name

Set style name explicitly, this way what user does in UI is what they get in IFC.
Previously confusingly if you set style name to "Glass" and "Glass" already existed, you would get "Glass.001" style internally but "Glass" name in UI.
This commit is contained in:
Andrej730
2025-04-11 12:58:30 +05:00
parent bc0fbf744a
commit b5bc53bdf6
+5 -2
View File
@@ -666,9 +666,12 @@ class Style(bonsai.core.tool.Style):
@classmethod
def rename_style(cls, style: ifcopenshell.entity_instance, name: str) -> None:
"""Rename style and related blender material."""
if style.Name == name:
return
style.Name = name
blender_material = tool.Ifc.get_object(style)
# Will implicitly update the style name using handler.
blender_material.name = name
assert isinstance(blender_material, bpy.types.Material)
tool.Root.set_material_name(blender_material, name)
@classmethod
def purge_unused_styles(cls) -> int: