xcomb
11-17-2006, 12:49 PM
Hi all!
I have tones of characters that needs to replace their geometries with new one created.
So i use new function substituteGeometry.
I wrote the script which pretty much supposed to deal with lots of geometries, so i don't have to go and select each element and use the substitute geometry.
So i have the problem with loops and don't know what else to append to fix this issue.
When i execute this script, it only works on some parts of the model, not whole parts as i wanned.
Please if you can explain me or help me, i would greatly appritiate!
Here is the script:
if(`window -exists mainWindow`)
deleteUI mainWindow;
window -title "Substitute Geometry" -w 300 -h 400 mainWindow;
string $base[] = `ls -sl`;
string $target[] = `ls -sl`;
columnLayout -adj 1 mainCol;
rowColumnLayout -numberOfRows 2
-rowHeight 1 150
-rowHeight 2 150;
setParent..;
textScrollList -h 300 -w 300 -ams true mainTSL;
button -label "Select Base" -c "baseObj()" baseBtn;
setParent..;
textScrollList -h 300 -w 300 -ams true mainTSL2;
button -label "Select Target" -c "targetObj()" targetBtn;
button -label "Proccess Geometry Substitution!" -c "substituteGeo()";
showWindow mainWindow;
global proc baseObj(){
textScrollList -e -ra mainTSL;
string $listBase[] = `ls -sl`;
string $sortBase[] = `sort($listBase)`;
for($eachBase in $sortBase){
textScrollList -e -append $eachBase mainTSL;
}
}
global proc targetObj(){
textScrollList -e -ra mainTSL2;
string $listTarget[] = `ls -sl`;
string $sortTarget[] = `sort($listTarget)`;
for($eachTarget in $sortTarget){
textScrollList -e -append $eachTarget mainTSL2;
}
}
global proc substituteGeo()
{
string $first[] = `textScrollList -q -si mainTSL`;
string $second[] = `textScrollList -q -si mainTSL2`;
int $sizeBase = size($first);
int $sizeTarget = size($second);
for($eachBase in $first){
//select -r ($eachBase);
for ($eachTarget in $second){
//select -r ($eachTarget);
substituteGeometry $eachBase $eachTarget;
//select -cl;
}
}
}
I have tones of characters that needs to replace their geometries with new one created.
So i use new function substituteGeometry.
I wrote the script which pretty much supposed to deal with lots of geometries, so i don't have to go and select each element and use the substitute geometry.
So i have the problem with loops and don't know what else to append to fix this issue.
When i execute this script, it only works on some parts of the model, not whole parts as i wanned.
Please if you can explain me or help me, i would greatly appritiate!
Here is the script:
if(`window -exists mainWindow`)
deleteUI mainWindow;
window -title "Substitute Geometry" -w 300 -h 400 mainWindow;
string $base[] = `ls -sl`;
string $target[] = `ls -sl`;
columnLayout -adj 1 mainCol;
rowColumnLayout -numberOfRows 2
-rowHeight 1 150
-rowHeight 2 150;
setParent..;
textScrollList -h 300 -w 300 -ams true mainTSL;
button -label "Select Base" -c "baseObj()" baseBtn;
setParent..;
textScrollList -h 300 -w 300 -ams true mainTSL2;
button -label "Select Target" -c "targetObj()" targetBtn;
button -label "Proccess Geometry Substitution!" -c "substituteGeo()";
showWindow mainWindow;
global proc baseObj(){
textScrollList -e -ra mainTSL;
string $listBase[] = `ls -sl`;
string $sortBase[] = `sort($listBase)`;
for($eachBase in $sortBase){
textScrollList -e -append $eachBase mainTSL;
}
}
global proc targetObj(){
textScrollList -e -ra mainTSL2;
string $listTarget[] = `ls -sl`;
string $sortTarget[] = `sort($listTarget)`;
for($eachTarget in $sortTarget){
textScrollList -e -append $eachTarget mainTSL2;
}
}
global proc substituteGeo()
{
string $first[] = `textScrollList -q -si mainTSL`;
string $second[] = `textScrollList -q -si mainTSL2`;
int $sizeBase = size($first);
int $sizeTarget = size($second);
for($eachBase in $first){
//select -r ($eachBase);
for ($eachTarget in $second){
//select -r ($eachTarget);
substituteGeometry $eachBase $eachTarget;
//select -cl;
}
}
}
