Remove avalon DB path

This commit is contained in:
clement.hector 2022-06-10 16:24:04 +02:00
parent 325827361a
commit 29e095e285
3 changed files with 1 additions and 58 deletions

View file

@ -1,52 +0,0 @@
from copy import copy
from openpype.api import Logger
from openpype.modules.shotgrid.lib import (
credentials,
settings,
server,
)
_LOG = Logger().get_logger("ShotgridModule.patch")
def _patched_projects(
self, projection=None, only_active=True
):
all_projects = list(self._prev_projects(projection, only_active))
if (
not credentials.get_local_login()
or not settings.filter_projects_by_login()
):
return all_projects
try:
linked_names = _fetch_linked_project_names() or set()
return [x for x in all_projects if _upper(x["name"]) in linked_names]
except Exception as e:
print(e)
return all_projects
def _upper(x):
return str(x).strip().upper()
def _fetch_linked_project_names():
return {
_upper(x["project_name"])
for x in server.find_linked_projects(credentials.get_local_login())
}
def patch_avalon_db():
_LOG.debug("Run avalon patching")
try:
from avalon.api import AvalonMongoDB
if AvalonMongoDB.projects is _patched_projects:
return None
_LOG.debug("Patch Avalon.projects method")
AvalonMongoDB._prev_projects = copy(AvalonMongoDB.projects)
AvalonMongoDB.projects = _patched_projects
except Exception as e:
_LOG.error("Unable to patch avalon db {}".format(e))

View file

@ -46,10 +46,6 @@ class ShotgridModule(
def tray_init(self):
from .tray.shotgrid_tray import ShotgridTrayWrapper
from .aop.patch import patch_avalon_db
patch_avalon_db()
threading.Timer(10.0, patch_avalon_db).start()
self.tray_wrapper = ShotgridTrayWrapper(self)

View file

@ -64,11 +64,10 @@
},
{
"type": "schema",
},
{
"name": "schema_project_shotgrid"
},
{
"type": "schema",
"name": "schema_project_kitsu"
},
{