From ad4ab1567f985b4abf8b2b98172cdb51a8ae5621 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 13 Jul 2023 11:08:52 +0500 Subject: [PATCH] model data parameters renamed to pset_data for consitency --- .../blenderbim/bim/module/cad/workspace.py | 8 +-- .../blenderbim/bim/module/model/data.py | 53 ++++++++----------- .../blenderbim/bim/module/model/roof.py | 2 +- .../blenderbim/bim/module/model/ui.py | 12 ++--- .../blenderbim/bim/module/model/workspace.py | 8 +-- 5 files changed, 36 insertions(+), 47 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/cad/workspace.py b/src/blenderbim/blenderbim/bim/module/cad/workspace.py index b01b10bfdc..60b04dfc9a 100644 --- a/src/blenderbim/blenderbim/bim/module/cad/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/cad/workspace.py @@ -137,7 +137,7 @@ class CadTool(WorkSpaceTool): else: if ( (RailingData.is_loaded or not RailingData.load()) - and RailingData.data["parameters"] + and RailingData.data["pset_data"] and context.active_object.BIMRailingProperties.is_editing_path ): row = layout.row(align=True) @@ -147,7 +147,7 @@ class CadTool(WorkSpaceTool): elif ( (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["parameters"] + and RoofData.data["pset_data"] and context.active_object.BIMRoofProperties.is_editing_path ): row = layout.row(align=True) @@ -227,7 +227,7 @@ class CadHotkey(bpy.types.Operator): row.prop(props, "y") elif ( (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["parameters"] + and RoofData.data["pset_data"] and bpy.context.active_object.BIMRoofProperties.is_editing_path ): self.layout.row().prop(props, "gable_roof_edge_angle") @@ -273,7 +273,7 @@ class CadHotkey(bpy.types.Operator): bpy.ops.bim.add_rectangle(x=self.props.x, y=self.props.y) elif ( (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["parameters"] + and RoofData.data["pset_data"] and bpy.context.active_object.BIMRoofProperties.is_editing_path ): bpy.ops.bim.set_gable_roof_edge_angle( diff --git a/src/blenderbim/blenderbim/bim/module/model/data.py b/src/blenderbim/blenderbim/bim/module/model/data.py index 29dcf87089..842b380eb8 100644 --- a/src/blenderbim/blenderbim/bim/module/model/data.py +++ b/src/blenderbim/blenderbim/bim/module/model/data.py @@ -272,17 +272,11 @@ class StairData: @classmethod def load(cls): cls.is_loaded = True - cls.data = {"parameters": cls.parameters()} + cls.data = {"pset_data": cls.pset_data()} @classmethod - def parameters(cls): - element = tool.Ifc.get_entity(bpy.context.active_object) - if element: - psets = ifcopenshell.util.element.get_psets(element) - parameters = psets.get("BBIM_Stair", None) - if parameters: - parameters["data_dict"] = json.loads(parameters.get("Data", "[]") or "[]") - return parameters + def pset_data(cls): + return tool.Model.get_modeling_bbim_pset_data(bpy.context.active_object, "BBIM_Stair") class SverchokData: @@ -292,17 +286,12 @@ class SverchokData: @classmethod def load(cls): cls.is_loaded = True - cls.data = {"parameters": cls.parameters(), "has_sverchok": cls.has_sverchok()} + cls.data = {"pset_data": cls.pset_data(), "has_sverchok": cls.has_sverchok()} + # NOTE: never used @classmethod - def parameters(cls): - element = tool.Ifc.get_entity(bpy.context.active_object) - if element: - psets = ifcopenshell.util.element.get_psets(element) - parameters = psets.get("BBIM_Sverchok", None) - if parameters: - parameters["data_dict"] = json.loads(parameters.get("Data", "[]") or "[]") - return parameters + def pset_data(cls): + return tool.Model.get_modeling_bbim_pset_data(bpy.context.active_object, "BBIM_Sverchok") @classmethod def has_sverchok(cls): @@ -329,7 +318,7 @@ class WindowData: def load(cls): cls.is_loaded = True cls.data = {} - cls.data["parameters"] = cls.pset_data() + cls.data["pset_data"] = cls.pset_data() cls.data["general_params"] = cls.general_params() cls.data["lining_params"] = cls.lining_params() cls.data["panel_params"] = cls.panel_params() @@ -341,7 +330,7 @@ class WindowData: @classmethod def general_params(cls): props = bpy.context.active_object.BIMWindowProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] general_params = {} general_props = props.get_general_kwargs() for prop_name in general_props: @@ -352,7 +341,7 @@ class WindowData: @classmethod def lining_params(cls): props = bpy.context.active_object.BIMWindowProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] lining_data = data["lining_properties"] lining_params = {} lining_props = props.get_lining_kwargs(window_type=data["window_type"]) @@ -364,7 +353,7 @@ class WindowData: @classmethod def panel_params(cls): props = bpy.context.active_object.BIMWindowProperties - panel_data = cls.data["parameters"]["data_dict"]["panel_properties"] + panel_data = cls.data["pset_data"]["data_dict"]["panel_properties"] panel_params = {} panel_props = props.get_panel_kwargs() for prop_name in panel_props: @@ -381,7 +370,7 @@ class DoorData: def load(cls): cls.is_loaded = True cls.data = {} - cls.data["parameters"] = cls.pset_data() + cls.data["pset_data"] = cls.pset_data() cls.data["general_params"] = cls.general_params() cls.data["lining_params"] = cls.lining_params() cls.data["panel_params"] = cls.panel_params() @@ -393,7 +382,7 @@ class DoorData: @classmethod def general_params(cls): props = bpy.context.active_object.BIMDoorProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] general_params = {} general_props = props.get_general_kwargs() for prop_name in general_props: @@ -404,7 +393,7 @@ class DoorData: @classmethod def lining_params(cls): props = bpy.context.active_object.BIMDoorProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] lining_data = data["lining_properties"] lining_params = {} lining_props = props.get_lining_kwargs(door_type=data["door_type"], lining_data=lining_data) @@ -416,8 +405,8 @@ class DoorData: @classmethod def panel_params(cls): props = bpy.context.active_object.BIMDoorProperties - data = cls.data["parameters"]["data_dict"] - panel_data = cls.data["parameters"]["data_dict"]["panel_properties"] + data = cls.data["pset_data"]["data_dict"] + panel_data = cls.data["pset_data"]["data_dict"]["panel_properties"] panel_params = {} panel_props = props.get_panel_kwargs(lining_data=data["lining_properties"]) for prop_name in panel_props: @@ -434,7 +423,7 @@ class RailingData: def load(cls): cls.is_loaded = True cls.data = {} - cls.data["parameters"] = cls.pset_data() + cls.data["pset_data"] = cls.pset_data() cls.data["general_params"] = cls.general_params() cls.data["path_data"] = cls.path_data() @@ -445,7 +434,7 @@ class RailingData: @classmethod def general_params(cls): props = bpy.context.active_object.BIMRailingProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] general_params = {} general_props = props.get_general_kwargs(railing_type=data["railing_type"]) for prop_name in general_props: @@ -455,7 +444,7 @@ class RailingData: @classmethod def path_data(cls): - return cls.data["parameters"]["data_dict"]["path_data"] + return cls.data["pset_data"]["data_dict"]["path_data"] class RoofData: @@ -466,7 +455,7 @@ class RoofData: def load(cls): cls.is_loaded = True cls.data = {} - cls.data["parameters"] = cls.pset_data() + cls.data["pset_data"] = cls.pset_data() cls.data["general_params"] = cls.general_params() @classmethod @@ -476,7 +465,7 @@ class RoofData: @classmethod def general_params(cls): props = bpy.context.active_object.BIMRoofProperties - data = cls.data["parameters"]["data_dict"] + data = cls.data["pset_data"]["data_dict"] general_params = {} general_props = props.get_general_kwargs(generation_method=data["generation_method"]) for prop_name in general_props: diff --git a/src/blenderbim/blenderbim/bim/module/model/roof.py b/src/blenderbim/blenderbim/bim/module/model/roof.py index 8b9a836337..f6d2cef7be 100644 --- a/src/blenderbim/blenderbim/bim/module/model/roof.py +++ b/src/blenderbim/blenderbim/bim/module/model/roof.py @@ -430,7 +430,7 @@ def update_roof_modifier_bmesh(context): # NOTE: using Data since bmesh update will hapen very often if not RoofData.is_loaded: RoofData.load() - path_data = RoofData.data["parameters"]["data_dict"]["path_data"] + path_data = RoofData.data["pset_data"]["data_dict"]["path_data"] angle_layer_data = path_data.get("gable_roof_angles", None) separate_verts_data = path_data.get("gable_roof_separate_verts", None) diff --git a/src/blenderbim/blenderbim/bim/module/model/ui.py b/src/blenderbim/blenderbim/bim/module/model/ui.py index d407588513..12aa343c9b 100644 --- a/src/blenderbim/blenderbim/bim/module/model/ui.py +++ b/src/blenderbim/blenderbim/bim/module/model/ui.py @@ -252,11 +252,11 @@ class BIM_PT_stair(bpy.types.Panel): props = context.active_object.BIMStairProperties - if StairData.data["parameters"]: + if StairData.data["pset_data"]: row = self.layout.row(align=True) row.label(text="Stair parameters", icon="IPO_CONSTANT") - stair_data = StairData.data["parameters"]["data_dict"] + stair_data = StairData.data["pset_data"]["data_dict"] if props.is_editing: row = self.layout.row(align=True) row.operator("bim.finish_editing_stair", icon="CHECKMARK", text="Finish Editing") @@ -350,7 +350,7 @@ class BIM_PT_window(bpy.types.Panel): props = context.active_object.BIMWindowProperties - if WindowData.data["parameters"]: + if WindowData.data["pset_data"]: row = self.layout.row(align=True) row.label(text="Window parameters", icon="OUTLINER_OB_LATTICE") @@ -459,7 +459,7 @@ class BIM_PT_door(bpy.types.Panel): props = context.active_object.BIMDoorProperties - if DoorData.data["parameters"]: + if DoorData.data["pset_data"]: row = self.layout.row(align=True) row.label(text="Door parameters", icon="OUTLINER_OB_LATTICE") @@ -532,7 +532,7 @@ class BIM_PT_railing(bpy.types.Panel): props = context.active_object.BIMRailingProperties - if RailingData.data["parameters"]: + if RailingData.data["pset_data"]: row = self.layout.row(align=True) row.label(text="Railing parameters", icon="OUTLINER_OB_LATTICE") @@ -594,7 +594,7 @@ class BIM_PT_roof(bpy.types.Panel): props = context.active_object.BIMRoofProperties - if RoofData.data["parameters"]: + if RoofData.data["pset_data"]: row = self.layout.row(align=True) row.label(text="Roof parameters", icon="OUTLINER_OB_LATTICE") diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index a17625d11b..62287f2b87 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -207,7 +207,7 @@ class BimToolUI: elif ( (RailingData.is_loaded or not RailingData.load()) - and RailingData.data["parameters"] + and RailingData.data["pset_data"] and not context.active_object.BIMRailingProperties.is_editing_path ): # NOTE: should be above "active_representation_type" = "SweptSolid" check @@ -248,7 +248,7 @@ class BimToolUI: elif ( (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["parameters"] + and RoofData.data["pset_data"] and not context.active_object.BIMRoofProperties.is_editing_path ): row = cls.layout.row(align=True) @@ -427,7 +427,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): # and it might conflict with one of the conditions below if ( (RailingData.is_loaded or not RailingData.load()) - and RailingData.data["parameters"] + and RailingData.data["pset_data"] and not bpy.context.active_object.BIMRailingProperties.is_editing_path ): bpy.ops.bim.enable_editing_railing_path() @@ -435,7 +435,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): elif ( (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["parameters"] + and RoofData.data["pset_data"] and not bpy.context.active_object.BIMRoofProperties.is_editing_path ): # undo the unselection done above because roof has no usage type