Maya, MEL, Error when execute the whole script

444 views Asked by At

first, happy new year everyone !

First error of the year is the follow :

I got an error when I execute the whole mel script, but my script work actually fine when I execute each lines separately. My code link attributes with connectAttr, between objects and operators.

I hope someone has already encountered this type of error, thank you in advance for your help !

int $x;
int $y;
int $z;
string $selection[];
spaceLocator -n ("CTRL_HP_ID") -p 0 0 0;
addAttr -ln "Range"  -at double  -min 1 -max 2000 -dv 1 |CTRL_HP_ID;
setAttr -e-keyable true |CTRL_HP_ID.Range;
addAttr -ln "Influence_y"  -at double  -min 0 -max 2000 -dv 1 |CTRL_HP_ID;
setAttr -e-keyable true |CTRL_HP_ID.Influence_y;
for ( $x = 1; $x < 10; $x++){
    for ( $z = 1; $z < 10; $z++){
        polyCube;
        string $selectionTwo[] = `ls -sl`;
        move (2*$x) (2*$y) (2*$z);
        spaceLocator -n ("IDLocator_" + $x + $z) -p 0 0 0;
        string $selectionOne[] = `ls -sl`;
        move (2*$x) (2*$y) (2*$z);
        group -name ("IDLocator_" + $x + $z + "_GRP");
        select ("IDLocator_" + $x + $z + "_GRP");
        select -add $selectionTwo[0];
        parent;
        //NODES :::

        string $nameDistanceNode = ("distance_node_" + $x + $z);
        string $nameRemapValNode = ("remapVal_node_" + $x + $z);
        string $addDoublNode = ("addDoubl_" + $x + $z);
        string $MultDivNode = ("MultDiv_" + $x + $z);
        string $MultDivTwoNode = ("MultDivTwo_" + $x + $z);
        shadingNode -asUtility distanceBetween -name $nameDistanceNode;
        connectAttr -f CTRL_HP_ID.translate ($nameDistanceNode + ".point1");
        connectAttr -f ($selectionOne[0] + ".translate") ($nameDistanceNode + ".point2");
        shadingNode -asUtility remapValue -name $nameRemapValNode;
        connectAttr -f ($nameDistanceNode + ".distance") ($nameRemapValNode + ".inputValue");
        connectAttr -f CTRL_HP_ID.Range ($nameRemapValNode + ".outputMin");
        connectAttr -f CTRL_HP_ID.Range ($nameRemapValNode + ".inputMax");
        shadingNode -asUtility addDoubleLinear -name $addDoublNode;
        connectAttr -f ($nameRemapValNode + ".outValue") ($addDoublNode + ".input1");
        shadingNode -asUtility multiplyDivide -name $MultDivNode;
        shadingNode -asUtility multiplyDivide -name $MultDivTwoNode;
        connectAttr -f ($addDoublNode + ".output") ($MultDivNode + ".input1X");
        connectAttr -f ($MultDivNode + ".outputX") ($MultDivTwoNode + ".input1X");
        connectAttr -f ($MultDivTwoNode + ".outputX") ($selectionTwo[0] + ".translateY");

        //set multipliers (and to divide)*********************
        setAttr ($MultDivNode + ".operation") 2;
        connectAttr -f CTRL_HP_ID.Range ($MultDivNode + ".input2X");
        connectAttr -f CTRL_HP_ID.Influence_y ($MultDivTwoNode + ".input2X")


        //set range
        //string $nameRemapValNode = ("remapVal_node_" + $x + $z);
        //connectAttr -f CTRL_HP_ID.Range ("remapVal_node_" + $x + $z + ".outputMin");
        //connectAttr -f CTRL_HP_ID.Range ("remapVal_node_" + $x + $z + ".inputMax");
    }
};
// Error:     }
 // 
// Error: Line 57.5: Syntax error // 
// Error:  // 
// Error: Line 59.0: Syntax error //
1

There are 1 answers

1
Achayan On BEST ANSWER

Its tricky mel ;) you missing a ; at line 47

connectAttr -f CTRL_HP_ID.Influence_y ($MultDivTwoNode + ".input2X") 

to connectAttr -f CTRL_HP_ID.Influence_y ($MultDivTwoNode + ".input2X");