Maya API what is a networked plug and do i want it or not?

Maya API what is a networked plug and do i want it or not?

Anonymous
Not applicable
2,002 Views
2 Replies
Message 1 of 3

Maya API what is a networked plug and do i want it or not?

Anonymous
Not applicable

Hi, im using the API with python and got curious. I've been using the MFnDependencyNode function findPlug and it has a parameter called wantNetworkedPlug and i really do not know what it means and if it is something i should have or not. As i do not know i have just set it to False all the time without really knowing what it does. Anyone want to shed some light upon what it is?

0 Likes
2,003 Views
2 Replies
Replies (2)
Message 2 of 3

kevin.picott
Alumni
Alumni

You're in luck, since I wrote that code some 20 years ago, back when Maya was just a baby!

 

Maya plugs come in two flavors - networked and non-networked. Which one you want depends on what use you're putting them to. Networked plugs contain the actual connection data between two nodes, and maybe some other flags as required, such as whether the plug is locked. Maya is free to create and destroy them as it needs to, and no notifications are sent when that happens. Non-networked plugs can be thought of as named references to a plug. They belong to you and have the lifespan you dictate.

 

In C++ terms a non-networked plug is like a copy of an object and a networked plug is like a pointer to it. The networked plugs have a speed advantage since you access the data directly and don't pay the cost of copying the object, but can go away at any time after your function has exited. The non-networked plugs are more permanent; they only go away when you destroy them or they go out of scope. (Neither will update if the object or attribute to which they refer is destroyed though.)

 

Now that the history lesson is over, some years back I optimized the plug code so that the networked plugs no longer offered the speed advantage they once did, so you can keep right on passing in False to that function and everything will work just fine.



Kevin "Father of the DG" Picott

Senior Principal Engineer
Message 3 of 3

Anonymous
Not applicable

Thank you, It was quite insightful.

0 Likes