Select objects with same material

Become a member of the CGSociety

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

Thread Tools Display Modes
  07 July 2018
Select objects with same material

I finded this script and i need select all mesh with same material without use "hyperShade -objects " command.
Can you help me?

string $objName[] = `ls -sl -l`;
string $myShapeNode[] = `listRelatives -children -shapes $objName[0]`;
string $mySGs[] = `listConnections -type shadingEngine $myShapeNode[0]`;
string $surfaceShader[] = `listConnections ($mySGs[0] + ".surfaceShader")`;
select -r $surfaceShader[0];
hyperShade -objects $surfaceShader[0];

hyperShade return all name.
I need return only the first mesh name from selection of the material.

  07 July 2018
hyperShade -objects "";
return shapenode, I need transorm node and/or name mesh.

  07 July 2018
Hi with this I have my target but I can't select it.
I need select all obj into $points!!!
Please Help me.

string $sfSel[] = `ls -sl -fl`;
string $points[];
for ($sfSOS in $sfSel)
$src_n = `listTransforms $sfSOS`;
string $points[] = $src_n;
select -r $points;

Last edited by LacioDrom83 : 07 July 2018 at 07:16 PM.
  07 July 2018
I have a Python version of the script to select objects with the same material.
3D animation blog
  07 July 2018
Originally Posted by kiryha: I have a Python version of the script to select objects with the same material.

I think....
select -add $points;

  07 July 2018
Switch to Python (PyMel, not cmds) and you will have way more applicable skill than MEL.
3D animation blog
reply 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 06:42 PM.

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