mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
create project structure is using settings
This commit is contained in:
parent
9515bcae3e
commit
e9892ce77e
3 changed files with 19 additions and 18 deletions
|
|
@ -2,7 +2,7 @@ import os
|
|||
import re
|
||||
|
||||
from pype.modules.ftrack.lib import BaseAction, statics_icon
|
||||
from pype.api import config, Anatomy
|
||||
from pype.api import Anatomy, project_settings as get_project_settings
|
||||
|
||||
|
||||
class CreateProjectFolders(BaseAction):
|
||||
|
|
@ -69,25 +69,26 @@ class CreateProjectFolders(BaseAction):
|
|||
return True
|
||||
|
||||
def launch(self, session, entities, event):
|
||||
entity = entities[0]
|
||||
project = self.get_project_from_entity(entity)
|
||||
project_folder_presets = (
|
||||
config.get_presets()
|
||||
.get("tools", {})
|
||||
.get("project_folder_structure")
|
||||
# Get project entity
|
||||
project_entity = self.get_project_from_entity(entities[0])
|
||||
# Load settings for project
|
||||
project_name = project_entity["full_name"]
|
||||
project_settings = get_project_settings(project_name)
|
||||
project_folder_structure = (
|
||||
project_settings["global"]["project_folder_structure"]
|
||||
)
|
||||
if not project_folder_presets:
|
||||
if not project_folder_structure:
|
||||
return {
|
||||
"success": False,
|
||||
"message": "Project structure presets are not set."
|
||||
"message": "Project structure is not set."
|
||||
}
|
||||
|
||||
try:
|
||||
# Get paths based on presets
|
||||
basic_paths = self.get_path_items(project_folder_presets)
|
||||
anatomy = Anatomy(project["full_name"])
|
||||
self.create_folders(basic_paths, entity, project, anatomy)
|
||||
self.create_ftrack_entities(basic_paths, project)
|
||||
basic_paths = self.get_path_items(project_folder_structure)
|
||||
anatomy = Anatomy(project_entity["full_name"])
|
||||
self.create_folders(basic_paths, project_entity, anatomy)
|
||||
self.create_ftrack_entities(basic_paths, project_entity)
|
||||
|
||||
except Exception as exc:
|
||||
session.rollback()
|
||||
|
|
@ -219,7 +220,7 @@ class CreateProjectFolders(BaseAction):
|
|||
output.append(os.path.normpath(os.path.sep.join(clean_items)))
|
||||
return output
|
||||
|
||||
def create_folders(self, basic_paths, entity, project, anatomy):
|
||||
def create_folders(self, basic_paths, project, anatomy):
|
||||
roots_paths = []
|
||||
if isinstance(anatomy.roots, dict):
|
||||
for root in anatomy.roots:
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ import os
|
|||
import sys
|
||||
import types
|
||||
import importlib
|
||||
import ftrack_api
|
||||
import time
|
||||
import logging
|
||||
import inspect
|
||||
|
||||
import ftrack_api
|
||||
|
||||
from pype.api import Logger, config
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ from . import credentials
|
|||
from .ftrack_base_handler import BaseHandler
|
||||
from .ftrack_event_handler import BaseEvent
|
||||
from .ftrack_action_handler import BaseAction, ServerAction, statics_icon
|
||||
from .ftrack_app_handler import AppAction
|
||||
|
||||
__all__ = (
|
||||
"avalon_sync",
|
||||
|
|
@ -12,6 +11,5 @@ __all__ = (
|
|||
"BaseEvent",
|
||||
"BaseAction",
|
||||
"ServerAction",
|
||||
"statics_icon",
|
||||
"AppAction"
|
||||
"statics_icon"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue