-
Notifications
You must be signed in to change notification settings - Fork 81
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
Molecule class #469
base: main
Are you sure you want to change the base?
Molecule class #469
Conversation
…r to moleculeinblender
It doesn't seem to be that easy to add a new attribute to the blender object. I'll read up on it tomorrow |
There are only a few things you can add as an attribute (floats, ints, strings...). For the starfile class I only save the filename of the starfile as an attribute on the blender object, which is all that is needed for "rehydration". MolecularNodes/molecularnodes/io/parse/star.py Lines 6 to 46 in 12fb08d
|
So it is not possible, to store an additional list? |
Edit: ahhh, I misunderstood. |
These are geometry nodes attributes. I thought this was about setting attributes of a blender object/data-block, which in blender are called ObjectProperties. https://docs.blender.org/api/blender_python_api_current/info_quickstart.html#custom-properties |
Blender can be very particular about extra things you can assign to blender objects. You can assign some arbitrary python-defined things like dictionaries, but more complex python objects like numpy arrays will cause a hard crash. # blender object (bob)
bob = bpy.data.objects['Default Cube']
bob['anything'] = {'hello': 'world'}
bob['a_list'] = ['foo', 'bar', 'baz'] More 'officially supported' options are any of the These 'arbitrary' properties can be used inside of python, but they can't reliably be displayed in the UI as they are just python objects and not 'official' blender properties (which can be displayed / interacted with via the UI). For setting information on the 3D objects themselves (for each vertex etc) you can use the |
Please note that this is only a rough suggestion and that there is still a lot of room for improvement. Above all, it is intended to show that it is possible to streamline the workflow. It is possible to create the same
The abstract The idea is, that the At this point, I've just restructured your code and chopped it up a bit to show what I want to show. For the more concrete implementation of how the I am looking forward to your opinion. |
Good morning @BradyAJohnston, I would like to continue working on improving the MoleculeInBlender class. After I have fully integrated the MDA session, I would like to add more molecules to the framework. However, I have some questions:
If yes:
MolecularNodes/molecularnodes/io/parse/mda.py Line 575 in ccb6a64
|
I think the idea is solid - but lets not rush the implementation. Have you spent some time with the add-on, using Blender through the GUI? If not - I suggest that you spend some time playing around with Blender itself, and go through some of the existing documentation around Molecular Nodes to create some 3D renderings. While the GSoC project will mostly be focused around implementing better integration with MDAnalysis, it's important to understand what quirks and limitations we have to work around when dealing with Blender and the fact that we are an add-on for Blender first, and a python package second. The line you are referencing makes the newly created object to be selected, once it is imported to Blender. This is an important step when using Blender through the GUI. It might also be a good idea to tinker with creating a very simple add-on for Blender as well, as a way to familiarise yourself more with how Blender's API works. There are lots of YouTube tutorials and documentation around doing that. It'll take me some time (which I don't have a lot of currently) to go more over the proposed new implementation. |
Sorry, I didn't mean to bother you either. I have already experimented with the add-on in Blender. But it seems to me a reasonable idea to write an Add-on myself to better understand the project. I have nothing to do until next Wednesday, so I wanted to get started because it's a major change as announced. I agree with you that it shouldn't be rushed, as the code has its pitfalls. Here is an example of the current functionality: The The implementation is by no means presentable yet, as I understand more each time I look at the code and work with it. In addition, the class currently still supports a trajectory, but only plain molecules. However, this is only a minor extension, which is mainly related to the indexing of the |
Proposal for Issue #464
Changes:
Every annotation in the AtomArrayStack is dynamically set as an attribute to the molecule class. E.g. PDB(Molecule) has the extra field
sec_struc
.the handling of the molecule object remains the same, but the annotations, which are set as class attributes, can be used to easily create masks that can be applied to the blender object.
MoleculeInBleder class