global proc ho_fluidExport(){ if(`window -exists ho_fluidExport`){ deleteUI -window ho_fluidExport; } window -t "ho_fluidExport" -rtf 1 ho_fluidExport; columnLayout; floatFieldGrp -l "startFrame" startFrame; floatFieldGrp -l "endFrame" -v1 3 endFrame; floatFieldGrp -l "increment" -v1 1 increment; textFieldGrp -l "folder path" -text "G:/ho/myVoxels" folderPath; textFieldGrp -l "file name" -text "myVoxel" filename; //checkBox -l "Rib Archive Export" -v 1 ribArchiveExport; //textFieldGrp -l "file name" -text "myRib" -en 0 ribArchiveName; text -l "data name"; textScrollList -numberOfRows 6 -append "force" -append "velocity" -append "density" -append "falloff" -append "fuel" -append "color" -selectItem "density" dataName; button -l "export" -c "ho_exportSquenceData"; text -l "hosok2@naver.com"; showWindow ho_fluidExport; } global proc ho_exportSquenceData(){ float $startFrame = `floatFieldGrp -q -v1 startFrame`; float $endFrame = `floatFieldGrp -q -v1 endFrame`; float $increment = `floatFieldGrp -q -v1 increment`; string $dataName[] = `textScrollList -q -si dataName`; progressWindow -title "exporting" -progress 0 -status ("") -min $startFrame -max $endFrame -isInterruptable true; for($n = $startFrame; $n <= $endFrame; $n++){ currentTime $n; if ( `progressWindow -query -progress` >= $endFrame ) break; if ( `progressWindow -query -isCancelled` ) break; progressWindow -edit -progress $n ;//-status ("frame "+$n); string $folder = `textFieldGrp -q -text folderPath`; string $filename = `textFieldGrp -q -text filename`; string $filePath = $folder + "/" + $filename + "." + $n + ".txt"; ho_exportData($dataName[0],$filePath); } progressWindow -endProgress; //print "done"; } global proc ho_exportData(string $dataName, string $filePath){ string $sel[] = `ls -sl`; string $fluidShape[] = `listRelatives -s $sel[0]`; float $res[] = `eval("getAttr " + $fluidShape[0] + ".res")`; float $bb[] = `xform -q -ws -bb $sel[0]`; int $fileId=`fopen $filePath "w"`; fprint $fileId (""+$res[0]+"\n"); fprint $fileId (""+$res[1]+"\n"); fprint $fileId (""+$res[2]+"\n"); fprint $fileId (""+$bb[0]+"\n"); fprint $fileId (""+$bb[1]+"\n"); fprint $fileId (""+$bb[2]+"\n"); fprint $fileId (""+$bb[3]+"\n"); fprint $fileId (""+$bb[4]+"\n"); fprint $fileId (""+$bb[5]+"\n"); for($i = 0;$i<$res[0];$i++){ //print ($i+"/"+(float)$i/$res[0]+"\n"); float $cf = `currentTime -q`; progressWindow -edit -status ("Frame "+$cf+" "+(int)((float)$i/$res[0]*100)+"%"); for($j = 0;$j<$res[1];$j++){ for($k = 0;$k<$res[2];$k++){ if ( `progressWindow -query -isCancelled` ){ //fclose $fileId; break; } float $v[] = `getFluidAttr -at $dataName -xi $i -yi $j -zi $k`; //print ($v); if($dataName == "density" || $dataName == "falloff" || $dataName == "fuel" ){ fprint $fileId (""+$v[0]+"\n"); }else{ fprint $fileId (""+$v[0]+" "+$v[1]+" "+$v[2]+"\n"); } }}} fclose $fileId; //print "done"; }