Tips on Making an exporter - Documentation needed

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Tips on Making an exporter - Documentation needed // Archive: Tech Forum

1  |  

Post by PrimMac // Jun 29, 2007, 10:50am

PrimMac
Total Posts: 78
Hi all,


I am trying to make a custom exporter using VBScript command objects. I realize that this might be possible using the Scripting.FileSystemObject, which is available in VBScript. However, I'm not sure if TS Mesh data can be converted into text (I want to write into the file the coordinates of each vertex). However, the MeshData.GetVertices() function seems to bring the vertices in a non-textual format.


That is, I cannot do things like:

System.Alert(mesh.GetVertices())


or


file.WriteLine(mesh.GetVertices())


Or if this is even the appropiate way to do this. I'm not even sure that documentation for these functions exists. Can anyone suggest how I might go about doing this?

Post by frootee // Jun 29, 2007, 11:15am

frootee
Total Posts: 2667
pic
The GetVertices function returns a vertex stream:

IrdVertexStream **pVal.


pVal is the coordinate stream.


To get individual x, y, and z ordinates, use the x, y, and z member functions of class IRdVertexStream:


HRESULT IRdVertexStream::x ( [in] RtDWORD dwIndex,

[out, retval] RtFloat * pVal )



Get X coordinate of i-th vertex



Parameters:

dwIndex Vertex index

pVal retrived value


Returns:

standard HRESULT processing can be applied to returned value


more info can be found in the developers guide in this html file:


ts7_DG\DataObjects\functions.html - select g (for getvertices); select the getvertices link, which will take you to the right page.


HTH


Frootee

Post by Jack Edwards // Jun 29, 2007, 8:02pm

Jack Edwards
Total Posts: 4062
pic
The answer to you question is: YES! it can definitely be done. But you may need to write your own functions to parse the mesh data to write out as a stream. Keep in mind that each file format wants the data differently. So just writing it straight out isnt' going to work.

You'll probably want to use the IrdNode object to get the currently selected object and then extract it's mesh. Once you have a mesh data object my morpher script illustrates how to extract and modify data from the Mesh object:
http://forums1.caligari.com/truespace/showthread.php?t=2573

So what you'd need to figure out is converting the data to a string and writing it out to a file (if it's an ascii format you're looking to write too). The File I/O streams objects should have every thing you need to handle that, but you'd need to consult a MS VBScript or JScript reference for that. ;)

Edit: the developer guide can be found here:
http://forums1.caligari.com/truespace/showthread.php?t=242

-Jack.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn