See #5799. Allow merging unnamed styles.

Styles are special because their names aren't critically semantic. It's
more to do with the style definition.
This commit is contained in:
Dion Moult
2025-01-20 13:58:39 +11:00
parent e8b097e2cb
commit c311b65af5
2 changed files with 4 additions and 4 deletions
@@ -713,9 +713,9 @@ class MergeIdenticalObjects(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"}
plural_object_type = f"{object_type.lower()}s"
if merged_data:
print(f"Merged {plural_object_type}:")
for element_type, element_names in merged_data.items():
print(f"- {element_type}: {', '.join(element_names)}")
names = ", ". join([n or "Unnamed" for n in element_names])
print(f"- {element_type}: {names}")
merged = sum(len(v) for v in merged_data.values())
msg = " See system console for details." if merged else ""
+2 -2
View File
@@ -131,8 +131,8 @@ class Debug(bonsai.core.tool.Debug):
# Calculate hashes.
hash_to_elements: defaultdict[int, list[ifcopenshell.entity_instance]] = defaultdict(list)
for element in elements:
# Ignore unnamed elements as they may be not safe to merge.
if not element.Name:
# Except for styles, ignore unnamed elements as they may be not safe to merge
if object_type != "STYLE" and not element.Name:
continue
element_hash = get_hash(element)
hash_to_elements[element_hash].append(element)