mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 13:28:19 +00:00
fix packages path for blender > 4.2
This commit is contained in:
@@ -2,9 +2,8 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
blenderbim_path = os.environ.get("blenderbim_path")
|
blenderbim_lib_path = os.environ.get("blenderbim_lib_path")
|
||||||
if blenderbim_path:
|
if blenderbim_lib_path:
|
||||||
blenderbim_lib_path = os.path.join(blenderbim_path, "libs", "site", "packages")
|
|
||||||
sys.path.insert(0, blenderbim_lib_path)
|
sys.path.insert(0, blenderbim_lib_path)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import threading
|
|||||||
import queue
|
import queue
|
||||||
import json
|
import json
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
sio = None
|
sio = None
|
||||||
ws_process = None
|
ws_process = None
|
||||||
@@ -105,11 +106,23 @@ class Web(blenderbim.core.tool.Web):
|
|||||||
webui_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "webui")
|
webui_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "webui")
|
||||||
ws_path = os.path.join(webui_path, "sioserver.py")
|
ws_path = os.path.join(webui_path, "sioserver.py")
|
||||||
|
|
||||||
addon = [a for a in addon_utils.modules() if a.bl_info["name"] == "BlenderBIM"][0]
|
py_version = sys.version_info
|
||||||
blenderbim_path = os.path.dirname(addon.__file__)
|
|
||||||
|
if bpy.app.version >= (4, 2, 0):
|
||||||
|
blenderbim_lib_path = (
|
||||||
|
Path(bpy.utils.user_resource("EXTENSIONS"))
|
||||||
|
/ ".local"
|
||||||
|
/ "lib"
|
||||||
|
/ f"python{py_version.major}.{py_version.minor}"
|
||||||
|
/ "site-packages"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
addon = [a for a in addon_utils.modules() if a.bl_info["name"] == "BlenderBIM"][0]
|
||||||
|
blenderbim_path = os.path.dirname(addon.__file__)
|
||||||
|
blenderbim_lib_path = os.path.join(blenderbim_path, "libs", "site", "packages")
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["blenderbim_path"] = blenderbim_path
|
env["blenderbim_lib_path"] = str(blenderbim_lib_path)
|
||||||
|
|
||||||
ws_process = subprocess.Popen(
|
ws_process = subprocess.Popen(
|
||||||
[sys.executable, ws_path, "--p", str(port), "--host", "127.0.0.1"],
|
[sys.executable, ws_path, "--p", str(port), "--host", "127.0.0.1"],
|
||||||
|
|||||||
Reference in New Issue
Block a user