mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
data are not overriden but only updated
This commit is contained in:
parent
a1275fedd5
commit
984f26a55d
1 changed files with 13 additions and 5 deletions
|
|
@ -28,8 +28,6 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
entity_type = entity_data["entity_type"]
|
||||
|
||||
data = {}
|
||||
|
||||
data["inputs"] = entity_data.get("inputs", [])
|
||||
data["entityType"] = entity_type
|
||||
|
||||
# Custom attributes.
|
||||
|
|
@ -64,8 +62,9 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
assert (entity is not None), "Did not find project in DB"
|
||||
|
||||
# get data from already existing project
|
||||
for key, value in entity.get("data", {}).items():
|
||||
data[key] = value
|
||||
entity_data = entity.get("data") or {}
|
||||
entity_data.update(data)
|
||||
data = entity_data
|
||||
|
||||
self.project = entity
|
||||
# Raise error if project or parent are not set
|
||||
|
|
@ -76,7 +75,12 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
# Else process assset
|
||||
else:
|
||||
entity = io.find_one({"type": "asset", "name": name})
|
||||
if entity is None:
|
||||
if entity:
|
||||
# Do not override data, only update
|
||||
entity_data = entity.get("data") or {}
|
||||
entity_data.update(data)
|
||||
data = entity_data
|
||||
else:
|
||||
# Skip updating data
|
||||
update_data = False
|
||||
|
||||
|
|
@ -113,6 +117,10 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
self.import_to_avalon(entity_data["childs"], entity)
|
||||
|
||||
def unarchive_entity(self, entity, data):
|
||||
entity_data = entity.get("data") or {}
|
||||
entity_data.update(data)
|
||||
data = entity_data
|
||||
|
||||
new_entity = {
|
||||
"_id": entity["_id"],
|
||||
"schema": "avalon-core:asset-3.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue