PDA

View Full Version : Absurd Syntax Error


uTgh4K33
12-14-2012, 02:19 PM
I copied a Mel Script, here it is:



//Reorientar joint XYZ

proc jointOri_xyz() {

//consultar selección

string $selJoint[] = `ls -sl`;

//Chequear tamaño de selección

if (size($selJoint) != 2)(warning "Must select 2 joints!";)

else if (size($selfJoint) == 2) {

//Rotación y Joint Orient Attributes de la joint a 0 para orientarla al mundo

setAttr ($selJoint[1] + ".rx") 0;

setAttr ($selJoint[1] + ".ry") 0;

setAttr ($selJoint[1] + ".rz") 0;

setAttr ($selJoint[1] + ".jointOrientX") 0;

setAttr ($selJoint[1] + ".jointOrientX") 0;

setAttr ($selJoint[1] + ".jointOrientX") 0;

//Crear aimConstraint

string $aimJoint[] = `aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0

-upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;

//encontrar y borrar constraint

string $findAimCns[] = `listRelatives -type aimConstraint $selJoint[1]`;

select 4findAimCns[0]; doDelete;

//Intercambiar valores de rotación de la Joint por Joint Orient values

//Encontrar lo valores de rotación de la target joint

float $selJnt_rz = `getArrt ($selJoint[1] + ".rx")`;

float $selJnt_ry = `getArrt ($selJoint[1] + ".ry")`;

float $selJnt_rz = `getArrt ($selJoint[1] + ".rz")`;


//Copiar los valores de rotación de la target joint a los atributos Joint Orient

setAttr ($selJoint[1] + ".jointOrientX") ($selJnt_rx);

setAttr ($selJoint[1] + ".jointOrientY") ($selJnt_ry);

setAttr ($selJoint[1] + ".jointOrientZ") ($selJnt_rz);

//Para terminar, a 0 los valores de rotación de la target joint

setAttr ($selJoint[1] + ".rx") 0;

setAttr ($selJoint[1] + ".ry") 0;

setAttr ($selJoint[1] + ".rz") 0;

}
}

//La ventana Joint Orient XYZ

if (`window -exists $jntOriXYZ_win`) {
deleteUI -window $jntOriXYZ_win;
}

//Crear ventana

string $jntOriXYZ_win = `window -t "Re-Orient Joint XYZ"`;

columnLayout -adj 1;

//Instrucciones de tool

text -1 "Instructions: first, select the target joint to aim at, then select the

source joint!";

//Crear una línea para dividir instrucciones y botones

separator;

//Botones

button -1 "APPLY" -c "jointOri_xyz";

button -1 "CLOSE" -c "deleteUI -window $jntOriXYZ_win";

//Mostrar ventana

showWindow $jntOriXYZ_win;



It was typed by me, but is exact to the other. The other one works just fine, but in this case it says I have a syntax error. First, it was on lines with "{", then a line with "if"... I don´t get it, any ideas?

Azrail
12-14-2012, 03:05 PM
At first glance:
1. change the second parentheses to curly braces () -> {}
2. replace the 4 with $.

1. if (size($selJoint) != 2)(warning "Must select 2 joints!";)
2. select 4findAimCns[0]; doDelete;

uTgh4K33
12-14-2012, 03:12 PM
Still saying there is a syntax error in line 74, this one:


if (`window -exists $jntOriXYZ_win`) {

Nyro
12-14-2012, 08:33 PM
you forgot the -query flag

CGTalk Moderation
12-14-2012, 08:33 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.