anopheles
01-08-2006, 03:03 PM
Okay here my code:
global proc endpointer () {
string $currentselection[] = `ls -sl`;
// check to see if curve
string $shapenode[] = (`listRelatives -pa -s $currentselection`);
string $nodechecker = `nodeType $shapenode[0]`;
if ($nodechecker != "nurbsCurve")
print "Selection was not a curve, creating default curve";
curve -d 3 -p 0 0 0 -p 1 4 0 -p 1.886928 7.619122 0 -p 2.58097 10.04827 0 -p 4.229321 12.781062 0 -p 6.26807 13.691993 0 -p 7.786288 13.691993 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 4 -k 4 ;
string $currentselection[] = `ls -sl`;
else {
if ($nodechecker == "nurbsCurve")
for ($current in $currentselection)
{
string $shapenode[] = (`listRelatives -s $current`);
int $numCV = `getAttr -s ($shapenode[0]+".controlPoints")`;
float $lastsel = `select -r ($currentselection[0]+".cv["+($numCV-1)+"]")`;
float $xypos[] = `xform -ws -q -t`;
anoCurver $xypos $currentselection;
}}};
This should be a pretty simple script I know what the problem is and why it is not
working but I dont know how to fix it.
The part which is interessting for you is this one:
if ($nodechecker != "nurbsCurve")
print "Selection was not a curve, creating default curve";
curve -d 3 -p 0 0 0 -p 1 4 0 -p 1.886928 7.619122 0 -p 2.58097 10.04827 0 -p 4.229321 12.781062 0 -p 6.26807 13.691993 0 -p 7.786288 13.691993 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 4 -k 4 ;
string $currentselection[] = `ls -sl`;
else {
So if the selections shape node is not a curve it should create the default curve
and put it in the $currenselection array. The problem is is this is localy stored,
because when I want to get the currentselection a a different {} it cant get it
anymore. How can I pass the string $currentselection[] = `ls -sl`; to a
different bracket?
Thanks ;)
anopheles
global proc endpointer () {
string $currentselection[] = `ls -sl`;
// check to see if curve
string $shapenode[] = (`listRelatives -pa -s $currentselection`);
string $nodechecker = `nodeType $shapenode[0]`;
if ($nodechecker != "nurbsCurve")
print "Selection was not a curve, creating default curve";
curve -d 3 -p 0 0 0 -p 1 4 0 -p 1.886928 7.619122 0 -p 2.58097 10.04827 0 -p 4.229321 12.781062 0 -p 6.26807 13.691993 0 -p 7.786288 13.691993 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 4 -k 4 ;
string $currentselection[] = `ls -sl`;
else {
if ($nodechecker == "nurbsCurve")
for ($current in $currentselection)
{
string $shapenode[] = (`listRelatives -s $current`);
int $numCV = `getAttr -s ($shapenode[0]+".controlPoints")`;
float $lastsel = `select -r ($currentselection[0]+".cv["+($numCV-1)+"]")`;
float $xypos[] = `xform -ws -q -t`;
anoCurver $xypos $currentselection;
}}};
This should be a pretty simple script I know what the problem is and why it is not
working but I dont know how to fix it.
The part which is interessting for you is this one:
if ($nodechecker != "nurbsCurve")
print "Selection was not a curve, creating default curve";
curve -d 3 -p 0 0 0 -p 1 4 0 -p 1.886928 7.619122 0 -p 2.58097 10.04827 0 -p 4.229321 12.781062 0 -p 6.26807 13.691993 0 -p 7.786288 13.691993 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 4 -k 4 ;
string $currentselection[] = `ls -sl`;
else {
So if the selections shape node is not a curve it should create the default curve
and put it in the $currenselection array. The problem is is this is localy stored,
because when I want to get the currentselection a a different {} it cant get it
anymore. How can I pass the string $currentselection[] = `ls -sl`; to a
different bracket?
Thanks ;)
anopheles
