Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/AY_7222-fix_create_custom_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-ynput committed Dec 11, 2024
2 parents 46fcc29 + 79903e4 commit b4b3ec5
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 37 deletions.
29 changes: 19 additions & 10 deletions client/ayon_core/pipeline/workfile/path_resolving.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import copy
import platform
from typing import Optional, Dict, Any

import ayon_api

Expand All @@ -16,12 +17,12 @@


def get_workfile_template_key_from_context(
project_name,
folder_path,
task_name,
host_name,
project_settings=None
):
project_name: str,
folder_path: str,
task_name: str,
host_name: str,
project_settings: Optional[Dict[str, Any]] = None,
) -> str:
"""Helper function to get template key for workfile template.
Do the same as `get_workfile_template_key` but returns value for "session
Expand All @@ -34,15 +35,23 @@ def get_workfile_template_key_from_context(
host_name (str): Host name.
project_settings (Dict[str, Any]): Project settings for passed
'project_name'. Not required at all but makes function faster.
"""
Returns:
str: Workfile template name.
"""
folder_entity = ayon_api.get_folder_by_path(
project_name, folder_path, fields={"id"}
project_name,
folder_path,
fields={"id"},
)
task_entity = ayon_api.get_task_by_name(
project_name, folder_entity["id"], task_name
project_name,
folder_entity["id"],
task_name,
fields={"taskType"},
)
task_type = task_entity.get("type")
task_type = task_entity.get("taskType")

return get_workfile_template_key(
project_name, task_type, host_name, project_settings
Expand Down
9 changes: 6 additions & 3 deletions client/ayon_core/tools/attribute_defs/files_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _on_about_to_be_removed(self, parent_index, start, end):
"""Make sure that removed items are removed from items mapping.
Connected with '_on_insert'. When user drag item and drop it to same
view the item is actually removed and creted again but it happens in
view the item is actually removed and created again but it happens in
inner calls of Qt.
"""

Expand Down Expand Up @@ -841,7 +841,7 @@ def _on_rows_inserted(self, parent_index, start_row, end_row):
self._multivalue
)
widget.context_menu_requested.connect(
self._on_context_menu_requested
self._on_item_context_menu_request
)
self._files_view.setIndexWidget(index, widget)
self._files_proxy_model.setData(
Expand All @@ -859,7 +859,7 @@ def _on_rows_removed(self, parent_index, start_row, end_row):
for row in range(self._files_proxy_model.rowCount()):
index = self._files_proxy_model.index(row, 0)
item_id = index.data(ITEM_ID_ROLE)
available_item_ids.add(index.data(ITEM_ID_ROLE))
available_item_ids.add(item_id)

widget_ids = set(self._widgets_by_id.keys())
for item_id in available_item_ids:
Expand Down Expand Up @@ -923,6 +923,9 @@ def _on_context_menu_requested(self, pos, valid_index):
if menu.actions():
menu.popup(pos)

def _on_item_context_menu_request(self, pos):
self._on_context_menu_requested(pos, True)

def dragEnterEvent(self, event):
if self._multivalue:
return
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/tools/push_to_project/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _check_submit_validations(self):
return False

if (
not self._user_values.new_folder_name
self._user_values.new_folder_name is None
and not self._selection_model.get_selected_folder_id()
):
return False
Expand Down
30 changes: 20 additions & 10 deletions client/ayon_core/tools/push_to_project/models/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ayon_core.pipeline.version_start import get_versioning_start
from ayon_core.pipeline.template_data import get_template_data
from ayon_core.pipeline.publish import get_publish_template_name
from ayon_core.pipeline.create import get_product_name
from ayon_core.pipeline.create import get_product_name, TaskNotSetError

UNKNOWN = object()

Expand Down Expand Up @@ -823,15 +823,25 @@ def _determine_product_name(self):
task_name = task_info["name"]
task_type = task_info["taskType"]

product_name = get_product_name(
self._item.dst_project_name,
task_name,
task_type,
self.host_name,
product_type,
self._item.variant,
project_settings=self._project_settings
)
try:
product_name = get_product_name(
self._item.dst_project_name,
task_name,
task_type,
self.host_name,
product_type,
self._item.variant,
project_settings=self._project_settings
)
except TaskNotSetError:
self._status.set_failed(
"Target product name template requires task name. To continue"
" you have to select target task or change settings"
" <b>ayon+settings://core/tools/creator/product_name_profiles"
f"?project={self._item.dst_project_name}</b>."
)
raise PushToProjectError(self._status.fail_reason)

self._log_info(
f"Push will be integrating to product with name '{product_name}'"
)
Expand Down
7 changes: 5 additions & 2 deletions client/ayon_core/tools/push_to_project/models/user_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ def set_new_folder_name(self, folder_name):
return

self._new_folder_name = folder_name
is_valid = True
if folder_name:
if folder_name is None:
is_valid = True
elif not folder_name:
is_valid = False
else:
is_valid = (
self.folder_name_regex.match(folder_name) is not None
)
Expand Down
Loading

0 comments on commit b4b3ec5

Please sign in to comment.