Skip to content

Commit

Permalink
Merge pull request #170 from BigRoy/bugfix/extract_layout_ignore_cont…
Browse files Browse the repository at this point in the history
…ainers_outside_of_project

Extract Layout: Do not error on containers loaded from library project
  • Loading branch information
BigRoy authored Nov 5, 2024
2 parents 22b8ad5 + 8ee263c commit ffe9aaa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions client/ayon_maya/plugins/publish/extract_layout.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import json
import math
import os
import uuid
from typing import List

from ayon_api import get_representation_by_id
from ayon_maya.api import plugin
from maya import cmds
from maya.api import OpenMaya as om


def is_valid_uuid(value) -> bool:
"""Return whether value is a valid UUID"""
try:
uuid.UUID(value)
except ValueError:
return False
return True


def convert_matrix_to_4x4_list(
value) -> List[List[float]]:
"""Convert matrix or flat list to 4x4 matrix list
Expand Down Expand Up @@ -78,11 +89,27 @@ def process(self, instance):
representation_id = cmds.getAttr(
"{}.representation".format(container))

# Ignore invalid UUID is the representation for whatever reason
# is invalid
if not is_valid_uuid(representation_id):
self.log.warning(
f"Skipping container with invalid UUID: {container}")
continue

# TODO: Once we support managed products from another project
# we should be querying here using the project name from the
# container instead.
representation = get_representation_by_id(
project_name,
representation_id,
fields={"versionId", "context", "name"}
)
if not representation:
self.log.warning(
"Representation not found in current project "
"for container: {}".format(container))
continue

version_id = representation["versionId"]
# TODO use product entity to get product type rather than
# data in representation 'context'
Expand Down

0 comments on commit ffe9aaa

Please sign in to comment.