mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Purge obsolete & risky module unloading / loading feature in favour of tabs.
This commit is contained in:
@@ -91,7 +91,6 @@ classes = [
|
||||
operator.AddIfcFile,
|
||||
operator.BIM_OT_add_section_plane,
|
||||
operator.BIM_OT_remove_section_plane,
|
||||
operator.ConfigureVisibility,
|
||||
operator.OpenUpstream,
|
||||
operator.OpenUri,
|
||||
operator.SwitchTab,
|
||||
@@ -112,7 +111,6 @@ classes = [
|
||||
operator.BIM_OT_enum_property_search, # /!\ Register AFTER prop.StrProperty
|
||||
prop.ObjProperty,
|
||||
prop.Attribute,
|
||||
prop.ModuleVisibility,
|
||||
prop.BIMAreaProperties,
|
||||
prop.BIMProperties,
|
||||
prop.IfcParameter,
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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"],
|
||||
}
|
||||
@@ -766,41 +766,6 @@ class FetchObjectPassport(bpy.types.Operator):
|
||||
context.active_object.data = bpy.data.meshes[reference.name]
|
||||
|
||||
|
||||
class ConfigureVisibility(bpy.types.Operator):
|
||||
bl_idname = "bim.configure_visibility"
|
||||
bl_label = "Configure module UI visibility in BlenderBIM"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
from blenderbim.bim import modules
|
||||
|
||||
wm = context.window_manager
|
||||
if not len(context.scene.BIMProperties.module_visibility):
|
||||
for module in sorted(modules.keys()):
|
||||
new = context.scene.BIMProperties.module_visibility.add()
|
||||
new.name = module
|
||||
return wm.invoke_props_dialog(self, width=450)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
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()
|
||||
col.label(text=module.name.capitalize())
|
||||
|
||||
col = split.column()
|
||||
col.prop(module, "is_visible", text="")
|
||||
|
||||
def execute(self, context):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def update_enum_property_search_prop(self, context):
|
||||
for i, prop in enumerate(self.collection_names):
|
||||
if prop.name == self.dummy_name:
|
||||
|
||||
@@ -58,45 +58,6 @@ def update_tab(self, context):
|
||||
self.previous_tab = self.tab
|
||||
|
||||
|
||||
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
|
||||
|
||||
# TODO: Pset depends on sequence module as an edge case.
|
||||
if self.name == "sequence" and not self.is_visible:
|
||||
context.scene.BIMProperties.module_visibility["pset"].is_visible = False
|
||||
|
||||
for cls in modules[self.name].classes:
|
||||
if not issubclass(cls, bpy.types.Panel):
|
||||
continue
|
||||
|
||||
if self.is_visible:
|
||||
try:
|
||||
bpy.utils.register_class(cls)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
bpy.utils.unregister_class(cls)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# If we don't cache strings, accents get mangled due to a Blender bug
|
||||
# https://blender.stackexchange.com/questions/216230/is-there-a-workaround-for-the-known-bug-in-dynamic-enumproperty
|
||||
# https://github.com/IfcOpenShell/IfcOpenShell/pull/1945
|
||||
@@ -336,11 +297,6 @@ class Attribute(PropertyGroup):
|
||||
setattr(self, self.get_value_name(), value)
|
||||
|
||||
|
||||
class ModuleVisibility(PropertyGroup):
|
||||
name: StringProperty(name="Name")
|
||||
is_visible: BoolProperty(name="Value", default=True, update=update_is_visible)
|
||||
|
||||
|
||||
def get_tab(self, context):
|
||||
return [
|
||||
("PROJECT", "Project Overview", "", blenderbim.bim.icons["IFC"].icon_id, 0),
|
||||
@@ -365,13 +321,6 @@ class BIMAreaProperties(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
|
||||
)
|
||||
|
||||
@@ -267,9 +267,6 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(context.scene.DocProperties, "shadingstyle_default")
|
||||
|
||||
row = layout.row()
|
||||
row.operator("bim.configure_visibility")
|
||||
|
||||
|
||||
# Scene panel groups
|
||||
class BIM_PT_tabs(Panel):
|
||||
|
||||
Reference in New Issue
Block a user