mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 03:37:21 +00:00
Hide edit mode for locked elements #5371
This commit is contained in:
@@ -52,7 +52,11 @@ class ViewportData:
|
|||||||
("OBJECT", "IFC Object Mode", "", "OBJECT_DATAMODE", 0),
|
("OBJECT", "IFC Object Mode", "", "OBJECT_DATAMODE", 0),
|
||||||
("EDIT", "IFC Edit Mode", "", "EDITMODE_HLT", 1),
|
("EDIT", "IFC Edit Mode", "", "EDITMODE_HLT", 1),
|
||||||
]
|
]
|
||||||
if not obj or not tool.Blender.is_editable(obj):
|
if (
|
||||||
|
not obj
|
||||||
|
or not tool.Blender.is_editable(obj)
|
||||||
|
or ((element := tool.Ifc.get_entity(obj)) and tool.Geometry.is_locked(element))
|
||||||
|
):
|
||||||
return obj_mode
|
return obj_mode
|
||||||
return mesh_modes
|
return mesh_modes
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ from bpy.props import (
|
|||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
|
import bonsai.bim.handler
|
||||||
import bonsai.core.geometry
|
import bonsai.core.geometry
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
@@ -125,6 +126,8 @@ def update_spatial_is_locked(self, context):
|
|||||||
tool.Geometry.lock_object(obj)
|
tool.Geometry.lock_object(obj)
|
||||||
else:
|
else:
|
||||||
tool.Geometry.unlock_object(obj)
|
tool.Geometry.unlock_object(obj)
|
||||||
|
# Need to update ViewportData.mode.
|
||||||
|
bonsai.bim.handler.refresh_ui_data()
|
||||||
|
|
||||||
|
|
||||||
def update_spatial_is_visible(self: "BIMSpatialDecompositionProperties", context: bpy.types.Context) -> None:
|
def update_spatial_is_visible(self: "BIMSpatialDecompositionProperties", context: bpy.types.Context) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user