Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 19-03-2012 , 03:50 PM
Registered User
Join Date: Aug 2008
Posts: 9

Selecting all polygon objects in the scene with a certain prefix

Hi guys,

Hope you're all well.

So i'm relatively new to mel and have managed just fine so far copying and editing other peoples scripts and writing my own (basic ones user added image Now i'm stuck and could really do with all your help.

I've spent a week building a scene filled with hundreds and hundreds of doors that open and close randomly. All these doors have hinges that are just to big. i want to make them smaller. Now there are thousands. SO

I want to write a script that looks through all the nodes in the scene and selects all the polygon meshes that have steelHinge in the name (all the hinges are steelHinge01, steelHinge02 and so on. The number at the end is quite random as ive deleted some and added some during the week. Nonetheless they all have a certain prefix

This is what i have at the moment, but i dont see anything selected in my viewport, and also it seems to be missing some???

// declare an array called $nodes. Call ls to list
// the nodes in the scene
$meshes = `ls -type "mesh"`;

// loop through each mesh
for( $mesh in $meshes )
// print the mesh name

$name = $mesh +"\n";

if(startsWith($name, "steelHinge"))

# 2 19-03-2012 , 03:52 PM
honestdom's Avatar
The Nurb Herd
Join Date: Oct 2007
Location: London
Posts: 2,381
umm... use select by name and type steelHinge*

# 3 19-03-2012 , 04:08 PM
Registered User
Join Date: Aug 2008
Posts: 9
Thats exactly what i was after. Hats off to you sir. You just simplified so much for me. AWESOME, i've made a note user added image

# 4 19-03-2012 , 06:08 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Just in case you're interested, you can use the match function with a regular expression to do the same thing.

Imagination is more important than knowledge.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads