diff --git a/molecularnodes/io/density.py b/molecularnodes/io/density.py index fe569277..adf6d612 100644 --- a/molecularnodes/io/density.py +++ b/molecularnodes/io/density.py @@ -3,11 +3,6 @@ import os from ..blender import nodes, coll -bpy.types.Scene.MN_import_density_nodes = bpy.props.BoolProperty( - name = "Setup Nodes", - description = "Creating starting node tree for imported map.", - default = True - ) bpy.types.Scene.MN_import_density_invert = bpy.props.BoolProperty( name = "Invert Data", description = "Invert the values in the map. Low becomes high, high becomes low.", @@ -304,9 +299,13 @@ def panel(layout, scene): layout.separator() layout.label(text = "Options", icon = "MODIFIER") - layout.prop(scene, "MN_import_density_style") + + row = layout.row() + row.prop(scene, 'MN_import_node_setup', text = "") + col = row.column() + col.prop(scene, "MN_import_density_style") + col.enabled = scene.MN_import_node_setup grid = layout.grid_flow() - grid.prop(scene, 'MN_import_density_nodes') grid.prop(scene, 'MN_import_density_invert') grid.prop(scene, 'MN_import_density_center') \ No newline at end of file diff --git a/molecularnodes/io/load.py b/molecularnodes/io/load.py index 682c2077..94ed6959 100644 --- a/molecularnodes/io/load.py +++ b/molecularnodes/io/load.py @@ -30,6 +30,11 @@ name = 'Build Assembly', default = False ) +bpy.types.Scene.MN_import_node_setup = bpy.props.BoolProperty( + name = "Setup Nodes", + default = True, + description = 'Create and set up a Geometry Nodes tree on import.' +) class MolecularNodesObjectProperties(bpy.types.PropertyGroup): subframes: bpy.props.IntProperty( diff --git a/molecularnodes/io/local.py b/molecularnodes/io/local.py index e51b9d10..64d59e82 100644 --- a/molecularnodes/io/local.py +++ b/molecularnodes/io/local.py @@ -144,7 +144,7 @@ def execute(self, context): del_solvent=scene.MN_import_del_solvent, style=scene.MN_import_style, build_assembly=scene.MN_import_build_assembly, - setup_nodes=True + setup_nodes=scene.MN_import_node_setup ) @@ -166,7 +166,11 @@ def panel(layout, scene): row_import.prop(scene, 'MN_import_local_path') layout.separator() layout.label(text = "Options", icon = "MODIFIER") - layout.prop(scene, "MN_import_style") + row = layout.row() + row.prop(scene, 'MN_import_node_setup', text = "") + col = row.column() + col.prop(scene, "MN_import_style") + col.enabled = scene.MN_import_node_setup grid = layout.grid_flow() grid.prop(scene, 'MN_import_build_assembly') grid.prop(scene, 'MN_import_centre', icon_value=0) diff --git a/molecularnodes/io/md.py b/molecularnodes/io/md.py index 1eecf2f6..06b5067e 100644 --- a/molecularnodes/io/md.py +++ b/molecularnodes/io/md.py @@ -253,7 +253,11 @@ def panel(layout, scene): layout.separator() layout.label(text = "Options", icon = "MODIFIER") - layout.prop(scene, "MN_import_style") + row = layout.row() + row.prop(scene, 'MN_import_node_setup', text = "") + col = row.column() + col.prop(scene, "MN_import_style") + col.enabled = scene.MN_import_node_setup layout.prop(scene, 'MN_md_selection') row_frame = layout.row(heading = "Frames", align = True) row_frame.prop(scene, 'MN_md_in_memory') diff --git a/molecularnodes/io/mda.py b/molecularnodes/io/mda.py index fddd362b..428c5e49 100644 --- a/molecularnodes/io/mda.py +++ b/molecularnodes/io/mda.py @@ -567,6 +567,7 @@ def in_memory( selection: str = "all", name: str = "atoms", custom_selections: Dict[str, str] = {}, + node_setup : bool = True ): """ Display an `MDAnalysis.Universe` or @@ -592,6 +593,8 @@ def in_memory( {'name' : 'selection string'} (default: {}). Uses MDAnalysis selection syntax. + node_setup : bool + Whether to add the node tree for the atomgroup. Default: True """ if isinstance(atoms, mda.Universe): atoms = atoms.select_atoms(selection) @@ -602,7 +605,7 @@ def in_memory( ag=atoms, name=name, style=style, - add_node_tree=False, + node_setup=False, return_object=True, ) @@ -643,11 +646,12 @@ def in_memory( coll_frames.name ].exclude = True - nodes.create_starting_node_tree( - object=mol_object, - coll_frames=coll_frames, - style=style, - ) + if node_setup: + nodes.create_starting_node_tree( + object=mol_object, + coll_frames=coll_frames, + style=style, + ) bpy.context.view_layer.objects.active = mol_object @@ -699,7 +703,7 @@ def _process_atomgroup( subframes = 0, name="atoms", style="vdw", - add_node_tree=True, + node_setup=True, return_object=False, ): """ @@ -717,7 +721,7 @@ def _process_atomgroup( The name of the atomgroup. Default: 'atoms' style : str The style of the atoms. Default: 'vdw' - add_node_tree : bool + node_setup : bool Whether to add the node tree for the atomgroup. Default: True return_object : bool Whether to return the blender object or not. Default: False @@ -766,7 +770,7 @@ def _process_atomgroup( # for old import, the node tree is added all at once # in the end of in_memory - if add_node_tree: + if node_setup: nodes.create_starting_node_tree( object=mol_object, style=style, diff --git a/molecularnodes/io/pdb.py b/molecularnodes/io/pdb.py index b694bf9d..d651b612 100644 --- a/molecularnodes/io/pdb.py +++ b/molecularnodes/io/pdb.py @@ -23,6 +23,7 @@ default = True ) + def load( pdb_code, style = 'spheres', @@ -133,6 +134,7 @@ def execute(self, context): del_solvent=scene.MN_import_del_solvent, style=scene.MN_import_style, cache_dir=cache_dir, + setup_nodes=scene.MN_import_node_setup, build_assembly = scene.MN_import_build_assembly ) @@ -151,7 +153,12 @@ def panel(layout, scene): layout.separator() layout.label(text = "Options", icon = "MODIFIER") options = layout.column(align = True) - options.prop(scene, "MN_import_style") + row = options.row() + row.prop(scene, 'MN_import_node_setup', text = "") + col = row.column() + col.prop(scene, "MN_import_style") + col.enabled = scene.MN_import_node_setup + options.separator() row = options.row() row.prop(scene, 'MN_cache', text="")