Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Just a simple code with a problem

Just a simple code with a problem

theo.baudoin30
Explorer Explorer
504 Views
2 Replies
Message 1 of 3

Just a simple code with a problem

theo.baudoin30
Explorer
Explorer

Hello everyone I am debutant in mel script and I can not find my mistake. I just wanted to add the word "H_" in front of Lambert's name, but he said I had an error. Do you know where this can come from?

 

 

string $refPoly[] = `ls -selection`;
string $Mname = ( "H_" + $refPoly ) ;
string $material = `shadingNode -asShader lambert -name $Mname`;
string $SG = `sets -renderable true -noSurfaceShader true -empty -name "refMaterialSG"`;
connectAttr -f ( $material + ".outColor" ) ( $SG + ".surfaceShader" );
select -r $refPoly[0];
hyperShade -assign $material;

0 Likes
Accepted solutions (1)
505 Views
2 Replies
Replies (2)
Message 2 of 3

mspeer
Consultant
Consultant
Accepted solution

Hi!

 

You can't add an array to string with "+", so change line 2 to:

string $Mname = ( "H_" + $refPoly[0] ) ;

 

Message 3 of 3

theo.baudoin30
Explorer
Explorer

Thanks a lot for your help !!!

0 Likes