Autodesk / maya-usd

A common USD (Universal Scene Description) plugin for Autodesk Maya

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow showing sublayers in payloads/references to also be able to mute those layers in Layer Editor

BigRoy opened this issue · comments

Is your feature request related to a problem? Please describe.

Working on asset look development I want to load an asset.usd which would contain the latest department layers for modeling, look, etc. but mute the look layer so what I'm seeing in my look development scene shows my current contributions and ignores the look contributions from previous iterations that are in the USD asset.

Unfortunately this doesn't work for me because our asset.usd offloads its layers into a ./payload.usd file which gets payloaded into the asset.

Describe the solution you'd like

Expose the layers in the USD Layer Editor to allow muting the sublayers in references and payloads in the USD stage.

This could be a toggle in the Layer Editor menu like "Auto-Hide Session Layer", etc.

Describe alternatives you've considered

Going through the Python API and rolling custom UIs - but I'd rather not.

However, it seems totally possible to mute them via the API currently:

from maya import cmds
import mayaUsd
from pxr import Sdf, Usd


def is_look_layer(layer):
    # simplified detection whether it is a look layer
    return "layer_id=look" in layer.identifier

proxies = cmds.ls(type="mayaUsdProxyShape", long=True)
for proxy in proxies:
    stage = mayaUsd.ufe.getStage("|world" + proxy)
    for layer in stage.GetUsedLayers():
        if is_look_layer(layer):
            print(f"Muting {layer.identifier}")
            stage.MuteLayer(layer.identifier)

Additional context
n/a

An alternative could be to have an attribute on the usd proxy shapes that could accept wildcards or render setup like pattern expressions to maybe dynamically mute layers for that stage?

So that e.g. a mute_layer_pattern attribute could be set to: *look*; then whenever any of those layers in used layers pop up that matches that it'd mute it.

But might be a bit expensive to keep track of continuously?