entities.Ensemble
entities.Ensemble(file_path)Attributes
| Name | Description |
|---|---|
| instance_collection | The instances of the ensemble. |
| props | The custom Blender properties for the molecule object. |
Methods
| Name | Description |
|---|---|
| create_asset_nodes | Create asset nodes for the entity object. |
| create_object | Create a 3D object for the ensemble. |
| get_view | The world-space positions of the geometry this entity renders. |
| load | Load an ensemble from a file and create its 3D object. |
| set_frame | Update the underlying data to correspond to changes in the scene frame. |
create_asset_nodes
entities.Ensemble.create_asset_nodes()Create asset nodes for the entity object.
This creates Select and Color nodes for each property combination. Chains, entities, and segments have nodes created for them if they have IDs. Nodes are created and registered as assets for the current Blender session so they can be added through drag-to-search in the node editor.
create_object
entities.Ensemble.create_object(name='NewEnsemble', node_setup=True)Create a 3D object for the ensemble.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | The name of the model, by default “NewEnsemble” | 'NewEnsemble' |
| node_setup | bool | Whether to setup nodes for the data and instancing objects, by default True | True |
Notes
Creates a data object which stores all of the required instancing information. If there are molecules to be instanced, they are also created in their own data collection.
get_view
entities.Ensemble.get_view()The world-space positions of the geometry this entity renders.
Read from the evaluated geometry, so these are the points actually drawn rather than the data they were built from, and they do not go stale between depsgraph updates.
Pass to look_at to frame them. Views from several entities can be combined with + to frame all of them at once.
load
entities.Ensemble.load(file_path, name=None, node_setup=True)Load an ensemble from a file and create its 3D object.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| file_path | str or Path | The path to the ensemble file, such as a CellPack .cif/.bcif model or a RELION/cisTEM .star file. |
required |
| name | str or None | The name to give the created object. If None, the file name is used. | None |
| node_setup | bool | Whether to set up the geometry nodes for the ensemble, by default True. | True |
Returns
| Name | Type | Description |
|---|---|---|
| Ensemble | The loaded ensemble, with its data and 3D representation created. |
set_frame
entities.Ensemble.set_frame(frame)Update the underlying data to correspond to changes in the scene frame.
This method should be implemented by subclasses to update the entity’s data based on the given frame number. This can include updating positions and performing other necessary calculations.
Args: frame (int): The frame number to update the entity’s data to.
Raises: NotImplementedError: If the method is not implemented by a subclass.