mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix UI errors with not unset active library id after disabling editing
It lead to UI errors when library was removed and Bonsai was still trying to get it from active_library_id.
This commit is contained in:
@@ -41,6 +41,7 @@ def enable_editing_library_references(library_tool: tool.Library, library: ifcop
|
||||
|
||||
def disable_editing_library_references(library: tool.Library) -> None:
|
||||
library.clear_editing_mode()
|
||||
library.set_active_library(None)
|
||||
|
||||
|
||||
def enable_editing_library(library: tool.Library) -> None:
|
||||
|
||||
@@ -73,8 +73,12 @@ class Library(bonsai.core.tool.Library):
|
||||
new.name = reference.Name or "Unnamed"
|
||||
|
||||
@classmethod
|
||||
def set_active_library(cls, library: ifcopenshell.entity_instance) -> None:
|
||||
bpy.context.scene.BIMLibraryProperties.active_library_id = library.id()
|
||||
def set_active_library(cls, library: Union[ifcopenshell.entity_instance, None]) -> None:
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
if library is None:
|
||||
props.active_library_id = 0
|
||||
else:
|
||||
props.active_library_id = library.id()
|
||||
|
||||
@classmethod
|
||||
def set_active_reference(cls, reference: ifcopenshell.entity_instance) -> None:
|
||||
|
||||
Reference in New Issue
Block a user