ynput / ayon-maya

Maya addon for AYON
Apache License 2.0
6 stars 9 forks source link

Extract camera Alembic: Incorrectly gets cameras #154

Open johhnry opened 1 month ago

johhnry commented 1 month ago

Is there an existing issue for this?

Current Behavior:

We are trying to publish a MatchMove product from a Maya Scene that has a single camera. It fails at the Extract Camera (Maya Scene) step in the publish.

Here is my scene: image

This is the relevant output:

  File "C:\Users\joseph.henry\AppData\Local\Ynput\AYON\addons\maya_0.2.14\ayon_maya\plugins\publish\extract_camera_mayaScene.py", line 269, in transfer_image_planes
    image_planes = cmds.listConnections(image_plane_plug,
ValueError: No object matches name: |pCube1|pCubeShape1.imagePlane

After investigating, it seems that it boils down to this line: https://github.com/ynput/ayon-maya/blob/265d1d8c38113043518cb5c0a1924dd5b3dca8de/client/ayon_maya/plugins/publish/extract_camera_mayaScene.py#L146

It tries to get the cameras by filtering objects from the ones you selected. In my case it's a camera and a geo.

If I test this code:

from maya import cmds

members = set(
    cmds.ls(
        ["pCube1", "camera1"],
        leaf=True,
        shapes=True,
        long=True,
        dag=True,
    )
)

print("MEMBERS: ", members)

cameras = set(
    cmds.ls(
        members,
        leaf=True,
        shapes=True,
        long=True,
        dag=True,
        type="camera",
    )
)

print("CAMERAS: ", cameras)
MEMBERS:  {'|camera1|cameraShape1', '|pCube1|pCubeShape1'}
CAMERAS:  {'|camera1|cameraShape1', '|pCube1|pCubeShape1'}

So it tried to filter out the cameras (with type="camera" in cmds.ls) but it didn't work because it tries to get the .imagePlane object on a geo.

I found that using cmds.ls(members, dag=True, type="camera") works and prints {'cameraShape1'}

Expected Behavior:

It should filter the cameras out of the objects in the publish set.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Open Maya
  2. Create a camera and a geo
  3. Select both objects
  4. Go to AYON > Create and create a MatchMove product
  5. Hit Publish

Are there any labels you wish to add?

Relevant log output:

No response

Additional context:

No response