Jump to content

Camera i/o script help


dpotter

Recommended Posts

I'm new to Houdini and am having some difficulty figuring out how to parse an external file and bring said data into a node. Basically, I have an ASCII camera format that is pretty straight forward, however, it also contains note tracks and has flags that allow the parser to know what it is able to do. From what I've been able to se, it looks pretty easy to read in straight sets of data, however, things seem to work differently on more complex file types.

The other complication to the situation, is that I am quite new and don't really know the proper approach for doing such a task in Houdini. I am imagining a button that would open a file browser, which would then give me a pointer to the file. After parsing, I would then have the script generate a cam node and apply the animation data.

*Any* input would be greatly appreciated. Is there a script out there that does file i/o? Basically I just need a starting point to see how Houdini approaches this problem, and then all should be pretty straight forward.

Thanks.

Dagan

Link to comment
Share on other sites

Hi there, and welcome to od[force].

Basically you're going to want to read in this data using a FileCHOP under the Motion&Audio context and export the data to any camera in your scene. You can override the position procedurally or export the export and create keyframed channels in your destination camera.

So is this a format that you're going to want to read often?

If so, then I'd look at writing a converter in any scripting language you like (like PERL, for instance) that can read your format and output rows of data. Now I'd look at editing the file under your Houdini installation called CHOPio (in the location $HFS/houdini/) and adding a line that tells Houdini what file extension would execute that script on the fly. Look at the clchan program for hints on how houdini will convert .bchn and such to ascii channel data, ripe to be read in by the FileCHOP.

If not and your camera conversion is a once off affair, I'd convert the data to rows of channels manually in an editor using macro's and such. (Or whatever is easiest for you)

The FileCHOP will read rows of data as raw samples into user-named channels (such as tx,ty,tz,rx,ry,rz,focal,aperture) and so on. If you have data like FOV , you can do math operations to the channels in CHOPs before you export the data to the camera.

You can read some more information here on the OdWiki Translation page.

Hope this helps,

Jason

Link to comment
Share on other sites

Thanks for the pointers Jason. I've gone a slightly different route which seems to work pretty well. Basically, I've got a python script which parses the file and builds an hscript with the information (cam settings, keys, etc). Then opens a port and basically feeds the hscript into houdini a line at a time.

While this seems to work fine, I'm not sold on the scriptability of houdini. It seems that the best way to create a tool, such as this one, is to do it as a plugin. Which, of course, is what's happening :)

As a whole, I must say that I am enjoying the houdini experience. Very cool application.

Dagan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...