Help fixing a script_srbMultiCache?

Help fixing a script_srbMultiCache?

Anonymous
Not applicable
296 Views
1 Reply
Message 1 of 2

Help fixing a script_srbMultiCache?

Anonymous
Not applicable
Hello I found this script in creative crash "srbMultiCache", it caches multiples objects (selection), you are able to export / import caches, for some reason the import option does not work, I can't figure out why?

Help much appreciated.

I'm using Maya 2011 but I'm geting the same error with 2009 and 2010
here the code:

//////////////////////////////////////////////////////////////////// //CREATE THE GLOBAL PROCEDURE---
global proc srbMultiCache() {
//USER INTERFACE---
if (`window -exists srbMultiCacheWin`) deleteUI srbMultiCacheWin;
window
-title "Cache multiple objects"
-rtf 1
-maximizeButton 0
srbMultiCacheWin;
columnLayout -adj 1;
textFieldButtonGrp
-label "Cache directory:"
-text "Enter cache file directory path (d:/data/sphere)..."
-buttonLabel "Browse"
-buttonCommand "srbFileBrowser"
dirPathTFG;
intSliderGrp -field 1 -label "Start Frame:"
-minValue -0 -maxValue 100
-fieldMinValue -1000 -fieldMaxValue 1000
-value ( `playbackOptions -q -min ` )
startFrameISG;

intSliderGrp -field 1 -label "End Frame:"
-minValue -0 -maxValue 100
-fieldMinValue -1000-fieldMaxValue 1000
-value ( `playbackOptions -q -max ` )
endFrameISG;
textFieldGrp
-label "Substitute reference name:"
-text ""
substituteTFG;
button -l "Export" -c "srbMultiCacheExportProc";
button -l "Import" -c "srbMultiCacheImportProc";
separator;
text -al left " This tool create a cache file for each selected Objects";
separator;
showWindow srbMultiCacheWin;
}
//CREATE THE MAIN PROCEDURE---
///////////////////////////////////////////////////////////////////
//Export Cache procedure
global proc srbMultiCacheExportProc () {
//DECLARE AND STORE SOME VARIABLES---
global string $gMainProgressBar;
string $dirPath = `textFieldGrp -query -text dirPathTFG`;
int $startFrameVal = `intSliderGrp -query -value startFrameISG`;
int $endFrameVal = `intSliderGrp -query -value endFrameISG`;
string $replaceName = `textFieldGrp -query -text substituteTFG`;
string $sel[] = `ls -sl`;
int $sizeSel = `size($sel)`;
//CREATE AND EDIT THE CUSTOM PROGRESSBAR ---
progressBar
-edit
-beginProgress
-isInterruptable true
-status "Exporting caches for selected objects...."
-maxValue ($sizeSel)
$gMainProgressBar;
if ($sizeSel == 0)
{
warning "Please select at least one geometry to export cache...";
}
else
{
for ($obj in $sel)
{
if(`progressBar -query -isCancelled $gMainProgressBar`)
{break;
print "Exporting cache file cancelled by user...\n";
}

progressBar
-edit
-step 1
$gMainProgressBar;

string $newName = `substitute $replaceName $obj ("")`;
string $newDirPath = ($dirPath + "/" + $newName )
select -r $obj;
doCreateGeometryCache 4 { "3", $startFrameVal, $endFrameVal, "OneFilePerFrame", "1", $newDirPath,"0","","0", "add", "0", "1", "1","0","0" } ;
}
//END PROGRESS BAR---
progressBar -edit
-endProgress
$gMainProgressBar;

print "SRB - Multiple Cache v0.3 has completed exporting geometry cache for selected objects...";
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Import Cache Procedure
global proc srbMultiCacheImportProc ()
{
string $dirPath = `textFieldGrp -query -text dirPathTFG`;
int $startFrameVal = `intSliderGrp -query -value startFrameISG`;
int $endFrameVal = `intSliderGrp -query -value endFrameISG`;
string $replaceName = `textFieldGrp -query -text substituteTFG`;
string $sel[] = `ls -sl`;
int $sizeSel = `size($sel)`;
if ($sizeSel == 0)
{
warning "Please select at least one geometry to import cache...";
}
else
{
//MAIN LOOP---
for ($obj in $sel)
{
string $colon = ":";
string $newName = `substitute $replaceName $obj ("")`;
string $cacheName = `substitute $colon $obj("_")`;
string $newDirPath = ($dirPath + "/" + $newName + "/" + $cacheName + "Shape.xml")
select -r $obj;
ImportCacheFile $newDirPath "xml";
}
print "SRB - Multiple Cache v0.3 has completed importing geometry cache for selected objects...";
}
}
global proc srbFileBrowser ()
{
fileBrowserDialog -mode 4 -fc "srbUpdateDirectory" -an "Pick your cache file directory:";
return;
}
global proc srbUpdateDirectory (string $path, string $mode)
{
string $bases[] = `ls -sl`;
float $size = `size $bases`;
string $base = $bases;
select -ado;
string $before[] = `ls -sl`;
textFieldButtonGrp -edit -text $path dirPathTFG;
}
//IMPORTANT PIECE OF CODE---
source doImportCacheFile.mel;
global proc int
ImportCacheFile(string $fileName, string $fileType)
{
string $geometries[];
return doImportCacheFile($fileName, $fileType,$geometries,{})
}
//THE END---
srbMultiCache;
0 Likes
297 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Your code already already has 3 " ; " missing and the end of 3 lines.

Also the import command will call a Maya thing called "srbMultiCacheImportProc".
and them the error is saying :


// Error: file: C:/Program Files/Autodesk/Maya2009/scripts/others/doImportCacheFile.mel line 117: The file name flag is required when querying channel names. // 


Then first do not call Maya stuff before to know what are the condition for using it in a good way.
And second do not use script directly in the Maya script resource will help to understand better why the script doesn't work!


Also last thing, at the end of the script, there is a source to a file called doImportCacheFile.mel;
And this file is probably not the same you can find in your Maya installation directory and will probably correct something.

Then you probably has to find this file first :) it probably overwrites something from the original function in your Maya 😄
0 Likes