Hi everyone,
I’m looking to create a plugin anim switching node. That is, something that will take multiple anim curves as inputs and switch between them to provide a single anim curve as output. It would be quite similar to the built-in Choice node except that there is some extended functionality I want to add. This is all fairly straightforward except that I’d like the node to be as invisible to the user as possible. For example, when you key a node being controlled by one of these switches I’d like the key to be set on the currently active anim curve. I know this ought to be possible, because this is what happens with the Choice node by default. However, I cannot find any information anywhere and how this keying information is passed through a node.
As a bonus, I’d love it if the graph editor could display the incoming curve as though it were hooked up directly and not going through an intermediary node. This is how a pair blend displays its incoming anim curves so, again, it seems like it ought to be possible.
Does anyone know how either of these things are achieved? Documentation and examples of nodes that sit in the middle of animation like this are a little spotty.
Thanks
Solved! Go to Solution.
Solved by brentmc. Go to Solution.
Try overriding MPxNode::passThroughToOne.
When passed an input plug you should return the output and when passed the output you should return the active input.
Not saying this is the answer but I would start there.
Hey Brent. Thanks for the reply. I have looked at passThroughToOne. As near as I can tell, it is largely used to rewire connections when the node is deleted--which is born out by testing. The only aspect I'm not certain of is this line from the documentation:
The base class Maya implementation of passThroughToAll will call this method if passThroughToAll returns false.
I'm not certain what passThroughToAll does or in what situation it would return false. I can't find any mention of it anywhere else in the documentation (or anywhere else on the internet). Aside from that, passThroughToOne doesn't appear to be triggered when keying.
I thought it might be using passthrough but this does not seem to be the case.
I did some more digging and it seems setKeyframe is explicitly handling blend, pair nodes etc so this wouldn't be possible without modifications to the Maya API.
I think the only way around it is to make a custom setKey command that handles your special node type.
Sorry.
Thanks. I was afraid that might be the case. It seems a slightly odd way to handle it since it must mean hardcoding a lot of exceptions into the setKeyframe command. A custom seyKey command might do the trick
Can't find what you're looking for? Ask the community or share your knowledge.