Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
change tasks to dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar committed Oct 7, 2020
1 parent 6d30b2e commit b4a0b1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,10 @@ def import_to_ftrack(self, input_data, parent=None):
existing_tasks.append(child['name'].lower())
# existing_tasks.append(child['type']['name'])

for task in tasks:
task_name = next(iter(task))
task_type = task[task_name]["type"]
for task_name in tasks:
task_type = tasks[task_name]["type"]
if task_name.lower() in existing_tasks:
print("Task {} already exists".format(task))
print("Task {} already exists".format(task_name))
continue
tasks_to_create.append((task_name, task_type))

Expand Down
4 changes: 2 additions & 2 deletions pype/plugins/global/publish/extract_hierarchy_avalon.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def import_to_avalon(self, input_data, parent=None):
new_tasks = data.pop("tasks", {})
if "tasks" not in cur_entity_data and not new_tasks:
continue
for task in new_tasks:
for task_name in new_tasks:
task_name = next(iter(task))
if task_name in cur_entity_data["tasks"].keys():
continue
cur_entity_data["tasks"][task_name] = task[task_name]
cur_entity_data["tasks"][task_name] = new_tasks[task_name]
cur_entity_data.update(data)
data = cur_entity_data
else:
Expand Down
2 changes: 1 addition & 1 deletion pype/plugins/hiero/publish/collect_shots.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def process(self, instance):
"{} - {} - tasks:{} - assetbuilds:{} - comments:{}".format(
data["asset"],
data["subset"],
[task.keys()[0] for task in data["tasks"]],
[task for task in data["tasks"]],
[x["name"] for x in data.get("assetbuilds", [])],
len(data.get("comments", []))
)
Expand Down
4 changes: 2 additions & 2 deletions pype/plugins/hiero/publish/collect_tag_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def process(self, instance):
# gets tags
tags = instance.data["tags"]

tasks = list()
tasks = dict()
for t in tags:
t_metadata = dict(t["metadata"])
t_family = t_metadata.get("tag.family", "")
Expand All @@ -22,7 +22,7 @@ def process(self, instance):
if "task" in t_family:
t_task_name = t_metadata.get("tag.label", "")
t_task_type = t_metadata.get("tag.type", "")
tasks.append({t_task_name: {"type": t_task_type}})
tasks[t_task_name] = {"type": t_task_type}

instance.data["tasks"] = tasks

Expand Down

0 comments on commit b4a0b1d

Please sign in to comment.