General: Filter available applications (#4667)

* added project settings for applications

* filter applications by new settings in launcher and ftrack

* disable filtering by default
This commit is contained in:
Jakub Trllo 2023-03-21 18:10:09 +01:00 committed by GitHub
parent c5ead7548c
commit c8c31018d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 0 deletions

View file

@ -124,6 +124,11 @@ class AppplicationsAction(BaseAction):
if not avalon_project_apps:
return False
settings = self.get_project_settings_from_event(
event, avalon_project_doc["name"])
only_available = settings["applications"]["only_available"]
items = []
for app_name in avalon_project_apps:
app = self.application_manager.applications.get(app_name)
@ -133,6 +138,10 @@ class AppplicationsAction(BaseAction):
if app.group.name in CUSTOM_LAUNCH_APP_GROUPS:
continue
# Skip applications without valid executables
if only_available and not app.find_executable():
continue
app_icon = app.icon
if app_icon and self.icon_url:
try:

View file

@ -0,0 +1,3 @@
{
"only_available": false
}

View file

@ -82,6 +82,10 @@
"type": "schema",
"name": "schema_project_slack"
},
{
"type": "schema",
"name": "schema_project_applications"
},
{
"type": "schema",
"name": "schema_project_max"

View file

@ -0,0 +1,14 @@
{
"type": "dict",
"key": "applications",
"label": "Applications",
"collapsible": true,
"is_file": true,
"children": [
{
"type": "boolean",
"key": "only_available",
"label": "Show only available applications"
}
]
}

View file

@ -19,6 +19,7 @@ from openpype.lib.applications import (
CUSTOM_LAUNCH_APP_GROUPS,
ApplicationManager
)
from openpype.settings import get_project_settings
from openpype.pipeline import discover_launcher_actions
from openpype.tools.utils.lib import (
DynamicQThread,
@ -94,6 +95,8 @@ class ActionModel(QtGui.QStandardItemModel):
if not project_doc:
return actions
project_settings = get_project_settings(project_name)
only_available = project_settings["applications"]["only_available"]
self.application_manager.refresh()
for app_def in project_doc["config"]["apps"]:
app_name = app_def["name"]
@ -104,6 +107,9 @@ class ActionModel(QtGui.QStandardItemModel):
if app.group.name in CUSTOM_LAUNCH_APP_GROUPS:
continue
if only_available and not app.find_executable():
continue
# Get from app definition, if not there from app in project
action = type(
"app_{}".format(app_name),