mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 11:18:18 +00:00
Presentation layers are now assigned to meshes, and implement representation assignment. See #1109.
This commit is contained in:
@@ -4328,11 +4328,12 @@ class AssignPresentationLayer(bpy.types.Operator):
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
presentation_layer = bpy.context.scene.BIMProperties.presentation_layers[self.index]
|
||||
layer = bpy.context.scene.BIMProperties.presentation_layers[self.index]
|
||||
for obj in bpy.context.selected_objects:
|
||||
# TODO: assign using a different strategy than name association
|
||||
obj.BIMObjectProperties.presentation_layer.name = presentation_layer.name
|
||||
obj.hide_set(not presentation_layer.layer_on)
|
||||
if not obj.data or not hasattr(obj.data, "BIMMeshProperties"):
|
||||
continue
|
||||
obj.data.BIMMeshProperties.presentation_layer_index = self.index
|
||||
obj.hide_set(not layer.layer_on)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -4341,9 +4342,10 @@ class UnassignPresentationLayer(bpy.types.Operator):
|
||||
bl_label = "Unassign Presentation Layer"
|
||||
|
||||
def execute(self, context):
|
||||
for el in bpy.context.selected_objects:
|
||||
if el.BIMObjectProperties.presentation_layer.name != "":
|
||||
el.BIMObjectProperties.presentation_layer.name = ""
|
||||
for obj in bpy.context.selected_objects:
|
||||
if not obj.data or not hasattr(obj.data, "BIMMeshProperties"):
|
||||
continue
|
||||
obj.data.BIMMeshProperties.presentation_layer_index = -1
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user