mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Ignore invalid representation ids
This commit is contained in:
parent
ea3c559143
commit
285ad4cdb3
2 changed files with 33 additions and 1 deletions
|
|
@ -1,7 +1,18 @@
|
|||
import uuid
|
||||
|
||||
import ayon_api
|
||||
import pyblish.api
|
||||
|
||||
|
||||
def is_valid_uuid(value) -> bool:
|
||||
"""Return whether value is a valid UUID"""
|
||||
try:
|
||||
uuid.UUID(value)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class CollectInputRepresentationsToVersions(pyblish.api.ContextPlugin):
|
||||
"""Converts collected input representations to input versions.
|
||||
|
||||
|
|
@ -23,6 +34,12 @@ class CollectInputRepresentationsToVersions(pyblish.api.ContextPlugin):
|
|||
if inst_repre:
|
||||
representations.update(inst_repre)
|
||||
|
||||
# Ignore representation ids that are not valid
|
||||
representations = {
|
||||
representation_id for representation_id in representations
|
||||
if is_valid_uuid(representation_id)
|
||||
}
|
||||
|
||||
repre_entities = ayon_api.get_representations(
|
||||
project_name=context.data["projectName"],
|
||||
representation_ids=representations,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,20 @@
|
|||
import uuid
|
||||
|
||||
import ayon_api
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline import registered_host
|
||||
|
||||
|
||||
def is_valid_uuid(value) -> bool:
|
||||
"""Return whether value is a valid UUID"""
|
||||
try:
|
||||
uuid.UUID(value)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class CollectSceneLoadedVersions(pyblish.api.ContextPlugin):
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.0001
|
||||
|
|
@ -40,6 +51,10 @@ class CollectSceneLoadedVersions(pyblish.api.ContextPlugin):
|
|||
container["representation"]
|
||||
for container in containers
|
||||
}
|
||||
repre_ids = {
|
||||
repre_id for repre_id in repre_ids
|
||||
if is_valid_uuid(repre_id)
|
||||
}
|
||||
|
||||
project_name = context.data["projectName"]
|
||||
repre_entities = ayon_api.get_representations(
|
||||
|
|
@ -65,7 +80,7 @@ class CollectSceneLoadedVersions(pyblish.api.ContextPlugin):
|
|||
continue
|
||||
|
||||
# NOTE:
|
||||
# may have more then one representation that are same version
|
||||
# may have more than one representation that are same version
|
||||
version = {
|
||||
"container_name": con["name"],
|
||||
"representation_id": repre_entity["id"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue