#180 - Changed tasks to dictionaries

Modifications based on change
This commit is contained in:
Petr Kalis 2020-09-25 12:24:02 +02:00
parent fec340f5ba
commit f8e558ca42
5 changed files with 12 additions and 10 deletions

View file

@ -71,8 +71,8 @@ def add_tags_from_presets():
# Get project task types.
tasks = io.find_one({"type": "project"})["config"]["tasks"]
nks_pres_tags["[Tasks]"] = {}
for task in tasks:
nks_pres_tags["[Tasks]"][task["name"]] = {
for task_name, _ in tasks.items():
nks_pres_tags["[Tasks]"][task_name] = {
"editable": "1",
"note": "",
"icon": {

View file

@ -30,7 +30,7 @@ class ClockifySync(api.Action):
projects_info = {}
for project in projects_to_sync:
task_types = [task['name'] for task in project['config']['tasks']]
task_types = project['config']['tasks'].keys()
projects_info[project['name']] = task_types
clockify_projects = self.clockapi.get_projects()

View file

@ -38,7 +38,7 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
data["inputs"] = entity_data.get("inputs", [])
# Tasks.
tasks = entity_data.get("tasks", [])
tasks = entity_data.get("tasks", {})
if tasks is not None or len(tasks) > 0:
data["tasks"] = tasks
parents = []
@ -78,11 +78,13 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
if entity:
# Do not override data, only update
cur_entity_data = entity.get("data") or {}
new_tasks = data.pop("tasks", [])
new_tasks = data.pop("tasks", {})
if "tasks" in cur_entity_data and new_tasks:
for task_name in new_tasks:
if task_name not in cur_entity_data["tasks"]:
cur_entity_data["tasks"].append(task_name)
for task_name in new_tasks.keys():
if task_name \
not in cur_entity_data["tasks"].keys():
cur_entity_data["tasks"][task_name] = \
new_tasks[task_name]
cur_entity_data.update(data)
data = cur_entity_data
else:

View file

@ -30,7 +30,7 @@ class CollectYetiCache(pyblish.api.InstancePlugin):
label = "Collect Yeti Cache"
families = ["yetiRig", "yeticache"]
hosts = ["maya"]
tasks = ["animation", "fx"]
tasks = {"animation": {"type": "Animation"}, "fx": {"type": "FX"}}
def process(self, instance):

View file

@ -43,7 +43,7 @@ class CollectShots(api.InstancePlugin):
"{} - {} - tasks:{} - assetbuilds:{}".format(
data["asset"],
data["subset"],
data["tasks"],
data["tasks"].keys(),
[x["name"] for x in data.get("assetbuilds", [])]
)
)