Page MenuHome

Cache loading via animation system
Confirmed, NormalPublicDESIGN


Currently the Cache Sequence modifier is used for loading geometry data from Alembic files, and the Transform Cache constraint is used for loading transformation data. This approach poses a few limitations:

  • A modifier is either generative or deforming, whereas the Cache Sequence modifier is both (depending on the particular frame-to-frame changes in the Alembic file).
  • Non-mesh geometry data (like curves) are troublesome to load, as the modifier system can only produce an evaluated mesh (T51311).
  • Non-geometry, non-transform properties, if loaded at all, are loaded at import time, but after that are static (T54050, T50725). This can be solved by having per-property F-curve modifiers (D2324), but this is cumbersome and unintuitive to handle.

This task proposes a new approach, adding a 'cache' step to the AnimData struct. If set, cached data would be loaded by the animation system first, before applying F-curves and drivers as usual. This would allow the cache loader to influence properties in a more general way:

  • It's a new system, so no pre-existing separation between 'generative' and 'deforming'.
  • Any ID datablock that supports animation can use this, so no distinction between mesh and non-mesh geometry.
  • Any property can be animated.

I'll study the current animation system, and then update this task with more technical details on how to approach this.

Event Timeline

Sybren A. Stüvel (sybren) lowered the priority of this task from 90 to Normal.Aug 22 2019, 12:03 PM
Sybren A. Stüvel (sybren) created this task.

I don’t even think you'd need to care about RNA here, it could work directly on DNA (unless we want to expose the 'cache reader' system to python, but I would not go that way tbh, we already do not want to allow python-defined modifiers, so...).

Thing is, unlike the rest of the animation system, you need nearly no user input for that, people just select a 'cache source' (probably some path?), the cache reader type, and everything else is handle automatically based on what's inside the cache.

I'm all in favour of keeping things simple, so I'll update the task description for this.

UI-wise I think it would be a good idea to show that a property is driven from a cache, in the same way that it's now shown that something is animated with an f-curve or a driver. I don't know how this happens currently, but I think that this would at least require some exposure to RNA.

UI-wise I think it would be a good idea to show that a property is driven from a cache, in the same way that it's now shown that something is animated with an f-curve or a driver.

From a user's perspective: Since the animation comes from a separate file, I think it would make sense if the UI for this was like linked data (greyed out), and overriding cache animation would look like overriding linked data (currently this is a shade of light blue). Maybe there should be something to visually distinguish which file-type is producing the animation data (blend or alembic, eventually vdb and usd, too), but maybe it's best to have it all look the same, to encourage hybrid pipelines. If abc and etc. look and feel like native Blender data (in the UI), it will be easy to convince people to adopt it into their pipeline, since they already use those other formats.

As an avid Python programmer, I'm curious about the costs and benefits of adding Python/RNA support to this proposed animation cache system. I can't think of any reason to do so.

I just found out about this task/idea after trying to update D2324. One thing to note about D2324 (and any other potential system) is that the properties are read from a CacheFile whose evaluation is inside the dependency graph so we have to be able to set a relationship from the object (or ID) to the CacheFile. Now, D2324 does not work anymore for this very reason: there does not seem to be a way yet to set this dependency through the F-Curve Modifier's API (unless I missed something), therefore we do not have a valid CacheFile handle to read the data from because the object might be evaluated before the one for the CacheFile, and it is simply crashing.

Sorry, I'm trying to wrap my head around this proposal. From my time working with Alembic, I found that there was essentially 3 cases that Alembic handled.

  1. Shape data - Meshes, curves, and probably one or two others that I'm missing.
  2. Required attributes - Attributes such as translate x/y/z, camera FOV, etc.
  3. Custom attributes - Attributes such as ones on meshes that are driven by a rig and used to control shaders on the lighting asset.

If I understand correctly, this proposal handles both types of attributes, but I'm not sure how it will handle shape data.

Also, let me know if there's somewhere in the Alembic support improvements where I can lend a hand.