Animate Prim Visibility #2640
Replies: 5 comments
-
|
Hmm.. interesting - lemme replicate and have a poke around inside. |
Beta Was this translation helpful? Give feedback.
-
|
Quick update, I don't believe we've got current capability to animate USD data in that way however i'm getting some help internally to check on the proxyAccessor approach as to if it's just visibility not being tagged, or if it's a whole class of attrs etc etc. (with the result being us logging tickets or otherwise tracking this and converting out the discussion) |
Beta Was this translation helpful? Give feedback.
-
|
I did some digging around on my end and I was not able to find a way to get visibility or purpose to work. It seems to recognize that the attribute exists and then creates the access plug, but editing the value doesn't make a difference. When this was initially implemented, I think the main focus was around xformsOps so it is possible that there isn't full support for other attributes. @christophezito I will create an issue or we can convert this to an issue and then track it to see if we can fix or add the support for visibility and purpose. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your interrest. I don't know what is the best option (create an new issue or convert this discussion to an issue), but it would definitlly be great to have the possibility to drive the Prim's visibility attribute like all xformOps using ProxyAccessors. Let me know if you need more input or context. I would be happy to help. Thanks again, Christophe |
Beta Was this translation helpful? Give feedback.
-
|
Tested this in Maya 2025.3 with Any recommendations or workaround on how to connect Maya native attributes to USD's visibility, With animation or even statically? Complete reprocase: import maya.cmds as cmds
from mayaUsd import lib as mayausdlib
import mayaUsd.lib.proxyAccessor as proxyAccessor
from pxr import Sdf
usd_path = ".../example.usd" # update path
# Create mayaUsdProxyShape and load the USD file
proxy_shape = cmds.createNode("mayaUsdProxyShape", name="usdProxyShape1")
proxy_shape = cmds.ls(proxy_shape, long=True)[0]
cmds.setAttr(f"{proxy_shape}.filePath", usd_path, type="string")
cmds.connectAttr('time1.outTime', f"{proxy_shape}.time", force=True)
prim_path = "/Xform1/Cube1"
usd_stage = mayausdlib.GetPrim(proxy_shape).GetStage()
usd_prim = usd_stage.GetPrimAtPath(prim_path)
vis_attr = usd_prim.GetProperty("visibility")
vis_type = vis_attr.GetTypeName()
# Create visibility attribute on mayaUsdProxyShape
ufe_object = proxyAccessor.createUfeSceneItem(f"{proxy_shape},{prim_path}")
visibility_pa = proxyAccessor.getOrCreateAccessPlug(
ufeObject=ufe_object, usdAttrName="visibility", sdfValueType=vis_type
)
# Test setting visibility attribute
cmds.setAttr(f"{proxy_shape}.{visibility_pa}", "invisible", type="string") # expect to change the Prim vis to invisible
cmds.setAttr(f"{proxy_shape}.{visibility_pa}", "inherited", type="string") # expect to change the Prim vis to inherited |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Our goal is to animate USD Prims within Maya.
For all transform operations, we use ProxyAccessors and it seems to perform well.
But regarding the
visibilityproperty, it seems to be more complicated.Using Maya 2022, the visibility attribute is exposed in the channel box, but is not keyable.
So we tried using the
ProxyAccessorsto handle this attribute, but apparently, even if the ProxyAccessor plug is created, it has no effect on the Prim's property. (See example below).Thanks,
Christophe
Beta Was this translation helpful? Give feedback.
All reactions