Skip to content

main

FolderReparentingRelocateModel

Bases: BaseSettingsModel

Re-parent folders with Root relocation

Source code in server/settings/main.py
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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."
        ),
    )

FolderReparentingTypeGroupingModel

Bases: BaseSettingsModel

Re-parent folders with Type grouping

Source code in server/settings/main.py
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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."
        ),
    )

MoviePathProfile

Bases: BaseSettingsModel

Profile to select representation to use in Version.sg_path_to_movie

Source code in server/settings/main.py
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
class MoviePathProfile(BaseSettingsModel):
    """Profile to select representation to use in Version.sg_path_to_movie"""
    _layout = "expanded"
    host_names: list[str] = SettingsField(
        default_factory=list, title="Host names"
    )
    product_types: list[str] = SettingsField(
        default_factory=list,
        title="Product types"
    )
    task_types: list[str] = SettingsField(
        default_factory=list,
        title="Task types",
        enum_resolver=task_types_enum
    )
    task_names: list[str] = SettingsField(
        default_factory=list,
        title="Task names")
    repre_names: list[str] = SettingsField(
        default_factory=list,
        title="Selected representation names",
        description="Representation names used for Version.sg_path_to_movie"
    )

ShotgridCompatibilitySettings

Bases: BaseSettingsModel

Settings to define relationships between ShotGrid and AYON.

Source code in server/settings/main.py
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
class ShotgridCompatibilitySettings(BaseSettingsModel):
    """Settings to define relationships between ShotGrid and AYON."""

    default_task_type: str = SettingsField(
        default="Generic",
        title="Default Task Type",
        enum_resolver=task_types_enum,
        description=("Default Task Type for SG tasks with missing pipeline step"),
    )
    shotgrid_enabled_entities: list[str] = SettingsField(
        title="ShotGrid Enabled Entities",
        default_factory=default_shotgrid_enabled_entities,
        enum_resolver=default_shotgrid_entities,
        description=(
            "The Entities that are enabled in ShotGrid, disable "
            "any that you do not use."
        ),
    )

    custom_attribs_map: list[AttributesMappingModel] = SettingsField(
        title="Folder Attributes Map",
        default_factory=get_default_folder_attributes,
        description=(
            "AYON attributes <> ShotGrid fields (without 'sg_' prefix!) "
            "mapping. Empty ones will be ignored. Scope is the list of "
            "ShotGrid entities that the mapping applies to. Disable any."
        ),
    )

    @validator("custom_attribs_map")
    def ensure_requests(cls, value):
        """ Ensure custom attribs map does not contain duplicated SG fields.
        """
        all_sg_fields = set()
        all_ayon_attributes = set()
        for entry in value:
            if entry.sg and entry.sg in all_sg_fields:
                raise BadRequestException(f"Duplicate mapped SG field: {entry.sg}")
            if entry.ayon and entry.ayon in all_ayon_attributes:
                raise BadRequestException(f"Duplicate mapped AYON attribute: {entry.ayon}")

            if entry.sg:
                all_sg_fields.add(entry.sg)
            if entry.ayon:
                all_ayon_attributes.add(entry.ayon)

        return value

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

ensure_requests(value)

Ensure custom attribs map does not contain duplicated SG fields.

Source code in server/settings/main.py
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
@validator("custom_attribs_map")
def ensure_requests(cls, value):
    """ Ensure custom attribs map does not contain duplicated SG fields.
    """
    all_sg_fields = set()
    all_ayon_attributes = set()
    for entry in value:
        if entry.sg and entry.sg in all_sg_fields:
            raise BadRequestException(f"Duplicate mapped SG field: {entry.sg}")
        if entry.ayon and entry.ayon in all_ayon_attributes:
            raise BadRequestException(f"Duplicate mapped AYON attribute: {entry.ayon}")

        if entry.sg:
            all_sg_fields.add(entry.sg)
        if entry.ayon:
            all_ayon_attributes.add(entry.ayon)

    return value

ShotgridServiceSettings

Bases: BaseSettingsModel

Specific settings for the ShotGrid Services: Processor, Leecher and Transmitter.

The different services process events from either ShotGrid or AYON, this field allows to control how long to wait between each event is processed.

Source code in server/settings/main.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
class ShotgridServiceSettings(BaseSettingsModel):
    """Specific settings for the ShotGrid Services: Processor, Leecher and
    Transmitter.

    The different services process events from either ShotGrid or AYON,
    this field allows to control how long to wait between each event
    is processed.
    """
    polling_frequency: int = SettingsField(
        default=10,
        title="How often (in seconds) to process ShotGrid related events.",
    )

    script_key: str = SettingsField(
        default="",
        enum_resolver=secrets_enum,
        title="ShotGrid's Script api key",
        description=(
            "AYON Secret used for Service related server operations "
            "Secret should lead to ShotGrid's Script api key. "
            "See more at: https://developer.shotgridsoftware.com/python-api/"
            "authentication.html#setting-up-shotgrid"
        ),
    )

    script_name: str = SettingsField(
        default="",
        placeholder="Create and Paste a script name here",
        title="ShotGrid's Script Name",
        description=(
            "AYON Secret used for Service related server operations "
            "Secret should lead to ShotGrid's Script Name. "
            "See more at: https://developer.shotgridsoftware.com/python-api/"
            "authentication.html#setting-up-shotgrid"
        ),
    )

ShotgridSettings

Bases: BaseSettingsModel

ShotGrid integration settings.

Main setting for the AYON x ShotGrid integration, these need to be filled out in order to for the services to correctly operate.

Source code in server/settings/main.py
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
class ShotgridSettings(BaseSettingsModel):
    """ShotGrid integration settings.

    Main setting for the AYON x ShotGrid integration, these need to be filled
    out in order to for the services to correctly operate.
    """

    shotgrid_server: str = SettingsField(
        default="",
        title="ShotGrid URL",
        description="The URL to the ShotGrid Server we want to interact with.",
        example="https://my-site.shotgrid.autodesk.com",
        scope=["studio"]
    )

    shotgrid_no_ssl_validation: bool = SettingsField(
        False,
        title="No SSL validation",
        description="Turns off hostname matching validation for SSL certificates.",
    )
    shotgrid_project_code_field: str = SettingsField(
        default="code",
        title="ShotGrid Project Code field name",
        description=(
            "In order to create AYON projects, we need a Project Code, you "
            "can specify here which field in the ShotGrid Project "
            "entity represents it."
        ),
        example="sg_code",
        scope=["studio"],
    )
    enable_shotgrid_local_storage: bool = SettingsField(
        default=True,
        title="Enable ShotGrid Local Storage.",
        description=(
            "Whether to try make use of local storage defined in ShotGrid "
            "('Site Preferences -> File Management -> Local Storage') or not."
        ),
        scope=["studio"],
    )
    shotgrid_local_storage_key: str = SettingsField(
        default="primary",
        title="ShotGrid Local Storage entry name",
        description=(
            "Name of the 'code' to select which one of the multiple "
            "possible local storages entries to use."
        ),
        example="ayon_storage",
        scope=["studio"],
    )
    anatomy_preset: str = SettingsField(
        default="_",
        title="Anatomy Preset",
        description=(
            "The anatomy preset to use for the "
            "ShotGrid synchronized projects."
        ),
        enum_resolver=anatomy_presets_enum
    )
    compatibility_settings: ShotgridCompatibilitySettings = SettingsField(
        default_factory=ShotgridCompatibilitySettings,
        title="ShotGrid <-> AYON compatibility Settings",
        description=(
            "All the settings that allow us to fine-grain the relation "
            "between ShotGrid and AYON entities."
        )
    )
    service_settings: ShotgridServiceSettings = SettingsField(
        default_factory=ShotgridServiceSettings,
        title="Service settings",
        scope=["studio"],
    )
    publish: ShotgridPublishPlugins = SettingsField(
        default_factory=ShotgridPublishPlugins, title="Publish plugins"
    )

default_shotgrid_enabled_entities()

The entity types in ShotGrid that are enabled by default in AYON.

Source code in server/settings/main.py
29
30
31
32
33
34
35
36
37
38
39
40
def default_shotgrid_enabled_entities():
    """The entity types in ShotGrid that are enabled by default in AYON."""
    return [
        "Project",
        "Episode",
        "Sequence",
        "Shot",
        "Asset",
        "Task",
        "Version",
        "Note"
    ]

default_shotgrid_entities()

The entity types that exist in ShotGrid.

Source code in server/settings/main.py
14
15
16
17
18
19
20
21
22
23
24
25
26
def default_shotgrid_entities():
    """The entity types that exist in ShotGrid."""
    return [
        "Project",
        "Episode",
        "Sequence",
        "Scene",
        "Shot",
        "Asset",
        "Task",
        "Version",
        "Note"
    ]

default_shotgrid_reparenting_entities()

The entity types in ShotGrid that are enabled by default in AYON.

Source code in server/settings/main.py
43
44
45
46
47
48
49
50
def default_shotgrid_reparenting_entities():
    """The entity types in ShotGrid that are enabled by default in AYON."""
    return [
        "Episode",
        "Sequence",
        "Shot",
        "Asset",
    ]

get_default_folder_attributes()

Get AYON's Folder attributes

Get all the attribs for Folder entities in a list to be consumed by the default_factory in the ShotgridCompatibilitySettings.custom_attribs_map settings.

Source code in server/settings/main.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
def get_default_folder_attributes():
    """Get AYON's Folder attributes

    Get all the `attribs` for Folder entities in a list
    to be consumed by the `default_factory` in the
    `ShotgridCompatibilitySettings.custom_attribs_map`
    settings.
    """
    attributes = []

    for attr_dict in attribute_library.data.get("folder", {}):
        attr_name = attr_dict["name"]

        if attr_name in ["shotgridId", "shotgridType", "tools"]:
            continue

        attr_map = {
            "ayon": attr_name,
            "sg": "",
            "type": attr_dict["type"],
            "scope": default_shotgrid_enabled_entities()
        }

        # Project.startDate is usually not editable in Flow
        if attr_name == "startDate":
            reduce_scope = default_shotgrid_enabled_entities()
            reduce_scope.remove("Project")
            attr_map["scope"] = reduce_scope

        if attr_map not in attributes:
            attributes.append(attr_map)

    return attributes