mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Make some of the more complex imports relative
This commit is contained in:
@@ -25,7 +25,7 @@ from . import handler, ui, prop, operator, helper
|
||||
from typing import Callable, Union
|
||||
|
||||
try:
|
||||
from blenderbim.translations import translations_dict
|
||||
from .translations import translations_dict
|
||||
except ImportError:
|
||||
translations_dict = {}
|
||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -91,7 +91,7 @@ modules = {
|
||||
|
||||
|
||||
for name in modules.keys():
|
||||
modules[name] = importlib.import_module(f"blenderbim.bim.module.{name}")
|
||||
modules[name] = importlib.import_module(f".module.{name}", package=__package__)
|
||||
|
||||
|
||||
classes = [
|
||||
@@ -289,7 +289,7 @@ def unregister():
|
||||
km.keymap_items.remove(kmi)
|
||||
addon_keymaps.clear()
|
||||
|
||||
import blenderbim.tool as tool
|
||||
from . import tool
|
||||
|
||||
# use tuple() as method will be removing keys from dict
|
||||
for panel in tuple(original_scene_panels_polls.keys()):
|
||||
|
||||
@@ -24,10 +24,10 @@ import hashlib
|
||||
import zipfile
|
||||
import tempfile
|
||||
import traceback
|
||||
import importlib
|
||||
import ifcopenshell
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.ifcopenshell_wrapper
|
||||
import blenderbim
|
||||
import blenderbim.bim.handler
|
||||
import blenderbim.tool as tool
|
||||
from pathlib import Path
|
||||
@@ -35,6 +35,7 @@ from blenderbim.tool.brick import BrickStore
|
||||
from typing import Set, Union, Optional, TypedDict, Callable
|
||||
|
||||
|
||||
bbim = importlib.import_module("..", package=__package__)
|
||||
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
|
||||
|
||||
|
||||
@@ -364,7 +365,7 @@ class IfcStore:
|
||||
|
||||
@staticmethod
|
||||
def execute_ifc_operator(operator: bpy.types.Operator, context: bpy.types.Context, is_invoke=False):
|
||||
blenderbim.last_actions.append({"type": "operator", "name": operator.bl_idname})
|
||||
bbim.last_actions.append({"type": "operator", "name": operator.bl_idname})
|
||||
bpy.context.scene.BIMProperties.is_dirty = True
|
||||
is_top_level_operator = not bool(IfcStore.current_transaction)
|
||||
|
||||
@@ -385,7 +386,7 @@ class IfcStore:
|
||||
else:
|
||||
result = getattr(operator, "_execute")(context)
|
||||
except:
|
||||
blenderbim.last_error = traceback.format_exc()
|
||||
bbim.last_error = traceback.format_exc()
|
||||
raise
|
||||
|
||||
if is_top_level_operator:
|
||||
|
||||
@@ -22,6 +22,7 @@ import time
|
||||
import json
|
||||
import logging
|
||||
import tempfile
|
||||
import importlib
|
||||
import traceback
|
||||
import subprocess
|
||||
import datetime
|
||||
@@ -58,6 +59,9 @@ from blenderbim.bim.module.project.decorator import ProjectDecorator, ClippingPl
|
||||
from typing import Union
|
||||
|
||||
|
||||
bbim = importlib.import_module("..", package=__package__)
|
||||
|
||||
|
||||
class NewProject(bpy.types.Operator):
|
||||
bl_idname = "bim.new_project"
|
||||
bl_label = "New Project"
|
||||
@@ -742,7 +746,7 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
||||
if not self.is_advanced:
|
||||
bpy.ops.bim.load_project_elements()
|
||||
except:
|
||||
blenderbim.last_error = traceback.format_exc()
|
||||
bbim.last_error = traceback.format_exc()
|
||||
raise
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import logging
|
||||
import textwrap
|
||||
import shutil
|
||||
import platform
|
||||
import importlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
import webbrowser
|
||||
@@ -44,6 +45,9 @@ from collections import namedtuple
|
||||
from typing import List
|
||||
|
||||
|
||||
bbim = importlib.import_module("..", package=__package__)
|
||||
|
||||
|
||||
class SetTab(bpy.types.Operator):
|
||||
bl_idname = "bim.set_tab"
|
||||
# NOTE: bl_label is set to empty string intentionally
|
||||
@@ -95,7 +99,7 @@ class CloseError(bpy.types.Operator):
|
||||
bl_label = "Close Error"
|
||||
|
||||
def execute(self, context):
|
||||
blenderbim.last_error = None
|
||||
bbim.last_error = None
|
||||
return {"FINISHED"}
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
Reference in New Issue
Block a user