PDA

View Full Version : Problem with reloading references Please help


devolved
04-05-2007, 08:02 PM
Here's a scipt that I came up with to iterate through referenced files and replace these with a new locations. When I run the script it does what it supposed to but then spits out.....

// Error: File not found.: //tails-server/tails render/Treetop_Studios/Tails_Video_1/Characters/Goose/Susie/scenes/Susie2.mb //

When I copy and paste the above path to the command :file -loadReference Susie2RN -type "mayaBinary" -options "v=0" "//tails-server/tails render/Treetop_Studios/Tails_Video_1/Characters/Goose/Susie/scenes/Susie2.mb";

it runs fine...


What am I doing wrong? The script is shown below. Any help is appreciated.



$foundFiles = (`ls -typ "reference"`);
print $foundFiles;

for ($elem in $foundFiles) {

if (!`gmatch $elem "*sharedReferenceNode*"` && !`gmatch $elem "*UNKNOWN_REF_NODE*"`) {

if (`gmatch $elem "*Sky*"`) {
file -removeReference "T:/Treetop_Studios/Tails_Video_1/Props/Scene_2/UpThereSky/Sky.mb";
}

else {
string $origLocation = (`referenceQuery -f $elem`);

file -removeReference $origLocation;


string $newLocation = `substitute "T:/" $origLocation "//tails-server/tails render/"` ;
file -loadReference $elem -type "mayaBinary" -options "v=0" $newLocation;

}

}

}

JamesPiechota
04-06-2007, 01:20 AM
I haven't tested this, but try removing the second 'file -removeReference' line:


$foundFiles = (`ls -typ "reference"`);
print $foundFiles;

for ($elem in $foundFiles) {
if (!`gmatch $elem "*sharedReferenceNode*"` && !`gmatch $elem "*UNKNOWN_REF_NODE*"`) {
if (`gmatch $elem "*Sky*"`) {
file -removeReference "T:/Treetop_Studios/Tails_Video_1/Props/Scene_2/UpThereSky/Sky.mb";
}
else {
string $origLocation = (`referenceQuery -f $elem`);

// DELETE THIS LINE:
//file -removeReference $origLocation;

string $newLocation = `substitute "T:/" $origLocation "//tails-server/tails render/"` ;
file -loadReference $elem -type "mayaBinary" -options "v=0" $newLocation;
}
}
}

The file -loadReference command should be enough to change the path referred to by the $elem reference node. The file -removeReference command was actually removing $elem as a reference altogether (Which would by one reason why the -loadReference would fail).

CGTalk Moderation
04-06-2007, 01:20 AM
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.