Fix #1872. Bug where duplicating an object didn't duplicate its styles.

This commit is contained in:
Dion Moult
2021-11-11 14:51:05 +11:00
parent d5b92c0fea
commit f5f88f4b97
6 changed files with 49 additions and 6 deletions
@@ -20,6 +20,7 @@ import bpy
import logging
import ifcopenshell
import blenderbim.core.tool
import blenderbim.core.style
import blenderbim.tool as tool
import blenderbim.bim.import_ifc
from mathutils import Vector
@@ -145,6 +146,10 @@ class Geometry(blenderbim.core.tool.Geometry):
def get_representation_name(cls, representation):
return f"{representation.ContextOfItems.id()}/{representation.id()}"
@classmethod
def get_styles(cls, obj):
return [tool.Style.get_style(s.material) for s in obj.material_slots if s.material]
@classmethod
def get_total_representation_items(cls, obj):
return max(1, len(obj.material_slots))
@@ -246,6 +251,10 @@ class Geometry(blenderbim.core.tool.Geometry):
def run_geometry_update_representation(cls, obj=None):
bpy.ops.bim.update_representation(obj=obj.name, ifc_representation_class="")
@classmethod
def run_style_add_style(cls, obj=None):
return blenderbim.core.style.add_style(tool.Ifc, tool.Style, obj=obj)
@classmethod
def should_force_faceted_brep(cls):
return bpy.context.scene.BIMGeometryProperties.should_force_faceted_brep