Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds 'Live' MDAnalysis Selections #466

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

BradyAJohnston
Copy link
Owner

@BradyAJohnston BradyAJohnston commented Apr 1, 2024

This moves the custom MDAnalysis selections from a single on-import selection that is added as a custom attribute, to be handled on a per-object basis. These selections update each change of frame in Blender if the Update is enabled.

blender_68ppJ4jB4x.mp4

As can be see in the example video, the user can tweak the selection language on the fly, and the selection is updated on the following frame.

Currently the boolean selections are created by first creating a new atom group, then checking to see if the atom indices are in that atom group. There is likely a faster way to implement this.

Todo:

  • Move the position update to be on a pre-frame update handler, and the selection will be on the post-update handler so that selections are calculated on the new positions.
  • Add tests for updating selections
  • Handle deletion of custom selections so they remove the attribute also
  • Maybe handle renaming of custom attributes (currently just creates a whole new attribute, leaving the other in its current state, not updating)

@BradyAJohnston
Copy link
Owner Author

@rbdavid this is an example of using the connected MDA Universe that is maintained between sessions. This won't be applicable to other import methods, but a similar approach could be done.

@BradyAJohnston BradyAJohnston mentioned this pull request Apr 1, 2024
4 tasks
@rbdavid
Copy link
Contributor

rbdavid commented Apr 1, 2024

This is awesome! From the video, it seems like you can add any number of selection atom groups where custom_selection is the named boolean attribute associated with the selection string. So this should enable a user to make multiple selections and use different materials, representation styles, etc to highlight those. Awesome work! Let me know if you want a second pair of eyes on the code.

@BradyAJohnston
Copy link
Owner Author

Yes the idea is that you can add any number of 'custom selections'. Each listed custom selection becomes a named attribute on the mesh, with a boolean selection that is generated through MDAnalysis. This can then be used inside of geometry nodes for styling / selecting etc.

@BradyAJohnston
Copy link
Owner Author

Related to #440 - I'm thinking we could manage universe transformations (smoothing, translations etc) from a similar list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants