Select object with material shortcut

Select object with material shortcut

will.ibarra
Observer Observer
572 Views
2 Replies
Message 1 of 3

Select object with material shortcut

will.ibarra
Observer
Observer

Is there any way to make ''select object with material'' function accessible through mel or python? Its usable though the hypershade or outliner but I need it in script. Thanks.

0 Likes
573 Views
2 Replies
Replies (2)
Message 2 of 3

mcw0
Advisor
Advisor

I'm not in Maya right now but in the scriptEditor, there's an option to print back the commands that Maya executes.  Clear the top field and run the function from the hyperShade and see what is printed back.

The other way is to get the shadingEngine connected to your selected shader.  A shadingEngine is an objectSet.  Then you can query the set's members to get all the meshes assigned to that shader.  Or you can get all meshes connected to the shadingEngine/objectSet.  Many ways to do the same thing.

0 Likes
Message 3 of 3

will.ibarra
Observer
Observer

Thanks for the reply. For some reasons when I run the operation Maya prints out only select ''-cl; select -r sphere1'' which is a simple clear select and select the geometry. I thought it would spit out something like select -shader node

but sadly it doesn't. 

 

maybe I can use the shading engine method. Maya script Mel prints something back when I create that.

0 Likes