diff --git a/surfaces/blender/brokkr_bridge/__init__.py b/surfaces/blender/brokkr_bridge/__init__.py index e692a49..4720cde 100644 --- a/surfaces/blender/brokkr_bridge/__init__.py +++ b/surfaces/blender/brokkr_bridge/__init__.py @@ -50,7 +50,7 @@ class BrokkrPreferences(bpy.types.AddonPreferences): name="CultLib Python Source", subtype="DIR_PATH", default=DEFAULT_CULTLIB_PY_SRC, - description="Path to CultLib packages/cultcache-py/src when cultcache-py is not installed in Blender", + description="Path to the CultLib packages directory when cultcache-py, cultnet-py and cultmesh-py are not installed in Blender", ) debug_mirror_root: bpy.props.StringProperty( diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 8ccb08c..7b473b7 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -13,7 +13,11 @@ PROVIDER_ID = "brokkr.blender_editor" TOOL_KIND = "blender-editor" DEFAULT_BROKER_URI = "cultmesh://brokkr" DEFAULT_CULTMESH_CACHE_PATH = "//.brokkr/blender-editor.ccmp" -DEFAULT_CULTLIB_PY_SRC = "E:/Projects/CultLib-main-work/packages/cultcache-py/src" +# The CultLib `packages` directory. The Python runtime is three layered +# packages there (cultcache-py, cultnet-py, cultmesh-py); each one's `src` is +# added to sys.path when they are not installed into Blender's interpreter. +DEFAULT_CULTLIB_PY_SRC = "F:/Projects/CultLib/packages" +CULTLIB_PY_PACKAGES = ("cultcache-py", "cultnet-py", "cultmesh-py") DEFAULT_DEBUG_MIRROR_ROOT = "//.brokkr/blender-editor-debug" HOST_SNAPSHOT_SCHEMA = "brokkr.blender.host_snapshot.v0" @@ -692,18 +696,20 @@ class BrokkrBlenderTarget: def _load_cultmesh(cultlib_py_src: str) -> tuple[Any, Any]: - source = Path(cultlib_py_src or DEFAULT_CULTLIB_PY_SRC) - if source.exists(): - source_text = str(source) - if source_text not in sys.path: - sys.path.insert(0, source_text) + packages = Path(cultlib_py_src or DEFAULT_CULTLIB_PY_SRC) + for name in CULTLIB_PY_PACKAGES: + source = packages / name / "src" + if source.exists(): + source_text = str(source) + if source_text not in sys.path: + sys.path.insert(0, source_text) try: import cultmesh_py # type: ignore import cultcache_py # type: ignore except ModuleNotFoundError as exc: raise RuntimeError( - "Brokkr Blender target requires CultLib's Python CultMesh package. Set CultLib Python Source " - "to the CultLib packages/cultcache-py/src directory or install cultcache-py into Blender's Python." + "Brokkr Blender target requires CultLib's Python packages. Set CultLib Python Source " + "to the CultLib packages directory or install cultcache-py, cultnet-py and cultmesh-py into Blender's Python." ) from exc return cultmesh_py, cultcache_py diff --git a/surfaces/blender/docs/install.md b/surfaces/blender/docs/install.md index 52b50bb..01a9a85 100644 --- a/surfaces/blender/docs/install.md +++ b/surfaces/blender/docs/install.md @@ -8,11 +8,12 @@ target surface for host snapshots, admitted command intents, and command receipts. The adapter writes its mirror documents through CultLib's Python CultMesh node. -If `cultcache-py`/`cultmesh_py` is not installed into Blender's Python, point -`CultLib Python Source` at: +If `cultcache-py`, `cultnet-py` and `cultmesh-py` are not installed into +Blender's Python, point `CultLib Python Source` at the CultLib packages +directory; the add-on puts each package's `src` on `sys.path`: ```text -E:/Projects/CultLib-main-work/packages/cultcache-py/src +F:/Projects/CultLib/packages ``` The default node cache is: