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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions client/ayon_core/plugins/actions/create_project_folders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from ayon_core.pipeline import LauncherAction, project_folders


class CreateProjectFoldersAction(LauncherAction):
"""Create project folders as defined in settings."""
name = "create_project_folders"
label = "Create Project Folders"
icon = "sitemap"
color = "#e0e1e1"
order = 1000

def is_compatible(self, selection) -> bool:

# Disable when the project folder structure setting is empty
# in settings
project_settings = selection.get_project_settings()
folder_structure = (
project_settings["core"]["project_folder_structure"]
).strip()
if not folder_structure or folder_structure == "{}":
return False

return (
selection.is_project_selected
and not selection.is_folder_selected
)

def process(self, selection, **kwargs):
project_folders.create_project_folders(selection.project_name)
9 changes: 9 additions & 0 deletions server/settings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ class CoreSettings(BaseSettingsModel):
"{}",
widget="textarea",
title="Project folder structure",
description=(
"Defines project folders to create on 'Create project folders'."
"\n\n"
"- In the launcher, this only creates the folders on disk and "
" when the setting is empty it will be hidden from users in the"
" launcher.\n"
"- In `ayon-ftrack` this will create the folders on disk **and**"
" will also create ftrack entities. It is never hidden there."
),
section="---"
)
project_environments: str = SettingsField(
Expand Down