Skip to content

Commit

Permalink
Merge branch 'main' into 669-node-modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Nov 29, 2024
2 parents 940c53a + 442d4e4 commit 58d42c5
Show file tree
Hide file tree
Showing 25 changed files with 1,077 additions and 2,118 deletions.
19 changes: 10 additions & 9 deletions molecularnodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import bpy
from bpy.app.handlers import frame_change_post, load_post, save_post

from bpy.props import PointerProperty, CollectionProperty
from .handlers import update_trajectories
from . import entities, operators, props, session, ui
from .utils import add_current_module_to_path
from .ui import pref
Expand All @@ -24,8 +25,8 @@
ui.CLASSES
+ operators.CLASSES
+ entities.CLASSES
+ props.CLASSES
+ [
props.MolecularNodesObjectProperties,
MN_PT_Scene,
]
+ pref.CLASSES
Expand Down Expand Up @@ -56,14 +57,13 @@ def register():

save_post.append(session._pickle)
load_post.append(session._load)
frame_change_post.append(entities.trajectory.handlers.update_trajectories)
frame_change_post.append(update_trajectories)

bpy.types.Scene.MNSession = session.MNSession()
bpy.types.Object.mn = bpy.props.PointerProperty(
type=props.MolecularNodesObjectProperties
)
bpy.types.Object.mn_trajectory_selections = bpy.props.CollectionProperty(
type=entities.trajectory.selections.TrajectorySelectionItem
bpy.types.Object.mn = PointerProperty(type=props.MolecularNodesObjectProperties)
bpy.types.Scene.mn = PointerProperty(type=props.MolecularNodesSceneProperties)
bpy.types.Object.mn_trajectory_selections = CollectionProperty(
type=entities.trajectory.props.TrajectorySelectionItem
)


Expand All @@ -81,7 +81,8 @@ def unregister():

save_post.remove(session._pickle)
load_post.remove(session._load)
frame_change_post.remove(entities.trajectory.handlers.update_trajectories)
frame_change_post.remove(update_trajectories)
del bpy.types.Scene.MNSession
del bpy.types.Scene.mn
del bpy.types.Object.mn
del bpy.types.Object.mn_trajectory_selections
20 changes: 10 additions & 10 deletions molecularnodes/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ wheels = [
"./wheels/biotite-0.41.2-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/biotite-0.41.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/biotite-0.41.2-cp311-cp311-win_amd64.whl",
"./wheels/contourpy-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl",
"./wheels/contourpy-1.3.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/contourpy-1.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/contourpy-1.3.0-cp311-cp311-win_amd64.whl",
"./wheels/contourpy-1.3.1-cp311-cp311-macosx_10_9_x86_64.whl",
"./wheels/contourpy-1.3.1-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/contourpy-1.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/contourpy-1.3.1-cp311-cp311-win_amd64.whl",
"./wheels/cycler-0.12.1-py3-none-any.whl",
"./wheels/fasteners-0.19-py3-none-any.whl",
"./wheels/fonttools-4.54.1-cp311-cp311-macosx_10_9_universal2.whl",
"./wheels/fonttools-4.54.1-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/fonttools-4.54.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/fonttools-4.54.1-cp311-cp311-win_amd64.whl",
"./wheels/fonttools-4.55.0-cp311-cp311-macosx_10_9_universal2.whl",
"./wheels/fonttools-4.55.0-cp311-cp311-macosx_10_9_x86_64.whl",
"./wheels/fonttools-4.55.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/fonttools-4.55.0-cp311-cp311-win_amd64.whl",
"./wheels/joblib-1.4.2-py3-none-any.whl",
"./wheels/kiwisolver-1.4.7-cp311-cp311-macosx_10_9_x86_64.whl",
"./wheels/kiwisolver-1.4.7-cp311-cp311-macosx_11_0_arm64.whl",
Expand All @@ -62,7 +62,7 @@ wheels = [
"./wheels/msgpack-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"./wheels/msgpack-1.1.0-cp311-cp311-win_amd64.whl",
"./wheels/networkx-3.4.2-py3-none-any.whl",
"./wheels/packaging-24.1-py3-none-any.whl",
"./wheels/packaging-24.2-py3-none-any.whl",
"./wheels/pandas-2.2.3-cp311-cp311-macosx_10_9_x86_64.whl",
"./wheels/pandas-2.2.3-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/pandas-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
Expand All @@ -81,7 +81,7 @@ wheels = [
"./wheels/six-1.16.0-py2.py3-none-any.whl",
"./wheels/starfile-0.5.6-py3-none-any.whl",
"./wheels/threadpoolctl-3.5.0-py3-none-any.whl",
"./wheels/tqdm-4.66.6-py3-none-any.whl",
"./wheels/tqdm-4.67.0-py3-none-any.whl",
"./wheels/typing_extensions-4.12.2-py3-none-any.whl",
"./wheels/tzdata-2024.2-py2.py3-none-any.whl",
]
Expand Down
19 changes: 9 additions & 10 deletions molecularnodes/entities/ensemble/cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ def _get_structure(self, extra_fields: str = None, sec_struct=True, bonds=True):
# which can be extracted with the get_component()
try:
array = pdbx.get_structure(self.file, extra_fields=extra_fields)
try:
array.set_annotation(
"sec_struct", _get_secondary_structure(array, self.file)
)
except KeyError:
warnings.warn("No secondary structure information.")
try:
array.set_annotation("entity_id", _get_entity_id(array, self.file))
except KeyError:
warnings.warn("Non entity_id information.")
annotations = {
"sec_struct": _get_secondary_structure,
"entity_id": _get_entity_id,
}
for key, func in annotations.items():
try:
array.set_annotation(key, func(array, self.file))
except KeyError:
pass

except InvalidFileError:
array = pdbx.get_component(self.file)
Expand Down
27 changes: 7 additions & 20 deletions molecularnodes/entities/molecule/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .pdb import PDB
from .pdbx import BCIF, CIF
from .sdf import SDF
from ...style import STYLE_ITEMS


def parse(filepath) -> Molecule:
Expand Down Expand Up @@ -103,20 +104,6 @@ def load_local(
return mol


STYLE_ITEMS = (
("spheres", "Spheres", "Space-filling atoms style."),
("cartoon", "Cartoon", "Secondary structure cartoons"),
("surface", "Surface", "Solvent-accsible surface."),
("ribbon", "Ribbon", "Continuous backbone ribbon."),
("sticks", "Sticks", "Sticks for each bond."),
("ball_and_stick", "Ball and Stick", "Spheres for atoms, sticks for bonds"),
("preset_1", "Preset 1", "A pre-made combination of different styles"),
("preset_2", "Preset 2", "A pre-made combination of different styles"),
("preset_3", "Preset 3", "A pre-made combination of different styles"),
("preset_4", "Preset 4", "A pre-made combination of different styles"),
)


class Import_Molecule(bpy.types.Operator):
style: EnumProperty( # type: ignore
name="Style",
Expand Down Expand Up @@ -381,7 +368,7 @@ def execute(self, context):

style = None
if scene.MN_import_node_setup:
style = scene.MN_import_style
style = scene.mn.import_style

centre = ""
if scene.MN_import_centre:
Expand Down Expand Up @@ -423,7 +410,7 @@ def execute(self, context):
scene = context.scene
file_path = scene.MN_import_local_path

style = scene.MN_import_style
style = scene.mn.import_style
if not scene.MN_import_node_setup:
style = None

Expand Down Expand Up @@ -467,7 +454,7 @@ def execute(self, context):

style = None
if scene.MN_import_node_setup:
style = scene.MN_import_style
style = scene.mn.import_style

centre = ""
if scene.MN_import_centre:
Expand Down Expand Up @@ -559,7 +546,7 @@ def panel_wwpdb(layout, scene):
row = options.row()
row.prop(scene, "MN_import_node_setup", text="")
col = row.column()
col.prop(scene, "MN_import_style")
col.prop(scene.mn, "import_style")
col.enabled = scene.MN_import_node_setup

row_centre = options.row()
Expand Down Expand Up @@ -601,7 +588,7 @@ def panel_alphafold(layout, scene):
row = options.row()
row.prop(scene, "MN_import_node_setup", text="")
col = row.column()
col.prop(scene, "MN_import_style")
col.prop(scene.mn, "import_style")
col.enabled = scene.MN_import_node_setup

row_centre = options.row()
Expand Down Expand Up @@ -638,7 +625,7 @@ def panel_local(layout, scene):
row = options.row()
row.prop(scene, "MN_import_node_setup", text="")
col = row.column()
col.prop(scene, "MN_import_style")
col.prop(scene.mn, "import_style")
col.enabled = scene.MN_import_node_setup

row_centre = options.row()
Expand Down
3 changes: 2 additions & 1 deletion molecularnodes/entities/trajectory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from . import selections
from . import ui
from . import props
from .ui import load
from .trajectory import Trajectory

CLASSES = selections.CLASSSES + ui.CLASSES
CLASSES = props.CLASSSES + ui.CLASSES
Loading

0 comments on commit 58d42c5

Please sign in to comment.