triple switch node

101 views
Skip to first unread message

miarmy

unread,
Apr 9, 2017, 5:15:35 PM4/9/17
to Python Programming for Autodesk Maya
hi!,I created a triple switch node,...
i want code of add surface button
look image:


help help help help....

justin hidair

unread,
Apr 11, 2017, 2:47:38 PM4/11/17
to Python Programming for Autodesk Maya
+ 1 PLEASE Someone respond to this

Ravi Jagannadhan

unread,
Apr 11, 2017, 2:49:54 PM4/11/17
to python_in...@googlegroups.com
I don't see any content in the e-mail?

On Tue, Apr 11, 2017 at 11:47 AM, justin hidair <justin...@gmail.com> wrote:
+ 1 PLEASE Someone respond to this

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6ff28f45-667b-4806-8280-5df9d9474015%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan

kevco...@gmail.com

unread,
Apr 13, 2017, 12:05:41 AM4/13/17
to Python Programming for Autodesk Maya
On Sunday, April 9, 2017 at 2:15:35 PM UTC-7, miarmy wrote:
> hi!,I created a triple switch node,...
> i want code of add surface button
> look image:
>
>
>
> help help help help....

is it line 169 of AEswitchControlTemplate.mel?

Andres Weber

unread,
Apr 17, 2017, 5:31:24 PM4/17/17
to Python Programming for Autodesk Maya
I personally find that looking at nodes like this in the NodeEditor helps if they have really dodgy/hidden mel AETemplate based functionality and a non obvious codeable interaction.  (WARNING: I'm realtively sure coding this in, without using the AETemplate calls will break the AETemplate and render the attribute view pretty useless.)























You can see that this one has Input[0].inShape.  So all you need to do is connect something to that attribute and can work with the code for compound attributes to detect:

import maya.cmds as mc
node = 'tripleShadingSwitch1'
[attr for attr in mc.listAttr('%s.input[:]' % node) if mc.listConnections('%s.%s'%(node, attr))]

This will display all connected input attributes.  Remove the if in the list comprehension and you can then just get all input attributes that are currently added to the node.  Good luck.

zeth willie

unread,
Apr 18, 2017, 3:54:26 PM4/18/17
to Python Programming for Autodesk Maya
I recently did a bunch of stuff scripting stuff into triple switches and it's tricky largely bc of the area Andres is talking about. If all you're doing is setting it up once, it's probably fine and not too hard, but all of those index numbers start to get a little harder to manage if you're accessing/changing it later via scripts bc you'll have to clean some stuff up yourself. You can end up with the same thing going into multiple indexes, empty indexes that become confusing in terms of the numbering (bc you'll have to line up the inTriple with the same index), indexes with something in the triple, but nothing in the input shape, etc. Not a deal breaker, but more confusing than most simple hook ups.  Writing a separate function that just cleans up the triple switch (or any given entry) might be helpful. HTH.

Z

Kumaran M

unread,
Apr 18, 2017, 11:14:50 PM4/18/17
to Python Programming for Autodesk Maya
I agree with zeth, and i have some code to share, but its around a lot of propiretry stuff, so i am avoiding a rewrite for now.
But if you go through the mel, you will see the cleanups and the way they handle it, and you would have to write up a python version for yourself.

Good luck,
Kumar
Reply all
Reply to author
Forward
0 new messages