Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Replace selected textures with lambert
  RSS 2.0 ATOM  

Replace selected textures with lambert
Rate this thread
 
36138
 
Permlink of this thread   Subscribe to this thread
avatar
  • alper455
  • Posted: 29 October 2009 12:12 PM
  • Total Posts: 8
  • Joined: 23 August 2006 02:07 AM

I have written to a script that would replace selected textures to lambert. Maybe it might have a use for people.

string $selection[] = `ls -selection`;

int $numElements size($selection)

print ("Number of elements is  " $numElements "\n")

int $i
;

for 
($i $i size($selection) $i++)
{
print ("For loop is  " $i "\n")
 

string $shaderNode 
$selection[$i];

string $replaceType "lambert";

string $replaceWith = `createNode $replaceType`;

replaceNode $shaderNode $replaceWith;

delete $shaderNode;

rename $replaceWith $shaderNode;
 
}


Replies: 0
avatar
  • samavan
  • Posted: 03 November 2009 01:49 PM

Reading you code you forget some ; and then some `` ... Should create some error in Maya… O_o…

you cantry the following one if the only one thing you want to do is to assign the lambert 1 to your objects :

string $selection[] = `ls -sl -l`;
if 
(`size $selection`>0)
{
 
for ($item in $selection)
 {
 sets 
--forceElement initialShadingGroup $item ;
 


else error "No polygonal objects found";


Portfolio_small.png

Replies: 0




   
  Settings Choose Theme color: