AYON: General fixes and updates (#4975)

* fix color conversion of maya load colors

* this seems to have been accidentally switched before, if there are no versions, return nothing, if there are, return something

* maya failed to run the userSetup due to the variable having been changed to settings

* fix representation fields conversion

* fix missing legacy io

* fix tools env conversion

* Updated AYON python api

---------

Co-authored-by: Sveinbjorn J. Tryggvason <sveinbjorn@rvx.is>
This commit is contained in:
Jakub Trllo 2023-05-17 12:46:57 +02:00 committed by Jakub Trllo
parent 1ff18dc4f3
commit c360d0b28d
8 changed files with 35 additions and 20 deletions

View file

@ -589,12 +589,15 @@ class EntityHub(object):
parent_id = task["folderId"]
tasks_by_parent_id[parent_id].append(task)
lock_queue = collections.deque()
hierarchy_queue = collections.deque()
hierarchy_queue.append((None, project_entity))
while hierarchy_queue:
item = hierarchy_queue.popleft()
parent_id, parent_entity = item
lock_queue.append(parent_entity)
children_ids = set()
for folder in folders_by_parent_id[parent_id]:
folder_entity = self.add_folder(folder)
@ -604,10 +607,16 @@ class EntityHub(object):
for task in tasks_by_parent_id[parent_id]:
task_entity = self.add_task(task)
lock_queue.append(task_entity)
children_ids.add(task_entity.id)
parent_entity.fill_children_ids(children_ids)
self.lock()
# Lock entities when all are added to hub
# - lock only entities added in this method
while lock_queue:
entity = lock_queue.popleft()
entity.lock()
def lock(self):
if self._project_entity is None:
@ -1198,6 +1207,7 @@ class BaseEntity(object):
self._attribs.lock()
self._immutable_for_hierarchy_cache = None
self._created = False
def _get_entity_by_id(self, entity_id):
return self._entity_hub.get_entity_by_id(entity_id)

View file

@ -314,7 +314,6 @@ def representations_graphql_query(fields):
def representations_parents_qraphql_query(
version_fields, subset_fields, folder_fields
):
query = GraphQlQuery("RepresentationsParentsQuery")
project_name_var = query.add_variable("projectName", "String!")
@ -388,7 +387,7 @@ def workfiles_info_graphql_query(fields):
def events_graphql_query(fields):
query = GraphQlQuery("WorkfilesInfo")
query = GraphQlQuery("Events")
topics_var = query.add_variable("eventTopics", "[String!]")
projects_var = query.add_variable("projectNames", "[String!]")
states_var = query.add_variable("eventStates", "[String!]")

View file

@ -14,6 +14,7 @@ except ImportError:
HTTPStatus = None
import requests
from requests.exceptions import JSONDecodeError as RequestsJSONDecodeError
from .constants import (
DEFAULT_PROJECT_FIELDS,
@ -112,9 +113,9 @@ class RestApiResponse(object):
@property
def data(self):
if self._data is None:
if self.status != 204:
try:
self._data = self.orig_response.json()
else:
except RequestsJSONDecodeError:
self._data = {}
return self._data
@ -128,7 +129,10 @@ class RestApiResponse(object):
@property
def detail(self):
return self.get("detail", _get_description(self))
detail = self.get("detail")
if detail:
return detail
return _get_description(self)
@property
def status_code(self):
@ -299,14 +303,6 @@ class ServerAPI(object):
'production').
"""
_entity_types_link_mapping = {
"folder": ("folderIds", "folders"),
"task": ("taskIds", "tasks"),
"subset": ("subsetIds", "subsets"),
"version": ("versionIds", "versions"),
"representation": ("representationIds", "representations"),
}
def __init__(
self,
base_url,
@ -916,7 +912,7 @@ class ServerAPI(object):
project_names = set(project_names)
if not project_names:
return
filters["projectName"] = list(project_names)
filters["projectNames"] = list(project_names)
if states is not None:
states = set(states)

View file

@ -1,2 +1,2 @@
"""Package declaring Python API for Ayon server."""
__version__ = "0.1.17-1"
__version__ = "0.1.18"