Dynamic file name in schema

is it possible to have files in the core/schema with dynamic file names the same way dynamic folders work?

I would like to have some default files setup for certain tasks so we do not have to start from scratch in certain situations. I would like these files to behave as dynamic folders do and get the shot and/or task name when created.


Hey Mael

Welcome to the forums, and good question!

Our folder creation process doesn’t support dynamic naming of files, unfortunately, in the same way that folders are handled. I’ll submit an idea on your behalf here.
You could potentially implement dynamic naming of files through the process_folder_creation.py core hook.

It’s not very pretty but I tested something here which seems to work, but I can’t really vouch for its robustness.

I added a file to my schema with {entity} in the file name:

Then I added the following here.

        current_entity = None

            # loop through our list of items
            for i in items:
                # get and store the current entity, so it can be used to name files that are children of the entity folder.
                entity = i.get("entity")
                if entity and entity["type"] in ["Asset", "Shot"]:
                    current_entity = i["entity"]

And the following here.

                    # dynamically rename the file based on the entity name gathered from an earlier item
                    # in this item loop.
                    if current_entity and "{entity}" in target_path:
                        target_path = target_path.replace("{entity}", current_entity["name"])

Which resulted in:

The reason for this slightly strange approach is that the item doesn’t know the context, so the only way I could find the entity name was to store it as it looped over the items. Since it creates the folders in the order of root to leaf, you can gather the entity before it gets to create the file, assuming the file is in a child folder of a dynamic entity folder.


Hello, any update for dynamic file naming when saving files in nuke/maya?


1 Like

No unfortunately not, our focus on the integrations side has been mostly on Python 3 support at the moment.

1 Like