PDA

View Full Version : how can i call the string in global procedure?


blendMinds
12-27-2005, 09:46 AM
hi folks

see this script it's giving error "undetermind string"

i trying to connect to circle to mutiplydivide node

how we can call the string in global procedure
window;
columnLayout ;
textFieldButtonGrp -l "GlobalCurve:" -bl "sel" -bc "globalsel" my;
button -l"scaleJoints" -c("apply");
showWindow;
global proc globalsel()
{ string $objs[0];
$objs = `ls -sl`;
if (size($objs) == 0)
error "You have nothing selected, try again.";
$shape = `listRelatives -f -c $objs[0]`;
if (`nodeType $shape[0]` != "nurbsCurve")
error "You don't have a nurbs curve selected.\n";
textFieldButtonGrp -e -tx $objs[0] my;
}
global proc apply ()
{

string $curvesrt;
$curvesrt=`textFieldButtonGrp -q -tx my`;
$cmd = "Do ";
$cmd += "\"";
evalEcho $cmd;
}
global proc Do(string $curvesrt)
{
$curvesrt=`textFieldButtonGrp -q -tx my`;
string $globalScale;
string $curveScale;
$curveScale =`createNode multiplyDivide`;
$globalScale=`createNode multiplyDivide`;
setAttr ($globalScale +".operation") 1;
$ty=`getAttr($curveScale+".input2X")`;
setAttr($globalScale+".input2X") $ty;
connectAttr ($globalScale+".input2X")($curveScale+".input2X");
connectAttr ($curvesrt+".scaleX")($globalScale+".input1X");
}


thanks

harmless
12-28-2005, 04:45 PM
The error actually says: "Unterminated string."
It is caused by this script:

$cmd = "Do ";
$cmd += "\"";
evalEcho $cmd;

I am not really sure why you are doing it this way.
I think you are simply trying to call the function "Do".
In that case the proper syntax would be:

$cmd = "Do();";
evalEcho $cmd;

...but that is just a silly way of doing this:

Do();

So, replace this function:

global proc apply ()
{
string $curvesrt;
$curvesrt=`textFieldButtonGrp -q -tx my`;
$cmd = "Do ";
$cmd += "\"";
evalEcho $cmd;
}

with this:

global proc apply ()
{
string $curvesrt;
$curvesrt=`textFieldButtonGrp -q -tx my`;
Do();
}

CGTalk Moderation
12-28-2005, 04:45 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.