j00ey
07-26-2007, 11:32 AM
I've written a pair of scripts [which are probably a bit clumsy as I'm no expert] and am trying to get rid of one error...
the first script imports 29 tubes into another scene and attaches them to motion paths with flow path objects [lattices]. It also renames the lattices, lattice bases and ffd nodes to avoid naming problems further down the line... [it does other stuff too but that all seems to work]
the second one deletes some connections made by the first then deletes the lattices and tubes etc...
I can run the import and the delete then the import again fine UNLESS i have another [30th] lattice in the scene. I've tried renaming the extra lattice / base & ffd but the import script falls over as the first newly created lattice gets the suffix 31 whilstand then tries to access #1...
if I delete the other lattice then run the import script it's fine. It's as if Maya is storing 'number of lattices created so far' and insisting on starting from that number +1. How can I reset it to 0? Or is there another way around this problem? Partitions?
Any help greatly appreciated
Many thanks in advance
ps here are the relevant chunks :
IMPORT:
for ($i = 1; $i<30; $i++)
{
select -r ("tubeGrp" + $i) ("tubePath" + $i);
pathAnimation -fractionMode true -follow true -followAxis z -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank false -startTimeU `playbackOptions -query -minTime` -endTimeU `playbackOptions -query -maxTime`;
flow -divisions 2 2 400 -objectCentered 0 -localCompute 1 -localDivisions 2 2 30 ("tubeGrp" + $i) ;
delete ("motionPath" + $i + "_uValue");
setAttr ("ffd" + $i + ".outsideLattice") 1;
rename ("ffd" + $i) ("tubeFfd" + $i);
}
//group Paths and Lattices
select -cl;
for ($i = 1; $i<30; $i++)
{
select -add ("tubePath" + $i);
}
group -name tubePathsGrp;
select -cl;
for ($i = 1; $i<30; $i++)
{
rename ("ffd" + $i + "Lattice") ("tube" + $i + "Lattice");
rename ("ffd" + $i + "Base") ("tube" + $i + "Base");
select -add ("tube" + $i + "Lattice");
select -add ("tube" + $i + "Base");
}
group -name tubeLatticesGrp;
DELETE :
string $tubeSetup[] = {"glassTubesLyr" , "trimCtrl" , "Tubes" , "tubePathsGrp" , "tubeLatticesGrp"};
int $size = `size $tubeSetup`;
for ($i = 0; $i < $size; $i++)
{
if (`objExists $tubeSetup[$i]`)
{
delete $tubeSetup[$i];
}
}
the first script imports 29 tubes into another scene and attaches them to motion paths with flow path objects [lattices]. It also renames the lattices, lattice bases and ffd nodes to avoid naming problems further down the line... [it does other stuff too but that all seems to work]
the second one deletes some connections made by the first then deletes the lattices and tubes etc...
I can run the import and the delete then the import again fine UNLESS i have another [30th] lattice in the scene. I've tried renaming the extra lattice / base & ffd but the import script falls over as the first newly created lattice gets the suffix 31 whilstand then tries to access #1...
if I delete the other lattice then run the import script it's fine. It's as if Maya is storing 'number of lattices created so far' and insisting on starting from that number +1. How can I reset it to 0? Or is there another way around this problem? Partitions?
Any help greatly appreciated
Many thanks in advance
ps here are the relevant chunks :
IMPORT:
for ($i = 1; $i<30; $i++)
{
select -r ("tubeGrp" + $i) ("tubePath" + $i);
pathAnimation -fractionMode true -follow true -followAxis z -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank false -startTimeU `playbackOptions -query -minTime` -endTimeU `playbackOptions -query -maxTime`;
flow -divisions 2 2 400 -objectCentered 0 -localCompute 1 -localDivisions 2 2 30 ("tubeGrp" + $i) ;
delete ("motionPath" + $i + "_uValue");
setAttr ("ffd" + $i + ".outsideLattice") 1;
rename ("ffd" + $i) ("tubeFfd" + $i);
}
//group Paths and Lattices
select -cl;
for ($i = 1; $i<30; $i++)
{
select -add ("tubePath" + $i);
}
group -name tubePathsGrp;
select -cl;
for ($i = 1; $i<30; $i++)
{
rename ("ffd" + $i + "Lattice") ("tube" + $i + "Lattice");
rename ("ffd" + $i + "Base") ("tube" + $i + "Base");
select -add ("tube" + $i + "Lattice");
select -add ("tube" + $i + "Base");
}
group -name tubeLatticesGrp;
DELETE :
string $tubeSetup[] = {"glassTubesLyr" , "trimCtrl" , "Tubes" , "tubePathsGrp" , "tubeLatticesGrp"};
int $size = `size $tubeSetup`;
for ($i = 0; $i < $size; $i++)
{
if (`objExists $tubeSetup[$i]`)
{
delete $tubeSetup[$i];
}
}
