mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
Merge pull request #5591 from ynput/bugfix/ayon-representation-folder-in-context
AYON: Fix representation context conversion
This commit is contained in:
commit
4f1638b3a7
1 changed files with 11 additions and 6 deletions
|
|
@ -663,10 +663,13 @@ def convert_v4_representation_to_v3(representation):
|
|||
if isinstance(context, six.string_types):
|
||||
context = json.loads(context)
|
||||
|
||||
if "folder" in context:
|
||||
_c_folder = context.pop("folder")
|
||||
if "asset" not in context and "folder" in context:
|
||||
_c_folder = context["folder"]
|
||||
context["asset"] = _c_folder["name"]
|
||||
|
||||
elif "asset" in context and "folder" not in context:
|
||||
context["folder"] = {"name": context["asset"]}
|
||||
|
||||
if "product" in context:
|
||||
_c_product = context.pop("product")
|
||||
context["family"] = _c_product["type"]
|
||||
|
|
@ -959,9 +962,11 @@ def convert_create_representation_to_v4(representation, con):
|
|||
converted_representation["files"] = new_files
|
||||
|
||||
context = representation["context"]
|
||||
context["folder"] = {
|
||||
"name": context.pop("asset", None)
|
||||
}
|
||||
if "folder" not in context:
|
||||
context["folder"] = {
|
||||
"name": context.get("asset")
|
||||
}
|
||||
|
||||
context["product"] = {
|
||||
"type": context.pop("family", None),
|
||||
"name": context.pop("subset", None),
|
||||
|
|
@ -1285,7 +1290,7 @@ def convert_update_representation_to_v4(
|
|||
|
||||
if "context" in update_data:
|
||||
context = update_data["context"]
|
||||
if "asset" in context:
|
||||
if "folder" not in context and "asset" in context:
|
||||
context["folder"] = {"name": context.pop("asset")}
|
||||
|
||||
if "family" in context or "subset" in context:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue