Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Loader: Families filtering #2043

Merged
merged 23 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d960ec7
defined family view, model and proxy model
iLLiCiTiT Sep 17, 2021
767142b
added simpler checkstate changes with space, enter and backspace
iLLiCiTiT Sep 17, 2021
ab98bf5
added filtering model
iLLiCiTiT Sep 17, 2021
7696fbd
pass refreshed to subset widget
iLLiCiTiT Sep 17, 2021
aad7996
fixed subset projection
iLLiCiTiT Sep 17, 2021
2e871a7
store subset families
iLLiCiTiT Sep 17, 2021
e6abb64
added ability to return families of current subsets
iLLiCiTiT Sep 17, 2021
5c1f34a
families filtering by asset added to library loader
iLLiCiTiT Sep 17, 2021
0639cfa
fixed duplication of families
iLLiCiTiT Sep 17, 2021
11ad2a8
FamiliesFilterProxyModel does not need family config
iLLiCiTiT Sep 17, 2021
eb9b880
refresh family configu during refresh of family model
iLLiCiTiT Sep 17, 2021
84cab2b
removed unused global_family_cache
iLLiCiTiT Sep 17, 2021
9433ffe
modified family config to suit more for settings
iLLiCiTiT Sep 17, 2021
7ccc1bc
added initial settings for families
iLLiCiTiT Sep 17, 2021
1bbfa72
added more suitable families
iLLiCiTiT Sep 17, 2021
622dfa0
use SharedObject class for jobs
iLLiCiTiT Sep 17, 2021
424c76e
replaced default item with just using new dictionary
iLLiCiTiT Sep 17, 2021
62b975d
update family filters on context change
iLLiCiTiT Sep 17, 2021
e731003
fix class name
iLLiCiTiT Sep 17, 2021
1ca05ef
hound fixes
iLLiCiTiT Sep 17, 2021
aeb5b59
Merge branch 'develop' into feature/loader_families_filtering
iLLiCiTiT Sep 17, 2021
7bb87a1
fixed filling of families
iLLiCiTiT Sep 20, 2021
d095830
fixed method arguments order
iLLiCiTiT Sep 20, 2021
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
9 changes: 9 additions & 0 deletions openpype/settings/defaults/project_settings/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,15 @@
"textures"
]
}
},
"loader": {
"family_filter_profiles": [
{
"hosts": [],
"task_types": [],
"filter_families": []
}
]
}
},
"project_folder_structure": "{\"__project_root__\": {\"prod\": {}, \"resources\": {\"footage\": {\"plates\": {}, \"offline\": {}}, \"audio\": {}, \"art_dept\": {}}, \"editorial\": {}, \"assets[ftrack.Library]\": {\"characters[ftrack]\": {}, \"locations[ftrack]\": {}}, \"shots[ftrack.Sequence]\": {\"scripts\": {}, \"editorial[ftrack.Folder]\": {}}}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,48 @@
}
}
]
},
{
"type": "dict",
"collapsible": true,
"key": "loader",
"label": "Loader",
"children": [
{
"type": "list",
"key": "family_filter_profiles",
"label": "Family filtering",
"use_label_wrap": true,
"object_type": {
"type": "dict",
"children": [
{
"type": "hosts-enum",
"key": "hosts",
"label": "Hosts",
"multiselection": true
},
{
"type": "task-types-enum",
"key": "task_types",
"label": "Task types"
},
{
"type": "splitter"
},
{
"type": "template",
"name": "template_publish_families",
"template_data": {
"key": "filter_families",
"label": "Filter families",
"multiselection": true
}
}
]
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"__default_values__": {
"multiselection": true
}
},
{
"key": "{key}",
"label": "{label}",
"multiselection": "{multiselection}",
"type": "enum",
"enum_items": [
{"action": "action"},
{"animation": "animation"},
{"audio": "audio"},
{"camera": "camera"},
{"editorial": "editorial"},
{"layout": "layout"},
{"look": "look"},
{"mayaAscii": "mayaAscii"},
{"model": "model"},
{"pointcache": "pointcache"},
{"reference": "reference"},
{"render": "render"},
{"review": "review"},
{"rig": "rig"},
{"setdress": "setdress"},
{"workfile": "workfile"},
{"xgen": "xgen"}
]
}
]
48 changes: 23 additions & 25 deletions openpype/tools/libraryloader/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import time

from Qt import QtWidgets, QtCore, QtGui

Expand All @@ -9,7 +8,7 @@
from openpype.tools.loader.widgets import (
ThumbnailWidget,
VersionWidget,
FamilyListWidget,
FamilyListView,
RepresentationWidget
)
from openpype.tools.utils.widgets import AssetWidget
Expand Down Expand Up @@ -65,7 +64,7 @@ def __init__(
assets = AssetWidget(
self.dbcon, multiselection=True, parent=self
)
families = FamilyListWidget(
families = FamilyListView(
self.dbcon, self.family_config_cache, parent=self
)
subsets = LibrarySubsetWidget(
Expand Down Expand Up @@ -151,6 +150,7 @@ def __init__(
assets.view.clicked.connect(self.on_assetview_click)
subsets.active_changed.connect(self.on_subsetschanged)
subsets.version_changed.connect(self.on_versionschanged)
subsets.refreshed.connect(self._on_subset_refresh)
self.combo_projects.currentTextChanged.connect(self.on_project_change)

self.sync_server = sync_server
Expand Down Expand Up @@ -242,6 +242,12 @@ def on_project_change(self):
"Config `%s` has no function `install`" % _config.__name__
)

subsets = self.data["widgets"]["subsets"]
representations = self.data["widgets"]["representations"]

subsets.on_project_change(self.dbcon.Session["AVALON_PROJECT"])
representations.on_project_change(self.dbcon.Session["AVALON_PROJECT"])

self.family_config_cache.refresh()
self.groups_config.refresh()

Expand All @@ -252,12 +258,6 @@ def on_project_change(self):
title = "{} - {}".format(self.tool_title, project_name)
self.setWindowTitle(title)

subsets = self.data["widgets"]["subsets"]
subsets.on_project_change(self.dbcon.Session["AVALON_PROJECT"])

representations = self.data["widgets"]["representations"]
representations.on_project_change(self.dbcon.Session["AVALON_PROJECT"])

@property
def current_project(self):
if (
Expand Down Expand Up @@ -288,6 +288,14 @@ def on_versionschanged(self, *args):
self.echo("Fetching version..")
tools_lib.schedule(self._versionschanged, 150, channel="mongo")

def _on_subset_refresh(self, has_item):
subsets_widget = self.data["widgets"]["subsets"]
families_view = self.data["widgets"]["families"]

subsets_widget.set_loading_state(loading=False, empty=not has_item)
families = subsets_widget.get_subsets_families()
families_view.set_enabled_families(families)

def set_context(self, context, refresh=True):
self.echo("Setting context: {}".format(context))
lib.schedule(
Expand All @@ -312,13 +320,14 @@ def _refresh_assets(self):
assert project_doc, "This is a bug"

assets_widget = self.data["widgets"]["assets"]
families_view = self.data["widgets"]["families"]
families_view.set_enabled_families(set())
families_view.refresh()

assets_widget.model.stop_fetch_thread()
assets_widget.refresh()
assets_widget.setFocus()

families = self.data["widgets"]["families"]
families.refresh()

def clear_assets_underlines(self):
last_asset_ids = self.data["state"]["assetIds"]
if not last_asset_ids:
Expand All @@ -337,8 +346,6 @@ def clear_assets_underlines(self):

def _assetschanged(self):
"""Selected assets have changed"""
t1 = time.time()

assets_widget = self.data["widgets"]["assets"]
subsets_widget = self.data["widgets"]["subsets"]
subsets_model = subsets_widget.model
Expand All @@ -365,14 +372,6 @@ def _assetschanged(self):
empty=True
)

def on_refreshed(has_item):
empty = not has_item
subsets_widget.set_loading_state(loading=False, empty=empty)
subsets_model.refreshed.disconnect()
self.echo("Duration: %.3fs" % (time.time() - t1))

subsets_model.refreshed.connect(on_refreshed)

subsets_model.set_assets(asset_ids)
subsets_widget.view.setColumnHidden(
subsets_model.Columns.index("asset"),
Expand All @@ -386,9 +385,8 @@ def on_refreshed(has_item):
self.data["state"]["assetIds"] = asset_ids

representations = self.data["widgets"]["representations"]
representations.set_version_ids([]) # reset repre list

self.echo("Duration: %.3fs" % (time.time() - t1))
# reset repre list
representations.set_version_ids([])

def _subsetschanged(self):
asset_ids = self.data["state"]["assetIds"]
Expand Down
4 changes: 2 additions & 2 deletions openpype/tools/loader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from .app import (
LoaderWidow,
LoaderWindow,
show,
cli,
)

__all__ = (
"LoaderWidow",
"LoaderWindow",
"show",
"cli",
)
Loading