Hi, In my #MEL command browse button is not working I'm getting an error
// Error: line 56: Object 'rsTxtPath' not found. ANY IDEA?
proc ScreenCaptureWin()
{
global string $rsTxtPath, $rsTxtName;
string $sn = `file -q -sn`;
string $cfp = `dirname( $sn )`;
if (`window -exists ScreenCapture`) //closes window if already open
deleteUI ScreenCapture;
window -title "ScreenCapture" ScreenCapture; //creates window
rowColumnLayout -numberOfColumns 5 -columnAttach 1 "right" 1 -columnWidth 10 10 -columnWidth 50 10;
text -label "Path";
$rsTxtPath = `textField -w 200 -h 28 -tx $cfp -ed true rsTxtFld`;
symbolButton -w 60 -h 28 -image "openLoadGeneric.png" -c "rsFileDialog()" rsTxtPath;
button -w 60 -h 28 -label "Capture" -command "Capture";
symbolButton -w 60 -h 28 -image "refresh.png" -command "seleP()";
rowColumnLayout -numberOfColumns 2 -columnAttach 1 "left" 1 -columnWidth 10 10 -columnWidth 10 10;
text -label "Name";
$rsTxtName = `textField -w 100 -h 28 -ed true `;
// show the window we last created
showWindow;;
}
global proc Capture()
{
global string $rsTxtPath;
global string $rsTxtName;
string $path = `textField -q -tx $rsTxtPath`;
string $FileName = `textField -q -tx $rsTxtName`;
string $rsFileList[] = `getFileList -folder $path`;
int $rsFileCount = size($rsFileList);
string $k = ($path + ("/"+$FileName+".jpg"));
string $ff = ".png";
string $node[] = `ls -sl`;
setAttr "defaultRenderGlobals.imageFormat" 8;
playblast -st 1 -et 1 -v 0 -fmt "image" -qlt 100 -p 100 -w 1000 -h 1000 -fp 0 -cf $k;
clear $node;
}
proc seleP() //It is for relaod button automatically add path where the user saved the Maya file
{
string $selDir = `workspace -q -dir`;
textFieldButtonGrp -e -tx $selDir rsTxtPath ;
}
proc rsFileDialog()
{
string $rsPath[] = `fileDialog2 -ds 1 -fm 3`;
textFieldButtonGrp -e -tx $rsPath[0] rsTxtPath;
}
Replies
global string $rsTxtPath, $rsTxtName;
Needs to be added inside every function(proc) that wants to use the global version.