Skip to content

Commit

Permalink
Squashed commit of add_master_task_file_templating:
Browse files Browse the repository at this point in the history
commit 21fc3b2
Author: clement.hector <clement.hector@gmail.com>
Date:   Wed Jan 5 14:28:44 2022 +0100

    Change master_task to main_task

commit c5bf5e1
Author: Jérôme LORRAIN <jerome.lorrain@protonmail.com>
Date:   Thu Dec 23 11:24:58 2021 +0100

    Remove wip

commit 592c97e
Author: Jérôme LORRAIN <jerome.lorrain@protonmail.com>
Date:   Fri Dec 17 11:52:38 2021 +0100

    Make lmauncher and workfiles interfaces use master_task info

commit 6f79251
Merge: ecae9f6 6468751
Author: Petr Kalis <petr.kalis@gmail.com>
Date:   Mon Feb 7 10:05:55 2022 +0100

    Merge pull request ynput#2634 from Ellipsanime/fix-photoshop-environement-workfiles-on-launch

    Fix open workfile on launch in photoshop

commit ecae9f6
Merge: 4b3834e 3160199
Author: Milan Kolar <mkolar@users.noreply.github.com>
Date:   Mon Feb 7 09:52:39 2022 +0100

    Merge pull request ynput#2556 from pypeclub/feature/OP-2429_Publisher-Preparations-before-standalone-publisher

commit 4b3834e
Merge: ccea535 604a590
Author: pypebot <82967070+pypebot@users.noreply.github.com>
Date:   Mon Feb 7 09:38:20 2022 +0100

    [Automated] Merged release main into develop

commit ccea535
Merge: f2a9543 a11700e
Author: pypebot <82967070+pypebot@users.noreply.github.com>
Date:   Sat Feb 5 04:34:51 2022 +0100

    [Automated] Merged main into develop

commit 6468751
Author: clement.hector <clement.hector@gmail.com>
Date:   Fri Feb 4 12:11:05 2022 +0100

    use env_value_to_bool instead of ast.literal_eval + os.getenv

commit fe46093
Author: clement.hector <clement.hector@gmail.com>
Date:   Wed Feb 2 19:36:49 2022 +0100

    fix test on string to boolean

commit 3160199
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 14:15:19 2022 +0100

    fix grammar

commit d739364
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 13:48:18 2022 +0100

    handle default value of 'is_label_horizontal'

commit 7ec4d50
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 13:48:03 2022 +0100

    precreate widget is separated from create dialog completely

commit f8be576
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 18:05:32 2022 +0100

    renamed method 'get_attribute_defs' to 'get_instance_attr_defs'

commit 20f5e8f
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:51:25 2022 +0100

    hound fixes

commit 95176b6
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:26:16 2022 +0100

    modified example creator

commit 23c3bc8
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:26:09 2022 +0100

    style changes of header view nad checkbox

commit 2d75212
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:25:51 2022 +0100

    ui attribute definitions are skipped for storing data

commit f0b7f72
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:25:34 2022 +0100

    creator dialog has context widget and creator's attributes

commit 9c6a57a
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:23:37 2022 +0100

    creator can define precreate attribute definitions and allowing context change

commit 3878c52
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:57 2022 +0100

    added widgett for pre create attributes

commit fffdef5
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:41 2022 +0100

    added publisher specific asset and task widgets

commit fbdd1d8
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:08 2022 +0100

    moved few widgets to tools/utils and modified asset/task widgets to easily change source model

commit 396bdfd
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:16:32 2022 +0100

    added few new attribute definitions and their widgets
  • Loading branch information
BenoitConnan committed Feb 28, 2022
1 parent 86080b2 commit f98bcd2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions openpype/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
get_workdir_data,
get_workdir,
get_workdir_with_workdir_data,
get_main_task,

create_workfile_doc,
save_workfile_data_to_doc,
Expand Down Expand Up @@ -228,6 +229,7 @@
"get_workdir_data",
"get_workdir",
"get_workdir_with_workdir_data",
"get_main_task",

"create_workfile_doc",
"save_workfile_data_to_doc",
Expand Down
28 changes: 28 additions & 0 deletions openpype/lib/avalon_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,30 @@ def get_latest_version(asset_name, subset_name, dbcon=None, project_name=None):
return version_doc


def get_main_task(asset_doc, task_name):
"""Retrieve main_task from avalon asset requested task
Return the main task if there is one, return the task otherwise.
Args:
asset_id (int): Id of asset under which the task belongs.
task_name (str): Name of task to retrieve main_task from.
Returns:
str: main task name if there is one, task name otherwise.
"""

if asset_doc:
main_task = (
asset_doc.get("data", {})
.get("tasks", {})
.get(task_name, {})
.get("main_task", None)
)
if main_task:
return main_task
return task_name


def get_workfile_template_key_from_context(
asset_name, task_name, host_name, project_name=None,
dbcon=None, project_settings=None
Expand Down Expand Up @@ -520,6 +544,10 @@ def get_workdir_data(project_doc, asset_doc, task_name, host_name):
if asset_parents:
parent_name = asset_parents[-1]

main_task = get_main_task(asset_doc, task_name)
if main_task:
task_name = main_task

data = {
"project": {
"name": project_doc["name"],
Expand Down
9 changes: 8 additions & 1 deletion openpype/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from openpype.tools.utils.delegates import PrettyTimeDelegate
from openpype.lib import (
Anatomy,
get_main_task,
get_workdir,
get_workfile_doc,
create_workfile_doc,
Expand Down Expand Up @@ -423,7 +424,11 @@ def set_asset_task(self, asset_id, task_name, task_type):
if asset_id != self._asset_id:
self._asset_doc = None
self._asset_id = asset_id
self._task_name = task_name
asset_doc = io.find_one(
{"type": "asset", "_id": asset_id},
{"data": True}
)
self._task_name = get_main_task(asset_doc, task_name)
self._task_type = task_type

# Define a custom session so we can query the work root
Expand Down Expand Up @@ -451,6 +456,8 @@ def set_asset_task(self, asset_id, task_name, task_type):
# Manually trigger file selection
self.on_file_select()

self._task_name = task_name

def _get_asset_doc(self):
if self._asset_id is None:
return None
Expand Down

0 comments on commit f98bcd2

Please sign in to comment.