mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
* Disable task editing if task was deleted as a result of deleting its parent * Optimize logic for bigger number of tasks * Don't try to disable editing if not editing in the first place
This commit is contained in:
@@ -513,13 +513,25 @@ class RemoveTask(bpy.types.Operator):
|
||||
def _execute(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
self.file = IfcStore.get_file()
|
||||
edited_task_ifc = self.file.by_id(props.active_task_id) if props.active_task_id else None
|
||||
|
||||
ifcopenshell.api.run(
|
||||
"sequence.remove_task",
|
||||
self.file,
|
||||
task=IfcStore.get_file().by_id(self.task),
|
||||
task=self.file.by_id(self.task),
|
||||
)
|
||||
Data.load(self.file)
|
||||
bpy.ops.bim.enable_editing_tasks(work_schedule=props.active_work_schedule_id)
|
||||
|
||||
if edited_task_ifc:
|
||||
if not any(
|
||||
task
|
||||
for task in context.scene.BIMTaskTreeProperties.tasks
|
||||
if task.ifc_definition_id == props.active_task_id
|
||||
and self.file.by_id(props.active_task_id) == edited_task_ifc
|
||||
): # Task was deleted
|
||||
bpy.ops.bim.disable_editing_task()
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user