Folder named "project" in schema

Is it possible to have a static folder named the same as a dynamic parent folder which is used to define context / templates from the path?

For example, is it possible to have a folder named “project” under them main root folder? For a project called “pipe”, it would be /projects/pipe/project/. Under that folder would be a custom entity, “Project Entities”, which will be entities with tasks that don’t link to any asset, shot, etc., but rather to the project itself (such as script, developmental work, full show ridethroughs, etc.)

I’ve tried two ways, each with an error. First method: create a static folder called “project” in the schema, with a dynamic “project-entity” folder underneath (same setup as Assets, Shots, etc.). But those dynamic folders throw an error when they look for the parent “$project”, which are called for in project-entity.yml, saying project.yml is missing. It’s not missing, it’s above the static “project” folder, but toolkit throws an error when it hits the static folder. Is it possible for those dynamic folders to skip this static “project” folder and find the dynamic “project.yml” above it, which resolves to “pipe”? I’ve tried, among other things, adding the following to project-entity.yml:

associated_entity_type: Project

But it does not help. The error is thrown on any folder creation, like opening software. No folders are created. All necessary paths in templates.yml do match the schema.

The second method is to bring the project-entity folder to the top level (removing the static “project” folder), and adding a folder to the project-entity.yml name:

name: "project/{code}

This actually works well: folders are created and software opens correctly. However there is some sort of local sync issue where i have to run the tank command

tk.synchronize_filesystem_structure(full_sync=True)

on each local machine whenever a new Project Entity is created. After that’s run, it works.

This sync issue has something to do with the “project” folder name. If i change the folder name to something else (and update templates.yml to match), like:

field_name: "project1/{code}

Everything works fine and no sync is needed.

So yes, one simple option is to just choose a different folder name. But I want to know if there is a way to solve the issue and use that folder name.

Thanks

2 Likes

Hi Steve –

This should work out of the box, and I’m not sure why it’s not. Sequence works pretty much the exact same way in the Default Config:

You have <PROJECT>/sequences/<SEQUENCE>, where sequences is a static folder, and sequence.yml has a filter that refers to $project. And it works fine.

So I suspect there’s something else at play here. As a first test, I’d try changing the name of the static folder to something less controversial, like common, and see if it still errors. If so, you’re right, and we’ve hit a limitation of the schema system.

If not, can you share the contents of project-entity.yml and the exact error you’re seeing? I’d be curious to know those details.

As a final note, I’ve found that you hit snags down the line if you name folders after the display name of CustomEntities like project-entity, as opposed to the actual system name, like CustomEntity04 or whatever it is. You might want to take a look at the Toolkit Basics Guide on Filesystem Configuration – it goes through a working example of adding a CustomEntity folder to your schema.

Let me know what you find!

2 Likes

Thanks Tannaz,

You have <PROJECT>/sequences/<SEQUENCE> , where sequences is a static folder, and sequence.yml has a filter that refers to $project . And it works fine.

In this case, the <SEQUENCE> dynamic info is below the static sequences folder, so toolkit finds the dynamic folder before the static one when traversing upward. For the project issue, the <PROJECT> dynamic folder is above the static project folder, so the static folder seems to be blocking access to it. See error below.

For project, as you suspect, changing the name to something like common or projects allows everything to work fine. I’ll probably go with show for the folder name here, though project is a bit more accurate (since some projects may not technically be shows). It’s no problem changing the name of the folder to something that works, but after spending time trying to figure out the issue, I just wanted to see if anyone had come across it or could point out something I was missing.

Thanks for the note about the CustomEntity folder names, makes sense. I’ll update that.

Here’s the error I get when the static folder (which has no associated .yml) is named project:

“Could not create folders on disk. Error reported: %s” % err
TankError: Could not create folders on disk. Error reported: Error resolving filter expression [{‘path’: ‘project’, ‘values’: [‘$project’], ‘relation’: ‘is’}] in Q:\pipelines\shotgun\workspaces\stavernia\sgtk-config\core\schema\project\project\project-entity.yml: Static folder objects () cannot be used in dynamic folder expressions using the “$” syntax. Perhaps you are missing the project.yml file in your schema?

project.yml does exist at the root (above the static project folder), and hasn’t been changed from default.

Here’s the project-entity.yml. I took out the comments because the text was obnoxiously large.

type: “shotgun_entity”

name: “code”

entity_type: “CustomEntity24”

skip_unused: true

create_with_parent: true

filters:
- { “path”: “project”, “relation”: “is”, “values”: [ “$project” ] }

Again, thanks for checking. I’m cool with renaming the static folder, but let me know if you find anything.

1 Like

Hi,

just a quick thought: it looks like an ‘override of built-in stuff’ error for me. As you mentioned, using something else than ‘project’ makes the thing work so my guess would be that this is hardcoded and somewhat protected.

4 Likes

Hey just a word of warning. I would avoid using the create_with_parent:true unless it is going to result in minimal folders being created.

It maybe better to specifically create the folders for your CustomEntity24 entities, via other methods:

2 Likes

I’ve just had a look into recreating the folder setup you were after. I’ve attached my schema here:
schema.zip (56.2 KB)

As you noted having a static folder called project inside the project root folder was causing issues, due to the way the entity folder’s filters were looking up the value for $project.
To get around this and still have a static project folder inside the root, I renamed the root folder itself from project to project_root and then updated all the filters inside the yaml files to have - { "path": "project", "relation": "is", "values": [ "$project_root" ] } instead.

Then it created the folders correctly. Hope that helps?

Cheers
Phil

2 Likes

Thanks for looking into that Philip, very helpful!

2 Likes