mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
addressing comments PR#1996
This commit is contained in:
parent
5417a4e9f5
commit
b2b248f818
6 changed files with 44 additions and 41 deletions
|
|
@ -4,7 +4,6 @@ from .settings import (
|
|||
get_current_project_settings,
|
||||
get_anatomy_settings,
|
||||
get_environments,
|
||||
get_project_basic_paths,
|
||||
|
||||
SystemSettings,
|
||||
ProjectSettings
|
||||
|
|
@ -26,7 +25,8 @@ from .lib import (
|
|||
get_global_environments,
|
||||
get_local_site_id,
|
||||
change_openpype_mongo_url,
|
||||
create_project_folders
|
||||
create_project_folders,
|
||||
get_project_basic_paths
|
||||
)
|
||||
|
||||
from .lib.mongo import (
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ from .path_tools import (
|
|||
version_up,
|
||||
get_version_from_path,
|
||||
get_last_version_from_path,
|
||||
create_project_folders
|
||||
create_project_folders,
|
||||
get_project_basic_paths
|
||||
)
|
||||
|
||||
from .editorial import (
|
||||
|
|
@ -278,5 +279,6 @@ __all__ = [
|
|||
"frames_to_secons",
|
||||
"frames_to_timecode",
|
||||
"make_sequence_collection",
|
||||
"create_project_folders"
|
||||
"create_project_folders",
|
||||
"get_project_basic_paths"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
|
||||
from openpype.api import Anatomy
|
||||
|
||||
from .anatomy import Anatomy
|
||||
from openpype.settings import get_project_settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
pattern_array = re.compile(r"\[.*\]")
|
||||
project_root_key = "__project_root__"
|
||||
|
||||
def _rreplace(s, a, b, n=1):
|
||||
"""Replace a with b in string s from right side n times."""
|
||||
|
|
@ -126,6 +127,8 @@ def get_last_version_from_path(path_dir, filter):
|
|||
|
||||
|
||||
def compute_paths(basic_paths_items, project_root):
|
||||
pattern_array = re.compile(r"\[.*\]")
|
||||
project_root_key = "__project_root__"
|
||||
output = []
|
||||
for path_items in basic_paths_items:
|
||||
clean_items = []
|
||||
|
|
@ -162,3 +165,32 @@ def create_project_folders(basic_paths, project_name):
|
|||
else:
|
||||
log.debug("Creating folder: {}".format(full_path))
|
||||
os.makedirs(full_path)
|
||||
|
||||
|
||||
def _list_path_items(folder_structure):
|
||||
output = []
|
||||
for key, value in folder_structure.items():
|
||||
if not value:
|
||||
output.append(key)
|
||||
else:
|
||||
paths = _list_path_items(value)
|
||||
for path in paths:
|
||||
if not isinstance(path, (list, tuple)):
|
||||
path = [path]
|
||||
|
||||
output.append([key, *path])
|
||||
|
||||
return output
|
||||
|
||||
|
||||
def get_project_basic_paths(project_name):
|
||||
project_settings = get_project_settings(project_name)
|
||||
folder_structure = (
|
||||
project_settings["global"]["project_folder_structure"]
|
||||
)
|
||||
if not folder_structure:
|
||||
return []
|
||||
|
||||
if isinstance(folder_structure, str):
|
||||
folder_structure = json.loads(folder_structure)
|
||||
return _list_path_items(folder_structure)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import os
|
|||
import re
|
||||
import json
|
||||
|
||||
from openpype.modules.ftrack.lib import BaseAction, statics_icon
|
||||
from openpype_modules.ftrack.lib import BaseAction, statics_icon
|
||||
from openpype.api import get_project_basic_paths, create_project_folders
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ from .lib import (
|
|||
get_current_project_settings,
|
||||
get_anatomy_settings,
|
||||
get_environments,
|
||||
get_local_settings,
|
||||
get_project_basic_paths
|
||||
get_local_settings
|
||||
)
|
||||
from .entities import (
|
||||
SystemSettings,
|
||||
|
|
@ -52,7 +51,6 @@ __all__ = (
|
|||
"get_anatomy_settings",
|
||||
"get_environments",
|
||||
"get_local_settings",
|
||||
"get_project_basic_paths",
|
||||
"SystemSettings",
|
||||
"ProjectSettings"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -941,35 +941,6 @@ def get_general_environments():
|
|||
return environments
|
||||
|
||||
|
||||
def _list_path_items(folder_structure):
|
||||
output = []
|
||||
for key, value in folder_structure.items():
|
||||
if not value:
|
||||
output.append(key)
|
||||
else:
|
||||
paths = _list_path_items(value)
|
||||
for path in paths:
|
||||
if not isinstance(path, (list, tuple)):
|
||||
path = [path]
|
||||
|
||||
output.append([key, *path])
|
||||
|
||||
return output
|
||||
|
||||
|
||||
def get_project_basic_paths(project_name):
|
||||
project_settings = get_project_settings(project_name)
|
||||
folder_structure = (
|
||||
project_settings["global"]["project_folder_structure"]
|
||||
)
|
||||
if not folder_structure:
|
||||
return []
|
||||
|
||||
if isinstance(folder_structure, str):
|
||||
folder_structure = json.loads(folder_structure)
|
||||
return _list_path_items(folder_structure)
|
||||
|
||||
|
||||
def clear_metadata_from_settings(values):
|
||||
"""Remove all metadata keys from loaded settings."""
|
||||
if isinstance(values, dict):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue