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

Move 'Selections' attributes to lookup from actual selection items #713

Open
BradyAJohnston opened this issue Jan 14, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@BradyAJohnston
Copy link
Owner

BradyAJohnston commented Jan 14, 2025

Currently the Selection class has attributes such as selection_str which are stored on the class / object, but are then also represented inside of Blender on the SelectionItem object. Currently some work has to be done to keep the two in sync.

The same approach which is now down for object names, should be done with these as well, where the representation inside of Blender are the 'Single Source of Truth' and the when accessing / setting inside of python / API, they just interact with the actual SelectionItems themselves.

traj.add_selection('protein', name='sel_1')
traj.selections['sel_1'].selection_str # this should just lookup the value from within Blender rather than store it inside of the class
traj.selections['sel_1'].selection_str = 'name CA') # update the value inside of Blender and not store it anywhere inside of the class

Potential porblems are an infinite loop where updating the properties inside of Blender updates the class, which updates the property which updates the class. Solution will be to have a secondary hidden set method on the class that can be used for updating when the property is updated, but doesn't then trigger everything again.

@BradyAJohnston BradyAJohnston added the enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant