Retrieve data from HDK

   3897   2   0
User Avatar
Member
26 posts
Joined: March 2008
Offline
Hello!

I am working on a exporter in Houdini (8.2), that exports a Virtools *.nmo file. And it works fine sofar, but I have some problems, so I thought I would include them all here to save space.

I have found the Faces data (GU_Detail.Primitives) and the vertices (GU_Detail.points) and normals. But I cant find where to locate the UV-coordinates (texture). So I was wondering where I would find these?

Another question is that I was wondering how you could find, if the object/s in Houdini are divided into groups?
I want to know, so I can divide the different groups apart and create seperate objects in the final application.

And my final question is, if there is a way to find the address, to where Houdini saves the specific object. You add a address to where you wish to save it, and Houdini does save it to that specific address.
But my issue is that I have to use a non-Houdini save function to save my created file, so I would somehow need to get access to that address from the Houdini HDK.

As a standalone app (created with HDK) I have the following inparameters:

int main(int argc, char *argv)


But then, in order to get the information about the geometry you need to run the following aswell:


m_GUDetail.load(cin);
ofstream LoadStream(argv);
LoadStream << “Write this into the file”;


So this ‘cin’ must have come from somewhere. So are there some kind of global variables you can get information from, or is there a way for me to retrieve the char/string with the final path to where Houdini will save its file?

Looking at the "argv“ string, this one is pointing to a temp address (not the final place where the file will appear).
And ”argv" only says the standalone program title.

So that was my questions. I hope there are some people out here which might now something about these questions.

Thanks!
You cant recycle wasted time
User Avatar
Staff
4439 posts
Joined: July 2005
Offline
UVs in Houdini are stored as point or vertex attributes named “uv”. This is very similar to normals, which are stored as attributes named “N”. But for normals there are all sorts of convenience functions (like computeNormal). For UVs, you'll need to access the attribute yourself. You can use code like:
uvOffset = gdp->findTextureAttribute(GEO_POINT_DICT);
if (uvOffset < 0)
cerr << “No texture attribute found” << endl;
to get the uv attribute offset. Then use:
UT_Vector3 uv = *(UT_Vector3 *)pt->getAttrib();
as you loop through each point.

I'd also suggest reading the (admittedly very limited) HDK documentation on the geometry classes under the “Geometry: Loading/Saving, Manipulation, Extending Formats” heading in the HDK docs index (found in $HFS/toolkit/html).

As for cin, that's just the C++ stream representing stdin. When Houdini uses an external application for geometry conversion (using the GEOio table, which I assume is what you're doing), it opens the application with a pipe, and sends the Houdini formatted geometry through stdin. As for writing out the file, you are doing the right things by saving to the file whose name is passed in as argv. Yes, this is a temp file. The reason for this is that Houdini can do some stuff that your app can't. For example, in Houdini you can specify “opdef:Object/myobj?somename” as a location to save a file. Your app would have no idea how to deal with that. So Houdini insultes your app by always letting you save to a nice local temp file. Houdini then copies that temp file to the actual requested save location, and deletes the temp file. So you're doing the right thing with the way you're saving the file. Houdini will take care of the details.

Mark
User Avatar
Member
26 posts
Joined: March 2008
Offline
Thank you Mark! That was a very thoroughly answer! It helped me alot!

I guess its how data is stored that confuses me.
But saving to a *.GEO file and then look at the structure also helped to see what is stored where.
You cant recycle wasted time
  • Quick Links