Skip to content

Commit

Permalink
finalised all primary nodes and example videos
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Sep 11, 2023
1 parent aae7d49 commit a4c14d5
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 58 deletions.
Binary file modified MolecularNodes/assets/MN_data_file.blend
Binary file not shown.
2 changes: 1 addition & 1 deletion MolecularNodes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def create_starting_nodes_density(obj, threshold = 0.8):
node_output = node_mod.node_group.nodes[bpy.app.translations.pgettext_data("Group Output",)]
node_output.location = [800, 0]

node_density = add_custom_node_group(node_mod, 'MN_style_density_surface', [400, 0])
node_density = add_custom_node_group(node_mod, 'MN_density_style_surface', [400, 0])
node_density.inputs['Material'].default_value = MN_base_material()
node_density.inputs['Density Threshold'].default_value = threshold

Expand Down
24 changes: 12 additions & 12 deletions MolecularNodes/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ def draw(self, context):
"Based on an initial selection, finds atoms which are \
within a certain number of bonds away")

class MN_MT_Add_Node_Menu_Styling(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_SYLING'
class MN_MT_Add_Node_Menu_Style(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_SYLE'
bl_label = ''

@classmethod
Expand Down Expand Up @@ -724,8 +724,8 @@ def draw(self, context):
Chains to have a single surface per chain")
# menu_item_interface(layout, 'Cartoon Utilities', 'MN_style_cartoon_utils')

class MN_MT_Add_Node_Menu_Selections(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_SELECTIONS'
class MN_MT_Add_Node_Menu_Selection(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_SELECTION'
bl_label = ''

@classmethod
Expand Down Expand Up @@ -855,8 +855,8 @@ def draw(self, context):
'MN_dna_style_ball_and_stick',
"Style the DNA bases with ball and stick representation")

class MN_MT_Add_Node_Menu_Animation(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_ANIMATION'
class MN_MT_Add_Node_Menu_Animate(bpy.types.Menu):
bl_idname = 'MN_MT_ADD_NODE_MENU_ANIMATE'
bl_label = ''

@classmethod
Expand Down Expand Up @@ -929,9 +929,9 @@ def poll(cls, context):
def draw(self, context):
layout = self.layout
layout.operator_context = "INVOKE_DEFAULT"
menu_item_interface(layout, 'Style Surface', 'MN_style_density_surface')
menu_item_interface(layout, 'Style Wire', 'MN_style_density_wire')
menu_item_interface(layout, 'Sample Nearest Attribute', 'MN_utils_sample_searest')
menu_item_interface(layout, 'Style Surface', 'MN_density_style_surface')
menu_item_interface(layout, 'Style Wire', 'MN_density_style_wire')
menu_item_interface(layout, 'Sample Nearest Attribute', 'MN_density_sample_searest')

class MN_MT_Add_Node_Menu(bpy.types.Menu):
bl_idname = "MN_MT_ADD_NODE_MENU"
Expand All @@ -944,13 +944,13 @@ def poll(cls, context):
def draw(self, context):
layout = self.layout.column_flow(columns=1)
layout.operator_context = "INVOKE_DEFAULT"
layout.menu('MN_MT_ADD_NODE_MENU_SYLING',
layout.menu('MN_MT_ADD_NODE_MENU_SYLE',
text='Style', icon_value=77)
layout.menu('MN_MT_ADD_NODE_MENU_SELECTIONS',
layout.menu('MN_MT_ADD_NODE_MENU_SELECTION',
text='Selection', icon_value=256)
layout.menu('MN_MT_ADD_NODE_MENU_COLOR',
text='Color', icon = 'COLORSET_07_VEC')
layout.menu('MN_MT_ADD_NODE_MENU_ANIMATION',
layout.menu('MN_MT_ADD_NODE_MENU_ANIMATE',
text='Animation', icon_value=409)
layout.menu('MN_MT_ADD_NODE_MENU_ASSEMBLY',
text='Assemblies', icon = 'GROUP_VERTEX')
Expand Down
9 changes: 9 additions & 0 deletions docs/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"MN_select_attribute": "Selections based on the different attributes that are available on the atomic geometry.",
"MN_select_cube": "Create a selection that is inside the `Empty_Cube` object. When this node is first created, an _empty_ object called `Empty_Cube` should be created. You can always create additional empty objects through the add menu, to use a different object. The rotation and scale of the object will be taken into account for the selection.",
"MN_select_sphere": "Create a selection that is within a spherical radius of an object, based on that object's scale. By default an _empty_ object called `Empty_Sphere` is created. You can use other objects or create a new empty to use. The origin point for the object will be used, which should be taken in to account when using molecules. Use [`MN_select_proximity`](#select-proximity) for selections which are within a certain distance of a selection of atoms instead of a single origin point.",
"MN_select_res_whole": "Expand a given selection to include entire residues. Expands the selection based on `res_id` attribute, so it can sometimes result in strange selections with ligands.",

"MN_color_set":"The is the primary way to change the color of structures in Molecular Nodes. Colors for cartoon and ribbon are taken from the _alpha-carbons_ of the structures. Change the color of the input atoms, based on a selection and a color field. The color field can be as complex of a calculation as you wish. In the example below the color for the whole structure can be set, or the color can be based on a color for each chain, or the result of mapping a color to an attribute such as `b_factor`.",
"MN_color_goodsell": "Change the inputted color to be darker for non-carbon atoms. Creates a _Goodsell Style_ color scheme for individual chains.",
Expand All @@ -37,6 +38,10 @@
"MN_style_atoms": "Style to apply the traditional space-filling atomic representation of atoms. Spheres are scaled based on the `vdw_radii` attribute. By default the _Point Cloud_ rendering system is used, which is only visible inside of Cycles.",
"MN_style_cartoon": "Style to apply the traditional cartoon representation of protein structures. This style highlights alpha-helices and beta-sheets with arrows and cylinders.",
"MN_style_ribbon": "Style that creates a continuous solid ribbon or licorice tube through the alpha-carbons of the structure.",
"MN_style_ribbon_protein": "Style that creates a continuous solid ribbon or 'licorice' tube through the alpha-carbons of the structure.",
"MN_style_ribbon_nucleic": "Style that creates a continuous ribbon through the bacbkone of nucleic acids, and s simplified cylinder for the bases.",
"MN_style_sticks": "Style that creates a cylinder for each bond. Cylindrical caps to the cylinders are currently not supported. Best to use [`MN_style_ball_and_stick`](#style-ball-and-stick).",
"MN_style_ball_and_stick": "Style that creates cylinders for bonds and spheres for atoms. The atoms can be either Eevee or Cycles compatible, with customisation to resolution and radius possible.",
"MN_style_surface": "Style that creates a surface representation based on the proximity of atoms to a probe that is moved through the entire structure.",

"MN_assembly_": "Creates a biological assembly by applying rotation and translation matrices to individual chains in the structure. It is created on an individual molecule basis, if assembly instructions are detected when imported.",
Expand All @@ -45,6 +50,10 @@
"MN_animate_value": "Animate a float value between the specified min and max values, over specified range of frames. If clamped, frames above and below the start and end will result in the min and max output values, otherwise it will continue to linearly interpolate the value beyond the min and max values.",
"MN_animate_frames": "Animate the atoms of a structure, based on the frames of a trajectory from the `Frames` collection in the input. The structure animates through the trajectory from the given start frame to the given end frame, as the `Animate 0..1` value moves from `0` to `1`. Values higher than `1` start at the beginning again and the trajectory will loop repeating every `1.00`.\nPosition and `b_factor` are interpolated if available. By default linear interpolation is used. Smoothing in and out of each frame can be applied with the `Smoother Step`, or no interpolation at all.",
"MN_animate_res_wiggle": "Create a procedural animation of side-chain movement. 'Wiggles' the side-chains of peptide amino acids based on the `b_factor` attribute. Wiggle is currently only supported for protein side-chains and does not check for steric clashing so higher amplitudes will result in strange results. The animation should seamlessly loop every `1.00` of the `Animate 0..1` input.",
"MN_animate_noise_position": "Create 3D noise vector based on the position of points in 3D space. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.\n\nAn example of using this noise is to offset the positions of atoms with the `Set Position` node.",
"MN_animate_noise_field": "Create a 3D noise vector based on the input field. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.\n\nAn example of using this noise is to offset the positions of atoms with the `Set Position` node. Different field inputs result in different noise being applied. Using the `chain_id` results in the same noise being generated for each atom in each chain, but different between chains.",
"MN_animate_noise_repeat": "Create a 3D noise vector based on the input field, that repeats every `1.00` for the `Animate 0..1` input. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.\n\nAn example of using this noise is to offset the positions of atoms with the `Set Position` node. Different field inputs result in different noise being applied. Using the `chain_id` results in the same noise being generated for each atom in each chain, but different between chains.",
"MN_animate_res_to_curve": "Take the protein residues from a structure and align then along an input curve. Editing the curve will change how the atoms are arranged. The output atoms can be styled as normal.",

"MN_utils_dssp": "A rudimentary secondary structure detection algorithm."

Expand Down
112 changes: 67 additions & 45 deletions docs/nodes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Position and `b_factor` are interpolated if available. By default linear interpo

### Animate Noise Field

Create a 3D noise vector based on the input field. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.

An example of using this noise is to offset the positions of atoms with the `Set Position` node. Different field inputs result in different noise being applied. Using the `chain_id` results in the same noise being generated for each atom in each chain, but different between chains.

![](videos/nodes/MN_animate_noise_field.mp4)


Expand All @@ -66,6 +70,10 @@ Position and `b_factor` are interpolated if available. By default linear interpo

### Animate Noise Position

Create 3D noise vector based on the position of points in 3D space. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.

An example of using this noise is to offset the positions of atoms with the `Set Position` node.

![](videos/nodes/MN_animate_noise_position.mp4)


Expand All @@ -91,6 +99,10 @@ Position and `b_factor` are interpolated if available. By default linear interpo

### Animate Noise Repeat

Create a 3D noise vector based on the input field, that repeats every `1.00` for the `Animate 0..1` input. Evolve the noise function with the `Animate` input, and change the characteristics of the noise function with the other inputs such as scale and detail. There is also a 1-dimensional noise output called `Fac`.

An example of using this noise is to offset the positions of atoms with the `Set Position` node. Different field inputs result in different noise being applied. Using the `chain_id` results in the same noise being generated for each atom in each chain, but different between chains.

![](videos/nodes/MN_animate_noise_repeat.mp4)


Expand All @@ -117,6 +129,8 @@ Position and `b_factor` are interpolated if available. By default linear interpo

### Animate Res To Curve

Take the protein residues from a structure and align then along an input curve. Editing the curve will change how the atoms are arranged. The output atoms can be styled as normal.

![](videos/nodes/MN_animate_res_to_curve.mp4)


Expand Down Expand Up @@ -634,6 +648,30 @@ The is the primary way to change the color of structures in Molecular Nodes. Col
## Density


### Density Sample Nearest

![](videos/nodes/MN_density_sample_nearest.mp4)


#### Inputs

| Name | Type | Description | Default |
|---------|----------|---------------------------------------------------|-----------|
| `Atoms` | Geometry | Atomic geometry that contains vertices and edges. | required |


#### Outputs

| Name | Type | Description | Default |
|-----------------|---------|---------------|----------------|
| `Color` | Color | | `rgb(0, 0, 0)` |
| `b_factor` | Float | | `0.0` |
| `atomic_number` | Integer | | `0` |
| `chain_number` | Integer | | `0` |
| `res_id` | Integer | | `0` |
| `res_name` | Integer | | `0` |


### Density Style Surface

![](videos/nodes/MN_density_style_surface.mp4)
Expand Down Expand Up @@ -1011,6 +1049,27 @@ Select single or multiple protein residues by name. Includes the 20 naturally oc
| `Inverted` | Boolean | The inverse of the calculated selection | `False` |


### Select Res Whole

Expand a given selection to include entire residues. Expands the selection based on `res_id` attribute, so it can sometimes result in strange selections with ligands.

![](videos/nodes/MN_select_res_whole.mp4)


#### Inputs

| Name | Type | Description | Default |
|-------------|---------|--------------------------------------------------------|-----------|
| `Selection` | Boolean | Expands given selection to include the entire residue. | `False` |


#### Outputs

| Name | Type | Description | Default |
|-------------|---------|--------------------------|-----------|
| `Selection` | Boolean | The calculated selection | `False` |


### Select Sec Struct

Select based on the assigned secondary structure information. Only returns a selection if the `sec_struct` attribute exists on the atoms. Will be imported from files where it is present, or can be calculated using the [`MN_utils_dssp'](#utils-dssp) node.
Expand Down Expand Up @@ -1107,27 +1166,6 @@ Create a selection that is within a spherical radius of an object, based on that
| `0..1` | Float | | `0.0` |


### Select Whole Res

Expand the given selection to include a whole residue, if a single atom in that residue is selected. Useful for when a distance or proximity selection includes some of the residue and you wish to include all of the residue.

![](videos/nodes/MN_select_whole_res.mp4)


#### Inputs

| Name | Type | Description | Default |
|-------------|---------|--------------------------------------------------------|-----------|
| `Selection` | Boolean | Expands given selection to include the entire residue. | `False` |


#### Outputs

| Name | Type | Description | Default |
|-------------|---------|--------------------------|-----------|
| `Selection` | Boolean | The calculated selection | `False` |


## Style


Expand Down Expand Up @@ -1160,6 +1198,8 @@ Style to apply the traditional space-filling atomic representation of atoms. Sph

### Style Ball And Stick

Style that creates cylinders for bonds and spheres for atoms. The atoms can be either Eevee or Cycles compatible, with customisation to resolution and radius possible.

![](videos/nodes/MN_style_ball_and_stick.mp4)


Expand Down Expand Up @@ -1219,6 +1259,8 @@ Style to apply the traditional cartoon representation of protein structures. Thi

### Style Ribbon Nucleic

Style that creates a continuous ribbon through the bacbkone of nucleic acids, and s simplified cylinder for the bases.

![](videos/nodes/MN_style_ribbon_nucleic.mp4)


Expand Down Expand Up @@ -1253,6 +1295,8 @@ Style to apply the traditional cartoon representation of protein structures. Thi

### Style Ribbon Protein

Style that creates a continuous solid ribbon or 'licorice' tube through the alpha-carbons of the structure.

![](videos/nodes/MN_style_ribbon_protein.mp4)


Expand Down Expand Up @@ -1280,6 +1324,8 @@ Style to apply the traditional cartoon representation of protein structures. Thi

### Style Sticks

Style that creates a cylinder for each bond. Cylindrical caps to the cylinders are currently not supported. Best to use [`MN_style_ball_and_stick`](#style-ball-and-stick).

![](videos/nodes/MN_style_sticks.mp4)


Expand Down Expand Up @@ -1490,30 +1536,6 @@ A rudimentary secondary structure detection algorithm.
| `Geometry` | Geometry | | required |


### Utils Sample Searest

![](videos/nodes/MN_utils_sample_searest.mp4)


#### Inputs

| Name | Type | Description | Default |
|---------|----------|---------------------------------------------------|-----------|
| `Atoms` | Geometry | Atomic geometry that contains vertices and edges. | required |


#### Outputs

| Name | Type | Description | Default |
|-----------------|---------|---------------|----------------|
| `Color` | Color | | `rgb(0, 0, 0)` |
| `b_factor` | Float | | `0.0` |
| `atomic_number` | Integer | | `0` |
| `chain_number` | Integer | | `0` |
| `res_id` | Integer | | `0` |
| `res_name` | Integer | | `0` |


### Utils Style Atoms Cycles

![](videos/nodes/MN_utils_style_atoms_cycles.mp4)
Expand Down
Binary file added docs/videos/nodes/MN_animate_noise_field.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_animate_noise_position.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_animate_noise_repeat.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_animate_res_to_curve.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_density_sample_nearest.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_density_style_surface.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_density_style_wire.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_select_res_whole.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_select_separate_atoms.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_style_ribbon_nucleic.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_style_ribbon_protein.mp4
Binary file not shown.
Binary file added docs/videos/nodes/MN_style_sticks.mp4
Binary file not shown.

0 comments on commit a4c14d5

Please sign in to comment.