Alembic CacheFile list of object_paths not available at creation

I stumble on a problem while trying to create CacheFile objects and assign them to MeshSequenceCache modifiers with an object path.
It seems the list of object paths (.object_paths property) is not available (empty) as soon as the CacheFile object is created, but some operations seem to trigger its evaluation.

here is my code (with paths placehodlers):

# check if CacheFile already exists (to avoid duplicates)
if '' not in
    # create the CacheFile object'/path/to/')

# get the CacheFile by its name
cf ='')

# for each selected objects
for obj in bpy.context.selected_objects:
    # create or get existing MeshSequenceCache modifier
        msc_mod = next(mod for mod in obj.modifiers if mod.type == 'MESH_SEQUENCE_CACHE')
        msc_mod ='MeshSequenceCache', type='MESH_SEQUENCE_CACHE')

    if msc_mod is None:
        # if `None`, the current selection doesn't handle MeshSequenceCache, continue...

        # find the matching path in CacheFile.object_paths collection
        abc_path = next(op for op in cf.object_paths.keys() if op ==
        # if none found, continue...
        print('no alembic path matching {}'.format(

    # if a matching path has been found, assign the CacheFile and the path to the MeshSequenceCache modifier
    msc_mod.cache_file = cf
    msc_mod.object_path = abc_path

But my problem is that the 1st time I execute this loop, my CacheFile object is empty, and my selected objects don’t find their matching alembic path.
The second time I execute this, magically, the CacheFile has a list of object_paths.
There seems to be something that triggers the evaluation, and the generation of “object paths”, so I guess it’s certainly possible via the API, but I didn’t found it :frowning:

Do you know how I can trigger this evaluation ?
for the moment I am forced to do the operation in two steps, which is not very practical !


I’m still investigating… I found an interesting lead :

  • it seems it’s the creation of a modifier that triggers a “dirty” state in the current context :'MeshSequenceCache', type='MESH_SEQUENCE_CACHE')
  • if I call bpy.context.evaluated_depsgraph_get() once, just after creating a modifier, it somehow also evaluate the CacheFile object
  • more interestingly, the modifier can be any other mod. (e.g. “SOLIDIFY”), it also works.
  • if I only call bpy.context.evaluated_depsgraph_get() without creating a modifier (which may happen if all my selected objects already have their modifier) it doesn’t work :frowning:
  • neither when I create something else than a modifier ( I create a cube, call evaluated_depsgraph_get, doesn’t evaluate the CacheFile) this is actually wrong, and it doesn’t even require a call to bpy.context.evaluated_depsgraph_get() afterward, the CacheFile is loaded.

I think I don’t understand this API very well, some help would be greatly appreciated ! :slight_smile:

I just ran into this problem myself when trying to automate our alembic loading.
@poru Any chance you’ve found a solution for this yet?
I’ll continue down your road of trying to find a way to trigger the refresh.

sorry I can’t find my script back, but I ended up making a little function that did almost what I described, that is, creating an object as simple as possible (a cube if I remember, a modifier in the example above) to trigger the alembic object, then delete it.
I did not have so much time to do that script so I didn’t dig any further, sorry :slight_smile: