use current schemas from client

This commit is contained in:
Jakub Trllo 2022-08-23 17:45:49 +02:00
parent 88682ddb6c
commit bc7aa718ad
4 changed files with 23 additions and 22 deletions

View file

@ -14,6 +14,11 @@ from openpype.client import (
get_last_version_by_subset_name,
get_workfile_info,
)
from openpype.client.operations import (
CURRENT_ASSET_DOC_SCHEMA,
CURRENT_PROJECT_SCHEMA,
CURRENT_PROJECT_CONFIG_SCHEMA,
)
from .profiles_filtering import filter_profiles
from .events import emit_event
from .path_templates import StringTemplate
@ -23,10 +28,11 @@ legacy_io = None
log = logging.getLogger("AvalonContext")
# Backwards compatibility - should not be used anymore
CURRENT_DOC_SCHEMAS = {
"project": "openpype:project-3.0",
"asset": "openpype:asset-3.0",
"config": "openpype:config-2.0"
"project": CURRENT_PROJECT_SCHEMA,
"asset": CURRENT_ASSET_DOC_SCHEMA,
"config": CURRENT_PROJECT_CONFIG_SCHEMA
}
PROJECT_NAME_ALLOWED_SYMBOLS = "a-zA-Z0-9_"
PROJECT_NAME_REGEX = re.compile(

View file

@ -18,6 +18,7 @@ from openpype.client import (
get_archived_assets,
get_asset_ids_with_subsets
)
from openpype.client.operations import CURRENT_ASSET_DOC_SCHEMA
from openpype.pipeline import AvalonMongoDB, schema
from openpype_modules.ftrack.lib import (
@ -35,7 +36,6 @@ from openpype_modules.ftrack.lib.avalon_sync import (
convert_to_fps,
InvalidFpsValue
)
from openpype.lib import CURRENT_DOC_SCHEMAS
class SyncToAvalonEvent(BaseEvent):
@ -1236,7 +1236,7 @@ class SyncToAvalonEvent(BaseEvent):
"_id": mongo_id,
"name": name,
"type": "asset",
"schema": CURRENT_DOC_SCHEMAS["asset"],
"schema": CURRENT_ASSET_DOC_SCHEMA,
"parent": proj["_id"],
"data": {
"ftrackId": ftrack_ent["id"],

View file

@ -14,6 +14,11 @@ from openpype.client import (
get_versions,
get_representations
)
from openpype.client.operations import (
CURRENT_ASSET_DOC_SCHEMA,
CURRENT_PROJECT_SCHEMA,
CURRENT_PROJECT_CONFIG_SCHEMA,
)
from openpype.api import (
Logger,
get_anatomy_settings
@ -32,14 +37,6 @@ import ftrack_api
log = Logger.get_logger(__name__)
# Current schemas for avalon types
CURRENT_DOC_SCHEMAS = {
"project": "openpype:project-3.0",
"asset": "openpype:asset-3.0",
"config": "openpype:config-2.0"
}
class InvalidFpsValue(Exception):
pass
@ -2063,7 +2060,7 @@ class SyncEntitiesFactory:
item["_id"] = new_id
item["parent"] = self.avalon_project_id
item["schema"] = CURRENT_DOC_SCHEMAS["asset"]
item["schema"] = CURRENT_ASSET_DOC_SCHEMA
item["data"]["visualParent"] = avalon_parent
new_id_str = str(new_id)
@ -2198,8 +2195,8 @@ class SyncEntitiesFactory:
project_item["_id"] = new_id
project_item["parent"] = None
project_item["schema"] = CURRENT_DOC_SCHEMAS["project"]
project_item["config"]["schema"] = CURRENT_DOC_SCHEMAS["config"]
project_item["schema"] = CURRENT_PROJECT_SCHEMA
project_item["config"]["schema"] = CURRENT_PROJECT_CONFIG_SCHEMA
self.ftrack_avalon_mapper[self.ft_project_id] = new_id
self.avalon_ftrack_mapper[new_id] = self.ft_project_id

View file

@ -13,10 +13,8 @@ from openpype.client import (
get_assets,
get_asset_ids_with_subsets,
)
from openpype.lib import (
CURRENT_DOC_SCHEMAS,
PypeLogger,
)
from openpype.client.operations import CURRENT_ASSET_DOC_SCHEMA
from openpype.lib import Logger
from .constants import (
IDENTIFIER_ROLE,
@ -203,7 +201,7 @@ class HierarchyModel(QtCore.QAbstractItemModel):
@property
def log(self):
if self._log is None:
self._log = PypeLogger.get_logger("ProjectManagerModel")
self._log = Logger.get_logger("ProjectManagerModel")
return self._log
@property
@ -1961,7 +1959,7 @@ class AssetItem(BaseItem):
}
schema_name = (
self._origin_asset_doc.get("schema")
or CURRENT_DOC_SCHEMAS["asset"]
or CURRENT_ASSET_DOC_SCHEMA
)
doc = {