mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
group invalid representaion ids under same group
This commit is contained in:
parent
d6e047cd1d
commit
3c927eb4fb
1 changed files with 12 additions and 10 deletions
|
|
@ -103,17 +103,8 @@ class ContainerItem:
|
|||
|
||||
@classmethod
|
||||
def from_container_data(cls, container):
|
||||
repre_id = container["representation"]
|
||||
|
||||
try:
|
||||
uuid.UUID(repre_id)
|
||||
except (ValueError, TypeError, AttributeError):
|
||||
# Fake not existing representation id so container is shown in UI
|
||||
# but as invalid
|
||||
repre_id = uuid.uuid4().hex
|
||||
|
||||
return cls(
|
||||
representation_id=repre_id,
|
||||
representation_id=container["representation"],
|
||||
loader_name=container["loader"],
|
||||
namespace=container["namespace"],
|
||||
object_name=container["objectName"],
|
||||
|
|
@ -367,9 +358,20 @@ class ContainersModel:
|
|||
container_items = []
|
||||
containers_by_id = {}
|
||||
container_items_by_id = {}
|
||||
invalid_ids_mapping = {}
|
||||
for container in containers:
|
||||
try:
|
||||
item = ContainerItem.from_container_data(container)
|
||||
repre_id = item.representation_id
|
||||
try:
|
||||
uuid.UUID(repre_id)
|
||||
except (ValueError, TypeError, AttributeError):
|
||||
# Fake not existing representation id so container is shown in UI
|
||||
# but as invalid
|
||||
item.representation_id = invalid_ids_mapping.setdefault(
|
||||
repre_id, uuid.uuid4().hex
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
# skip item if required data are missing
|
||||
self._controller.log_error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue