BlenderBIM: Add UI Preset to Preferences (#1825)

* inital commit

* update based on comments

* incorporate suggestion from @Gorgious56

* change curly brackets to square brackets ;)

* update based on comments from @Moult

* code suggestion from @Gorgious56
This commit is contained in:
Vukas Pajic
2021-10-28 14:41:56 +02:00
committed by GitHub
parent 72d9bc9256
commit b46f1647d2
3 changed files with 267 additions and 1 deletions
@@ -0,0 +1,241 @@
presets = {
"Basic": [
"project",
"search",
"bcf",
"attribute",
"spatial",
"pset",
"qto"
],
"Admin": [
"project",
"search",
"bcf",
"root",
"unit",
"model",
"georeference",
"context",
"drawing",
"misc",
"attribute",
"type",
"spatial",
"void",
"aggregate",
"geometry",
"cobie",
"resource",
"cost",
"sequence",
"group",
"system",
"structural",
"boundary",
"profile",
"material",
"style",
"layer",
"owner",
"pset",
"qto",
"classification",
"constraint",
"document",
"pset_template",
"clash",
"lca",
"csv",
"bimtester",
"diff",
"patch",
"covetool",
"augin",
"debug"
],
"BIM Coordination": [
"project",
"search",
"bcf",
"root",
"unit",
"georeference",
"attribute",
"type",
"spatial",
"void",
"aggregate",
"owner",
"pset",
"qto",
"clash",
"csv",
"bimtester",
"diff",
"patch",
"debug"
],
"Architecture": [
"project",
"search",
"bcf",
"root",
"unit",
"model",
"georeference",
"context",
"drawing",
"misc",
"attribute",
"type",
"spatial",
"void",
"aggregate",
"geometry",
"group",
"system",
"boundary",
"profile",
"material",
"style",
"layer",
"owner",
"pset",
"qto",
"classification",
"pset_template",
"clash",
"csv"
],
"Structural Engineering": [
"project",
"search",
"bcf",
"root",
"unit",
"model",
"georeference",
"context",
"drawing",
"misc",
"attribute",
"type",
"spatial",
"void",
"aggregate",
"geometry",
"group",
"system",
"structural",
"boundary",
"profile",
"material",
"style",
"layer",
"owner",
"pset",
"qto",
"classification",
"pset_template",
"clash",
"csv"
],
"MEP": [
"project",
"search",
"bcf",
"root",
"unit",
"model",
"georeference",
"context",
"drawing",
"misc",
"attribute",
"type",
"spatial",
"void",
"aggregate",
"geometry",
"group",
"system",
"boundary",
"profile",
"material",
"style",
"layer",
"owner",
"pset",
"qto",
"classification",
"pset_template",
"clash",
"csv"
],
"Quantity Surveying": [
"project",
"search",
"attribute",
"spatial",
"void",
"pset",
"qto",
"classification",
"csv"
],
"Model Enrichment": [
"project",
"search",
"root",
"attribute",
"spatial",
"pset",
"qto",
"pset_template",
"csv",
"patch"
],
"3D Visualisation": [
"project",
"search",
"bcf",
"attribute",
"spatial",
"pset",
"qto"
],
"4D Scheduling": [
"project",
"search",
"attribute",
"spatial",
"resource",
"cost",
"sequence",
"pset",
"qto"
],
"5D Cost Management": [
"project",
"search",
"attribute",
"spatial",
"resource",
"cost",
"sequence",
"pset",
"qto",
"lca"
],
"Facility Management": [
"project",
"search",
"attribute",
"spatial",
"cobie",
"pset",
"qto",
"lca"
]
}
+5 -1
View File
@@ -442,8 +442,12 @@ class ConfigureVisibility(bpy.types.Operator):
def draw(self, context):
layout = self.layout
grid = layout.column_flow(columns=3)
layout.prop(context.scene.BIMProperties, "ui_preset")
layout.separator()
layout.label(text="Adjust the modules to your liking:")
grid = layout.column_flow(columns=3)
for module in context.scene.BIMProperties.module_visibility:
split = grid.split()
col = split.column()
+21
View File
@@ -41,6 +41,21 @@ cwd = os.path.dirname(os.path.realpath(__file__))
materialpsetnames_enum = []
def update_preset(self, context):
from blenderbim.bim.data.ui.presets import presets
module_visibility = context.scene.BIMProperties.module_visibility
chosen_preset = context.scene.BIMProperties.ui_preset
for module in module_visibility:
module.is_visible = module.name in presets[chosen_preset]
def load_presets(self, context):
from blenderbim.bim.data.ui.presets import presets
return [(preset,preset,"") for preset in presets.keys()]
def update_is_visible(self, context):
from blenderbim.bim import modules
@@ -203,6 +218,12 @@ class ModuleVisibility(PropertyGroup):
class BIMProperties(PropertyGroup):
ui_preset: EnumProperty(
name="UI Preset",
description="Select from one of the available UI presets, or configure the modules to your preference below",
update=update_preset,
items=load_presets
)
module_visibility: CollectionProperty(name="Module Visibility", type=ModuleVisibility)
schema_dir: StringProperty(
default=os.path.join(cwd, "schema") + os.path.sep, name="Schema Directory", update=update_schema_dir