Fix #6028. Deprecate schema dir as it's basically just data.

This commit is contained in:
Dion Moult
2025-01-23 23:10:40 +11:00
parent 15bc968179
commit c6b64baccb
44 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ endif
# Brickschema requires pkg_resources which is provided by Blender.
# Provides Brickschema functionality
# For now lets bundle the latest nightly schema
cd build/bonsai/bim/schema && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
cd build/bonsai/bim/data/brick/ && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
# Required for hipped roof generation
cd build && wget https://github.com/prochitecture/bpypolyskel/archive/refs/heads/master.zip
@@ -0,0 +1,3 @@
*
!.gitignore
!README.md
@@ -0,0 +1 @@
This directory stores Brickschema definitions in TTL format.
+1 -1
View File
@@ -403,7 +403,7 @@ class DocProperties(PropertyGroup):
imperial_precision: StringProperty(default="1/32", name="Imperial Precision")
tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects")
classes_to_wireframe: StringProperty(
default="IfcVirtualelement",
default="IfcVirtualElement",
name="Classes to Wireframe",
description="Upon import, these classes will display as wireframe.\nEx: IfcVirtualelement, IfcSpace",
)
+1 -5
View File
@@ -353,15 +353,11 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
layout.prop(context.scene.BIMModelProperties, "occurrence_name_function")
def draw_directories(self, layout, context):
row = layout.row(align=True)
row.prop(context.scene.BIMProperties, "schema_dir")
row.operator("bim.select_schema_dir", icon="FILE_FOLDER", text="")
row = layout.row(align=True)
row.prop(context.scene.BIMProperties, "data_dir")
row.operator("bim.select_data_dir", icon="FILE_FOLDER", text="")
row = self.layout.row(align=True)
row = layout.row(align=True)
row.prop(context.scene.BIMProperties, "cache_dir")
row.operator("bim.select_cache_dir", icon="FILE_FOLDER", text="")
+4 -5
View File
@@ -18,6 +18,7 @@
import os
import bpy
import datetime
import ifcopenshell
import ifcopenshell.guid
import ifcopenshell.util.brick
@@ -26,8 +27,8 @@ import ifcopenshell.util.system
import bonsai.core.brick
import bonsai.core.tool
import bonsai.tool as tool
from pathlib import Path
from contextlib import contextmanager
import datetime
try:
import brickschema
@@ -349,8 +350,7 @@ class Brick(bonsai.core.tool.Brick):
@classmethod
def load_brick_file(cls, filepath):
if not BrickStore.schema: # important check for running under test cases
cwd = os.path.dirname(os.path.realpath(__file__))
BrickStore.schema = os.path.join(cwd, "..", "bim", "schema", "Brick.ttl")
BrickStore.schema = tool.Blender.get_data_dir_path(Path('brick', 'Brick.ttl'))
BrickStore.graph = brickschema.persistent.VersionedGraphCollection("sqlite://")
with BrickStore.graph.new_changeset("SCHEMA") as cs:
cs.load_file(BrickStore.schema)
@@ -366,8 +366,7 @@ class Brick(bonsai.core.tool.Brick):
@classmethod
def new_brick_file(cls):
if not BrickStore.schema: # important check for running under test cases
cwd = os.path.dirname(os.path.realpath(__file__))
BrickStore.schema = os.path.join(cwd, "..", "bim", "schema", "Brick.ttl")
BrickStore.schema = tool.Blender.get_data_dir_path(Path('brick', 'Brick.ttl'))
BrickStore.graph = brickschema.persistent.VersionedGraphCollection("sqlite://")
with BrickStore.graph.new_changeset("SCHEMA") as cs:
cs.load_file(BrickStore.schema)