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

Sequence and shot folder grouping #129

Merged
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9f73b18
Added creation of separate sequence category
kalisp Sep 5, 2024
ac4e85e
Added shot subfolder
kalisp Sep 5, 2024
8907ec6
Refactored similar code
kalisp Sep 6, 2024
2c1682f
Added new folder types
kalisp Sep 6, 2024
c12dc8a
Use new folder types for shot, sequence folders
kalisp Sep 6, 2024
9ee2c8c
Skip non integer id
kalisp Sep 6, 2024
bda159a
Skip non integer id
kalisp Sep 6, 2024
df445bf
Handles special folders when creating entity in SG
kalisp Sep 6, 2024
9483b83
Use only real parents, not grouping folders like shot
kalisp Sep 6, 2024
0523d58
Handles creation of shot/sequence only from events
kalisp Sep 6, 2024
7fc70a7
Removed storing unnecessary sg_id
kalisp Sep 6, 2024
3b97998
Special folders are configured in Settings
kalisp Sep 9, 2024
e02228a
Added configuration for special folder prefixes
kalisp Sep 9, 2024
5ae2744
Revert unwanted changes
kalisp Sep 12, 2024
5037cb7
Merge develop
kalisp Nov 12, 2024
803fabc
Merge branch 'develop' into enhancement/AY-6666_Shotgrid-sequence-and…
jakubjezek001 Nov 14, 2024
16b728f
Add folder types enum and implement default ShotGrid reparenting enti…
jakubjezek001 Nov 14, 2024
a2c56b2
removing settings
jakubjezek001 Nov 14, 2024
eee98f3
Refactor folder path retrieval for asset, sequence, and shot categories
jakubjezek001 Nov 14, 2024
25fabe0
Merge develop
kalisp Nov 14, 2024
39e880e
Do not put shots in sequence to different folder type
kalisp Nov 14, 2024
0edc903
Removed unnecessary code
kalisp Nov 14, 2024
ea292b1
Added docstring
kalisp Nov 14, 2024
a48dddd
Merge
kalisp Nov 14, 2024
dc1196a
Fix import
kalisp Nov 14, 2024
ec7608a
Remove AssetCategory, update folder naming conventions, and add re-pa…
jakubjezek001 Nov 15, 2024
ca031c5
Merge remote-tracking branch 'origin/enhancement/AY-6666_Shotgrid-seq…
kalisp Nov 18, 2024
e97919d
Fix use project setting
kalisp Nov 18, 2024
e697216
Implemented type_grouping use case
kalisp Nov 19, 2024
986e646
Fix access to local variable
kalisp Nov 20, 2024
dbb0f16
Fix non parented entities
kalisp Nov 20, 2024
59feada
Fix cases where no parent found
kalisp Nov 20, 2024
b08ed55
Introduced parenting transfer workflows
kalisp Nov 20, 2024
7f17ded
Renamed placeholder value
kalisp Nov 20, 2024
c1a2e93
Implemented pulling name from AssetCategory as folder name
kalisp Nov 20, 2024
5e263df
Fixes for parent transfer
kalisp Nov 20, 2024
e7865c8
Added parent sequence info to shot sg_ay_dict
kalisp Nov 20, 2024
0c690cc
Fix missing Task entities
kalisp Nov 20, 2024
15eb5a0
Extracted _sync_project_attributes
kalisp Nov 21, 2024
af1ad65
Extracted _update_sg_entity
kalisp Nov 21, 2024
f3ad1c5
Removed parent_entity
kalisp Nov 21, 2024
8b3c017
Added note
kalisp Nov 21, 2024
8120182
Fix wrong parents for Tasks
kalisp Nov 21, 2024
f802f26
Removed unnecessary ShotCategory, SequenceCategory
kalisp Nov 21, 2024
e29611f
Fix missing data on Task entities
kalisp Nov 21, 2024
cbff7e9
Ruff
kalisp Nov 21, 2024
1d77f0e
Fix explicit argument
kalisp Nov 22, 2024
3dd475f
Merge branch 'develop' of https://github.com/ynput/ayon-shotgrid into…
kalisp Nov 25, 2024
c3ad7bb
Removed parent entity from arguments
kalisp Nov 25, 2024
ccc1f1c
Removed parent entity from arguments
kalisp Nov 25, 2024
1814310
Updated logging
kalisp Nov 26, 2024
d89372e
Update data only if exist
kalisp Nov 26, 2024
281a192
Set data directly when create entity
kalisp Nov 26, 2024
643e66e
Added Folder to additional folder types
kalisp Nov 29, 2024
127e24c
Fix parenting
kalisp Nov 29, 2024
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
108 changes: 107 additions & 1 deletion server/settings/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from ayon_server.entities.core.attrib import attribute_library
from ayon_server.settings import BaseSettingsModel, SettingsField
from ayon_server.settings.enum import secrets_enum, anatomy_presets_enum
from ayon_server.settings.enum import (
secrets_enum,
anatomy_presets_enum,
folder_types_enum
)


def default_shotgrid_entities():
Expand Down Expand Up @@ -30,6 +34,16 @@ def default_shotgrid_enabled_entities():
]


def default_shotgrid_reparenting_entities():
"""The entity types in ShotGrid that are enabled by default in AYON."""
return [
"Episode",
"Sequence",
"Shot",
"Asset",
]


def get_default_folder_attributes():
"""Get AYON's Folder attributes

Expand Down Expand Up @@ -113,6 +127,92 @@ class AttributesMappingModel(BaseSettingsModel):
)


class FolderReparentingParentsModel(BaseSettingsModel):
folder_type: str = SettingsField(
"asset",
title="Parent Ayon Folder Type",
enum_resolver=folder_types_enum,
description="Type of the parent folder in AYON",
)
folder_name: str = SettingsField(
"assets",
title="Parent Ayon Folder Name",
description=(
"Name of the parent folder in AYON. Anatomy presets can be used."
"`sg_` prefix can be used to refer to ShotGrid entities. Example: "
"`{shotgrid_type}` will be replaced with the ShotGrid Asset Type."
),
)


class FolderReparentingPresetsModel(BaseSettingsModel):

filter_by_sg_entity_type: str = SettingsField(
"Asset",
title="Filter by ShotGrid Entity Type",
enum_resolver=default_shotgrid_reparenting_entities,
description=("Type of the ShotGrid entity to filter preset on."),
)
parents: list[FolderReparentingParentsModel] = SettingsField(
title="Parents",
default_factory=list,
description=(
"List of parent folders. If empty default behavior will be used. "
"The order of the parents from top to bottom is important."
"Within 'Root relocation' type the first parent will be "
"the root folder."
),
)


class FolderReparentingRelocateModel(BaseSettingsModel):
"""Re-parent folders with Root relocation"""
enabled: bool = SettingsField(
False,
title="Enabled",
description="Enable or disable the re-parenting",
)

presets: list[FolderReparentingPresetsModel] = SettingsField(
title="Presets",
default_factory=list,
description=(
"List of presets for re-parenting. "
"If empty default behavior will be used."
),
)


class FolderReparentingTypeGroupingModel(BaseSettingsModel):
"""Re-parent folders with Type grouping"""
enabled: bool = SettingsField(
False,
title="Enabled",
description="Enable or disable the re-parenting",
)

presets: list[FolderReparentingPresetsModel] = SettingsField(
title="Presets",
default_factory=list,
description=(
"List of presets for re-parenting. "
"If empty default behavior will be used."
),
)


class FolderReparentingModel(BaseSettingsModel):

root_relocate: FolderReparentingRelocateModel = SettingsField(
default_factory=FolderReparentingRelocateModel,
title="Root relocation",
)

type_grouping: FolderReparentingTypeGroupingModel = SettingsField(
default_factory=FolderReparentingTypeGroupingModel,
title="Type grouping",
)

class ShotgridCompatibilitySettings(BaseSettingsModel):
""" Settings to define relationships between ShotGrid and AYON.
"""
Expand All @@ -136,6 +236,12 @@ class ShotgridCompatibilitySettings(BaseSettingsModel):
),
)

folder_parenting: FolderReparentingModel = SettingsField(
title="Folder re-parenting",
default_factory=FolderReparentingModel,
description=("Parent folders for AYON folders matching to SG types."),
)


class ClientLoginDetailsModel(BaseSettingsModel):
_layout = "expanded"
Expand Down
6 changes: 4 additions & 2 deletions services/shotgrid_common/ayon_shotgrid_hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self,
custom_attribs_types=None,
sg_enabled_entities=None,
):
self.settings = ayon_api.get_service_addon_settings()
self.settings = ayon_api.get_service_addon_settings(project_name)

self._sg = sg_connection

Expand Down Expand Up @@ -280,7 +280,8 @@ def synchronize_projects(self, source="ayon"):
self._sg,
self.sg_enabled_entities,
self.sg_project_code_field,
self.custom_attribs_map
self.custom_attribs_map,
self.settings
)

case _:
Expand Down Expand Up @@ -338,6 +339,7 @@ def react_to_shotgrid_event(self, sg_event_meta):
self.sg_enabled_entities,
self.sg_project_code_field,
self.custom_attribs_map,
self.settings
)

case "attribute_change":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def match_ayon_hierarchy_in_shotgrid(
)
continue
elif sg_entity_id:
# convert sg_entity_id to int if exists
sg_entity_id = int(sg_entity_id)

if sg_entity_type == "AssetCategory":
Expand Down
Loading