Skip to content

Commit

Permalink
(hopefully) fix issue with enabling without atomium
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Apr 26, 2022
1 parent 00b57d6 commit 22606e1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Binary file modified molecular_nodes_append_file.blend
Binary file not shown.
Binary file removed release/molecular_nodes_0.3.2.zip
Binary file not shown.
Binary file added release/molecular_nodes_0.3.4.zip
Binary file not shown.
Binary file modified serpens_plugin_file.blend
Binary file not shown.
14 changes: 10 additions & 4 deletions src/import_structure.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import bpy
import numpy as np
import atomium
import re
try:
import atomium
except:
print("Atomium Not Installed")

atom_name_dict = {
'C' : 1,
Expand Down Expand Up @@ -351,9 +354,13 @@ def get_frame_positions(frame):
try:
parent_coll = bpy.data.collections['MolecularNodes']
parent_coll.name == "MolecularNodes"
# make the collection active, for creating and disabling new
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children['MolecularNodes']
except:
parent_coll = bpy.data.collections.new('MolecularNodes')
bpy.context.scene.collection.children.link(parent_coll)
# make the collection active, for creating and disabling new
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children['MolecularNodes']



Expand All @@ -367,7 +374,6 @@ def get_frame_positions(frame):
# create the first model, that will be the actual atomic model the user will interact with and display
create_model(pdb_id, collection = col, locations = get_frame_positions(pdb.models[0]) * one_nanometre_size_in_metres)


# Creat the different models that will encode the various properties into
# the XYZ locations of ther vertices.
create_properties_model(
Expand All @@ -394,7 +400,7 @@ def get_frame_positions(frame):
)

# hide the created properties collection
bpy.context.layer_collection.children['MolecularNodes'].children[pdb_id].children[pdb_id + '_properties'].exclude = True
bpy.context.layer_collection.children[pdb_id].children[pdb_id + '_properties'].exclude = True


if (n_models > 1):
Expand All @@ -410,5 +416,5 @@ def get_frame_positions(frame):
)

# hide the created frames collection
bpy.context.layer_collection.children['MolecularNodes'].children[pdb_id].children[pdb_id + '_frames'].exclude = True
bpy.context.layer_collection.children[pdb_id].children[pdb_id + '_frames'].exclude = True

0 comments on commit 22606e1

Please sign in to comment.