-
Notifications
You must be signed in to change notification settings - Fork 91
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
Change BlenderObject lookup #687
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #687 +/- ##
==========================================
+ Coverage 71.85% 72.20% +0.35%
==========================================
Files 65 65
Lines 4661 4731 +70
==========================================
+ Hits 3349 3416 +67
- Misses 1312 1315 +3 ☔ View full report in Codecov by Sentry. |
only when run with all other tests, I fucking hate it here
The tests are all passing on GHA but the final tests related to trajectories fail on my local machines. When running the individual tests with |
The tests pass on local machine if running tests in a uv venv python=3.11
source .venv/scripts/activate
uv pip install -r pyproject.toml --all-extras
uv pip install -e .
uv run -m pytest |
I just nuked all installed & development add-ons, now the tests pass locally. Also did some tweaking. Will come back to this after I've had some time away, what a waste of 1.5 days. |
BlenderObject
and thusMolecularEntity
references to blender's objects are tweaker to just use a name (and potentialy.uuid
backup reference) instead of reference to the actualbpy.data.objects['oject']
data block.The Problem
Previously the
BlenderObject
/MolecularEntity
had the propertybob.object
which returned the object in Blender's database that was linked to this entity. This was previously stored as the actual reference to the object itself. This was bad because sometimes that object would change in Blender's database and we would lose connection. This could be re-established with theobject.uuid
custom property defined. If the connection was lost we would just loop through all objects in the database for something with that uuid and re-establish the connection.This didn't work well with pickling though, as
bpy.data.Object
couldn't be pickled.The Solution
References to objects, collections, and other components of Blender's database are instead stored as a string of their name. This way every time we want to access the
object
it queries the database for the object. This fails if objects are renamed, because there is no deeper reference to the objects inside of Blender that we have access to, so with thebpy.types.Object.uuid
property, we can do the same as previously and just iterate through the database looking for our match.