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

Add simple Create Project Structure launcher action #679

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

BigRoy
Copy link
Collaborator

@BigRoy BigRoy commented Jun 20, 2024

Imp for AY-5076

Changelog Description

Add simple Create Project Structure launcher action.

image

Which creates the folder structure as defined in project settings: ayon+settings://core/project_folder_structure

image

Additional info

It currently only shows when you're in a project in the launcher but have NO folder or task selected to avoid clutter in launcher.

The label unfortunately is a bit too long to be nicely displayed by default, see screenshot. Any ideas for better icon and shorter label that doesn't get cut off?


This feature request came up a few times:

Testing notes:

  1. Update core addon
  2. Run the launcher action when you enter a project.
  3. Folders should now be generated as per settings.

@ynbot ynbot added size/XS type: enhancement Improvement of existing functionality or minor addition labels Jun 20, 2024
@BigRoy BigRoy requested a review from iLLiCiTiT June 21, 2024 07:39
@alainxi
Copy link

alainxi commented Jun 21, 2024

Any ideas for better icon and shorter label that doesn't get cut off?

Your icon choice is already very good.

Shorter labels : The "disk" concept is important, to avoid confusion with the project's folder structure in database. Ideas :

  • Add disk proj struct
  • Add proj struct on disk
  • Create Project Structure (the current label, but with a different icon : mdi.harddisk-plus or mdi.harddisk )

@LiborBatek
Copy link
Member

I can think of these names:

Create Dir
Create PRJ
Project Dir

@BigRoy
Copy link
Collaborator Author

BigRoy commented Jun 28, 2024

I think maybe it's also worth discussing whether it might be nice to shrink the font sizes just a tad there to ensure there's less cut off. I often see it on other applications as well - which may fix the chosen names here as well?

@iLLiCiTiT what do you think?

Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

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

Took me a while to realize its not pre-creating the folders from the Project browser/editor but by Ayon Core definition (as mentioned in testing steps:) but after that small confusion all working fine...LGTM

image
they obviously been matching

@LiborBatek
Copy link
Member

@BigRoy btw what happens if user trigger Create Project... if those already existing?? I hope it will just skip the creation :) ?

@BigRoy
Copy link
Collaborator Author

BigRoy commented Jun 28, 2024

@BigRoy btw what happens if user trigger Create Project... if those already existing?? I hope it will just skip the creation :) ?

Not sure - since I didn't implement that code myself. But I suspect it would just generate the folders on disk that currently do not exist yet - so if you've adjusted your studio settings to have new folders in the template - then those get added.

Are you afraid to click the button? If so, what is making you scared and what could we do to make it feel less scary? A tooltip? A pop-up before the creation? (Like a confirmation? Which might make it feel more scary even?)

@LiborBatek
Copy link
Member

@BigRoy btw what happens if user trigger Create Project... if those already existing?? I hope it will just skip the creation :) ?

Not sure - since I didn't implement that code myself. But I suspect it would just generate the folders on disk that currently do not exist yet - so if you've adjusted your studio settings to have new folders in the template - then those get added.

Are you afraid to click the button? If so, what is making you scared and what could we do to make it feel less scary? A tooltip? A pop-up before the creation? (Like a confirmation? Which might make it feel more scary even?)

yeah, some popup would do! informing user whats gonna happen...

@LichiMan
Copy link

LichiMan commented Jul 9, 2024

Thanks a lot for this @BigRoy , this is one of the things I was missing from our current pipeline while testing Ayon.

In our current pipeline we always have a folder called 00_MATERIALS where we save a lot of stuff in different subfolders like audio, references (with more subfolders), logos, client_material...

The production team is who usually save there all the material and they need to have the folder structure created to start copying files.

Now my question. As far as I know you can setup the folder structure in ayon+settings://core/project_folder_structure but there's no way to create these folders automatically before this PR, but if you setup a folder structure in that Ayon setting it's because you want it. So, shouldn't this folder structure be created automatically when you create a new project with that Bundle instead of have to go the the Launcher and click on this icon?

Of course, this is just for that folder structure setting and not for the whole folders/tasks you define inside the Project Settings.

@BigRoy
Copy link
Collaborator Author

BigRoy commented Jul 9, 2024

Thanks a lot for this @BigRoy , this is one of the things I was missing from our current pipeline while testing Ayon.

In our current pipeline we always have a folder called 00_MATERIALS where we save a lot of stuff in different subfolders like audio, references (with more subfolders), logos, client_material...

The production team is who usually save there all the material and they need to have the folder structure created to start copying files.

Now my question. As far as I know you can setup the folder structure in ayon+settings://core/project_folder_structure but there's no way to create these folders automatically before this PR, but if you setup a folder structure in that Ayon setting it's because you want it. So, shouldn't this folder structure be created automatically when you create a new project with that Bundle instead of have to go the the Launcher and click on this icon?

Of course, this is just for that folder structure setting and not for the whole folders/tasks you define inside the Project Settings.

It's a good question - but admittedly with site sync a project may be accessible from multiple locations and thus may have already been existing before that 'creation'. Also the project creation may happen in any variety of ways, yes currently most likely is the ayon-frontend triggering this but it may even be automated by the API or e.g. occur due to syncing from kitsu, ftrack or shotgrid/flow (which you may not want to automatically flood a local directory with project folders or not). Also, what if a producer just happens to create a project using the web frontend without access to the physical storage | what would create the project folder and files where?

Anyway, nothing is holding anyone from triggering e.g. this logic anytime the AYON Tray Launcher starts up or whatever - I'd just say that from my perspective I don't think I'd recommend that.

Do note that potentially soon using Web Actions from the front-end it may be possible to trigger an action like this from the web front-end, not requiring to do it via the Tray Launcher UI.


Additionally, having it accessible as a callable action does allow you to update the template in settings, and re-run it again if you happened to have changed the template.

@LiborBatek
Copy link
Member

I have done one more test run to see what happens if those folders are already present and filled with some content...

The good is, even when re-triggering this Create Proj action nothing happens aka no deleting or similar destructive action.

However still missing that popup info message what are you about to do.... @BigRoy any chance you incorporate it? :)

@LichiMan
Copy link

It's a good question - but admittedly with site sync a project may be accessible from multiple locations and thus may have already been existing before that 'creation'. Also the project creation may happen in any variety of ways, yes currently most likely is the ayon-frontend triggering this but it may even be automated by the API or e.g. occur due to syncing from kitsu, ftrack or shotgrid/flow (which you may not want to automatically flood a local directory with project folders or not). Also, what if a producer just happens to create a project using the web frontend without access to the physical storage | what would create the project folder and files where?

Anyway, nothing is holding anyone from triggering e.g. this logic anytime the AYON Tray Launcher starts up or whatever - I'd just say that from my perspective I don't think I'd recommend that.

Do note that potentially soon using Web Actions from the front-end it may be possible to trigger an action like this from the web front-end, not requiring to do it via the Tray Launcher UI.

Additionally, having it accessible as a callable action does allow you to update the template in settings, and re-run it again if you happened to have changed the template.

Yes, it makes sense.

I'm still don't know how Web Actions will work but it sounds like a nice way for doing this, better than the Tray Launcher as everything stay in the web front-end, IMHO.

@BigRoy BigRoy self-assigned this Jul 29, 2024
@BigRoy
Copy link
Collaborator Author

BigRoy commented Jul 29, 2024

@iLLiCiTiT any preference where to go from here aside of the icon and label cosmetics?

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Aug 2, 2024

any preference where to go from here aside of the icon and label cosmetics?

Not from my point of view. Code is ok.

The question is, if it is "pipeline ok". Not sure if any artist should be able to run the action?

@krishnaavril
Copy link

The question is, if it is "pipeline ok". Not sure if any artist should be able to run the action?

Or should the option be like, select the folders/shots on the left pane and choose the option!?
even creating all the folders by artists is also okay, there is no harm I believe, anyway production already carefully adds the shots in ayon web. We are waiting for this option, everytime when we wanted to paste something inside shots its manual, I think this helps a lot

@BigRoy
Copy link
Collaborator Author

BigRoy commented Sep 2, 2024

Just commenting that I'm not working on this currently - so it may be stale until there's more details on how to best proceed with this? I believe Web Actions might take precedence on this and 'replace' it? But maybe @LiborBatek 's comment here is still relevant if there is a time and place for having this also directly in launcher.

@iLLiCiTiT so FYI - I'll hold of changes to this until there's a clear route of action.

@MustafaJafar MustafaJafar self-requested a review September 9, 2024 08:37
@MustafaJafar
Copy link
Contributor

MustafaJafar commented Sep 9, 2024

For the first glance when I read the PR's description (sorry if it was mentioned before) I had these thoughts:

  • What will happen if the ayon+settings://core/project_folder_structure doesn't match my actual project structure in the project editor ?
  • What should be the source of truth for the folder creation ?

@alainxi
Copy link

alainxi commented Sep 9, 2024

For the first glance when I read the PR's description (sorry if it was mentioned before) I had these thoughts:

  • What will happen if the ayon+settings://core/project_folder_structure doesn't match my actual project structure in the project editor ?
  • What should be the source of truth for the folder creation ?

I think "Create Project Structure" (on disk, for assets that are not handled by Ayon) should follow "ayon+settings://core/project_folder_structure".

It's really different from the Logical structure (in Editor), which is only for Ayon managed stuff.

Look at Jakub's message on that matter (a year ago) :

This particular settings is at wrong place even in OpenPype...

The same settings are used for 2 features:
1 : Create default folder structure (on disk)
2 : Create default project hierarchy (in project manager)
Which usually cause many troubles..

Found here :
https://discord.com/channels/517362899170230292/890894521817260052/1147160515576082552

@BigRoy
Copy link
Collaborator Author

BigRoy commented Sep 9, 2024

For the first glance when I read the PR's description (sorry if it was mentioned before) I had these thoughts:

* What will happen if the `ayon+settings://core/project_folder_structure` doesn't match my actual project structure in the project editor ?

* What should be the source of truth for the folder creation ?

AFAIK this is not at all about creating folders for "folder" entities or tasks, etc. It's to create generic folders for your project that you may want to populate for "a project". Like e.g. you may - out of the pipeline - have a static "resources" folder, or a static "documents" folder where producers maybe put in some stuff. Etc.

So it's more of a "Please just create me some standard folders for the project" that are not related to actual assets or shots.

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 works on my side.

But, there are few things to keep in mind:

  1. I can only find it if I've nothing selected in the launcher (which happens when selecting a project) but once I select a folder, I won't be able to unselect it. so I have to return and reselect my project.
  2. I wish if I can see the folders created reflected in the launcher view. and be able to use button Explore here.
  3. (irrelevant to this PR) when using the button Explore here on intermediate folders, it keep telling me Folder does not exist yet.
    image
    *** WRN: >>> { ActionsModel }: [  Action trigger FAILED.  ] 
    ==========================
    Folder does not exist yet.
    ==========================
    Traceback (most recent call last):
      File "E:\Ynput\ayon-core\client\ayon_core\tools\launcher\models\actions.py", line 405, in trigger_action
        action.process(selection)
      File "E:\Ynput\ayon-core\client\ayon_core\plugins\actions\open_file_explorer.py", line 26, in process
        path = self._get_workdir(selection)
      File "E:\Ynput\ayon-core\client\ayon_core\plugins\actions\open_file_explorer.py", line 94, in _get_workdir
        raise AssertionERROR("Folder does not exist yet.")
    AssertionERROR: Folder does not exist yet.

Anyways, I think this feature/enhancement may come lead to more suggestions/requests/complaints like mine above.

@LiborBatek
Copy link
Member

@krishnaavril this action is not intended as a substitution for creation of AYON driven project folders (assets, shots etc) but for additional folders predefined in the ayon-core settings ayon+settings://core/project_folder_structure (for resources like plates, footage, offline and other items production might need and to save those in a standard places)

@BigRoy as the confusion already happening I think we definetely should use different naming than Create Project Folders but refer more to Resources folders or similar.

@alainxi
Copy link

alainxi commented Sep 12, 2024

@LiborBatek

I agree we should use different naming than Create Project Folders, to avoid confusion.
For that, the "disk" concept is important.
Here are alternatives (very short ones, to not clutter GUI) :

  • Add disk proj struct
  • Add proj struct on disk

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Oct 2, 2024

@BigRoy @iLLiCiTiT @dee-ynput should we convert this to draft since it may be replaced by a web action?

@BigRoy
Copy link
Collaborator Author

BigRoy commented Oct 4, 2024

@dee-ynput could you answer the remaining questions:

  • What should be the label on the action? It must be short because as can be seen from the screenshot - it gets cut off. These have come up:
    Add disk proj struct
    Add proj struct on disk
    Create Project Structure (will be cut off after "Project...")
    Create Project Folders (will be cut off after "Project...")
  • What's a sensible icon to use. I think you can pick one from: https://fontawesome.com/v4/icons/
  • Should it pop up a confirmation dialog (maybe even explaining which folders would get created; it could even report if they already exist too) to avoid accidental clicks?
  • Should it appear for ALL users? Or just certain roles? (If so, which?)
  • Should it have a setting to enable/disable the action completely?

@dee-ynput
Copy link

dee-ynput commented Oct 4, 2024

Thanks for the summary @BigRoy!

  • What should be the label on the action? It must be short because as can be seen from the screenshot - it gets cut off. These have come up:

Let's match the setting name "Project folder structure", so: Create Project Folders.
The name being cut off indeed sucks, but that's something we'll fix at UI level (this limitation is a bummer for many other situations)

The sitemap icon kinda works. I could consider a simple folder icon or the hdd icon...

  • Should it pop up a confirmation dialog (maybe even explaining which folders would get created; it could even report if they already exist too) to avoid accidental clicks?

Let's add this later if requested 👍
(I do like it)

  • Should it appear for ALL users? Or just certain roles? (If so, which?)

I need to check with CS team, but worst case would be to have a setting to state if it's managers only or for artists too.

  • Should it have a setting to enable/disable the action completely?

Having the setting value empty should disable it.
It must be stated in the settings inline help / tooltip.

@ynbot
Copy link
Contributor

ynbot commented Oct 4, 2024

Task linked: AY-5076 Ayon: Folder creation

@dee-ynput
Copy link

@BigRoy
After reviewing the CS request:

  • Should it appear for ALL users? Or just certain roles? (If so, which?)

Let's do it for all users.
The restriction will be implemented if/when we move this to a proper web action 👍

@BigRoy
Copy link
Collaborator Author

BigRoy commented Oct 4, 2024

Let's match the setting name "Project folder structure", so: Create Project Folders.
The name being cut off indeed sucks, but that's something we'll fix at UI level (this limitation is a bummer for many other situations)

Done.

Unfortunately reads like this:

image

Having the setting value empty should disable it.
It must be stated in the settings inline help / tooltip.

Done.

image

The sitemap icon kinda works. I could consider a simple folder icon or the hdd icon...

I'll keep sitemap for now.

@BigRoy BigRoy requested a review from LiborBatek October 4, 2024 09:26
Comment on lines 303 to 308
title="Project folder structure",
description=(
"Defines project folders to create on 'Create project folders'."
" When empty, the action will be hidden from users in the"
" launcher because there is nothing to create."
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it will create the project structure in the setting.
but, could we be clear that it is an additional structure that is not necessarily related to the project structure in the project editor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean like adding "This does not create folder and task entities, but creates project folders on disk unrelated to any entity"? It seems quite long and verbose and still unclear too. Any ideas on how to explain it with less words and more correct?

Copy link
Member

@iLLiCiTiT iLLiCiTiT Oct 4, 2024

Choose a reason for hiding this comment

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

BTW it is still used for actions that actually do use this setting to create project folder structure, instead of folder structure on disk, e.g. in ftrack. That is in fact original purpose of these settings.

Copy link
Collaborator Author

@BigRoy BigRoy Oct 4, 2024

Choose a reason for hiding this comment

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

Yes - so you're saying it will not do anything there when empty but it will still be visible/shown as action (it does not get hidden there). Correct?

@dee-ynput thoughts? Is the tooltip just confusing then, or? Or we should start hiding the action there too in the future?

Copy link
Member

Choose a reason for hiding this comment

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

Yes - so you're saying it will not do anything there when empty but it will still be visible/shown as action (it does not get hidden there). Correct?

No, I'm saying that this setting is used for 2 features:

  1. Create folder structure in project.
  2. Create folder structure on disk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So this: 5065e0e

image

No idea how it formats it like this haha 🤦‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's why the "disk" word is important for the button name.
With "Create Project Folders", people will think it creates folder entities, and they will be surprised to discover it created disk structure.

@dee-ynput ? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean like adding "This does not create folder and task entities, but creates project folders on disk unrelated to any entity"? It seems quite long and verbose and still unclear too. Any ideas on how to explain it with less words and more correct?

I mean something like this.
imo, we may not add all of the that to the tool tip in favor of adding them to the documentation.

Defines project folders to be created when selecting 'Create project folders'. 

- If you use the exact same structure in the project editor, it will create all the folders.
- If you use a different structure, it will add them as additional directories.
- If the setting is empty, the 'Create project directories' action will be hidden from users in the launcher.

This setting is also used in ftrack addon to create both the folders on disk and the ftrack entities.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • If you use the exact same structure in the project editor, it will create all the folders.
  • If you use a different structure, it will add them as additional directories.

I personally don't understand these? Same structure to what? :)

Anyway, make a decision and I'll be happy to adjust accordingly - so we don't keep this lingering much longer.

Copy link
Contributor

@MustafaJafar MustafaJafar Oct 4, 2024

Choose a reason for hiding this comment

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

I think the new tool tip is much better.

I personally don't understand these? Same structure to what? :)

I was just trying to say that I can use the same structure that I'm using in my project editor like this one
#679 (review)
where I want to create an empty folders for my assets.

@MustafaJafar MustafaJafar requested a review from alainxi October 4, 2024 16:42
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.

I think I've found a bug.
Can we use lists in ayon+settings://core/project_folder_structure setting?

I made this

{
    "__project_root__": {
        "Assets": {
            "Characters": {
                "NewRobo": {
                    "work": [
                        "cfx",
                        "concept",
                        "modeling",
                        "walkcycle"
                    ]
                },
                "RoboPoro": {
                    "work": [
                        "cfx",
                        "concept",
                        "modeling",
                        "walkcycle"
                    ]
                },
                "RoboMad": {
                    "work": [
                        "cfx",
                        "concept",
                        "modeling",
                        "walkcycle"
                    ]
                }
            }
        }
    }
}

and I got this error:

*** WRN: >>> { ActionsModel }: [  Action trigger FAILED.  ] 
==============================
'list' object has no attribute 'items'
==============================
Traceback (most recent call last):
  File "E:\Ynput\ayon-core\client\ayon_core\tools\launcher\models\actions.py", line 405, in trigger_action
    action.process(selection)
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\actions\create_project_folders.py", line 29, in process
    project_folders.create_project_folders(selection.project_name)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 66, in create_project_folders
    basic_paths = get_project_basic_paths(project_name)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 112, in get_project_basic_paths
    return _list_path_items(folder_structure)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 90, in _list_path_items
    paths = _list_path_items(value)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 90, in _list_path_items
    paths = _list_path_items(value)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 90, in _list_path_items
    paths = _list_path_items(value)
  [ Previous line repeated 2 more times ]
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\project_folders.py", line 85, in _list_path_items
    for key, value in folder_structure.items():
AttributeERROR: 'list' object has no attribute 'items'

Copy link

@alainxi alainxi left a comment

Choose a reason for hiding this comment

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

I have tested with this, which works perfectly :

{
    "{root[work]}/{project[name]}": {
        "DELIVERIES": {
            "ASSETS_FOR_CLIENTS": {},
            "ICON": {
                "OLD": {}
            },
            "MOF_AND_PUB": {
                "OLD": {}
            }        },
        "PREPROD": {
            "ASSETS_FROM_ARCHIVE": {
                "NOM_DU_PROJET": {}
            },
            "ASSETS_FROM_CLIENT": {
                "GUIDELINES_AND_STORYBOARD": {
                    "OLD": {}
                },
                "VIDEOS_AND_SOUNDS": {
                    "OLD": {}
                }
            },
            "MOCKUP_AND_STORYBOARD": {
                "EXPORT": {
                    "OLD": {}
                },
                "WIP": {}
            }
        }
    }
}

I used {root[work]}/{project[name]} instead of __project_root__ , because the later is marked as legacy in the code (and it tries to create the same folder tree on all Anatomy roots, a behaviour that we don't want).

@BigRoy
Copy link
Collaborator Author

BigRoy commented Oct 7, 2024

I used {root[work]}/{project[name]} instead of __project_root__ , because the later is marked as legacy in the code (and it tries to create the same folder tree on all Anatomy roots, a behaviour that we don't want).

Separate from this PR - should we update the default settings @m-u-r-p-h-y @LiborBatek to use {root[work]}/{project[name]} instead? Or?

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
None yet
Development

Successfully merging this pull request may close these issues.

9 participants