Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Add more keys for folder template data #362

Closed
wants to merge 1 commit into from

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Proposal of new keys available in folder dictionary.

Additional info

Added new keys under folder template data. First obvious is "type" where is folder type. Key "path" is just a folder path, "parent" is name of parent which is project if direct parent is folder, "parents" is what "hirarchy" was.

Any comments, ideas, confrontations welcommed.

@ynbot ynbot added size/XS type: enhancement Improvement of existing functionality or minor addition labels Apr 3, 2024
@iLLiCiTiT iLLiCiTiT changed the title Chore: Added more keys for folder template data Chore: Add more keys for folder template data Apr 3, 2024
@@ -399,6 +399,10 @@ def _fill_folder_data(self, instance, project_entity, anatomy_data):
"parent": parent_name,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be calling the function from ayon_core.pipeline.template_data.get_folder_template_data?

data = get_folder_template_data(folder_entity)
anatomy_data.update(data)

"path": path,
"type": folder_entity["folderType"],
"parents": hierarchy,
"parent": parent_name,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really use in having the parent data duplicated outside the folder key and inside?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say tha the data which are now in root of dictionary should be considered as deprecated with these changes.

Copy link
Contributor

@MustafaJafar MustafaJafar Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check I get it correctly.
these data in the screenshot should be considered as deprecated

image

which means:

  • {root[work]}/{project[name]}/{folder[parents]}
  • {root[work]}/{project[name]}/{parents}

@@ -411,13 +415,18 @@ def _fill_folder_data(self, instance, project_entity, anatomy_data):
if hierarchy:
parent_name = hierarchy.split("/")[-1]

folder_name = instance.data["folderPath"].split("/")[-1]
folder_path = instance.data["folderPath"]
folder_name = folder_path.split("/")[-1]
anatomy_data.update({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we implement get_folder_template_data in a way that it calls e.g. get_folder_template_data_from_values(folder_path, folder_type, project_name) then also here we could re-use the implementation of ayon_core.template_data.get_folder_template_data_from_values to ensure each of these end up using the same function instead of duplicating the code everywhere that seem to define these template data. Preferably there's one entry point to this. that returns the valid data - instead of having this duplicated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we focus more on the data keys?

Copy link
Collaborator

@BigRoy BigRoy Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better then to first fix the duplication of logic in a separate PR which would make the size of this PR change much smaller since there's much less to change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this PR to raise discussion about the keys....

Comment on lines +404 to +405
"parent": parent_name,
"parents": hierarchy,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think it's confusing that "parent" includes the project name if there are no parents for the folder but parents never includes the project name.

We could keep e.g. hierarchy to be what it was (all parents excluding project) and add parents to be {project_name}/{hierarchy} so that parent makes sense again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree that if parent can be project name then parents are confusing. My thinking was that hierarchy should probably contain the folder name too, but maybe you're right.

Ad. "parent" I don't remember why the project name is used? I do remember there was a discussion but don't remember why we chose this approach?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that hierarchy should probably contain the folder name too, but maybe you're right.

Kind of had the same - but by having {hierarchy} separate from the folder name itself you can actually use them separately, plus if they were combined then you'd just have folder[path]? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on having hierarchy as "hierarchy within the project" - so without project name and without folder name. parents should be basically dirname(folder[path]) and parent direct ancestor of the folder?

MustafaJafar
MustafaJafar previously approved these changes Apr 4, 2024
Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool it works on my side. I used it with this Houdini feature that uses template data.

I think we should update Available template keys

image

@kalisp
Copy link
Member

kalisp commented Apr 5, 2024

Is there matching update of documentation (most likely https://ayon.ynput.io/docs/admin_settings_project_anatomy/#available-template-keys)?

@jakubjezek001
Copy link
Member

Is there matching update of documentation (most likely ayon.ynput.io/docs/admin_settings_project_anatomy/#available-template-keys)?

I am guessing that once the proposal will turn into implementation then yes it will need to have that step.

@iLLiCiTiT iLLiCiTiT dismissed MustafaJafar’s stale review April 30, 2024 08:41

This is proposal PR

@iLLiCiTiT iLLiCiTiT marked this pull request as draft April 30, 2024 08:41
@iLLiCiTiT
Copy link
Member Author

Created PR adding "type" and "path" #445 .

@iLLiCiTiT
Copy link
Member Author

iLLiCiTiT commented Aug 12, 2024

Closing. Keys type and path were already added. Key parents is in progress, but did hit few issues. And seems like nobody likes parent key to be under folder.

@iLLiCiTiT iLLiCiTiT closed this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants