Search code examples
pythonmaya

How to get an attribute's anim curve between utility nodes?


I'm very aware about cmds.listHistory and cmds.listConnections, but they fail miserably here.

Let's say I have a 3 objects:

A has a custom attribute that drives C's visibility.

Between that connection let's say there's a bunch of utility nodes.

And finally there's B that drives one of the utility nodes but has nothing to do with C.

If I set keyframes on A's custom attribute, how can find from C the anim curve that's driving it? If this was a direct connection it would be easier to solve, but it's not. If B is also animated it will fetch both anim curves. In fact if A has no anim curve but B does listing history will grab B's anim curve, which is totally bogus!

This feels like it's impossible to get the anim curve that's driving C's visibility without mistaking it with another one?


Solution

  • So you have something like this? Two nodes are connected to a utility node and the output of a utility node drives visibility of the node on the right side?

    If so, I fear it is not possible to determine which input drives the visibility, you will have to do it yourself by iterating over all nodes. Something like this?