aws-deadline / deadline-cloud-for-maya

AWS Deadline Cloud for Maya
Apache License 2.0
11 stars 16 forks source link

fix: when listing layers make sure referenced layers are active. #164

Closed rmv closed 3 months ago

rmv commented 3 months ago

What was the problem/requirement? (What/Why)

Submitter won't open with Maya files that reference files with inactive additional render layers.

What was the solution? (How)

When checking valid render layers make also sure that they are connected to the current layer manager.

What is the impact of this change?

No negative impact.

How was this change tested?

Added a job bundle test, tested with a customer maya scene and with a repro.

Did you run the "Job Bundle Output Tests"? If not, why not? If so, paste the test results here.

Yes, all passed.

Was this change documented?

No need to, bug fix.

Is this a breaking change?

No


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

erico-aws commented 3 months ago

Should we add some unit tests for this?

rmv commented 3 months ago

Pushed some fixes:

rmv commented 3 months ago

@erico-aws was asking:

Should we add some unit tests for this?

I added a job bundle output test to cover this issue.

I think the code that gets the render layers is not very suited for a unit test, it mainly consists of calls to Maya's API, once we mock up those there would be nothing left to test:

# ignore referenced and disconnected layers
render_manager = maya.cmds.ls("renderLayerManager")[0]
render_layer_map = {
    maya.mel.eval(f'renderLayerDisplayName "{render_layer_name}"'): name
    for name in maya.cmds.ls(type="renderLayer")
    if not maya.cmds.referenceQuery(name, isNodeReferenced=True)
    and maya.cmds.listConnections(name, t="renderLayerManager")[0] == render_manager
}