mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
🚧 wip on validation of parent relationships
This commit is contained in:
parent
ca6d77fff7
commit
73fb899e90
1 changed files with 19 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ class ValidateCameraContents(pyblish.api.InstancePlugin):
|
|||
invalid = []
|
||||
cameras = cmds.ls(shapes, type='camera', long=True)
|
||||
if len(cameras) != 1:
|
||||
cls.log.warning("Camera instance must have a single camera. "
|
||||
cls.log.error("Camera instance must have a single camera. "
|
||||
"Found {0}: {1}".format(len(cameras), cameras))
|
||||
invalid.extend(cameras)
|
||||
|
||||
|
|
@ -51,16 +51,32 @@ class ValidateCameraContents(pyblish.api.InstancePlugin):
|
|||
raise RuntimeError("No cameras found in empty instance.")
|
||||
|
||||
if not cls.validate_shapes:
|
||||
return
|
||||
cls.log.info("not validating shapes in the content")
|
||||
|
||||
for member in members:
|
||||
parents = cmds.ls(member, long=True)[0].split("|")[1:-1]
|
||||
cls.log.info(parents)
|
||||
parents_long_named = [
|
||||
"|".join(parents[:i]) for i in range(1, 1 + len(parents))
|
||||
]
|
||||
cls.log.info(parents_long_named)
|
||||
if cameras[0] in parents_long_named:
|
||||
cls.log.error(
|
||||
"{} is parented under camera {}".format(member, cameras[0]))
|
||||
invalid.extend(member)
|
||||
return invalid
|
||||
|
||||
# non-camera shapes
|
||||
valid_shapes = cmds.ls(shapes, type=('camera', 'locator'), long=True)
|
||||
shapes = set(shapes) - set(valid_shapes)
|
||||
if shapes:
|
||||
shapes = list(shapes)
|
||||
cls.log.warning("Camera instance should only contain camera "
|
||||
cls.log.error("Camera instance should only contain camera "
|
||||
"shapes. Found: {0}".format(shapes))
|
||||
invalid.extend(shapes)
|
||||
|
||||
|
||||
|
||||
invalid = list(set(invalid))
|
||||
|
||||
return invalid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue