Global: Fix if None in entity.data.tasks then they should be dict

and not list as it was before
This commit is contained in:
Jakub Jezek 2021-03-30 15:47:20 +02:00
parent 6e8c574509
commit c5ab3e5ebb
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3

View file

@ -99,13 +99,20 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
if entity:
# Do not override data, only update
cur_entity_data = entity.get("data") or {}
entity_tasks = cur_entity_data["tasks"] or {}
# create tasks as dict by default
if not entity_tasks:
cur_entity_data["tasks"] = entity_tasks
new_tasks = data.pop("tasks", {})
if "tasks" not in cur_entity_data and not new_tasks:
continue
for task_name in new_tasks:
if task_name in cur_entity_data["tasks"].keys():
if task_name in entity_tasks.keys():
continue
cur_entity_data["tasks"][task_name] = new_tasks[task_name]
cur_entity_data["tasks"][task_name] = new_tasks[
task_name]
cur_entity_data.update(data)
data = cur_entity_data
else: