From 3a2746622e95b91a79d9a53af899a27ae8bf7cc1 Mon Sep 17 00:00:00 2001 From: Brady Johnston Date: Fri, 1 Dec 2023 19:07:26 +0800 Subject: [PATCH] relax requirement for scipy for import, only for biological assemblies --- molecularnodes/__init__.py | 2 +- molecularnodes/io/local.py | 8 ++++++-- molecularnodes/io/pdb.py | 12 ++++++++---- molecularnodes/ui/panel.py | 4 ++-- pyproject.toml | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/molecularnodes/__init__.py b/molecularnodes/__init__.py index d344f3ca..aa4262f5 100644 --- a/molecularnodes/__init__.py +++ b/molecularnodes/__init__.py @@ -16,7 +16,7 @@ "author" : "Brady Johnston", "description" : "Toolbox for molecular animations in Blender & Geometry Nodes.", "blender" : (4, 0, 0), - "version" : (4, 0, 2), + "version" : (4, 0, 3), "location" : "Scene Properties -> Molecular Nodes", "warning" : "", "doc_url" : "https://bradyajohnston.github.io/MolecularNodes/", diff --git a/molecularnodes/io/local.py b/molecularnodes/io/local.py index 87f20b32..8e733b82 100644 --- a/molecularnodes/io/local.py +++ b/molecularnodes/io/local.py @@ -1,6 +1,6 @@ import bpy import warnings -from .. import assembly +from .. import assembly, pkg from .load import create_molecule from ..blender import ( nodes @@ -162,6 +162,10 @@ def panel(layout, scene): layout.prop(scene, "MN_import_style") grid = layout.grid_flow() - grid.prop(scene, 'MN_import_build_assembly') + row = grid.row().column() + if not pkg.is_current('scipy'): + row.enabled = False + row.label(text = 'For assemblies, install scipy in add-on preferences.') + row.prop(scene, 'MN_import_build_assembly') grid.prop(scene, 'MN_import_centre', icon_value=0) grid.prop(scene, 'MN_import_del_solvent', icon_value=0) \ No newline at end of file diff --git a/molecularnodes/io/pdb.py b/molecularnodes/io/pdb.py index cdf6daa9..1d98f8a5 100644 --- a/molecularnodes/io/pdb.py +++ b/molecularnodes/io/pdb.py @@ -1,7 +1,7 @@ import bpy from pathlib import Path import numpy as np - +from .. import pkg from .load import create_molecule from ..blender import nodes from .. import assembly @@ -179,6 +179,10 @@ def panel(layout, scene): col.prop(scene, 'MN_cache_dir', text = "Cache") col.enabled = scene.MN_cache grid = options.grid_flow() - for property in ['MN_import_build_assembly', 'MN_import_centre', 'MN_import_del_solvent']: - grid.prop(scene, property) - \ No newline at end of file + row = grid.row().column() + if not pkg.is_current('scipy'): + row.enabled = False + row.label(text = 'For assemblies, install scipy in add-on preferences.') + row.prop(scene, 'MN_import_build_assembly') + grid.prop(scene, 'MN_import_centre') + grid.prop(scene, 'MN_import_del_solvent') \ No newline at end of file diff --git a/molecularnodes/ui/panel.py b/molecularnodes/ui/panel.py index 31022bd9..22f11dc6 100644 --- a/molecularnodes/ui/panel.py +++ b/molecularnodes/ui/panel.py @@ -40,9 +40,9 @@ } packages = { - 'pdb': ['biotite', 'scipy'], + 'pdb': ['biotite'], 'star': ['starfile', 'eulerangles'], - 'local': ['biotite', 'scipy'], + 'local': ['biotite'], 'cellpack': ['biotite', 'msgpack', 'scipy'], 'md': ['MDAnalysis'], 'density': ['mrcfile', 'scipy'], diff --git a/pyproject.toml b/pyproject.toml index 52100513..1e274c98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "molecularnodes" -version = "4.0.2" +version = "4.0.3" description = "Toolbox for molecular animations with Blender and Geometry Nodes." authors = ["Brady Johnston "] license = "MIT"