Delayed persistant write for use of persist=True CachedBLProperty in write-restricted hot-paths #16

Closed
opened 2024-05-04 17:01:23 +02:00 by so-rose · 0 comments

In Blender, one generally cannot write to bpy.types.Property inside of particular "write-restricted" hot-paths. This isn't a bad thing; it protects from nuanced thread-related bugs.

Unfortunately, we structure our CachedBLProperty code such that persistance caching happens in __get__.

Practically, this means that any property we want to be able to access from a draw() method cannot be persisted. This is rather unfortunate, but so far, not really a deal breaker. It would be a very nice breath of fresh air to get it fixed, though; finally make peace with the mass-recomputation-on-startup that challenges so many assumptions at once (some of which may, in valid ways, not quite still be the same as when they were saved).

Some ideas could include:

  • Cache in __set__: This presupposes that absolutely no write happens without going through __set__. This may be harder than at first glance.
  • Delayed Write: Store an indicator that a property should be persisted whenever convenient, and implement using various handlers. This feels enormously unclean.
In Blender, one generally cannot write to `bpy.types.Property` inside of particular "write-restricted" hot-paths. This isn't a bad thing; it protects from nuanced thread-related bugs. Unfortunately, we structure our `CachedBLProperty` code such that persistance caching happens in `__get__`. Practically, this means that any property we want to be able to access from a `draw()` method **cannot be persisted**. This is rather unfortunate, but so far, not really a deal breaker. It would be a very nice breath of fresh air to get it fixed, though; finally make peace with the mass-recomputation-on-startup that challenges so many assumptions at once (some of which may, in valid ways, not quite still be the same as when they were saved). Some ideas could include: - **Cache in `__set__`**: This presupposes that absolutely no write happens without going through `__set__`. _This may be harder than at first glance_. - **Delayed Write**: Store an indicator that a property should be persisted whenever convenient, and implement using various handlers. _This feels enormously unclean._
so-rose added the
bug
enhancement
abstractions
labels 2024-05-04 17:01:23 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: so-rose/blender_maxwell#16
There is no content yet.