Skip to content

Commit

Permalink
Prevent error when user deletes all spatial structure elements and th…
Browse files Browse the repository at this point in the history
…e spatial manager panel is expanded
  • Loading branch information
Gorgious56 committed May 13, 2024
1 parent aca26c7 commit ac686db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/blenderbim/blenderbim/bim/module/spatial/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def update_elevation(self, context):


def update_active_container_index(self, context):
if self.active_container_index < 0:
return
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
self.container_name = self.containers[self.active_container_index].name
self.elevation = self.containers[self.active_container_index].elevation
Expand Down
4 changes: 2 additions & 2 deletions src/blenderbim/blenderbim/bim/module/spatial/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def draw(self, context):
self.props = context.scene.BIMSpatialManagerProperties
row = self.layout.row()
row.operator("bim.load_container_manager", icon="FILE_REFRESH", text="Load Spatial Structure")
if self.props.active_container_index < len(self.props.containers):
if 0 <= self.props.active_container_index < len(self.props.containers):
ifc_definition_id = self.props.containers[self.props.active_container_index].ifc_definition_id
row = self.layout.row()
row.alignment = "RIGHT"
Expand All @@ -134,7 +134,7 @@ def draw(self, context):
"active_container_index",
)
row = self.layout.row()
if self.props.active_container_index < len(self.props.containers):
if 0 <= self.props.active_container_index < len(self.props.containers):
row.prop(self.props, "container_name", text="")
row.prop(self.props, "elevation", text="")
op = row.operator("bim.edit_container_attributes", icon="CHECKMARK", text="Apply")
Expand Down

0 comments on commit ac686db

Please sign in to comment.