Open dmo-j-cube opened 2 years ago
Host: FTrack?
I believe the same create button is present in the Project Manager as Create Starting Folders so this shouldn't be necessarily tied to a an implementation like Ftrack.
For future reference, this also came up on OpenPype discord here.
With multiple roots defined what __project_root__
would you have it expected to take? Since it doesn't know it assumes all created roots.
I believe __project_root__
is the older deprecated way of doing this (from back when there was only ever one root) and instead it's recommended to use {root[work]}
and explicitly state what root you would like it to use. The __project_root__
will assume all available roots (and only returns the ones of which the path exists.)
tl;dr
Try {root[work]}
instead of __project_root__
(older; see backward compatibility notice)
One could argue that if that works, that potentially {root[work]}
is a more sensible default value than __project_root__
for the starting folders.
This is archaic part of code that I believe doesn't use anatomy at all. We've known for a while that it should be re-written, made completely separate from ftrack, we just never got to it.
This was really only used for simple scenarios of setting up the first few folders and never received a whole lot of love afterwards. I'd say it also needs a bit of discussion about what it's responsibilites should really be. @iLLiCiTiT has been bringing this up in the office repeatedly actually, but it tends to slip down priorities as it's used so little.
It should be able to format against this data when looking at the code.
Because create_project_folders
- fills the paths which formats against that format data. Since anatomy.roots
is a Roots
instance it should allow indexing by key like {root[work]}
.
So this example should work:
{
"{root[work]}": {
"prod": {},
"resources": {
"footage": {
"plates": {},
"offline": {}
},
"audio": {},
"art_dept": {}
},
"editorial": {},
"assets": {
"characters": {},
"locations": {}
},
"shots": {}
}
}
Untested - but I don't see a reason in the code why it should fail to do so. Of course my snippet assumes you have a root defined that's named "work" - which should be there by default.
Describe the bug When you have multiple roots in your project anatomy (eg: publish, work, render), and click on
Create Project Structure
in FTrack's webUI, you will get repeated nested directories created in your folder. Example with ProjectName=Blah
and 3 roots:To Reproduce Steps to reproduce the behavior:
Default
:project_anatomy/roots
, eg:work
,render
,publish
Blah
) and follow OP's instructions for initial setupCreate Project Structure
Expected behavior Only a single set of directories should be created.
Desktop (please complete the following information):
Additional context I tried to track the issue down to
openpype/lib/path_tools.py
, inconcatenate_splitted_paths()
, in the __project_root__ section, the first element ofclean_items
is replaced with two items for everyanatomy.roots
item. This means that the secondanatomy.roots
iteration will contain two{project[name]}
elements, and the third iteration will contain 3, etc.A suggested fix would be to make a local copy of
clean_items
in that for loop, and use that cleanly on each iteration, similar to the attached patch file.The attached file also contains the dump of the variables
split_paths
&anatomy
toconcatenate_splitted_paths():
.OpenPype_FTrack_Mutliple_Roots.zip
[cuID:OP-3762]