Skip to content

Commit

Permalink
properly register UI operators
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Jun 11, 2024
1 parent fb443b1 commit 84238ff
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion molecularnodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .io.parse.mda import _rejuvenate_universe, _sync_universe
from .io.parse.star import _rehydrate_ensembles
from .props import MolecularNodesObjectProperties
from .ui.node_menu import MN_add_node_menu, draw_node_menus
from .ui.node_menu import MN_add_node_menu, draw_node_menus, CLASSES
from .ui.ops import ops_ui
from .ui.panel import MN_PT_panel, change_style_menu, change_style_node_menu
from .ui.pref import MN_OT_Install_Template
Expand All @@ -26,6 +26,7 @@
ops_ui
+ ops_io
+ [MN_OT_Install_Template, MolecularNodesObjectProperties, MN_PT_panel]
+ CLASSES
)

universe_funcs = [_sync_universe, _rejuvenate_universe]
Expand Down
Binary file modified molecularnodes/assets/MN_data_file_4.2.blend
Binary file not shown.
1 change: 1 addition & 0 deletions molecularnodes/ui/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def build_menu(layout, items):
layout.separator()
elif item["label"] == "custom":
for button in item["values"]:
print(f"{button=}")
item["function"](
layout,
label=button["label"],
Expand Down
16 changes: 16 additions & 0 deletions molecularnodes/ui/node_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,19 @@ def MN_add_node_menu(self, context):
if "GeometryNodeTree" == bpy.context.area.spaces[0].tree_type:
layout = self.layout
layout.menu("MN_MT_NODE", text="Molecular Nodes", icon_value=88)


CLASSES = [
MN_MT_Node,
MN_MT_Node_Animate,
MN_MT_Node_Assembly,
MN_MT_Node_Bonds,
MN_MT_Node_CellPack,
MN_MT_Node_Color,
MN_MT_Node_Density,
MN_MT_Node_DNA,
MN_MT_Node_Style,
MN_MT_Node_Select,
MN_MT_Node_Topology,
MN_MT_Node_Utils,
]
2 changes: 2 additions & 0 deletions molecularnodes/ui/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,6 @@ def execute(self, context):
MN_OT_Add_Custom_Node_Group,
MN_OT_Residues_Selection_Custom,
MN_OT_Change_Style,
MN_OT_Assembly_Bio,
MN_OT_iswitch_custom,
]
6 changes: 3 additions & 3 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ def test_node_topology(snapshot_custom: NumpySnapshotExtension):
for node_name in node_names:
# exclude these particular nodes, as they aren't field nodes and so we shouldn't
# be testing them here. Will create their own particular tests later
if "backbone" in node_name or "bonds" in node_name:
if "Backbone" in node_name or "Bonds" in node_name:
continue
node_topo = nodes.add_custom(
group, node_name, location=[x - 300 for x in node_att.location]
)

if node_name == "MN_topo_point_mask":
if node_name == "Point Group Mask":
node_topo.inputs["atom_name"].default_value = 61

type_to_data_type = {
Expand Down Expand Up @@ -294,7 +294,7 @@ def test_compute_backbone(snapshot_custom: NumpySnapshotExtension):
group, node_name, location=[x - 300 for x in node_att.location]
)

if node_name == "MN_topo_point_mask":
if node_name == "Point Group Mask":
node_topo.inputs["atom_name"].default_value = 61

type_to_data_type = {
Expand Down

0 comments on commit 84238ff

Please sign in to comment.