mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Groups/Systems UI - removing item to update uilist index
This commit is contained in:
@@ -118,6 +118,7 @@ class RemoveGroup(bpy.types.Operator, tool.Ifc.Operator):
|
||||
self.file = tool.Ifc.get()
|
||||
ifcopenshell.api.group.remove_group(self.file, group=self.file.by_id(self.group))
|
||||
tool.Group.import_groups("IfcGroup")
|
||||
tool.Group.update_uilist_index("IfcGroup")
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class RemoveSystem(bpy.types.Operator, tool.Ifc.Operator):
|
||||
system: bpy.props.IntProperty()
|
||||
|
||||
def _execute(self, context):
|
||||
core.remove_system(tool.Ifc, tool.System, system=tool.Ifc.get().by_id(self.system))
|
||||
core.remove_system(tool.Ifc, tool.Group, tool.System, system=tool.Ifc.get().by_id(self.system))
|
||||
|
||||
|
||||
class EnableEditingSystem(bpy.types.Operator):
|
||||
|
||||
@@ -55,9 +55,15 @@ def edit_system(ifc: type[tool.Ifc], system_tool: type[tool.System], system: ifc
|
||||
system_tool.import_systems()
|
||||
|
||||
|
||||
def remove_system(ifc: type[tool.Ifc], system_tool: type[tool.System], system: ifcopenshell.entity_instance) -> None:
|
||||
def remove_system(
|
||||
ifc: type[tool.Ifc],
|
||||
group: type[tool.Group],
|
||||
system_tool: type[tool.System],
|
||||
system: ifcopenshell.entity_instance,
|
||||
) -> None:
|
||||
ifc.run("system.remove_system", system=system)
|
||||
system_tool.import_systems()
|
||||
group.update_uilist_index("IfcSystem")
|
||||
|
||||
|
||||
def enable_editing_system(system_tool: type[tool.System], system: ifcopenshell.entity_instance) -> None:
|
||||
|
||||
@@ -137,3 +137,8 @@ class Group(bonsai.core.tool.System):
|
||||
expanded_groups.remove(ifc_definition_id)
|
||||
props.expanded_groups_json = json.dumps(list(expanded_groups))
|
||||
cls.import_groups(group_type)
|
||||
|
||||
@classmethod
|
||||
def update_uilist_index(cls, group_type: GroupType) -> None:
|
||||
props, blender_groups = cls.get_groups_data(group_type)
|
||||
props.active_group_index = tool.Blender.get_valid_uilist_index(props.active_group_index, blender_groups)
|
||||
|
||||
Reference in New Issue
Block a user