mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user