Merge branch 'develop' into enhancement/1416-loader-actions

This commit is contained in:
Jakub Trllo 2025-08-25 16:42:04 +02:00 committed by GitHub
commit 47fc15faf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 8 deletions

View file

@ -6,15 +6,15 @@ from ayon_core.pipeline import load
from ayon_core.pipeline.load import LoadError
class PushToLibraryProject(load.ProductLoaderPlugin):
"""Export selected versions to folder structure from Template"""
class PushToProject(load.ProductLoaderPlugin):
"""Export selected versions to different project"""
is_multiple_contexts_compatible = True
representations = {"*"}
product_types = {"*"}
label = "Push to Library project"
label = "Push to project"
order = 35
icon = "send"
color = "#d8d8d8"
@ -44,7 +44,6 @@ class PushToLibraryProject(load.ProductLoaderPlugin):
version_id = context["version"]["id"]
args = get_ayon_launcher_args(
"run",
push_tool_script_path,
"--project", project_name,
"--version", version_id

View file

@ -5,6 +5,7 @@ import itertools
import sys
import traceback
import uuid
from typing import Optional
import ayon_api
from ayon_api.utils import create_entity_id
@ -21,6 +22,7 @@ from ayon_core.lib import (
source_hash,
)
from ayon_core.lib.file_transaction import FileTransaction
from ayon_core.pipeline.thumbnails import get_thumbnail_path
from ayon_core.settings import get_project_settings
from ayon_core.pipeline import Anatomy
from ayon_core.pipeline.version_start import get_versioning_start
@ -371,7 +373,6 @@ class ProjectPushRepreItem:
resource_files.append(ResourceFile(filepath, relative_path))
continue
filepath = os.path.join(src_dirpath, basename)
frame = None
udim = None
for item in src_basename_regex.finditer(basename):
@ -917,14 +918,19 @@ class ProjectPushItemProcess:
task_name=self._task_info["name"],
task_type=self._task_info["taskType"],
product_type=product_type,
product_name=product_entity["name"]
product_name=product_entity["name"],
)
existing_version_entity = ayon_api.get_version_by_name(
project_name, version, product_id
)
thumbnail_id = self._copy_version_thumbnail()
# Update existing version
if existing_version_entity:
updata_data = {"attrib": dst_attrib}
if thumbnail_id:
updata_data["thumbnailId"] = thumbnail_id
self._operations.update_entity(
project_name,
"version",
@ -939,6 +945,7 @@ class ProjectPushItemProcess:
version,
product_id,
attribs=dst_attrib,
thumbnail_id=thumbnail_id,
)
self._operations.create_entity(
project_name, "version", version_entity
@ -1147,6 +1154,23 @@ class ProjectPushItemProcess:
{"active": False}
)
def _copy_version_thumbnail(self) -> Optional[str]:
thumbnail_id = self._src_version_entity["thumbnailId"]
if not thumbnail_id:
return None
path = get_thumbnail_path(
self._item.src_project_name,
"version",
self._src_version_entity["id"],
thumbnail_id
)
if not path:
return None
return ayon_api.create_thumbnail(
self._item.dst_project_name,
path
)
class IntegrateModel:
def __init__(self, controller):

View file

@ -85,6 +85,13 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
header_widget = QtWidgets.QWidget(main_context_widget)
library_only_label = QtWidgets.QLabel(
"Show only libraries",
header_widget
)
library_only_checkbox = NiceCheckbox(
True, parent=header_widget)
header_label = QtWidgets.QLabel(
controller.get_source_label(),
header_widget
@ -92,7 +99,9 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
header_layout = QtWidgets.QHBoxLayout(header_widget)
header_layout.setContentsMargins(0, 0, 0, 0)
header_layout.addWidget(header_label)
header_layout.addWidget(header_label, 1)
header_layout.addWidget(library_only_label, 0)
header_layout.addWidget(library_only_checkbox, 0)
main_splitter = QtWidgets.QSplitter(
QtCore.Qt.Horizontal, main_context_widget
@ -240,6 +249,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
folder_name_input.textChanged.connect(self._on_new_folder_change)
variant_input.textChanged.connect(self._on_variant_change)
comment_input.textChanged.connect(self._on_comment_change)
library_only_checkbox.stateChanged.connect(self._on_library_only_change)
publish_btn.clicked.connect(self._on_select_click)
cancel_btn.clicked.connect(self._on_close_click)
@ -394,6 +404,11 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
self._comment_input_text = text
self._user_input_changed_timer.start()
def _on_library_only_change(self, state: int) -> None:
"""Change toggle state, reset filter, recalculate dropdown"""
state = bool(state)
self._projects_combobox.set_standard_filter_enabled(state)
def _on_user_input_timer(self):
folder_name_enabled = self._new_folder_name_enabled
folder_name = self._new_folder_name_input_text
@ -534,7 +549,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
self._main_thread_timer_can_stop = False
self._main_thread_timer.start()
self._main_layout.setCurrentWidget(self._overlay_widget)
self._overlay_label.setText("Submittion started")
self._overlay_label.setText("Submission started")
def _on_controller_submit_end(self):
self._main_thread_timer_can_stop = True