fr3drik
11-19-2003, 09:22 AM
I have a script (filename faSubdPolyToggle.mel) that looks like this:
global proc faSubdPolyToggle ()
{
// SELECT CURRENT SUBD TRANSFORM NODE(S)
select -hi;
for ($item in `ls -sl -type "transform"`)
{
// ADD ATTRIBUTE highres
print ("addAttr -ln highres -at bool -dv off " + $item + ";");
print "\r";
print ("setAttr -e -keyable true " + $item + ".highres;");
print "\r";
// ADD ATTRIBUTE lowres
print ("addAttr -ln lowres -at bool -dv on " + $item + ";");
print "\r";
print ("setAttr -e -keyable true " + $item + ".lowres;");
print "\r";
// CONNECTIONS
print ("connectAttr -f " + $item + ".highres " + $item + "Shape.visibility;");
print "\r";
print ("subdGivenIntoPolyMode " + $item + "Shape 1 0 0 0;"); //NEEDS FOR ShapeHistPoly ATTRIBUTE TO BE CREATED
print "\r";
print ("connectAttr -f " + $item + ".lowres " + $item + "ShapeHistPoly.visibility;");
print "\r";
}
}
When I type faSubdPolyToggle; into the command line this code appears in the script editor's history:
faSubdPolyToggle;
addAttr -ln highres -at bool -dv off subdivCube1;
setAttr -e -keyable true subdivCube1.highres;
addAttr -ln lowres -at bool -dv on subdivCube1;
setAttr -e -keyable true subdivCube1.lowres;
connectAttr -f subdivCube1.highres subdivCube1Shape.visibility;
subdGivenIntoPolyMode subdivCube1Shape 1 0 0 0;
connectAttr -f subdivCube1.lowres subdivCube1ShapeHistPoly.visibility;
...but it isn't executed! I need to copy this text into the script editor and manually execute it to make it work.
What am I doing wrong?! :cry:
global proc faSubdPolyToggle ()
{
// SELECT CURRENT SUBD TRANSFORM NODE(S)
select -hi;
for ($item in `ls -sl -type "transform"`)
{
// ADD ATTRIBUTE highres
print ("addAttr -ln highres -at bool -dv off " + $item + ";");
print "\r";
print ("setAttr -e -keyable true " + $item + ".highres;");
print "\r";
// ADD ATTRIBUTE lowres
print ("addAttr -ln lowres -at bool -dv on " + $item + ";");
print "\r";
print ("setAttr -e -keyable true " + $item + ".lowres;");
print "\r";
// CONNECTIONS
print ("connectAttr -f " + $item + ".highres " + $item + "Shape.visibility;");
print "\r";
print ("subdGivenIntoPolyMode " + $item + "Shape 1 0 0 0;"); //NEEDS FOR ShapeHistPoly ATTRIBUTE TO BE CREATED
print "\r";
print ("connectAttr -f " + $item + ".lowres " + $item + "ShapeHistPoly.visibility;");
print "\r";
}
}
When I type faSubdPolyToggle; into the command line this code appears in the script editor's history:
faSubdPolyToggle;
addAttr -ln highres -at bool -dv off subdivCube1;
setAttr -e -keyable true subdivCube1.highres;
addAttr -ln lowres -at bool -dv on subdivCube1;
setAttr -e -keyable true subdivCube1.lowres;
connectAttr -f subdivCube1.highres subdivCube1Shape.visibility;
subdGivenIntoPolyMode subdivCube1Shape 1 0 0 0;
connectAttr -f subdivCube1.lowres subdivCube1ShapeHistPoly.visibility;
...but it isn't executed! I need to copy this text into the script editor and manually execute it to make it work.
What am I doing wrong?! :cry:
