Hey guys,
I haven’t done any scripting in over a decade and I want to grab a user input number from a prompt dialog box to use it as a variable for a loop statement. Here is what I have:
string $result = promptDialog -title "Key Mesh Frames" -message "Number of Frames" -button "OK" -button "Cancel" -defaultButton "OK" -cancelButton "Cancel" -dismissString "Cancel"
;
if ($result == “OK”) {
$int = promptDialog -query
;
$frameCount = float($int);
MeshKeyStepLoop;
}
global proc MeshKeyStepLoop()
{
for( $i=0; $i<10; ++$i )
{
string $nodes[] = ls -selection
;
for ($node in $nodes)
{
Do Something;
}
}
}
I want to replace the number 10 on the for loop to a variable, but when I attempt to replace it with ($frameCount) Maya says it is an undeclared variable. Does anyone know how I can get this to work? thanks in advance!