From: Marten S. (dev) <dev...@sv...> - 2007-10-30 18:05:53
|
Is this script the same as the one in the trunk? Then the addition of =20 it to trunk should be merged over, not the script added directly. Can =20 you confirm its indeed the same and if so should you or I fix it? -Marten Quoting lpa...@us...: > Revision: 28038 > http://crystal.svn.sourceforge.net/crystal/?rev=3D28038&view=3Dr= ev > Author: lpancallo > Date: 2007-10-29 00:59:17 -0700 (Mon, 29 Oct 2007) > > Log Message: > ----------- > Added 3dsmax exporter for genmeshes (required by lighter2) > > Added Paths: > ----------- > CS/branches/release/V1.2/scripts/max/exportCS.mcr > > Added: CS/branches/release/V1.2/scripts/max/exportCS.mcr > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- CS/branches/release/V1.2/scripts/max/exportCS.mcr=09 =20 > (rev 0) > +++ CS/branches/release/V1.2/scripts/max/exportCS.mcr=092007-10-29 =20 > 07:59:17 UTC (rev 28038) > @@ -0,0 +1,2760 @@ > +------------------------------------------------------------ > +-- Author: Luca Pancallo <pan...@ne...> > +-- > +-- Copyright (C) 2002 PlaneShift Team (in...@pl..., > +-- http://www.planeshift.it) > +-- > +-- This program is free software; you can redistribute it and/or > +-- modify it under the terms of the GNU General Public License > +-- as published by the Free Software Foundation (version 2 of the License= ) > +-- This program is distributed in the hope that it will be useful, > +-- but WITHOUT ANY WARRANTY; without even the implied warranty of > +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +-- GNU General Public License for more details. > +-- You should have received a copy of the GNU General Public License > +-- along with this program; if not, write to the Free Software > +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA =20 > 02111-1307, USA. > +-- > +------------------------------------------------------------ > + > + > +macroScript Export_CS_GenMesh > +category:"PlaneShift" > +internalcategory:"PlaneShift" > +ButtonText:"Export Level CS GenMesh" > +tooltip:"Export Level CS GenMesh" Icon:#("Maxscript",1) > +( > + > +rollout Test1 "Export Level to CS GenMesh" width:226 height:450 > +( > +=09edittext edt3 "" pos:[17,32] width:192 height:21 > +=09label lbl1 "Export Level To:" pos:[21,7] width:142 height:20 > +=09button btn2 "Export!" pos:[37,110] width:152 height:24 > +=09label lbl6 "Scale:" pos:[58,72] width:40 height:20 > +=09edittext edtScale "" pos:[101,67] width:63 height:27 > +=09checkbox chkLights "Generate Fake lights for walktest" pos:[6,179] =20 > width:215 height:20 enabled:true > +=09label lbl3 "Duration (msecs):" pos:[16,207] width:108 height:20 > +=09edittext edtDuration "" pos:[128,206] width:76 height:22 > +=09checkbox chk2 "Copy textures to dest dir" pos:[6,152] width:210 height= :22 > +=09GroupBox grp2 "Sanity Check" pos:[10,243] width:201 height:94 > +=09checkbox chkSanity "Check Only, no Deletion" pos:[22,267] =20 > width:159 height:23 enabled:true checked:true > +=09button sanity "SanityCheck!" pos:[32,297] width:145 height:31 > +=09label lblVersion "V." pos:[180,5] width:40 height:21 > + > +=09groupBox grp3 "Terrain" pos:[13,348] width:189 height:89 > +=09checkbox chkTerrain "Export as Terrain Level" pos:[22,372] =20 > width:168 height:26 > +=09on Test1 open do > +=09( > +=09 version =3D 50 as String > +=09 lblVersion.text =3D "V."+version > + > +=09=09-- get room name from custom property > +=09=09customPropNumber =3D fileProperties.findProperty #custom "roomname" > +=09=09if (customPropNumber=3D=3D0) then ( > +=09=09=09messageBox "Please click on File>File Properties and add a =20 > Custom Property called roomname with the name of the sector." > +=09=09=09return 1 > +=09=09) > +=09=09roomName =3D fileProperties.getPropertyValue #custom customPropNumb= er > + > +=09=09-- get default scale from custom property > +=09=09customPropNumber =3D fileProperties.findProperty #custom "scale" > +=09=09if (customPropNumber=3D=3D0) then ( > +=09=09=09messageBox "Please click on File>File Properties and add a =20 > Custom Property called \"scale\" with the scale of the sector.\n 1 =20 > generic unit=3D1 meter. You can model at higher scale, then specify =20 > scale=3D0.1 or 0.01" > +=09=09=09return 1 > +=09=09) > +=09=09defaultScale =3D fileProperties.getPropertyValue #custom customProp= Number > + > +=09 edt3.text =3D "D:\Luca\PS\gfxpackage3.4\levels\\"+roomName+"\world" > +=09 edtScale.text =3D defaultScale > +=09) > +=09on btn2 pressed do > +=09( > + > +=09=09-- //////////////////////// > +=09=09-- Variables used in the program > +=09=09-- //////////////////////// > + > +=09=09-- get filename > +=09=09filename =3D edt3.text > +=09=09-- set debug output > +=09=09debug=3Dfalse > +=09=09debug2=3Dfalse > + > +=09=09-- define if the program should combine 2 planar triangles into = =20 > one polygon > +=09=09polyCombine =3D true > + > +=09=09-- Define verbose output (that takes more space and memory) > +=09=09verboseMode =3D true > + > +=09=09-- parameters for scaling and relocation > +=09=09global xscale =3D edtScale.text as Float > +=09=09global yscale =3D edtScale.text as Float > +=09=09global zscale =3D edtScale.text as Float > + > +=09=09global xrelocate =3D 0 > +=09=09global yrelocate =3D 0 > +=09=09global zrelocate =3D 0 > + > +=09=09-- functions declaration > +=09=09global tokenize > +=09=09global lowercase > +=09=09global getMatFilename > +=09=09global getMatFullPath > + > +=09=09-- particle variables > +=09=09global fireNeeded =3D false > + > +=09=09global emitNeeded =3D false > +=09=09global partMaterials =3D #() > + > +=09=09-- get room name from custom property > +=09=09customPropNumber =3D fileProperties.findProperty #custom "roomname" > +=09=09if (customPropNumber=3D=3D0) then ( > +=09=09=09messageBox "Please click on File>File Properties and add a =20 > Custom Property called roomname with the name of the sector." > +=09=09=09return 1 > +=09=09) > +=09=09roomName =3D fileProperties.getPropertyValue #custom customPropNumb= er > + > + > +=09=09-- LowerCase utility function > +=09=09fn lowercase instring =3D > +=09=09( > +=09=09 local upper, lower, outstring > +=09=09 upper=3D"ABCDEFGHIJKLMNOPQRSTUVWXYZ" > +=09=09 lower=3D"abcdefghijklmnopqrstuvwxyz" > + > +=09=09 outstring=3Dcopy instring > + > +=09=09 for i=3D1 to outstring.count do > +=09=09 ( j=3DfindString upper outstring[i] > +=09=09 if (j !=3D undefined) do outstring[i]=3Dlower[j] > +=09=09 ) > + > +=09=09 outstring > +=09=09) > + > +=09=09-- Tokenize utility function > +=09=09fn tokenize instring sep =3D > +=09=09( > +=09=09 outarray =3D #() > +=09=09 temp=3Dcopy instring > +=09=09 i =3D 1 > +=09=09 while (true) do ( > +=09=09 =09index =3D findstring temp sep > +=09=09=09if (index=3D=3Dundefined) then > +=09=09=09( > +=09=09=09=09outarray[i]=3Dtemp > +=09=09=09=09exit > +=09=09=09) else ( > +=09=09=09=09outarray[i] =3D substring temp 1 (index-1) > +=09=09=09=09temp =3D substring temp (index+1) -1 > +=09=09=09) > +=09=09=09i =3D i +1 > +=09=09 ) > +=09=09 outarray > +=09=09) > + > +=09=09-- get filename from a material > +=09=09fn getMatFilename m =3D > +=09=09( > +=09=09 if (m=3D=3Dundefined) then > +=09=09=09=09image=3D"MATERIALNOTDEFINED" > +=09=09=09else ( > +=09=09=09 mat =3D m.maps[2] > +=09=09=09=09if (mat!=3Dundefined) then > +=09=09=09=09( > +=09=09=09=09=09image =3D mat.filename > +=09=09=09=09=09indx =3D tokenize image "\\" > +=09=09=09=09=09image =3D indx[indx.count] > +=09=09=09=09) else > +=09=09=09=09=09image=3D"MATERIALNOTDEFINED" > + > +=09=09=09=09image =3D lowercase(image) > +=09=09=09) > +=09=09) > + > +=09=09-- get fullpath of a material > +=09=09fn getMatFullPath m =3D > +=09=09( > +=09=09 if (m=3D=3Dundefined) then > +=09=09=09=09image=3D"MATERIALNOTDEFINED" > +=09=09=09else ( > +=09=09=09 mat =3D m.maps[2] > +=09=09=09=09if (mat!=3Dundefined) then > +=09=09=09=09( > +=09=09=09=09=09image =3D mat.filename > +=09=09=09=09) else > +=09=09=09=09=09image=3D"MATERIALNOTDEFINED" > +=09=09=09 image =3D lowercase(image) > +=09=09=09) > +=09=09) > + > +=09=09-- //////////////////////// > +=09=09-- Write material function > +=09=09-- //////////////////////// > + > +=09=09fn WriteMaterials terrainobject outFile =3D > +=09=09( > + > +=09=09 --/// TEXTURES > + > +=09=09 materialsWrittenToWorld=3D#() > + > +=09=09 format " <textures>\n" to:outFile > + > +=09=09 for m in sceneMaterials do > +=09=09 ( > +=09=09 -- handle Standardmaterials > +=09=09=09if ((classOf m)=3D=3DStandardmaterial) then ( > +=09=09=09=09-- if material not written, add it > +=09=09=09=09image =3D getMatFilename m > +=09=09=09=09if (findItem materialsWrittenToWorld image=3D=3D0 and =20 > image!=3D"MATERIALNOTDEFINED") then ( > +=09=09=09=09format "m: % \n" m > +=09=09=09=09=09-- handles trasparent materials > +=09=09=09=09=09if (m.mapEnables[7]) then > +=09=09=09=09=09=09format " <texture name=3D\"%\"> =20 > <file>%</file><alpha><binary/></alpha></texture>\n" image image =20 > to:outFile > +=09=09=09=09=09else > +=09=09=09=09=09=09format " <texture name=3D\"%\"> <file>%</file></text= ure>\n" =20 > image image to:outFile > + > +=09=09=09=09=09append materialsWrittenToWorld image > +=09=09=09=09) > +=09=09=09) > + > +=09=09 -- handle Multi/materials > +=09=09=09if ((classOf m)=3D=3DMultimaterial) then ( > +=09=09=09=09for subm in m do ( > +=09=09=09=09=09image =3D getMatFilename subm > +=09=09=09=09=09if (findItem materialsWrittenToWorld image=3D=3D0 and =20 > image!=3D"MATERIALNOTDEFINED") then ( > +=09=09=09=09=09=09format "m: % subm: % \n" m subm > +=09=09=09=09=09=09if (subm.mapEnables[7]) then > +=09=09=09=09=09=09=09format " <texture name=3D\"%\"> =20 > <file>%</file><alpha><binary/></alpha></texture>\n" image image =20 > to:outFile > +=09=09=09=09=09=09else > +=09=09=09=09=09=09=09format " <texture name=3D\"%\"> <file>%</file></t= exture>\n" =20 > image image to:outFile > +=09=09=09=09=09=09append materialsWrittenToWorld image > +=09=09=09=09=09) > +=09=09=09=09) > +=09=09=09) > + > +=09=09 ) > + > +=09=09 if (fireNeeded or emitNeeded) then ( > +=09=09=09 format " <texture name=3D\"raindrop\"> =20 > <file>raindrop.png</file></texture>\n" to:outFile > +=09=09 ) > + > +=09=09 -- handle additional textures for particles > +=09=09 for m in partMaterials do > +=09=09 ( > +=09=09=09 format " <texture name=3D\"%\"> <file>%</file></texture>\= n" =20 > m m to:outFile > +=09=09 ) > + > + > +=09=09 format " </textures>\n" to:outFile > + > + > +=09=09 --/// MATERIALS > + > +=09=09 materialsWrittenToWorld=3D#() > + > +=09=09 format " <materials>\n" to:outFile > + > +=09=09 for m in sceneMaterials do > +=09=09 ( > +=09=09 -- handle Standardmaterials > +=09=09=09if ((classOf m)=3D=3DStandardmaterial) then ( > +=09=09=09=09-- if material not written, add it > +=09=09=09=09image =3D getMatFilename m > +=09=09=09=09if (findItem materialsWrittenToWorld image=3D=3D0 and =20 > image!=3D"MATERIALNOTDEFINED") then ( > +=09=09=09=09 format " <material name=3D\"%\"> =20 > <texture>%</texture></material>\n" image image to:outFile > +=09=09=09=09=09append materialsWrittenToWorld image > +=09=09=09=09) > +=09=09=09) > + > +=09=09 -- handle Multi/materials > +=09=09=09if ((classOf m)=3D=3DMultimaterial) then ( > +=09=09=09=09for subm in m do ( > +=09=09=09=09=09image =3D getMatFilename subm > +=09=09=09=09=09isshader =3D false > + > +=09=09=09=09=09-- skip wrong materials > +=09=09=09=09=09if ( image=3D=3D"MATERIALNOTDEFINED") then > +=09=09=09=09=09=09continue; > + > +=09=09=09=09=09-- determine if it's a shader material > +=09=09=09=09=09if (findString subm.name "_shader_"!=3Dundefined) then > +=09=09=09=09=09=09isshader =3D true > + > +=09=09=09=09=09-- check if already written > +=09=09=09=09=09found =3D false > +=09=09=09=09=09imagetemp =3D image > +=09=09=09=09=09if (isshader) then ( > +=09=09=09=09=09=09imagetemp =3D image + "sshhaaddeerr" > +=09=09=09=09=09=09if(findItem materialsWrittenToWorld imagetemp!=3D0) the= n > +=09=09=09=09=09=09=09found=3Dtrue > +=09=09=09=09=09) else ( > +=09=09=09=09=09=09if(findItem materialsWrittenToWorld image!=3D0) then > +=09=09=09=09=09=09=09found=3Dtrue > +=09=09=09=09=09) > + > +=09=09=09=09=09if (not found) then ( > + > +=09=09=09=09=09=09format " <material name=3D\"%\"> <texture>%</texture= >\n" =20 > imagetemp image to:outFile > +=09=09=09=09=09=09-- manage shaders > +=09=09=09=09=09=09if (findString subm.name "_shader_" !=3D undefined) the= n ( > +=09=09=09=09=09=09=09if (findString subm.name "_shader_terrain" !=3Dundef= ined) then ( > +=09=09=09=09=09=09=09=09format " <shadervar name=3D\"texture scale\" = =20 > type=3D\"vector2\">32,32</shadervar>\n" to:outFile > +=09=09=09=09=09=09=09=09format " <shader type=3D\"terrain =20 > splat\">terrain_fixed_splatting</shader>\n" to:outFile > +=09=09=09=09=09=09=09) > +=09=09=09=09=09=09=09else if (findString subm.name "_shader_ambient" !=3D= undefined) then ( > +=09=09=09=09=09=09=09=09format " <shader =20 > type=3D\"ambient\">terrain_fixed_base</shader>\n" to:outFile > +=09=09=09=09=09=09=09) else ( > +=09=09=09=09=09=09=09=09message =3D "ERROR: Found terrain's material "+m.= name+" with =20 > submat "+subm.name+" defining a shader of unsupported type!\n" > +=09=09=09=09=09=09=09=09message =3D message + "Supported types are: _shad= er_terrain , =20 > _shader_ambient" > +=09=09=09=09=09=09=09=09messageBox message > +=09=09=09=09=09=09=09=09format " </material>\n" to:outFile > +=09=09=09=09=09=09=09=09return 1 > +=09=09=09=09=09=09=09) > + > +=09=09=09=09=09=09) else > +=09=09=09=09=09=09=09append materialsWrittenToWorld imagetemp > + > +=09=09=09=09=09=09format " </material>\n" image image to:outFile > + > +=09=09=09=09=09) > +=09=09=09=09) > +=09=09=09) > +=09=09 ) > + > + > +=09=09 if (fireNeeded or emitNeeded) then ( > +=09=09=09 format " <material name=3D\"raindrop\"> =20 > <texture>raindrop</texture></material>\n" to:outFile > +=09=09 ) > + > +=09=09 -- handle additional materials for particles > +=09=09 for m in partMaterials do > +=09=09 ( > +=09=09=09 format " <material name=3D\"%\"> =20 > <texture>%</texture></material>\n" m m to:outFile > +=09=09 ) > + > +=09=09 format " </materials>\n\n" to:outFile > + > +=09=09) > + > +=09=09-- //////////////////////// > +=09=09-- Write shaders function > +=09=09-- //////////////////////// > + > +=09=09fn WriteShaders outFile =3D > +=09=09( > + > +=09=09 -- add shaders needed for terrain > +=09=09 if (chkTerrain.checked) then ( > +=09=09 filestr =3D openFile "ps_terrain.shaders.txt" > +=09=09 if (filestr=3D=3Dundefined) then ( > +=09=09=09=09message =3D "ERROR: ps_terrain.shaders.txt not found!" > +=09=09=09=09messageBox message > +=09=09=09=09return 1 > +=09=09 ) > +=09=09 while (not eof filestr) do > +=09=09 ( > +=09=09 =09line =3D readLine filestr > +=09=09=09format "%\n" line to:outFile > +=09=09 ) > +=09=09 ) > + > +=09=09) > + > + > +=09=09-- //////////////////////// > +=09=09-- Output Particle function > +=09=09-- //////////////////////// > +=09=09fn OutputParticle obj allObjects outFile =3D > +=09=09( > +=09=09=09=09type =3D getUserProp obj "TYPE" > +=09=09=09=09partMaterial =3D getUserProp obj "MATERIAL" > +=09=09=09=09mixmode =3D getUserProp obj "MIXMODE" > + > +=09=09=09=09xpart =3D (obj.pos.x * xscale) + xrelocate > +=09=09=09=09ypart =3D (obj.pos.y * yscale) + yrelocate > +=09=09=09=09zpart =3D (obj.pos.z * zscale) + zrelocate > + > +=09=09 --format " ;Particle Name: % Type: %\n" obj.name type = =20 > to:outFile > + > +=09=09=09=09-- ////// > +=09=09=09=09-- Fire > +=09=09=09=09-- ////// > +=09=09=09=09if (type =3D=3D "fire") then ( > + > +=09=09=09=09=09number =3D getUserProp obj "NUMBER" > +=09=09=09=09=09dropsize =3D getUserProp obj "DROPSIZE" > +=09=09=09=09=09lighting =3D getUserProp obj "LIGHTING" > +=09=09=09=09=09swirl =3D getUserProp obj "SWIRL" > +=09=09=09=09=09colorscale =3D getUserProp obj "COLORSCALE" > + > +=09=09=09=09=09format " <meshobj name=3D\"Fire01\">\n" to:outFile > +=09=09=09=09=09format " <priority>alpha</priority>\n" to:outFile > +=09=09=09=09=09format " <plugin>emit</plugin>\n" to:outFile > +=09=09=09=09=09format " <ztest />\n" to:outFile > +=09=09=09=09=09format " <move> <v x=3D\"0\" y=3D\"0\" z=3D\"0\" /> <= /move>\n" =20 > to:outFile > +=09=09=09=09=09format " <params>\n" to:outFile > +=09=09=09=09=09format "=09 <factory>emitFact</factory> \n" to:outFile > +=09=09=09=09=09format "=09 <mixmode><add /></mixmode>\n" to:outFile > + > +=09=09=09=09=09if (partMaterial =3D=3D undefined) then > +=09=09=09=09=09=09format "=09 <material>candleflame.png</material>\n" = to:outFile > +=09=09=09=09=09else > +=09=09=09=09=09=09format "=09 <material>%</material>\n" partMaterial = to:outFile > + > +=09=09=09=09=09format "=09 <number>%</number> \n" number to:outFile > +=09=09=09=09=09format "=09 <regularparticles sides=3D\"4\" radius=3D\"= 0.1\" /> =20 > \n" to:outFile > +=09=09=09=09=09format "=09 <lighting>off</lighting> \n" to:outFile > +=09=09=09=09=09format "=09 <totaltime>1000</totaltime> \n" to:outFile > +=09=09=09=09=09format "=09 <startpos><emitsphere x=3D\"%\" y=3D\"%\" z= =3D\"%\" =20 > p=3D\"0\" q=3D\"0.03\" /></startpos> \n" xpart zpart ypart to:outFile > +=09=09=09=09=09format "=09 <startspeed><emitbox><min x=3D\"0\" y=3D\"0= \" z=3D\"0\" =20 > /> \n" to:outFile > +=09=09=09=09=09format "=09 <max x=3D\"0\" y=3D\"0.3\" z=3D\"0\" =20 > /></emitbox></startspeed> \n" to:outFile > +=09=09=09=09=09format "=09 <startaccel><emitfixed x=3D\"0\" y=3D\"0\" = z=3D\"0\" =20 > /></startaccel>\n" to:outFile > +=09=09=09=09=09format "=09 <attractor> <emitfixed x=3D\"%\" y=3D\"%\" = z=3D\"%\" =20 > /> </attractor> " xpart (zpart+0.2) ypart to:outFile > +=09=09=09=09=09format "=09 <attractorforce>1</attractorforce>\n" to:ou= tFile > +=09=09=09=09=09format "=09 <aging> <time>0</time><color red=3D\"0.7\" = =20 > green=3D\"0.1\" blue=3D\"0.0\" /> \n" to:outFile > +=09=09=09=09=09format "=09 =20 > <alpha>0.2</alpha><swirl>0.01</swirl><rotspeed>0.0</rotspeed><scale>0.4</s= cale></aging>\n" =20 > to:outFile > +=09=09=09=09=09format "=09 <aging> <time>250</time><color red=3D\"0.6\= " =20 > green=3D\"0.1\" blue=3D\"0.05\" /> \n" to:outFile > +=09=09=09=09=09format "=09 =20 > <alpha>0.5</alpha><swirl>0.002</swirl><rotspeed>0.0</rotspeed><scale>0.4</= scale></aging>\n" =20 > to:outFile > +=09=09=09=09=09format "=09 <aging> <time>500</time><color red=3D\"0.8\= " =20 > green=3D\"0.6\" blue=3D\"0.1\" /> \n" to:outFile > +=09=09=09=09=09format "=09 =20 > <alpha>0.8</alpha><swirl>0.01</swirl><rotspeed>0.0</rotspeed><scale>0.6</s= cale></aging>\n" =20 > to:outFile > +=09=09=09=09=09format "=09 <aging> <time>750</time><color red=3D\"0.4\= " =20 > green=3D\"0.2\" blue=3D\"0.05\" /> \n" to:outFile > +=09=09=09=09=09format "=09 =20 > <alpha>0.6</alpha><swirl>0.02</swirl><rotspeed>0.0</rotspeed><scale>0.4</s= cale></aging>\n" =20 > to:outFile > +=09=09=09=09=09format "=09 <aging> <time>1000</time><color red=3D\"0.3= \" =20 > green=3D\"0.1\" blue=3D\"0.02\" /> \n" to:outFile > +=09=09=09=09=09format "=09 =20 > <alpha>1</alpha><swirl>0.001</swirl><rotspeed>0.0</rotspeed><scale>0.2</sc= ale></aging>\n" =20 > to:outFile > +=09=09=09=09=09format " </params>\n" to:outFile > +=09=09=09=09=09format " </meshobj>\n" to:outFile > + > +=09=09=09=09) > +=09=09=09=09-- ////// > +=09=09=09=09-- Emit > +=09=09=09=09-- ////// > +=09=09=09=09else if (type =3D=3D "emit") then ( > +=09=09=09=09=09number =3D getUserProp obj "NUMBER" > +=09=09=09=09=09regparticle =3D getUserProp obj "REGULARPARTICLES" > +=09=09=09=09=09if (regparticle=3D=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09rectparticle =3D getUserProp obj "RECTPARTICLES" > +=09=09=09=09=09=09rectparticle2 =3D tokenize rectparticle "," > +=09=09=09=09=09) else ( > +=09=09=09=09=09=09regparticle2 =3D tokenize regparticle "," > +=09=09=09=09=09) > +=09=09=09=09=09lighting =3D getUserProp obj "LIGHTING" > +=09=09=09=09=09totaltime =3D getUserProp obj "TOTALTIME" > +=09=09=09=09=09-- STARTPOS: STARTPOS1=3DEMITSPHERE STARTPOS2=3D0,0.1 > +=09=09=09=09=09startpostype =3D getUserProp obj "STARTPOS1" > +=09=09=09=09=09startpostype =3D lowercase startpostype > +=09=09=09=09=09startpos =3D getUserProp obj "STARTPOS2" > +=09=09=09=09=09index =3D findString startpos "," > +=09=09=09=09=09startposarray =3D tokenize startpos "," > +=09=09=09=09=09-- STARTSPEED=3DEMITBOX(-1,-1,-1,1,1,1) > +=09=09=09=09=09startspeed =3D getUserProp obj "STARTSPEED" > +=09=09=09=09=09index =3D findString startspeed "(" > +=09=09=09=09=09startspeedtype =3D lowercase (substring startspeed 1 (inde= x-1)) > +=09=09=09=09=09startspeed =3D substring startspeed (index+1) -1 > +=09=09=09=09=09startspeed =3D substring startspeed 1 ((startspeed.count)-= 1) > +=09=09=09=09=09startspeedarray =3D tokenize startspeed "," > +=09=09=09=09=09-- STARTACCEL=3DEMITFIXED(0,0,0) > +=09=09=09=09=09startaccel =3D getUserProp obj "STARTACCEL" > +=09=09=09=09=09index =3D findString startaccel "(" > +=09=09=09=09=09startacctype =3D lowercase (substring startaccel 1 (index-= 1)) > +=09=09=09=09=09startaccel =3D substring startaccel (index+1) -1 > +=09=09=09=09=09startaccel =3D substring startaccel 1 ((startaccel.count)-= 1) > +=09=09=09=09=09startaccarray =3D tokenize startaccel "," > +=09=09=09=09=09attractorobj =3D obj.children[1] > +=09=09=09=09=09if (attractorobj!=3Dundefined) then ( > +=09=09=09=09=09=09xattractorobj =3D (attractorobj.pos.x * xscale) + xrelo= cate > +=09=09=09=09=09=09yattractorobj =3D (attractorobj.pos.y * yscale) + yrelo= cate > +=09=09=09=09=09=09zattractorobj =3D (attractorobj.pos.z * zscale) + zrelo= cate > +=09=09=09=09=09=09typeattractor =3D getUserProp attractorobj "TYPE" > +=09=09=09=09=09=09attractorforce =3D getUserProp obj "ATTRACTORFORCE" > +=09=09=09=09=09) > + > +=09=09=09=09=09-- fieldspeed > +=09=09=09=09=09fieldspeed =3D getUserProp obj "FIELDSPEED" > +=09=09=09=09=09format "fieldspeed: % \n" fieldspeed > +=09=09=09=09=09if (fieldspeed!=3Dundefined) then ( > +=09=09=09=09=09=09index =3D findString fieldspeed "(" > +=09=09=09=09=09=09fieldspeedtype =3D lowercase (substring fieldspeed 1 (i= ndex-1)) > +=09=09=09=09=09=09format "fieldspeedtype: % \n" fieldspeedtype > +=09=09=09=09=09=09fieldspeed =3D substring fieldspeed (index+1) -1 > +=09=09=09=09=09=09fieldspeed =3D substring fieldspeed 1 ((fieldspeed.coun= t)-1) > +=09=09=09=09=09=09fieldspeedarray =3D tokenize fieldspeed "," > +=09=09=09=09=09) > + > +=09=09=09=09=09aging0 =3D getUserProp obj "AGING0" > +=09=09=09=09=09if (aging0!=3Dundefined) then > +=09=09=09=09=09=09aging0 =3D tokenize aging0 "," > +=09=09=09=09=09aging1 =3D getUserProp obj "AGING1" > +=09=09=09=09=09if (aging1!=3Dundefined) then > +=09=09=09=09=09=09aging1 =3D tokenize aging1 "," > +=09=09=09=09=09aging2 =3D getUserProp obj "AGING2" > +=09=09=09=09=09if (aging2!=3Dundefined) then > +=09=09=09=09=09=09aging2 =3D tokenize aging2 "," > +=09=09=09=09=09aging3 =3D getUserProp obj "AGING3" > +=09=09=09=09=09if (aging3!=3Dundefined) then > +=09=09=09=09=09=09aging3 =3D tokenize aging3 "," > +=09=09=09=09=09aging4 =3D getUserProp obj "AGING4" > +=09=09=09=09=09if (aging4!=3Dundefined) then > +=09=09=09=09=09=09aging4 =3D tokenize aging4 "," > + > +=09=09=09=09=09format " <meshobj name=3D\"%\">\n" obj.name to:outFile > +=09=09=09=09=09format " <priority>alpha</priority>\n" to:outFile > +=09=09=09=09=09format " <plugin>emit</plugin>\n" to:outFile > +=09=09=09=09=09format " <ztest />\n" to:outFile > + > +=09=09=09=09=09if (attractorobj!=3Dundefined) then ( > +=09=09=09=09=09=09movexpart =3D 0; moveypart =3D 0; movezpart =3D 0 > +=09=09=09=09=09=09startposxpart =3D xpart; startposypart =3D ypart ; star= tposzpart =3D zpart > +=09=09=09=09=09) else ( > +=09=09=09=09=09=09movexpart =3D xpart; moveypart =3D ypart ; movezpart = =3D zpart > +=09=09=09=09=09=09startposxpart =3D 0; startposypart =3D 0 ; startposzpar= t =3D 0 > +=09=09=09=09=09) > + > +=09=09=09=09=09format " <move> <v x=3D\"%\" y=3D\"%\" z=3D\"%\" /> <= /move>\n" =20 > movexpart movezpart moveypart to:outFile > + > +=09=09=09=09=09format " <params>\n" to:outFile > +=09=09=09=09=09format "=09 <factory>emitFact</factory> \n" to:outFile > +=09=09=09=09=09if (mixmode =3D=3D undefined) then > +=09=09=09=09=09=09format "=09 <mixmode><add /></mixmode>\n" to:outFile > +=09=09=09=09=09else > +=09=09=09=09=09=09format "=09 <mixmode><% /></mixmode>\n" mixmode to:o= utFile > +=09=09=09=09=09if (partMaterial =3D=3D undefined) then > +=09=09=09=09=09=09format "=09 <material>raindrop</material>\n" to:outF= ile > +=09=09=09=09=09else > +=09=09=09=09=09=09format "=09 <material>%</material>\n" partMaterial = to:outFile > + > +=09=09=09=09=09format "=09 <number>%</number> \n" number to:outFile > +=09=09=09=09=09if (regparticle=3D=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <rectparticles w=3D\"%\" h=3D\"%\" /> \n= " =20 > rectparticle2[1] rectparticle2[2] to:outFile > +=09=09=09=09=09) else ( > +=09=09=09=09=09=09format "=09 <regularparticles sides=3D\"%\" radius= =3D\"%\" /> =20 > \n" regparticle2[1] regparticle2[2] to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09format "=09 <lighting>%</lighting> \n" lighting to:outF= ile > +=09=09=09=09=09format "=09 <totaltime>%</totaltime> \n" totaltime to:o= utFile > +=09=09=09=09=09-- STARTPOS > +=09=09=09=09=09if (startpostype=3D=3D"emitsphere") then ( > +=09=09=09=09=09=09--pscaled =3D (startposarray[1] * xscale) + xrelocate > +=09=09=09=09=09=09--qscaled =3D (startposarray[2] * yscale) + yrelocate > +=09=09=09=09=09=09format "=09 <startpos><% x=3D\"%\" y=3D\"%\" z=3D\"%= \" p=3D\"%\" =20 > q=3D\"%\" /></startpos>\n" startpostype startposxpart startposzpart =20 > startposypart startposarray[1] startposarray[2] to:outFile > +=09=09=09=09=09) else if (startpostype=3D=3D"emitfixed") then > +=09=09=09=09=09=09format "=09 <startpos><% x=3D\"%\" y=3D\"%\" z=3D\"%= \" =20 > /></startpos>\n" startpostype startposxpart startposzpart =20 > startposypart to:outFile > +=09=09=09=09=09else if (startpostype=3D=3D"emitbox") then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <startpos><%><min x=3D\"%\" y=3D\"%\" z= =3D\"%\" /> \n" =20 > startpostype startposarray[1] startposarray[2] startposarray[3] =20 > to:outFile > +=09=09=09=09=09=09format "=09 <max x=3D\"%\" y=3D\"%\" z=3D\"%\" /></%= ></startpos> =20 > \n" startposarray[4] startposarray[5] startposarray[6] startpostype =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09-- STARTSPEED > +=09=09=09=09=09if (startspeedtype=3D=3D"emitbox") then > +=09=09=09=09=09( > + > +=09=09=09=09=09=09format "=09 <startspeed><%><min x=3D\"%\" y=3D\"%\" = z=3D\"%\" /> =20 > \n" startspeedtype startspeedarray[1] startspeedarray[2] =20 > startspeedarray[3] to:outFile > +=09=09=09=09=09=09format "=09 <max x=3D\"%\" y=3D\"%\" z=3D\"%\" /></%= ></startspeed> =20 > \n" startspeedarray[4] startspeedarray[5] startspeedarray[6] =20 > startspeedtype to:outFile > +=09=09=09=09=09) else if (startspeedtype=3D=3D"emitfixed") then > +=09=09=09=09=09=09format "=09 <startspeed><% x=3D\"%\" y=3D\"%\" z=3D\= "%\" /> =20 > </startspeed>\n" startspeedtype startspeedarray[1] =20 > startspeedarray[2] startspeedarray[3] to:outFile > +=09=09=09=09=09format "=09 <startaccel><% x=3D\"%\" y=3D\"%\" z=3D\"%\= " =20 > /></startaccel>\n" startacctype startaccarray[1] startaccarray[2] =20 > startaccarray[3] to:outFile > + > +=09=09=09=09=09-- ATTRACTOR > +=09=09=09=09=09if (attractorobj!=3Dundefined) then ( > +=09=09=09=09=09=09format "=09 <attractor> <emitfixed x=3D\"%\" y=3D\"%= \" z=3D\"%\" =20 > /> </attractor>\n" xattractorobj zattractorobj yattractorobj =20 > to:outFile > +=09=09=09=09=09=09format "=09 <attractorforce>%</attractorforce>\n" = =20 > attractorforce to:outFile > +=09=09=09=09=09) > + > +=09=09=09=09=09-- FIELDSPEED > + =09if (fieldspeedtype=3D=3D"emitcylindertangent") then > +=09=09=09=09=09( > +=09=09=09=09=09=09format " <fieldspeed><% p=3D\"%\" q=3D\"%\">\n" = =20 > fieldspeedtype fieldspeedarray[1] fieldspeedarray[2] to:outFile > +=09=09=09=09=09=09format " <min x=3D\"%\" y=3D\"%\" z=3D\"%\" /><m= ax x=3D\"%\" =20 > y=3D\"%\" z=3D\"%\" /> \n" fieldspeedarray[3] fieldspeedarray[4] =20 > fieldspeedarray[5] fieldspeedarray[6] fieldspeedarray[7] =20 > fieldspeedarray[8] to:outFile > +=09=09=09=09=09=09format " </emitcylindertangent></fieldspeed>\n" = to:outFile > +=09=09=09=09=09) > + > +=09=09=09=09=09if (aging0!=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <aging> <time>%</time><color red=3D\"%\"= =20 > green=3D\"%\" blue=3D\"%\" /> \n" aging0[1] aging0[2] aging0[3] =20 > aging0[4] to:outFile > +=09=09=09=09=09=09format "=09 =20 > <alpha>%</alpha><swirl>%</swirl><rotspeed>%</rotspeed><scale>%</scale></ag= ing>\n" aging0[5] aging0[6] aging0[7] aging0[8] =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09if (aging1!=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <aging> <time>%</time><color red=3D\"%\"= =20 > green=3D\"%\" blue=3D\"%\" /> \n" aging1[1] aging1[2] aging1[3] =20 > aging1[4] to:outFile > +=09=09=09=09=09=09format "=09 =20 > <alpha>%</alpha><swirl>%</swirl><rotspeed>%</rotspeed><scale>%</scale></ag= ing>\n" aging1[5] aging1[6] aging1[7] aging1[8] =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09if (aging2!=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <aging> <time>%</time><color red=3D\"%\"= =20 > green=3D\"%\" blue=3D\"%\" /> \n" aging2[1] aging2[2] aging2[3] =20 > aging2[4] to:outFile > +=09=09=09=09=09=09format "=09 =20 > <alpha>%</alpha><swirl>%</swirl><rotspeed>%</rotspeed><scale>%</scale></ag= ing>\n" aging2[5] aging2[6] aging2[7] aging2[8] =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09if (aging3!=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <aging> <time>%</time><color red=3D\"%\"= =20 > green=3D\"%\" blue=3D\"%\" /> \n" aging3[1] aging3[2] aging3[3] =20 > aging3[4] to:outFile > +=09=09=09=09=09=09format "=09 =20 > <alpha>%</alpha><swirl>%</swirl><rotspeed>%</rotspeed><scale>%</scale></ag= ing>\n" aging3[5] aging3[6] aging3[7] aging3[8] =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09if (aging4!=3Dundefined) then > +=09=09=09=09=09( > +=09=09=09=09=09=09format "=09 <aging> <time>%</time><color red=3D\"%\"= =20 > green=3D\"%\" blue=3D\"%\" /> \n" aging4[1] aging4[2] aging4[3] =20 > aging4[4] to:outFile > +=09=09=09=09=09=09format "=09 =20 > <alpha>%</alpha><swirl>%</swirl><rotspeed>%</rotspeed><scale>%</scale></ag= ing>\n" aging4[5] aging4[6] aging4[7] aging4[8] =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09=09=09format " </params>\n" to:outFile > +=09=09=09=09=09format " </meshobj>\n" to:outFile > +=09=09=09=09) > +=09=09) > + > +=09=09-- //////////////////////// > +=09=09-- copy textures to output dir > +=09=09-- //////////////////////// > +=09=09fn CopyTexturesToDir outFile =3D > +=09=09( > +=09=09 destDir =3D getFilenamePath edt3.text > +=09=09 destFile =3D filenameFromPath edt3.text > +=09=09 destDir =3D destDir + destFile + "textures" > +=09=09 format "makedir % \n" destDir > +=09=09 makeDir destDir > + > +=09=09 materialsWrittenToWorld=3D#() > + > +=09=09 for m in sceneMaterials do > +=09=09 ( > +=09=09 -- handle Standardmaterials > +=09=09=09if ((classOf m)=3D=3DStandardmaterial) then ( > +=09=09=09=09-- if material not written, add it > +=09=09=09=09image =3D getMatFullPath m > +=09=09=09=09if (findItem materialsWrittenToWorld image=3D=3D0) then ( > +=09=09=09=09=09destFile2 =3D filenameFromPath image > +=09=09=09=09=09destFile2 =3D destDir + "\\" + destFile2 > +=09=09=09=09=09format "copy from % to % \n" image destFile2 > +=09=09=09=09=09copyFile image destFile2 > +=09=09=09=09=09append materialsWrittenToWorld image > +=09=09=09=09) > +=09=09=09) > + > + > +=09=09 -- handle Multi/materials > +=09=09=09if ((classOf m)=3D=3DMultimaterial) then ( > +=09=09=09=09for subm in m do ( > +=09=09=09=09=09image =3D getMatFullPath subm > +=09=09=09=09=09if (findItem materialsWrittenToWorld image=3D=3D0) then ( > +=09=09=09=09=09=09destFile2 =3D filenameFromPath image > +=09=09=09=09=09=09destFile2 =3D destDir + "\\" + destFile2 > +=09=09=09=09=09=09format "copy from % to % \n" image destFile2 > +=09=09=09=09=09=09copyFile image destFile2 > +=09=09=09=09=09=09append materialsWrittenToWorld image > +=09=09=09=09=09) > +=09=09=09=09) > +=09=09=09) > +=09=09 ) > +=09=09) > + > + > + > +=09=09-- //////////////////////// > +=09=09-- Output a Portal object > +=09=09-- //////////////////////// > +=09=09fn OutputPortal obj debug outFile =3D > +=09=09( > +=09=09=09format " <portals><portal name=3D\"%\">\n" obj.name to:outFil= e > + > +=09=09=09-- all portals as autoresolve > +=09=09=09format " <autoresolve />\n" to:outFile > + > +=09=09=09-- check if poly is valid: for now should be 2 faces or have = =20 > VERTS specified > +=09=09=09faces =3D getNumFaces obj > +=09=09=09vertsProp =3D getUserProp obj "VERTS" > +=09=09=09if (faces!=3D2 and vertsProp=3D=3Dundefined) then ( > +=09=09=09=09message =3D "ERROR: If you want to add a portals with more th= an 2 =20 > triangles add a property called VERTS with list of verts clockwise." > +=09=09=09=09messageBox message > +=09=09=09=09return 1 > +=09=09=09) > + > +=09=09=09verts =3D #() > +=09=09=09-- manage polygon portals > +=09=09=09if (faces!=3D2) then ( > +=09=09=09=09toks =3D tokenize vertsProp "," > +=09=09=09=09for elem in toks do ( > +=09=09=09=09=09vertPoly =3D getvert obj (elem as Integer) > +=09=09=09=09=09append verts (elem as Integer) > +=09=09=09=09=09format "extracted %: % \n" elem vertPoly > +=09=09=09=09) > + > +=09=09=09-- manage 2 faces portals > +=09=09=09) else ( > + > +=09=09=09=09-- checks if model has left-oriented system or not > +=09=09=09=09face =3D getface obj 1 > +=09=09=09=09v1=3D getvert obj face[1] > +=09=09=09=09v2 =3D getvert obj face[2] > +=09=09=09=09v3 =3D getvert obj face[3] > + > +=09=09=09=09vect1 =3D v1-v2 > +=09=09=09=09vect2 =3D v3-v2 > +=09=09=09=09normal1 =3D cross vect1 vect2 > +=09=09=09=09facenorm =3D normal1/(length normal1) > +=09=09=09=09maxnorm =3D getfacenormal obj 1 > +=09=09=09=09flipModel =3D false > + > +=09=09=09=09dotProd =3D dot facenorm maxnorm > +=09=09=09=09if (dotProd>0) then ( > +=09=09=09=09=09flipModel =3D true > +=09=09=09=09) > + > +=09=09=09=09-- get faces verts > +=09=09=09 vertsFace1=3Dgetface obj 1 > +=09=09=09=09vertsFace2=3Dgetface obj 2 > + > +=09=09=09=09-- trasform to array (needed for findItem func) > +=09=09=09=09verts1 =3D #() > +=09=09=09=09verts2 =3D #() > +=09=09=09=09for h=3D1 to 3 do append verts1 vertsFace1[h] > +=09=09=09=09for h=3D1 to 3 do append verts2 vertsFace2[h] > + > +=09=09=09=09additionalVertex =3D 0 > +=09=09=09=09oppositeVertex =3D 0 > + > +=09=09=09=09if (debug) then format "Vertex of first face: %\n" verts1 > + > +=09=09=09=09-- search non-common vertex on face2 > +=09=09=09=09for h=3D1 to 3 do > +=09=09=09=09( > +=09=09=09=09=09if (findItem verts1 verts2[h]=3D=3D0) then > +=09=09=09=09=09=09additionalVertex =3D h > +=09=09=09=09) > +=09=09=09=09if (debug) then format "Additional vertex: % " verts2[additio= nalVertex] > + > +=09=09=09=09-- search opposite vertex > +=09=09=09=09for h=3D1 to 3 do > +=09=09=09=09( > +=09=09=09=09=09if (findItem verts2 verts1[h]=3D=3D0) then > +=09=09=09=09=09=09oppositeVertex =3D h > +=09=09=09=09) > +=09=09=09=09if (debug) then format "Opposite vertex: % " verts1[oppositeV= ertex] > + > +=09=09=09=09-- list vertexes in right order for resulting polygon > +=09=09=09=09commonV =3D false > +=09=09=09=09addedAdd =3D false > +=09=09=09=09addedOpp =3D false > +=09=09=09=09for h=3D1 to 3 do > +=09=09=09=09( > +=09=09=09=09=09 -- check next vertex > +=09=09=09=09=09 if (h!=3D3 and h!=3DoppositeVertex) then ( > +=09=09=09=09=09 nextV =3D verts1[h+1] > +=09=09=09=09=09=09-- first common vertex > +=09=09=09=09=09 =09if (nextV !=3D verts1[oppositeVertex]) then ( > +=09=09=09=09=09=09=09append verts verts1[h] > +=09=09=09=09=09=09=09append verts verts2[additionalVertex] > + > +=09=09=09=09=09=09=09addedAdd =3D true > + > +=09=09=09=09=09=09=09continue > +=09=09=09=09=09=09) > +=09=09=09=09=09 ) > + > +=09=09=09=09=09-- add vertex > +=09=09=09=09=09append verts verts1[h] > + > +=09=09=09=09=09if (h=3D=3D3 and (not addedAdd) ) then ( > +=09=09=09=09=09=09append verts verts2[additionalVertex] > +=09=09=09=09=09) > +=09=09=09=09) > + > +=09=09=09=09-- clock-wise vertexes listing for CS > +=09=09=09=09if (not flipModel) then ( > +=09=09=09=09=09tmpVert =3D verts[2] > +=09=09=09=09=09verts[2] =3D verts[4] > +=09=09=09=09=09verts[4] =3D tmpVert > +=09=09=09=09) > + > +=09=09=09) -- end if 2 faces > + > +=09=09=09-- export in XZY format > +=09=09=09piv =3D obj.pos > +=09=09=09for v in verts do > +=09=09=09( > +=09=09=09=09currVert =3D getVert obj v > + > + --relocate in local pivot coords (needed for =20 > rotation of warping portals) > +=09=09=09=09--currVert =3D currVert-piv > + > +=09=09=09=09--scale > +=09=09=09=09scaledx =3D (currVert.x * xscale) + xrelocate > +=09=09=09=09scaledy =3D (currVert.y * yscale) + yrelocate > +=09=09=09=09scaledz =3D (currVert.z * zscale) + zrelocate > +=09=09=09=09format " <v x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" scaledx= scaledz =20 > scaledy to:outFile > +=09=09=09=09--format " <v x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" currV= ert.x =20 > currVert.z currVert.y to:outFile > +=09=09=09) > + > +=09=09=09-- search displacement target > +=09=09=09warp =3D getUserProp obj "WARPTARGET" > +=09=09=09if (warp!=3Dundefined) then > +=09=09=09( > +=09=09=09 warptarget =3D getNodeByName warp > +=09=09=09=09if (warptarget=3D=3Dundefined) then ( > +=09=09=09=09=09message =3D "ERROR: WARP TARGET "+ warp + " specified on o= bject =20 > "+obj.name+" doesn't exist" > +=09=09=09=09=09messageBox message > +=09=09=09=09=09return 1 > +=09=09=09=09) > +=09=09=09=09-- calcs distance from warptarget > +=09=09=09=09warpx =3D obj.pos.x - warptarget.pos.x > +=09=09=09=09warpy =3D obj.pos.y - warptarget.pos.y > +=09=09=09=09warpz =3D obj.pos.z - warptarget.pos.z > +=09=09=09=09warpx =3D (warpx * xscale) + xrelocate > +=09=09=09=09warpy =3D (warpy * yscale) + yrelocate > +=09=09=09=09warpz =3D (warpz * zscale) + zrelocate > + > +=09 -- check portal rotation compared to target rotation > +=09 if (obj.rotation.x!=3Dwarptarget.rotation.x or =20 > obj.rotation.y!=3Dwarptarget.rotation.y or =20 > obj.rotation.z!=3Dwarptarget.rotation.z) then ( > +=09=09=09=09 -- move the target to 0,0,0 for a clean rotation > +=09=09=09=09 format " <wv x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" = =20 > warptarget.pos.x warptarget.pos.z warptarget.pos.y to:outFile > + > +=09=09=09=09 -- rotate > +=09=09=09=09 rotmatrix =3D (warptarget.rotation - obj.rotation) as eule= rAngles > +=09=09=09=09 rotmatrixcs =3D (eulerAngles rotmatrix.x rotmatrix.z =20 > rotmatrix.y) as matrix3 > +=09=09=09=09 format " <matrix>\n" to:outFile > +=09=09=09=09 format " <m11>%</m11><m12>%</m12><m13>%</m13>\n" = =20 > rotmatrixcs[1][1] rotmatrixcs[1][2] rotmatrixcs[1][3] to:outFile > +=09=09=09=09 format " <m21>%</m21><m22>%</m22><m23>%</m23>\n" = =20 > rotmatrixcs[2][1] rotmatrixcs[2][2] rotmatrixcs[2][3] to:outFile > +=09=09=09=09 format " <m31>%</m31><m32>%</m32><m33>%</m33>\n" = =20 > rotmatrixcs[3][1] rotmatrixcs[3][2] rotmatrixcs[3][3] to:outFile > +=09=09=09=09 format " </matrix> \n" to:outFile > + > +=09=09=09=09 -- move it back in the right spot > +=09=09=09=09 format " <ww x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" obj= .pos.x =20 > obj.pos.z obj.pos.y to:outFile > + > +=09=09=09=09) else ( > +=09=09=09=09 format " <ww x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" warp= x warpz =20 > warpy to:outFile > +=09=09=09=09) > +=09=09=09) > + > +=09=09=09arrives =3D getUserProp obj "ARRIVESINTHEMIDDLE" > +=09=09=09if (arrives=3D=3D"yes") then > +=09=09=09=09format " <clip/>" to:outFile > + > +=09=09=09starts =3D getUserProp obj "STARTSINTHEMIDDLE" > +=09=09=09if (starts=3D=3D"yes") then > +=09=09=09=09format " <zfill/>" to:outFile > + > +=09=09=09portalname =3D getUserProp obj "PORTAL" > +=09=09=09if (portalname=3D=3Dundefined) then > +=09=09=09( > +=09=09=09=09message =3D "ERROR: PORTAL WITH NO DESTINATION % " obj.name > +=09=09=09=09messageBox message > +=09=09=09=09return 1 > +=09=09=09) > +=09=09=09format "=09 <sector>%</sector>\n" portalname to:outFile > +=09=09=09format " </portal>\n" to:outFile > + > +=09=09=09-- now displace by the pivot position > +=09=09=09--format " <move><v x=3D\"%\" y=3D\"%\" z=3D\"%\" /></move>= \n" =20 > piv.x piv.z piv.y to:outFile > +=09=09=09format " </portals>\n" to:outFile > + > +=09=09) > + > + > +=09=09-- //////////////////////// > +=09=09-- Output culleronly trimesh > +=09=09-- //////////////////////// > + > +=09=09fn OutputCullerOnly obj outFile verboseMode debug =3D > +=09=09( > + > +=09=09=09-- output vertexes of the object in XZY format > +=09=09=09for v in obj.verts do > +=09=09=09( > +=09=09=09=09xvert =3D (v.pos.x * xscale) + xrelocate > +=09=09=09=09yvert =3D (v.pos.y * yscale) + yrelocate > +=09=09=09=09zvert =3D (v.pos.z * zscale) + zrelocate > +=09=09=09=09format " <v x=3D\"%\" y=3D\"%\" z=3D\"%\" />\n" xvert z= vert =20 > yvert to:outFile > +=09=09=09) > + > +=09=09=09format "\n" to:outFile > + > +=09=09=09-- cycle on all faces of object > +=09=09=09for i =3D1 to obj.numFaces do > +=09=09=09( > +=09=09=09=09=09-- get its 3 vertices as a point3 > +=09=09=09=09=09-- export in XZY format > +=09=09=09=09 verts=3Dgetface obj i > +=09=09=09=09=09a =3D verts[1] as Integer > +=09=09=09=09=09b =3D verts[3] as Integer > +=09=09=09=09=09c =3D verts[2] as Integer > + > +=09=09=09=09=09if (verboseMode) then > +=09=09=09=09=09( > +=09=09=09=09 =09format " <t v1=3D\"%\" v2=3D\"%\" v3=3D\"%\" />\n= " (a-1) =20 > (b-1) (c-1) to:outFile > +=09=09=09=09=09) else ( > +=09=09=09=09=09=09format "<t v1=3D\"%\" v2=3D\"%\" v3=3D\"%\" />\n" (a-1)= (b-1) (c-1) =20 > to:outFile > +=09=09=09=09=09) > +=09=09=09) > +=09=09) > + > +=09=09-- //////////////////////// > +=09=09-- Defines if an object should have <colldet> > +=09=09-- //////////////////////// > +=09=09fn doesCollide obj groupsInfo =3D > +=09=09( > + > +=09=09=09-- check for colldet setting > +=09=09=09colldetProp =3D getUserProp obj "COLLDET" > + > +=09=09=09-- if it should not collide (e.g. water) > +=09=09=09if (colldetProp=3D=3D"no") then > +=09=09=09=09return false; > + > + > +=09=09=09-- if is not in a group by defaults it collides > +=09=09=09if ( not isGroupMember obj) then > +=09=09=09=09return true; > + > +=09=09=09-- check for colldet based on groups > + > +=09=09) > + > +=09=09fn OutputGenMeshFactory obj outFile debug auto =3D > + ( > +=09=09=09format "auto setting is % for object %\n" auto obj.name > +=09=09=09if (auto=3D=3D1) then ( > +=09=09=09 format "AUTO setting for object %\n" obj.name > +=09=09=09=09factoryName =3D "_auto_" + obj.name > +=09=09=09) else ( > +=09=09=09=09toks =3D tokenize obj.name "_" > +=09=09=09=09factoryName =3D toks[3] > +=09=09=09) > + > +=09=09=09------------------- > +=09=09=09-- support for LOD. > +=09=09=09-- it has to check all objects listed and export each as a =20 > nested meshfact > +=09=09=09------------------- > +=09=09=09lodlow =3D getUserProp obj "LODLOW" > +=09=09=09if (lodlow!=3Dundefined) then ( > +=09=09=09=09format "FOUND LOD OBJECT: %" factoryName > + > + =09=09=09=09=09-- search low detail obj > +=09=09=09=09lodobjects =3D #() > +=09=09=09=09if (lodlow=3D=3D"NULL") then > +=09=09=09=09=09append lodobjects "null" > +=09=09=09=09else > +=09=09=09=09=09append lodobjects (getNodeByName lodlow) > + > + =09=09=09=09=09-- search med detail obj > +=09=09=09=09lodmed =3D getUserProp obj "LODMED" > +=09=09=09=09if (lodmed=3D=3D"NULL") then > +=09=09=09=09=09append lodobjects "null" > +=09=09=09=09else > +=09=09=09=09=09append lodobjects (getNodeByName lodmed) > + > + =09=09=09=09=09-- search high detail obj > +=09=09=09=09append lodobjects obj > + > +=09=09=09------------------------- > +=09=09=09-- no LOD for this object > +=09=09=09------------------------- > +=09=09=09) else ( > +=09=09=09=09lodobjects =3D #() > +=09=09=09=09append lodobjects obj > +=09=09=09) > + > + =09=09=09=09=09-- export low, med and high version > +=09=09=09if (lodobjects.count!=3D1) then > +=09=09=09( > +=09=09=09=09format "<meshfact name=3D\"%\">\n" factoryName to:outFile > +=09=09=09=09-- get proper nullmesh bbox size > +=09=09=09=09rmin =3D [-1,-1,-1] > +=09=09=09=09rmax =3D [1,1,1] > +=09=09=09=09for k=3D1 to lodobjects.count do > +=09=09=09=09( > +=09=09=09=09=09if (lodobjects[k]!=3D"null") then > +=09=09=09=09=09( > +=09=09=09=09=09=09tempmin =3D lodobjects[k].min - lodobjects[k].center > +=09=09=09=09=09=09tempmax =3D lodobjects[k].max - lodobjects[k].center > +=09=09=09=09=09=09if (tempmin.x<rmin.x) then rmin.x=3Dtempmin.x > +=09=09=09=09=09=09if (tempmin.y<rmin.y) then rmin.y=3Dtempmin.y > +=09=09=09=09=09=09if (tempmin.z<rmin.z) then rmin.z=3Dtempmin.z > +=09=09=09=09=09=09if (tempmax.x>rmax.x) then rmax.x=3Dtempmax.x > +=09=09=09=09=09=09if (tempmax.y>rmax.y) then rmax.y=3Dtempmax.y > +=09=09=09=09=09=09if (tempmax.z>rmax.z) then rmax.z=3Dtempmax.z > +=09=09=09=09=09) > +=09=09=09=09) > +=09=09=09=09rmin =3D (rmin * xscale) + xrelocate > +=09=09=09=09rmax =3D (rmax * xscale) + xrelocate > +=09=09=09=09format "<nullmesh><min x=3D\"%\" y=3D\"%\" z=3D\"%\" /><max x= =3D\"%\" =20 > y=3D\"%\" z=3D\"%\" /></nullmesh>\n" rmin.x rmin.z rmin.y rmax.x rmax.z = =20 > rmax.y to:outFile > +=09=09=09=09format "<staticlod><distance varm=3D\"LodM\" vara=3D\"LodA\" = =20 > /></staticlod>\n" to:outFile > +=09=09=09) > + > +=09=09=09for k=3D1 to lodobjects.count do > +=09=09=09( > + > +=09=09=09=09--check simple colldet setting > +=09=09=09=09colldet =3D getUserProp obj "COLLDET" > + > +=09=09 =09=09-- output nullmesh > +=09=09=09=09if (lodobjects[k]=3D=3D"null") then > +=09=09=09=09( > +=09=09=09=09=09format " <meshfact name=3D\"%_%\">\n" factoryName (k-1) t= o:outFile > +=09=09=09=09=09format " <lodlevel>%</lodlevel>\n" (k-1) to:outFile > +=09=09=09=09=09format " <nullmesh><min x=3D\"-0.1\" y=3D\"-0.1\" z=3D\"-= 0.1\" =20 > /><max x=3D\"0.1\" y=3D\"0.1\" z=3D\"0.1\" /></nullmesh>\n" to:outFile > +=09=09=09=09=09format " </meshfact>\n\n" to:outFile > +=09=09=09=09=09continue; > +=09=09=09=09) > + > +=09=09=09=09obj =3D lodobjects[k] > + > +=09=09=09=09-- output normalmeshfact > +=09=09=09=09-- meshfact name changes for hierarchy > +=09=09=09=09if (lodlow!=3Dundefined) then > +=09=09=09=09=09format " <meshfact name=3D\"%_%\">\n" factoryName (k-1) t= o:outFile > +=09=09=09=09else > +=09=09=09=09=09format " <meshfact name=3D\"%\">\n" factoryName to:outFil= e > + > +=09=09=09=09if (lodobjects.count!=3D1) then > +=09=09=09=09=09format "<lodlevel>%</lodlevel>\n" (k-1) to:outFile > +=09=09=09=09format " <plugin>meshFact</plugin><params><numvt>%</numvt>\n= " =20 > (getNumTVerts obj) to:outFile > + > +=09=09=09=09-- just for LOD hierarchical objects material must be spefici= ed =20 > in the factory > +=09=09=09=09if (lodlow!=3Dundefined) then ( > +=09=09=09=09=09m =3D obj.mat; > +=09=09=09=09=09if ((classOf m)=3D=3DMultimaterial) then ( > +=09=09=09=09=09=09matUsed =3D getFaceMatID obj 1 > +=09=09=09=09=09=09m =3D obj.mat[matUsed]; > +=09=09=09=09=09) > +=09=09=09=09=09format " <material>%</material>\n" (getMatFilename m)= to:outFile > +=09=09=09=09) > + > +=09=09=09=09-- check texture > +=09=09=09=09if (getNumTVerts obj=3D=3D0) then > +=09=09=09=09( > +=09=09=09=09=09message =3D "Export aborted: No UV maps assigned to genmes= h =20 > object: " + factoryName > +=09=09=09=09=09messageBox message > +=09=09=09=09=09close outFile > +=09=09=09=09=09return 1 > +=09=09=09=09) > + > +=09=09=09=09-- checks if model has left-oriented system or not > +=09=09=09=09face =3D getface obj 1 > +=09=09=09=09v1=3D getvert obj face[1] > +=09=09=09=09v2 =3D getvert obj face[2] > +=09=09=09=09v3 =3D getvert obj face[3] > + > + > +=09=09=09=09vect1 =3D v1-v2 > +=09=09=09=09vect2 =3D v3-v2 > +=09=09=09=09normal1 =3D cross vect1 vect2 > +=09=09=09=09facenorm =3D normal1/(length normal1) > +=09=09=09=09maxnorm =3D getfacenormal obj 1 > +=09=09=09=09flipModel =3D false > + > +=09=09=09=09dotProd =3D dot facenorm maxnorm > +=09=09=09=09if (dotProd>0) then ( > +=09=09=09=09=09flipModel =3D true > +=09=09=09=09) > + > +=09=09=09 if (flipModel) then ( > +=09=09=09 format "\n GenMesh Factory Object needs flipping: %\n" facto= ryName > +=09=09=09 ) > + > +=09=09=09=09vertTInfo =3D #(getNumTVerts obj) > +=09=09=09=09vertTInfo[1] =3D undefined > +=09=09=09=09normalsVert =3D #() > + > +=09=09=09=09isSky =3D false > +=09=09=09=09if (findString obj.name "_sky_" !=3Dundefined) then > +=09=09=09=09 isSky =3D true > + > +=09=09=09=09-- cycle on all Faces of the object to get Tverts x,y,z posit= ions > +=09=09=09=09for i=3D1 to obj.numfaces do > +=09=09=09=09( > +=09=09=09=09=09-- get face > +=09=09=09=09=09Tface =3D getTVFace obj i > +=09=09=09=09=09face =3D getFace obj i > + > +=09=09=09=09=09-- check smooth group of the face > +=09=09=09=09=09smoothgroup =3D getFaceSmoothGroup obj i > + > +=09=09=09=09=09-- get its 3 vertices > +=09=09=09=09=09for h=3D1 to 3 do ( > +=09=09=09=09 =09curVert=3DgetVert obj face[h] > +=09=09=09=09=09=09if (curVert=3D=3Dundefined) then > +=09=09=09=09=09=09=09format "\n\nUNDEF: %\n\n" Tface[h] > +=09=09=09=09=09=09if (debug) then > +=09=09=09=09=09=09=09format " face: % curVert %: %\n" i Tface[h] curVert > + > +=09=09=09=09=09=09-- if the value is different we have a problem on Welde= d UV > +=09=09=09=09=09=09if (vertTInfo[Tface[h]]!=3Dundefined and =20 > vertTInfo[Tface[h]]!=3DcurVert) then ( > +=09=09=09=09=09=09=09message =3D "PROBLEM on object " + factoryName + ".\= n UV =20 > should not be welded on vertex " + (Tface[h] as String) > +=09=09=09=09=09=09=09messageBox message > +=09=09=09=09=09=09=09close outFile > +=09=09=09=09=09=09=09return 1 > +=09=09=09=09=09=09) > +=09=09=09=09=09=09vertTInfo[Tface[h]]=3DcurVert > + > +=09=09=09=09=09=09-- get normal for sky (TODO: double check, seems not ri= ght) > +=09=09=09=09=09=09if (isSky) then ( > +=09=09=09=09=09=09=09normalsVert[Tface[h]]=3DgetNormal obj face[h] > +=09=09=09=09=09=09-- get normal in case of smoothing groups > + ) else if (smoothgroup!=3D0) then ( > +=09=09=09=09=09=09=09-- get average normal > +=09=09=09=09=09=09=09faces =3D meshop.getFacesUsingVert obj face[h] as ar= ray > +=09=09=09=09=09=09=09normal =3D [0,0,0] > +=09=09=09=09=09=09=09facescount =3D 0 > +=09=09=09=09=09=09=09for j in faces do ( > +=09=09=09=09=09=09=09 if (getFaceSmoothGroup obj j=3D=3Dsmoothgroup) t= hen > +=09=09=09=09=09=09=09=09=09normal +=3D (getFaceNormal obj j) > +=09=09=09=09=09=09=09=09=09facescount+=3D1 > +=09=09=09=09=09=09=09) > +=09=09=09=09=09=09=09normal =3D normal/facescount > +=09=09=09=09=09=09=09normalsVert[Tface[h]]=3Dnormal > +=09=09=09=09=09=09-- get normal in case no smooth group present > +=09=09=09=09=09=09) else ( > +=09=09=09=09=09=09=09--normalsVert[Tface[h]]=3DgetNormal obj face[h] > +=09=09=09=09=09=09=09normal =3D meshop.getFaceRNormals obj i > +=09=09=09=09=09=09=09normalsVert[Tface[h]]=3Dnormal[1] > +=09=09=09=09=09=09) > +=09=09=09=09=09) > +=09=09=09=09) > + > +=09=09=09=09-- cycle on all TVerts of the object > +=09=09=09=09for i =3D1 to (getNumTVerts obj) do > +=09=09=09=09( > +=09=09=09=09=09-- get its 3 vertices as a point3 > +=09=09=09=09=09-- export in XZY format > +=09=09=09=09 vert=3DvertTInfo[i] > +=09=09=09=09=09if (vert=3D=3Dundefined) then ( > +=09=09=09=09=09=09message =3D "PROBLEM on object " + factoryName + ": UV = mapping =20 > seems to be messed up. Please UnWrap it then collapse it."; > +=09=09=09=09=09=09messageBox message > +=09=09=09=09=09=09close outFile > +=09=09=09=09=09=09return 1 > +=09=09=09=09=09) > +=09=09=09=09=09xvert =3D (vert.x * xscale) + xrelocate > +=09=09=09=09=09yvert =3D (vert.y * yscale) + yrelocate > +=09=09=09=09=09zvert =3D (vert.z * zscale) + zrelocate > + > +=09=09=09=09=09Tvert =3D getTVert obj i > + > +=09=09=09=09=09-- if it's an autogenerated genmesh then relocate to 0,0,0 > +=09=09=09=09=09if (auto=3D=3D1) then ( > +=09=09=09=09=09=09xvert =3D xvert - obj.pos.x > +=09=09=09=09=09=09yvert =3D yvert - obj.pos.y > +=09=09=09=09=09=09zvert =3D zvert - obj.pos.z > +=09=09=09=09=09) > + > +=09=09=09=09=09format " <v x=3D\"%\" y=3D\"%\" z=3D\"%\" u=3D\"%\" v= =3D\"%\" /> =20 > \n" xvert zvert yvert Tvert[1] (1-Tvert[2]) i to:outFile > +=09=09=09=09) > + > +=09=09=09=09-- write all normals > +=09=09=09=09for i =3D1 to (getNumTVerts obj) do > +=09=09=09=09( > +=09=09=09=09=09Tvert =3D getTVert obj i > +=09=09=09=09=09normalvert =3D normalsVert[i] > +=09=09=09=09=09normalvert =3D normalize(normalvert) > +=09=09=09=09=09format " <n x=3D\"%\" y=3D\"%\" z=3D\"%\" /> \n" norm= alvert.x =20 > normalvert.z normalvert.y to:outFile > +=09=09=09=09) > + > +=09=09=09=09-- cycle on all faces of object and split by material > +=09=09=09=09facesmaterial=3D#() > +=09=09=09=09facesmaterialfaces=3D#() > + -- if standard material, then 1 submesh only > +=09=09=09=09if ((classOf obj.mat)=3D=3DStandardmaterial) then ( > +=09=09=09=09 append facesmaterial (getMatFilename (obj.mat)) > +=09=09=09=09=09facesmaterialfaces[1]=3D#() > +=09=09=09=09=09for i =3D1 to obj.numFaces do > +=09=09=09=09=09( > +=09=09=09=09=09=09append facesmaterialfaces[1] i > +=09=09=09=09=09) > +=09=09=09=09) else ( > +=09=09=09=09=09for i =3D1 to obj.numFaces do > +=09=09=09=09=09( > +=09=09=09=09=09 textid =3D getFaceMatID obj i > +=09=09=09=09=09=09if (textid > obj.mat.count) then ( > +=09=09=09=09=09=09 format "ERROR!!! Object % uses more material ID than = the =20 > materials defined. \n" obj.name > +=09=09=09=09=09=09) > +=09=09=09=09=09=09m =3D obj.mat[textid] > +=09 =09=09=09=09=09mname =3D getMatFilename(m) > +=09=09=09=09=09=09if (findItem facesmaterial mname=3D=3D0) then ( > +=09=09=09=09=09=09=09append facesmaterial mname > +=09=09=09=09=09=09) > +=09=09=09=09=09=09pos =3D findItem facesmaterial mname > +=09=09=09=09=09=09if (facesmaterialfaces[pos]=3D=3Dundefined) then > +=09=09=09=09=09=09 facesmaterialfaces[pos]=3D#() > +=09=09=09=09=09 append facesmaterialfaces[pos] i > +=09=09=09=09=09) > +=09=09=09=09) > +=09=09=09=09format "\n facesmaterial: % \n" facesmaterial > +=09=09=09=09format "\n facesmaterialid: % \n" facesmaterialfaces > + > +=09=09=09=09-- write one submesh for each material > +=09=09=09=09for i =3D1 to facesmaterial.count do > +=09=09=09=09( > +=09=09=09=09=09mname =3D facesmaterial[i]; > + > +=09=09=09=09=09format " <submesh name=3D\"%\">\n" ("submesh"+i as Stri= ng) to:outFile > + format " <material>%</material>\n" mname to:outFil= e > + format " <indexbuffer components=3D\"1\" =20 > type=3D\"uint\" indices=3D\"yes\">\n" to:outFile > + > + -- cycle on all faces using same material > + for j=3D1 to facesmaterialfaces[i].count do > +=09=09=09=09=09( > +=09=09=09=09=09=09currentfaceset =3D facesmaterialfaces[i] > +=09=09=09=09=09=09faceVerts=3DgetTVface obj currentfaceset[j] > +=09=09=09=09=09=09a =3D (faceVerts[1]-1) as Integer > + > +=09=09=09=09=09=09if (flipModel) then ( > +=09=09=09=09=09=09=09b =3D (faceVerts[2]-1) as Integer > +=09=09=09=09=09=09=09c =3D (faceVerts[3]-1) as Integer > +=09=09=09=09=09=09) else ( > +=09=09=09=09=09=09=09b =3D (faceVerts[3]-1) as Integer > +=09=09=09=09=09=09=09c =3D (faceVerts[2]-1) as Integer > +=09=09=09=09=09=09) > + > +=09=09=09=09=09=09-- exclude collision detection on low lod versions > +=09=09=09=09=09=09if (k!=3Dlodobjects.count) then ( > +=09=09=09=09=09=09=09format " <e c0=3D\"%\" /><e c0=3D\"%\" /><e c0=3D= \"%\" />\n" a =20 > b c to:outFile > +=09=09=09=09=09=09=09--if (colldet=3D=3D"no") then format "<colldet>no</c= olldet>" to:outFile > +=09=09=09=09=09=09) else ( > +=09=09=09=09=09=09=09--if (colldet=3D=3D"no") then format "<t v1=3D\"%\" = v2=3D\"%\" =20 > v3=3D\"%\"><colldet>no</colldet></t>" a b c to:outFile > +=09=09=09=09=09=09=09format " <e c0=3D\"%\" /><e c0=3D\"%\" /><e c0=3D= \"%\" />\n" a =20 > b c to:outFile > +=09=09=09=09=09=09) > +=09=09=09=09=09) > +=09=09=09=09=09format " </indexbuffer></submesh>\n" to:outFile > +=09=09=09 ) > + > + > +=09=09=09=09-- check for smooth setting > +=09=09=09=09-- temporary disabled > +=09=09=09=09--smooth =3D getUserProp obj "SMOOTH" > +=09=09=09=09--if (smooth=3D=3D"yes") then > +=09=09=09=09--=09format " <autonormals/>\n" to:outFile > + > +=09=09=09=09format " </params>\n" to:outFile > + > +=09=09=09=09-- check for no lighting setting > +=09=09=09=09lighting =3D getUserProp obj "LIGHTING" > + > +=09=09=09=09--check simple colldet setting > +=09=09=09=09colldet =3D getUserProp obj "COLLDET" > + > +=09=09=09=09-- check for viscull setting > +=09=09=09=09viscull =3D getUserProp obj "VISCULL" > + > +=09=09=09=09-- check for culleronly setting > +=09=09=09=09culleronly =3D getUserProp obj "CULLERONLY" > + > +=09=09=09=09-- check player barrier setting > +=09=09=09=09playerbarrier =3D getUserProp obj "PLAYERBARRIER" > + > + occluder =3D false > +=09=09=09=09-- check for culleronly setting > +=09=09=09=09culleronly =3D getUserProp obj "CULLERONLY" > + > +=09=09=09=09-- check player barrier setting > +=09=09=09=09playerbarrier =3D getUserProp obj "PLAYERBARRIER" > + > +=09=09=09 -- output name of object and some info > +=09=09=09=09if (findString obj.name "_occ_" !=3Dundefined) then ( > +=09=09=09=09=09occluder =3D true > +=09=09=09=09) > + > +=09=09=09=09istrasparent=3Dfalse > +=09=09=09=09-- check if object is a range alpha trasparent > +=09=09=09=09rangetrasp =3D getUserProp obj "RANGETRASP" > +=09=09=09=09if (rangetrasp=3D=3D"yes") then ( > +=09=09=09=09 istrasparent=3Dtrue > +=09=09=09=09) > + > +=09=09=09=09-- check if object is a binary alpha trasparent > +=09=09=09=09trasp =3D getUserProp obj "TRASPARENT" > +=09=09=09=09if (trasp=3D=3D"yes") then ( > +=09=09=09=09 istrasparent=3Dtrue > +=09=09=09=09) > + > +=09=09=09=09-- handles transparent objects > +=09=09=09=09if (istrasparent) then ( > +=09=09=09=09 format " <priority>alpha</priority>\n" to:outFile > +=09=09=09=09 format " <ztest />\n" to:outFile > +=09=09=09=09) > +=09=09=09 -- handles sky objects > +=09=09=09=09else if (findString obj.name "_sky_" !=3Dundefined) then ( > +=09=09=09=09 format " <priority>sky</priority>\n" to:outFile > +=09=09=09=09 format " <zuse />\n" to:outFile > +=09=09=09=09) > +=09=09=09 -- handles zfill objects > +=09=09=09=09else if (findString obj.name "_s_" !=3Dundefined) then ( > +=09=09=09=09 format " <priority>object</priority>\n" to:outFile > +=09=09=09=09 format " <zuse />\n" to:outFile > +=09=09=09=09) > +=09=09=09=09else if (culleronly=3D=3D"yes" or playerbarrier=3D=3D"yes" or= (occluder =20 > and (classOf obj)!=3DBox)) then ( > +=09=09=09=09=09format " <mesh>\n" to:outFile > +=09=09=09=09) else if (occluder and (classOf obj)=3D=3DBox) then ( > +=09=09=09=09=09format " <box>\n" to:outFile > +=09=09=09=09) else ( > +=09=09=09=09 format " <priority>object</priority>\n" to:outFile > +=09=09=09=09 format " <zuse />\n" to:outFile > +=09=09=09=09) > + > +=09=09=09=09-- check for no shadow setting > +=09=09=09=09noshadows =3D getUserProp obj "NOSHADOWS" > +=09=09=09=09if (noshadows=3D=3D"yes") then > +=09=09=09=09=09format " <noshadows />\n" to:outFile > + > + > +=09=09=09=09if (colldet=3D=3D"no") then format =20 > "<trimesh><id>colldet</id></trimesh>\n" to:outFile > + > +=09=09=09=09-- check for no shadow setting > +=09=09=09=09-- NO MORE WORKING?? > +=09=09=09=09noshadows =3D getUserProp obj "N... [truncated message content] |