fix bug where nested resources in task ICOM panel didn't show

This commit is contained in:
Sigma Dimensions (Yass)
2023-08-24 13:58:18 +01:00
parent fc7459c07f
commit 1c7e6cf1b9
3 changed files with 2 additions and 11 deletions
@@ -95,7 +95,7 @@ class ResourceData:
sum = 0
nested_resources = ifcopenshell.util.resource.get_nested_resources(resource)
for nested_resource in nested_resources or []:
if not nested_resource.Usage:
if not nested_resource.Usage or not nested_resource.Usage.ScheduleWork:
continue
duration = ifcopenshell.util.date.ifc2datetime(nested_resource.Usage.ScheduleWork)
sum += duration.total_seconds() / 3600
@@ -124,7 +124,7 @@ class BIM_PT_resources(Panel):
schedule_work = resource.get("ScheduleWork", None)
derived_schedule_work = resource.get("DerivedScheduleWork", None)
row1col2.label(
text="{}".format(schedule_work) if schedule_work else "*{}".format(derived_schedule_work),
text="{}".format(schedule_work) if schedule_work else "{} h*".format(derived_schedule_work),
icon="TIME",
)
@@ -489,15 +489,6 @@ class Sequence(blenderbim.core.tool.Sequence):
is_deep = bpy.context.scene.BIMWorkScheduleProperties.show_nested_outputs
return ifcopenshell.util.sequence.get_task_outputs(task, is_deep)
@classmethod
def get_task_resources(cls, task):
resources = []
for rel in task.OperatesOn:
for object in rel.RelatedObjects:
if object.is_a("IfcResource"):
resources.append(object)
return resources
@classmethod
def enable_editing_work_calendar_times(cls, work_calendar):
props = bpy.context.scene.BIMWorkCalendarProperties