So I have a MEL script code that lets you build blinds in a snap. It's for a beginner's course and it's my final project. My problem is, when it tries to connect the attributes to the controller, it tells me " Warning: line 114: 'nurbsCircle1.rotateY' is already connected to 'blindSheet1.rotateZ'."
I know that you can connect multiple objects to one controller, so why is it stopping me? Here's the code.
global proc makeBlinds()
{
//Checks to see if there is a previous window
if (window -exists makingBlinds
==1)
deleteUI makingBlinds;
//If the window doesn't exist, the window will be made
if (window -exists makeBlinds
!=1)
{
//Window's Title
window -title "Making Blinds" makingBlinds;
//Window Layout
rowColumnLayout
-numberOfColumns 2 -columnAttach 1 "right" 0
-columnWidth 1 150 -columnWidth 2 250;
//Text Field for the number of blinds
text -label "Number of Blinds";
string $numberBlinds = textField -text "Please Enter a Numerical Value" blindNumberField
;
//Text Field for the Blind's Width
text -label "Width of Blinds";
string $widthBlinds = textField -text "Please Enter a Numerical Value" blindWidthField
;
//Button that makes the blinds
button -label "Make Blinds" -command "theBlinds();";
//Pops the window up
showWindow makingBlinds;
}
}
global proc theBlinds()
{
//Makes the cube to become a blind
string $makeCube[] = polyCube -h 0.1 -sx 4 -sy 4 -sz 4 -n "blindSheet1"
;
//Creates a nonLinear bend
string $makeBend[] = nonLinear -type bend -lowBound -1 -highBound 1 -curvature 0
;
//Sets the Bend so that the Cube bends into a blind
setAttr ($makeBend[1] + ".rotateZ") 90;
setAttr ($makeBend[0] + ".curvature") -30;
//Looks at the text field for the blind width
float $newWidth = textField -query -text blindWidthField
;
//Sets the blind width
setAttr ($makeCube[1] + ".depth") $newWidth;
//Deletes the bend without affecting the blind
select -r $makeCube[0];
delete -ch;
//Rotates blind into position
setAttr ($makeCube[0] + ".rotateZ") 65;
//Freezing transformation on blinds
select $makeCube[0];
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
//Makes a number of blinds based on the text field
//Looking at the text field to see number of blinds
int $numberOfBlinds = textField -query -text blindNumberField
;
//Selects original blind to duplicate
select -r $makeCube[0];
//Loop that duplicates blinds
for ($i = 1; $i < $numberOfBlinds; $i++)
{
duplicate;
move -r 0 .7 0;
}
//Making the blind control
//Getting position of blinds so that the control will be next to the blinds
float $vBlinds[3] = xform -q -ws -t ($makeCube[0] + ".vtx[12]")
;
//Making control based on vertex position
string $makeControl[] = circle -nr 0 1 0
;
setAttr ($makeControl[1] + ".centerX") ($vBlinds[0]);
setAttr ($makeControl[1] + ".centerY") ($vBlinds[1]);
setAttr ($makeControl[1] + ".centerZ") (($vBlinds[2]) + 1);
xform -cp;
//Connecting the controler to the blind's Rotate Z axis
string $blinds[] = ls "blindSheet*"
;
string $objBlinds[] = listRelatives -p $blinds
;
//Loop that connects blinds to control
for ($s = 0; $s < $numberOfBlinds; $s++)
{
connectAttr ($makeControl[0] + ".rotateY") ($objBlinds[0] + ".rotateZ");
}
}