You need to check "UDIM Filename Expansion".
Than if you have UDIM textures like "pic.1001.tif" in filename need to enter "pic.%(UDIM)d.tif".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | global proc int sierp(int $counter , int $max) { int $currentCounter = $counter ; if($currentCounter == $max) { return 0 ; } string $objs[]; clear($objs); $objs = `ls -sl -tr`; string $newObjsList[]; clear($newObjsList); for( $item in $objs) { string $tempArray[]; // pega Bouding Box float $bbox[]= `polyEvaluate -b $item`; // separa em elemtos float $xmin = $bbox[0]; float $xmax = $bbox[1]; float $ymin = $bbox[2]; float $ymax = $bbox[3]; float $zmin = $bbox[4]; float $zmax = $bbox[5]; //print $xmin ; //print "\n" ; //print $xmax ; //print "\n" ; // acha divisoes float $quarter = ($xmax - $xmin)/4; float $half = ($xmax - $xmin) /2; float $leftQuarter = ($xmin + $quarter); float $rightQuarter = ($xmax - $quarter); float $mid = $xmin + $half ; float $bottomQuarter = ($ymin + $quarter); float $topQuarter = ($ymax - $quarter); float $topMid = ($ymax - $half); float $frontQuarter = ($zmax - $quarter); float $backQuarter = ($zmin + $quarter); float $frontMid = ($zmax - $half); //********** CRIA CUBOS ************ //LEFT BOTTOM FRONT $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $leftQuarter $bottomQuarter $frontQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //RIGHT BOTTOM FRONT $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $rightQuarter $bottomQuarter $frontQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //LEFT BOTTOM BACK $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $leftQuarter $bottomQuarter $backQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //RIGHT BOTTOM BACK $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $rightQuarter $bottomQuarter $backQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); // MID TOP FRONTMID $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $mid $topQuarter $frontMid ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); // DELETA OBJ ORIGINAL delete $item; } $currentCounter += 1; select $newObjsList; sierp($currentCounter , $max); return 0; } sierp(0, 5); |
#2D array access
#define WIDTH 5
#define HEIGHT 3
int jimmy [HEIGHT][WIDTH];
int n,m;
int main ()
{
for (n=0; n<HEIGHT; n++)
for (m=0; m<WIDTH; m++)
{
jimmy[n][m]=(n+1)*(m+1);
}
}
#1D array access
#define WIDTH 5
#define HEIGHT 3
int jimmy [HEIGHT * WIDTH];
int n,m;
int main ()
{
for (n=0; n<HEIGHT; n++)
for (m=0; m<WIDTH; m++)
{
jimmy[n*WIDTH+m]=(n+1)*(m+1);
}
}
double fit(double index, double old_min, double old_max, double new_min,double new_max)
{
return new_min + (new_max - new_min) * (index - old_min) / (old_max- old_min);
}
usage :
fit(0.5, 0, 1, 10, 20);
>> 15.0
>>
LERP:
Precise method which guarantees v = v1 when t = 1.
float lerp(float v0, float v1, float t)
{
return (1-t)*v0 + t*v1;
}
n = '4'
print n.zfill(3)
>>> '004'