PDA

View Full Version : Stuck with replace _pasted materials script


Hamburger
11-22-2011, 09:59 PM
Hi there,

I've currently got a script together that can identify _pasted materials and their originals in a scene (it selects the materials and also prints the originals and _pasted counterparts to the script editor).

However I'm now stuck!


// WIP

global proc replacePastedMaterials(){

select -clear;

string $pasted[] = `ls -mat "pasted__*"`;
string $material;
string $stripped;

for ( $material in $pasted )
{
select -add $material;
string $orginal[] = `ls -sl -mat`;
string $elements[];
tokenize( $material, "|", $elements );
string $stripped = $elements[ `size $elements` - 1 ];
$stripped = `substitute "pasted__" $stripped ""`;
select -add ($stripped + "*");

print ($stripped + "\n");
print ($material + "\n");


}

//string $nen=`nodeEditorWindow`;
//string $ncmd="nodeEditor -e -frameAll -rfs 1 -ups 1 -ds 1 "+$nen;
//evalDeferred $ncmd;

}


As you can see by the last few commented lines I've been using this script and replacing the _pasted materials manually -- but it is a pain. Hey I'm scripting right, surely there has to be an automatic way?

You can run the script on this ascii scene below, as you can see the script is almost there!

replaceTest.ma (http://www.mayzie.net/wp-content/downloads/cgtalk/replaceTest.ma)

Once it is working obviously feel free to keep it, pass it on etc...

CGTalk Moderation
11-22-2011, 09:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.