Spatial Manager - try to preserve the selection on loading the manager

Also noticed in Sigma Dimensions video that every time user deletes a storey or applies new elevation the selection was jumping to the first storey. Now it's going to be more natural.

Before - https://imgur.com/a/gbn7ryQ
After - https://imgur.com/a/QX2RulF
This commit is contained in:
Andrej730
2023-09-09 18:04:35 +05:00
parent 90f92cd139
commit 45feaeaec4
+2 -1
View File
@@ -198,6 +198,7 @@ class Spatial(blenderbim.core.tool.Spatial):
@classmethod
def load_container_manager(cls):
cls.props = bpy.context.scene.BIMSpatialManagerProperties
previous_container_index = cls.props.active_container_index
cls.props.containers.clear()
cls.contracted_containers = json.loads(cls.props.contracted_containers)
cls.props.is_container_update_enabled = False
@@ -208,7 +209,7 @@ class Spatial(blenderbim.core.tool.Spatial):
cls.create_new_storey_li(object, 0)
cls.props.is_container_update_enabled = True
# triggers spatial manager props setup
cls.props.active_container_index = 0
cls.props.active_container_index = min(previous_container_index, len(cls.props.containers) - 1)
@classmethod
def create_new_storey_li(cls, element, level_index):