Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loader tool: Refactor loader tool (for AYON) #5729

Merged
merged 69 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
11f0c5b
initial commitof ayon loader
iLLiCiTiT Sep 22, 2023
99543c2
tweaks in ayon utils
iLLiCiTiT Sep 22, 2023
adab6d4
implemented product type filtering
iLLiCiTiT Sep 22, 2023
6a0b4db
products have icons and proper style
iLLiCiTiT Sep 22, 2023
3469a9b
fix refresh of products
iLLiCiTiT Sep 22, 2023
3dbb9eb
added enable grouping checkbox
iLLiCiTiT Sep 22, 2023
f8c1686
added icons and sorting of grouped items
iLLiCiTiT Sep 25, 2023
f0f7177
fix version delegate
iLLiCiTiT Sep 25, 2023
12f1c59
add splitter between context and product type filtering
iLLiCiTiT Sep 25, 2023
75414f6
fix products filtering by name
iLLiCiTiT Sep 25, 2023
a844a44
implemented 'filter_repre_contexts_by_loader'
iLLiCiTiT Sep 27, 2023
6cd6131
implemented base of action items
iLLiCiTiT Sep 27, 2023
da9e9a8
implemented folder underline colors
iLLiCiTiT Oct 2, 2023
7dc5b6a
changed version items to dictionary
iLLiCiTiT Oct 2, 2023
3436634
use 'product_id' instead of 'subset_id'
iLLiCiTiT Oct 2, 2023
17c2d7b
base implementation of info widget
iLLiCiTiT Oct 2, 2023
34d28e1
require less to trigger action
iLLiCiTiT Oct 4, 2023
b312867
set selection of version ids in controller
iLLiCiTiT Oct 4, 2023
759b565
added representation widget and related logic changes
iLLiCiTiT Oct 4, 2023
155322f
implemented actions in representations widget
iLLiCiTiT Oct 5, 2023
37c6b47
handle load error
iLLiCiTiT Oct 5, 2023
5d9a7bd
use versions for subset loader
iLLiCiTiT Oct 5, 2023
42ee874
fix representations widget
iLLiCiTiT Oct 5, 2023
5cb1709
implemente "in scene" logic properly
iLLiCiTiT Oct 5, 2023
a751c7b
use ayon loader in host tools
iLLiCiTiT Oct 5, 2023
59cbd12
fix used function to get tasks
iLLiCiTiT Oct 6, 2023
1edd985
show actions per representation name
iLLiCiTiT Oct 6, 2023
b974252
center window
iLLiCiTiT Oct 6, 2023
062966b
add window flag to loader window
iLLiCiTiT Oct 6, 2023
3f33141
added 'ThumbnailPainterWidget' to tool utils
iLLiCiTiT Oct 6, 2023
d4fa75c
implemented thumbnails model
iLLiCiTiT Oct 6, 2023
533c0a3
implement thumbnail widget
iLLiCiTiT Oct 6, 2023
46e08bf
fix FolderItem args docstring
iLLiCiTiT Oct 6, 2023
51f2a52
bypass bug in ayon_api
iLLiCiTiT Oct 6, 2023
00f7e07
fix sorting of folders
iLLiCiTiT Oct 6, 2023
f6f65f6
added refresh button
iLLiCiTiT Oct 6, 2023
a9f9e33
added expected selection and go to current context
iLLiCiTiT Oct 6, 2023
822a0f8
added information if project item is library project
iLLiCiTiT Oct 6, 2023
99b6e99
added more filtering options to projects widget
iLLiCiTiT Oct 6, 2023
0cd5f5c
added missing information abou is library to model items
iLLiCiTiT Oct 6, 2023
e097017
remove select project item on selection change
iLLiCiTiT Oct 6, 2023
f0be388
filter out non library projects
iLLiCiTiT Oct 6, 2023
06f9d87
set current context project to project combobox
iLLiCiTiT Oct 6, 2023
fbf42c8
change window title
iLLiCiTiT Oct 6, 2023
93719fe
fix hero version queries
iLLiCiTiT Oct 9, 2023
5ddb31a
move current project to the top
iLLiCiTiT Oct 9, 2023
cce2a26
fix reset
iLLiCiTiT Oct 9, 2023
62a1cff
change icon for library projects
iLLiCiTiT Oct 9, 2023
5b95f0c
added libraries separator to project widget
iLLiCiTiT Oct 9, 2023
7d2bd3d
show libraries separator in loader
iLLiCiTiT Oct 9, 2023
6a67c11
ise single line expression
iLLiCiTiT Oct 9, 2023
7b970b3
library loader tool is loader tool in AYON mode
iLLiCiTiT Oct 9, 2023
538be74
fixes in grouping model
iLLiCiTiT Oct 9, 2023
a950741
implemented grouping logic
iLLiCiTiT Oct 9, 2023
adf177c
use loader in tray action
iLLiCiTiT Oct 9, 2023
251b95d
better initial sizes
iLLiCiTiT Oct 9, 2023
db97e3b
moved 'ActionItem' to abstract
iLLiCiTiT Oct 9, 2023
bd2b35c
filter loaders by tool name based on current context project
iLLiCiTiT Oct 9, 2023
58d9e84
formatting fixes
iLLiCiTiT Oct 9, 2023
56d0bde
separate abstract classes into frontend and backend abstractions
iLLiCiTiT Oct 9, 2023
10e3dd7
added docstrings to abstractions
iLLiCiTiT Oct 9, 2023
a337763
implemented 'to_data' and 'from_data' for action item options
iLLiCiTiT Oct 9, 2023
8f464c6
added more docstrings
iLLiCiTiT Oct 9, 2023
2a02cf3
first filter representation contexts and then create action items
iLLiCiTiT Oct 10, 2023
e949262
implemented 'refresh' method
iLLiCiTiT Oct 10, 2023
5d85d3e
do not reset controller in '_on_first_show'
iLLiCiTiT Oct 10, 2023
e2d3782
'ThumbnailPainterWidget' have more options of bg painting
iLLiCiTiT Oct 10, 2023
1e78d72
do not use checkerboard in loader thumbnail
iLLiCiTiT Oct 10, 2023
6ba7f41
fix condition
iLLiCiTiT Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions openpype/modules/avalon_apps/avalon_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from openpype import AYON_SERVER_ENABLED
from openpype.modules import OpenPypeModule, ITrayModule


Expand Down Expand Up @@ -75,20 +76,11 @@ def tray_exit(self, *_a, **_kw):

def show_library_loader(self):
if self._library_loader_window is None:
from qtpy import QtCore
from openpype.tools.libraryloader import LibraryLoaderWindow
from openpype.pipeline import install_openpype_plugins

libraryloader = LibraryLoaderWindow(
show_projects=True,
show_libraries=True
)
# Remove always on top flag for tray
window_flags = libraryloader.windowFlags()
if window_flags | QtCore.Qt.WindowStaysOnTopHint:
window_flags ^= QtCore.Qt.WindowStaysOnTopHint
libraryloader.setWindowFlags(window_flags)
self._library_loader_window = libraryloader
if AYON_SERVER_ENABLED:
self._init_ayon_loader()
else:
self._init_library_loader()

install_openpype_plugins()

Expand All @@ -106,3 +98,25 @@ def webserver_initialization(self, server_manager):
if self.tray_initialized:
from .rest_api import AvalonRestApiResource
self.rest_api_obj = AvalonRestApiResource(self, server_manager)

def _init_library_loader(self):
from qtpy import QtCore
from openpype.tools.libraryloader import LibraryLoaderWindow

libraryloader = LibraryLoaderWindow(
show_projects=True,
show_libraries=True
)
# Remove always on top flag for tray
window_flags = libraryloader.windowFlags()
if window_flags | QtCore.Qt.WindowStaysOnTopHint:
window_flags ^= QtCore.Qt.WindowStaysOnTopHint
libraryloader.setWindowFlags(window_flags)
self._library_loader_window = libraryloader

def _init_ayon_loader(self):
from openpype.tools.ayon_loader.ui import LoaderWindow

libraryloader = LoaderWindow()

self._library_loader_window = libraryloader
2 changes: 2 additions & 0 deletions openpype/pipeline/load/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

loaders_from_repre_context,
loaders_from_representation,
filter_repre_contexts_by_loader,

any_outdated_containers,
get_outdated_containers,
Expand Down Expand Up @@ -85,6 +86,7 @@

"loaders_from_repre_context",
"loaders_from_representation",
"filter_repre_contexts_by_loader",

"any_outdated_containers",
"get_outdated_containers",
Expand Down
18 changes: 18 additions & 0 deletions openpype/pipeline/load/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,24 @@ def loaders_from_repre_context(loaders, repre_context):
]


def filter_repre_contexts_by_loader(repre_contexts, loader):
"""Filter representation contexts for loader.

Args:
repre_contexts (list[dict[str, Ant]]): Representation context.
loader (LoaderPlugin): Loader plugin to filter contexts for.

Returns:
list[dict[str, Any]]: Filtered representation contexts.
"""

return [
repre_context
for repre_context in repre_contexts
if is_compatible_loader(loader, repre_context)
]


def loaders_from_representation(loaders, representation):
"""Return all compatible loaders for a representation."""

Expand Down
10 changes: 7 additions & 3 deletions openpype/pipeline/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,12 @@ def process(self, thumbnail_entity, thumbnail_type):

# This is new way how thumbnails can be received from server
# - output is 'ThumbnailContent' object
if hasattr(ayon_api, "get_thumbnail_by_id"):
result = ayon_api.get_thumbnail_by_id(thumbnail_id)
# NOTE Use 'get_server_api_connection' because public function
# 'get_thumbnail_by_id' does not return output of 'ServerAPI'
# method.
con = ayon_api.get_server_api_connection()
if hasattr(con, "get_thumbnail_by_id"):
result = con.get_thumbnail_by_id(thumbnail_id)
if result.is_valid:
filepath = cache.store_thumbnail(
project_name,
Expand All @@ -178,7 +182,7 @@ def process(self, thumbnail_entity, thumbnail_type):
else:
# Backwards compatibility for ayon api where 'get_thumbnail_by_id'
# is not implemented and output is filepath
filepath = ayon_api.get_thumbnail(
filepath = con.get_thumbnail(
project_name, entity_type, entity_id, thumbnail_id
)

Expand Down
6 changes: 6 additions & 0 deletions openpype/tools/ayon_loader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .control import LoaderController


__all__ = (
"LoaderController",
)
Loading