mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
removed 'AYON_SERVER_ENABLED' conditions from pipeline
This commit is contained in:
parent
b55cbaff7d
commit
d699a17e93
5 changed files with 82 additions and 251 deletions
|
|
@ -8,13 +8,9 @@ import numbers
|
||||||
import six
|
import six
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ayon_core import AYON_SERVER_ENABLED
|
|
||||||
from ayon_core.settings.lib import (
|
from ayon_core.settings.lib import (
|
||||||
get_local_settings,
|
get_local_settings,
|
||||||
)
|
)
|
||||||
from ayon_core.settings.constants import (
|
|
||||||
DEFAULT_PROJECT_KEY
|
|
||||||
)
|
|
||||||
from ayon_core.client import get_project, get_ayon_server_api_connection
|
from ayon_core.client import get_project, get_ayon_server_api_connection
|
||||||
from ayon_core.lib import Logger, get_local_site_id
|
from ayon_core.lib import Logger, get_local_site_id
|
||||||
from ayon_core.lib.path_templates import (
|
from ayon_core.lib.path_templates import (
|
||||||
|
|
@ -474,40 +470,12 @@ class Anatomy(BaseAnatomy):
|
||||||
Returns:
|
Returns:
|
||||||
Union[Dict[str, str], None]): Local root overrides.
|
Union[Dict[str, str], None]): Local root overrides.
|
||||||
"""
|
"""
|
||||||
|
if not project_name:
|
||||||
if AYON_SERVER_ENABLED:
|
|
||||||
if not project_name:
|
|
||||||
return
|
|
||||||
con = get_ayon_server_api_connection()
|
|
||||||
return con.get_project_roots_for_site(
|
|
||||||
project_name, get_local_site_id()
|
|
||||||
)
|
|
||||||
|
|
||||||
if local_settings is None:
|
|
||||||
local_settings = get_local_settings()
|
|
||||||
|
|
||||||
local_project_settings = local_settings.get("projects") or {}
|
|
||||||
if not local_project_settings:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Check for roots existence in local settings first
|
|
||||||
roots_project_locals = (
|
|
||||||
local_project_settings
|
|
||||||
.get(project_name, {})
|
|
||||||
)
|
|
||||||
roots_default_locals = (
|
|
||||||
local_project_settings
|
|
||||||
.get(DEFAULT_PROJECT_KEY, {})
|
|
||||||
)
|
|
||||||
|
|
||||||
# Skip rest of processing if roots are not set
|
|
||||||
if not roots_project_locals and not roots_default_locals:
|
|
||||||
return
|
return
|
||||||
|
con = get_ayon_server_api_connection()
|
||||||
# Combine roots from local settings
|
return con.get_project_roots_for_site(
|
||||||
roots_locals = roots_default_locals.get("studio") or {}
|
project_name, get_local_site_id()
|
||||||
roots_locals.update(roots_project_locals.get("studio") or {})
|
)
|
||||||
return roots_locals
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_site_root_overrides(cls, project_name, site_name):
|
def _get_site_root_overrides(cls, project_name, site_name):
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import uuid
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from pyblish.lib import MessageHandler
|
from pyblish.lib import MessageHandler
|
||||||
|
|
||||||
from ayon_core import AYON_SERVER_ENABLED, AYON_CORE_ROOT
|
from ayon_core import AYON_CORE_ROOT
|
||||||
from ayon_core.host import HostBase
|
from ayon_core.host import HostBase
|
||||||
from ayon_core.client import (
|
from ayon_core.client import (
|
||||||
get_project,
|
get_project,
|
||||||
|
|
@ -114,8 +114,7 @@ def install_host(host):
|
||||||
_is_installed = True
|
_is_installed = True
|
||||||
|
|
||||||
# Make sure global AYON connection has set site id and version
|
# Make sure global AYON connection has set site id and version
|
||||||
if AYON_SERVER_ENABLED:
|
get_ayon_server_api_connection()
|
||||||
get_ayon_server_api_connection()
|
|
||||||
|
|
||||||
legacy_io.install()
|
legacy_io.install()
|
||||||
modules_manager = _get_modules_manager()
|
modules_manager = _get_modules_manager()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ from contextlib import contextmanager
|
||||||
import pyblish.logic
|
import pyblish.logic
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
|
|
||||||
from ayon_core import AYON_SERVER_ENABLED
|
|
||||||
from ayon_core.client import (
|
from ayon_core.client import (
|
||||||
get_assets,
|
get_assets,
|
||||||
get_asset_by_name,
|
get_asset_by_name,
|
||||||
|
|
@ -931,15 +930,9 @@ class CreatedInstance:
|
||||||
data.pop("family", None)
|
data.pop("family", None)
|
||||||
data.pop("subset", None)
|
data.pop("subset", None)
|
||||||
|
|
||||||
if AYON_SERVER_ENABLED:
|
asset_name = data.pop("asset", None)
|
||||||
asset_name = data.pop("asset", None)
|
if "folderPath" not in data:
|
||||||
if "folderPath" not in data:
|
data["folderPath"] = asset_name
|
||||||
data["folderPath"] = asset_name
|
|
||||||
|
|
||||||
elif "folderPath" in data:
|
|
||||||
asset_name = data.pop("folderPath").split("/")[-1]
|
|
||||||
if "asset" not in data:
|
|
||||||
data["asset"] = asset_name
|
|
||||||
|
|
||||||
# QUESTION Does it make sense to have data stored as ordered dict?
|
# QUESTION Does it make sense to have data stored as ordered dict?
|
||||||
self._data = collections.OrderedDict()
|
self._data = collections.OrderedDict()
|
||||||
|
|
@ -1283,9 +1276,7 @@ class CreatedInstance:
|
||||||
def has_set_asset(self):
|
def has_set_asset(self):
|
||||||
"""Asset name is set in data."""
|
"""Asset name is set in data."""
|
||||||
|
|
||||||
if AYON_SERVER_ENABLED:
|
return "folderPath" in self._data
|
||||||
return "folderPath" in self._data
|
|
||||||
return "asset" in self._data
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_set_task(self):
|
def has_set_task(self):
|
||||||
|
|
@ -2021,13 +2012,9 @@ class CreateContext:
|
||||||
self.host_name
|
self.host_name
|
||||||
)
|
)
|
||||||
asset_name = get_asset_name_identifier(asset_doc)
|
asset_name = get_asset_name_identifier(asset_doc)
|
||||||
if AYON_SERVER_ENABLED:
|
|
||||||
asset_name_key = "folderPath"
|
|
||||||
else:
|
|
||||||
asset_name_key = "asset"
|
|
||||||
|
|
||||||
instance_data = {
|
instance_data = {
|
||||||
asset_name_key: asset_name,
|
"folderPath": asset_name,
|
||||||
"task": task_name,
|
"task": task_name,
|
||||||
"family": creator.family,
|
"family": creator.family,
|
||||||
"variant": variant
|
"variant": variant
|
||||||
|
|
@ -2251,11 +2238,8 @@ class CreateContext:
|
||||||
|
|
||||||
task_names_by_asset_name = {}
|
task_names_by_asset_name = {}
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
|
asset_name = instance.get("folderPath")
|
||||||
task_name = instance.get("task")
|
task_name = instance.get("task")
|
||||||
if AYON_SERVER_ENABLED:
|
|
||||||
asset_name = instance.get("folderPath")
|
|
||||||
else:
|
|
||||||
asset_name = instance.get("asset")
|
|
||||||
if asset_name:
|
if asset_name:
|
||||||
task_names_by_asset_name[asset_name] = set()
|
task_names_by_asset_name[asset_name] = set()
|
||||||
if task_name:
|
if task_name:
|
||||||
|
|
@ -2266,13 +2250,10 @@ class CreateContext:
|
||||||
for asset_name in task_names_by_asset_name.keys()
|
for asset_name in task_names_by_asset_name.keys()
|
||||||
if asset_name is not None
|
if asset_name is not None
|
||||||
}
|
}
|
||||||
fields = {"name", "data.tasks"}
|
|
||||||
if AYON_SERVER_ENABLED:
|
|
||||||
fields |= {"data.parents"}
|
|
||||||
asset_docs = list(get_assets(
|
asset_docs = list(get_assets(
|
||||||
self.project_name,
|
self.project_name,
|
||||||
asset_names=asset_names,
|
asset_names=asset_names,
|
||||||
fields=fields
|
fields={"name", "data.tasks", "data.parents"}
|
||||||
))
|
))
|
||||||
|
|
||||||
task_names_by_asset_name = {}
|
task_names_by_asset_name = {}
|
||||||
|
|
@ -2287,15 +2268,12 @@ class CreateContext:
|
||||||
if not instance.has_valid_asset or not instance.has_valid_task:
|
if not instance.has_valid_asset or not instance.has_valid_task:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if AYON_SERVER_ENABLED:
|
asset_name = instance["folderPath"]
|
||||||
asset_name = instance["folderPath"]
|
if asset_name and "/" not in asset_name:
|
||||||
if asset_name and "/" not in asset_name:
|
asset_docs = asset_docs_by_name.get(asset_name)
|
||||||
asset_docs = asset_docs_by_name.get(asset_name)
|
if len(asset_docs) == 1:
|
||||||
if len(asset_docs) == 1:
|
asset_name = get_asset_name_identifier(asset_docs[0])
|
||||||
asset_name = get_asset_name_identifier(asset_docs[0])
|
instance["folderPath"] = asset_name
|
||||||
instance["folderPath"] = asset_name
|
|
||||||
else:
|
|
||||||
asset_name = instance["asset"]
|
|
||||||
|
|
||||||
if asset_name not in task_names_by_asset_name:
|
if asset_name not in task_names_by_asset_name:
|
||||||
instance.set_asset_invalid(True)
|
instance.set_asset_invalid(True)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import os
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from ayon_core import AYON_SERVER_ENABLED
|
|
||||||
from ayon_core.lib import Logger
|
from ayon_core.lib import Logger
|
||||||
from ayon_core.client import get_project, get_ayon_server_api_connection
|
from ayon_core.client import get_project, get_ayon_server_api_connection
|
||||||
from . import legacy_io
|
from . import legacy_io
|
||||||
|
|
@ -145,8 +144,6 @@ class ServerThumbnailResolver(ThumbnailResolver):
|
||||||
return cls._cache
|
return cls._cache
|
||||||
|
|
||||||
def process(self, thumbnail_entity, thumbnail_type):
|
def process(self, thumbnail_entity, thumbnail_type):
|
||||||
if not AYON_SERVER_ENABLED:
|
|
||||||
return None
|
|
||||||
data = thumbnail_entity["data"]
|
data = thumbnail_entity["data"]
|
||||||
entity_type = data.get("entity_type")
|
entity_type = data.get("entity_type")
|
||||||
entity_id = data.get("entity_id")
|
entity_id = data.get("entity_id")
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,14 @@ import copy
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from ayon_api import get_products, get_last_versions
|
||||||
|
from ayon_api.graphql_queries import folders_graphql_query
|
||||||
|
|
||||||
from ayon_core import AYON_SERVER_ENABLED
|
|
||||||
from ayon_core.client import (
|
from ayon_core.client import (
|
||||||
get_asset_by_name,
|
get_asset_by_name,
|
||||||
get_linked_assets,
|
get_linked_assets,
|
||||||
get_representations,
|
get_representations,
|
||||||
|
get_ayon_server_api_connection,
|
||||||
)
|
)
|
||||||
from ayon_core.settings import (
|
from ayon_core.settings import (
|
||||||
get_project_settings,
|
get_project_settings,
|
||||||
|
|
@ -1273,44 +1275,25 @@ class PlaceholderLoadMixin(object):
|
||||||
# Sort for readability
|
# Sort for readability
|
||||||
families = list(sorted(families))
|
families = list(sorted(families))
|
||||||
|
|
||||||
if AYON_SERVER_ENABLED:
|
builder_type_enum_items = [
|
||||||
builder_type_enum_items = [
|
{"label": "Current folder", "value": "context_folder"},
|
||||||
{"label": "Current folder", "value": "context_folder"},
|
# TODO implement linked folders
|
||||||
# TODO implement linked folders
|
# {"label": "Linked folders", "value": "linked_folders"},
|
||||||
# {"label": "Linked folders", "value": "linked_folders"},
|
{"label": "All folders", "value": "all_folders"},
|
||||||
{"label": "All folders", "value": "all_folders"},
|
]
|
||||||
]
|
build_type_label = "Folder Builder Type"
|
||||||
build_type_label = "Folder Builder Type"
|
build_type_help = (
|
||||||
build_type_help = (
|
"Folder Builder Type\n"
|
||||||
"Folder Builder Type\n"
|
"\nBuilder type describe what template loader will look"
|
||||||
"\nBuilder type describe what template loader will look"
|
" for."
|
||||||
" for."
|
"\nCurrent Folder: Template loader will look for products"
|
||||||
"\nCurrent Folder: Template loader will look for products"
|
" of current context folder (Folder /assets/bob will"
|
||||||
" of current context folder (Folder /assets/bob will"
|
" find asset)"
|
||||||
" find asset)"
|
"\nAll folders: All folders matching the regex will be"
|
||||||
"\nAll folders: All folders matching the regex will be"
|
" used."
|
||||||
" used."
|
)
|
||||||
)
|
|
||||||
else:
|
|
||||||
builder_type_enum_items = [
|
|
||||||
{"label": "Current asset", "value": "context_asset"},
|
|
||||||
{"label": "Linked assets", "value": "linked_asset"},
|
|
||||||
{"label": "All assets", "value": "all_assets"},
|
|
||||||
]
|
|
||||||
build_type_label = "Asset Builder Type"
|
|
||||||
build_type_help = (
|
|
||||||
"Asset Builder Type\n"
|
|
||||||
"\nBuilder type describe what template loader will look"
|
|
||||||
" for."
|
|
||||||
"\ncontext_asset : Template loader will look for subsets"
|
|
||||||
" of current context asset (Asset bob will find asset)"
|
|
||||||
"\nlinked_asset : Template loader will look for assets"
|
|
||||||
" linked to current context asset."
|
|
||||||
"\nLinked asset are looked in database under"
|
|
||||||
" field \"inputLinks\""
|
|
||||||
)
|
|
||||||
|
|
||||||
attr_defs = [
|
return [
|
||||||
attribute_definitions.UISeparatorDef(),
|
attribute_definitions.UISeparatorDef(),
|
||||||
attribute_definitions.UILabelDef("Main attributes"),
|
attribute_definitions.UILabelDef("Main attributes"),
|
||||||
attribute_definitions.UISeparatorDef(),
|
attribute_definitions.UISeparatorDef(),
|
||||||
|
|
@ -1376,63 +1359,27 @@ class PlaceholderLoadMixin(object):
|
||||||
attribute_definitions.UISeparatorDef(),
|
attribute_definitions.UISeparatorDef(),
|
||||||
attribute_definitions.UILabelDef("Optional attributes"),
|
attribute_definitions.UILabelDef("Optional attributes"),
|
||||||
attribute_definitions.UISeparatorDef(),
|
attribute_definitions.UISeparatorDef(),
|
||||||
]
|
attribute_definitions.TextDef(
|
||||||
if AYON_SERVER_ENABLED:
|
"folder_path",
|
||||||
attr_defs.extend([
|
label="Folder filter",
|
||||||
attribute_definitions.TextDef(
|
default=options.get("folder_path"),
|
||||||
"folder_path",
|
placeholder="regex filtering by folder path",
|
||||||
label="Folder filter",
|
tooltip=(
|
||||||
default=options.get("folder_path"),
|
"Filtering assets by matching"
|
||||||
placeholder="regex filtering by folder path",
|
" field regex to folder path"
|
||||||
tooltip=(
|
|
||||||
"Filtering assets by matching"
|
|
||||||
" field regex to folder path"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
attribute_definitions.TextDef(
|
|
||||||
"product_name",
|
|
||||||
label="Product filter",
|
|
||||||
default=options.get("product_name"),
|
|
||||||
placeholder="regex filtering by product name",
|
|
||||||
tooltip=(
|
|
||||||
"Filtering assets by matching"
|
|
||||||
" field regex to product name"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
])
|
|
||||||
else:
|
|
||||||
attr_defs.extend([
|
|
||||||
attribute_definitions.TextDef(
|
|
||||||
"asset",
|
|
||||||
label="Asset filter",
|
|
||||||
default=options.get("asset"),
|
|
||||||
placeholder="regex filtering by asset name",
|
|
||||||
tooltip=(
|
|
||||||
"Filtering assets by matching"
|
|
||||||
" field regex to asset's name"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
attribute_definitions.TextDef(
|
|
||||||
"subset",
|
|
||||||
label="Subset filter",
|
|
||||||
default=options.get("subset"),
|
|
||||||
placeholder="regex filtering by subset name",
|
|
||||||
tooltip=(
|
|
||||||
"Filtering assets by matching"
|
|
||||||
" field regex to subset's name"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
attribute_definitions.TextDef(
|
|
||||||
"hierarchy",
|
|
||||||
label="Hierarchy filter",
|
|
||||||
default=options.get("hierarchy"),
|
|
||||||
placeholder="regex filtering by asset's hierarchy",
|
|
||||||
tooltip=(
|
|
||||||
"Filtering assets by matching field asset's hierarchy"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
])
|
),
|
||||||
return attr_defs
|
attribute_definitions.TextDef(
|
||||||
|
"product_name",
|
||||||
|
label="Product filter",
|
||||||
|
default=options.get("product_name"),
|
||||||
|
placeholder="regex filtering by product name",
|
||||||
|
tooltip=(
|
||||||
|
"Filtering assets by matching"
|
||||||
|
" field regex to product name"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
def parse_loader_args(self, loader_args):
|
def parse_loader_args(self, loader_args):
|
||||||
"""Helper function to parse string of loader arugments.
|
"""Helper function to parse string of loader arugments.
|
||||||
|
|
@ -1477,9 +1424,6 @@ class PlaceholderLoadMixin(object):
|
||||||
list[str]: List of folder paths.
|
list[str]: List of folder paths.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ayon_api.graphql_queries import folders_graphql_query
|
|
||||||
from ayon_core.client import get_ayon_server_api_connection
|
|
||||||
|
|
||||||
query = folders_graphql_query({"id"})
|
query = folders_graphql_query({"id"})
|
||||||
|
|
||||||
folders_field = None
|
folders_field = None
|
||||||
|
|
@ -1509,7 +1453,25 @@ class PlaceholderLoadMixin(object):
|
||||||
for folder in parsed_data["project"]["folders"]:
|
for folder in parsed_data["project"]["folders"]:
|
||||||
yield folder["id"]
|
yield folder["id"]
|
||||||
|
|
||||||
def _get_representations_ayon(self, placeholder):
|
def _get_representations(self, placeholder):
|
||||||
|
"""Prepared query of representations based on load options.
|
||||||
|
|
||||||
|
This function is directly connected to options defined in
|
||||||
|
'get_load_plugin_options'.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
This returns all representation documents from all versions of
|
||||||
|
matching subset. To filter for last version use
|
||||||
|
'_reduce_last_version_repre_docs'.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
placeholder (PlaceholderItem): Item which should be populated.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List[Dict[str, Any]]: Representation documents matching filters
|
||||||
|
from placeholder data.
|
||||||
|
"""
|
||||||
|
|
||||||
# An OpenPype placeholder loaded in AYON
|
# An OpenPype placeholder loaded in AYON
|
||||||
if "asset" in placeholder.data:
|
if "asset" in placeholder.data:
|
||||||
return []
|
return []
|
||||||
|
|
@ -1541,8 +1503,6 @@ class PlaceholderLoadMixin(object):
|
||||||
if not folder_ids:
|
if not folder_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
from ayon_api import get_products, get_last_versions
|
|
||||||
|
|
||||||
products = list(get_products(
|
products = list(get_products(
|
||||||
project_name,
|
project_name,
|
||||||
folder_ids=folder_ids,
|
folder_ids=folder_ids,
|
||||||
|
|
@ -1552,8 +1512,8 @@ class PlaceholderLoadMixin(object):
|
||||||
filtered_product_ids = set()
|
filtered_product_ids = set()
|
||||||
for product in products:
|
for product in products:
|
||||||
if (
|
if (
|
||||||
product_name_regex is None
|
product_name_regex is None
|
||||||
or product_name_regex.match(product["name"])
|
or product_name_regex.match(product["name"])
|
||||||
):
|
):
|
||||||
filtered_product_ids.add(product["id"])
|
filtered_product_ids.add(product["id"])
|
||||||
|
|
||||||
|
|
@ -1572,77 +1532,6 @@ class PlaceholderLoadMixin(object):
|
||||||
version_ids=version_ids
|
version_ids=version_ids
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
def _get_representations(self, placeholder):
|
|
||||||
"""Prepared query of representations based on load options.
|
|
||||||
|
|
||||||
This function is directly connected to options defined in
|
|
||||||
'get_load_plugin_options'.
|
|
||||||
|
|
||||||
Note:
|
|
||||||
This returns all representation documents from all versions of
|
|
||||||
matching subset. To filter for last version use
|
|
||||||
'_reduce_last_version_repre_docs'.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
placeholder (PlaceholderItem): Item which should be populated.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List[Dict[str, Any]]: Representation documents matching filters
|
|
||||||
from placeholder data.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if AYON_SERVER_ENABLED:
|
|
||||||
return self._get_representations_ayon(placeholder)
|
|
||||||
|
|
||||||
# An AYON placeholder loaded in OpenPype
|
|
||||||
if "folder_path" in placeholder.data:
|
|
||||||
return []
|
|
||||||
|
|
||||||
project_name = self.builder.project_name
|
|
||||||
current_asset_doc = self.builder.current_asset_doc
|
|
||||||
linked_asset_docs = self.builder.linked_asset_docs
|
|
||||||
|
|
||||||
builder_type = placeholder.data["builder_type"]
|
|
||||||
if builder_type == "context_asset":
|
|
||||||
context_filters = {
|
|
||||||
"asset": [current_asset_doc["name"]],
|
|
||||||
"subset": [re.compile(placeholder.data["subset"])],
|
|
||||||
"hierarchy": [re.compile(placeholder.data["hierarchy"])],
|
|
||||||
"representation": [placeholder.data["representation"]],
|
|
||||||
"family": [placeholder.data["family"]]
|
|
||||||
}
|
|
||||||
|
|
||||||
elif builder_type == "linked_asset":
|
|
||||||
asset_regex = re.compile(placeholder.data["asset"])
|
|
||||||
linked_asset_names = []
|
|
||||||
for asset_doc in linked_asset_docs:
|
|
||||||
asset_name = asset_doc["name"]
|
|
||||||
if asset_regex.match(asset_name):
|
|
||||||
linked_asset_names.append(asset_name)
|
|
||||||
|
|
||||||
context_filters = {
|
|
||||||
"asset": linked_asset_names,
|
|
||||||
"subset": [re.compile(placeholder.data["subset"])],
|
|
||||||
"hierarchy": [re.compile(placeholder.data["hierarchy"])],
|
|
||||||
"representation": [placeholder.data["representation"]],
|
|
||||||
"family": [placeholder.data["family"]],
|
|
||||||
}
|
|
||||||
|
|
||||||
else:
|
|
||||||
context_filters = {
|
|
||||||
"asset": [re.compile(placeholder.data["asset"])],
|
|
||||||
"subset": [re.compile(placeholder.data["subset"])],
|
|
||||||
"hierarchy": [re.compile(placeholder.data["hierarchy"])],
|
|
||||||
"representation": [placeholder.data["representation"]],
|
|
||||||
"family": [placeholder.data["family"]]
|
|
||||||
}
|
|
||||||
|
|
||||||
return list(get_representations(
|
|
||||||
project_name,
|
|
||||||
context_filters=context_filters
|
|
||||||
))
|
|
||||||
|
|
||||||
def _before_placeholder_load(self, placeholder):
|
def _before_placeholder_load(self, placeholder):
|
||||||
"""Can be overridden. It's called before placeholder representations
|
"""Can be overridden. It's called before placeholder representations
|
||||||
are loaded.
|
are loaded.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue