diff --git a/src/blenderbim/blenderbim/bim/module/cost/__init__.py b/src/blenderbim/blenderbim/bim/module/cost/__init__.py index 49ed24868b..942302d059 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/cost/__init__.py @@ -67,6 +67,8 @@ classes = ( operator.ExpandCostItemRate, operator.ContractCostItemRate, operator.CalculateCostItemResourceValue, + operator.LoadCostItemElementQuantities, + operator.LoadCostItemTaskQuantities, prop.CostItem, prop.CostItemQuantity, prop.CostItemType, diff --git a/src/blenderbim/blenderbim/bim/module/cost/operator.py b/src/blenderbim/blenderbim/bim/module/cost/operator.py index 7d798cb8cd..6130d91615 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/operator.py +++ b/src/blenderbim/blenderbim/bim/module/cost/operator.py @@ -528,6 +528,17 @@ class LoadCostItemElementQuantities(bpy.types.Operator): core.load_cost_item_element_quantities(tool.Cost) return {"FINISHED"} + +class LoadCostItemTaskQuantities(bpy.types.Operator): + bl_idname = "bim.load_cost_item_task_quantities" + bl_label = "Load Cost Item Task Quantities" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + core.load_cost_item_task_quantities(tool.Cost) + return {"FINISHED"} + + class LoadCostItemTypes(bpy.types.Operator): bl_idname = "bim.load_cost_item_types" bl_label = "Load Cost Item Types" diff --git a/src/blenderbim/blenderbim/bim/module/cost/prop.py b/src/blenderbim/blenderbim/bim/module/cost/prop.py index 3d1aea3748..d1a7313928 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/prop.py +++ b/src/blenderbim/blenderbim/bim/module/cost/prop.py @@ -138,6 +138,10 @@ def update_active_cost_item_elements(self, context): bpy.ops.bim.load_cost_item_element_quantities() +def update_active_cost_item_tasks(self, context): + bpy.ops.bim.load_cost_item_task_quantities() + + class BIMCostProperties(PropertyGroup): cost_schedule_predefined_types: EnumProperty( items=get_schedule_predefined_types, name="Predefined Type", default=None @@ -189,6 +193,6 @@ class BIMCostProperties(PropertyGroup): cost_item_rates: CollectionProperty(name="Cost Item Rates", type=CostItem) active_cost_item_rate_index: IntProperty(name="Active Cost Rate Index") contracted_cost_item_rates: StringProperty(name="Contracted Cost Item Rates", default="[]") - show_nested_elements: BoolProperty( - name="Show Nested Tasks", default=False, update=update_active_cost_item_elements + show_nested_elements: BoolProperty(name="Show Nested Tasks", default=False, update=update_active_cost_item_elements) + show_nested_tasks: BoolProperty(name="Show Nested Tasks", default=False, update=update_active_cost_item_tasks) ) diff --git a/src/blenderbim/blenderbim/bim/module/cost/ui.py b/src/blenderbim/blenderbim/bim/module/cost/ui.py index f475da927f..e1a7371882 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/ui.py +++ b/src/blenderbim/blenderbim/bim/module/cost/ui.py @@ -399,6 +399,9 @@ class BIM_PT_cost_item_quantities(Panel): op.cost_item = cost_item.ifc_definition_id op.prop_name = "" + row2 = col.row() + row2.prop(self.props, "show_nested_tasks", text="Show nested") + row2 = col.row() row2.template_list( "BIM_UL_cost_item_quantities", diff --git a/src/blenderbim/blenderbim/core/cost.py b/src/blenderbim/blenderbim/core/cost.py index 14674f782f..108e2cb82e 100644 --- a/src/blenderbim/blenderbim/core/cost.py +++ b/src/blenderbim/blenderbim/core/cost.py @@ -118,6 +118,9 @@ def load_cost_item_element_quantities(cost): cost_item = cost.get_highlighted_cost_item() cost.load_cost_item_quantity_assignments(cost_item, related_object_type="PRODUCT") +def load_cost_item_task_quantities(cost): + cost_item = cost.get_highlighted_cost_item() + cost.load_cost_item_quantity_assignments(cost_item, related_object_type="PROCESS") def assign_cost_value(ifc, cost_item, cost_rate):