Maya API initialising Node variables

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  11 November 2010
Maya API initialising Node variables

Hey guys,

Learning the maya API and I have created a Node which I can plug in object translate attributes and it outputs the result I want back to those objects.

After connecting all my objects I want to get my node to update a value with the number of objects connected. Is there any way to get it to run a function which will set-up my Node so that it will compute to all of them correctly? Or am I thinking about it the wrong way? Thanks!
To become a great artist just try and suck a little less every day.
  11 November 2010
Just want to make sure I understand what you want:

so you have a custom node whose output plugs connect to the translate attributes of multiple objects ? Is it an array plug or one plug for each translate attribute it connects to ?

And you want to compute the total number of objects your node is connected to ?
  11 November 2010
Hey whisperwing,

It's a custom node with an array plug connected to multiple objects, I want to know if I can get my node to find the number of connections after they are connected.

Or do I just have to check during the compute function? Just seems a bit inefficient..
To become a great artist just try and suck a little less every day.
  11 November 2010
One way to do it is to use Mplug::connectedTo() to get all the plugs it connected to. Then just check the size of the MplugArray returned from the function. This way could be used even if your plug is not an array plug.
But since you are using an array plug, you can use Mplug::numConnectedElements().

Last edited by whisperwing : 11 November 2010 at 08:26 PM.
  11 November 2010
awesome thanks bud I'll do that!
To become a great artist just try and suck a little less every day.
  11 November 2010
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:16 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.