Jump to content

How to include embedded code files into VEX?

Recommended Posts


I am experimenting with the new namespaces but I couldn't find a way to do this. Basically I want to refer to a VEX code file stored in the Extra Files tab to be included like this:

#include "myEmbeddedFile.vfl"

I tried namespaced syntax too. But it doesn't work. I didn't try this method before namespaces so not sure if it would work?

I assume the opdef syntax is not something the built-in include function would recognize? Python has a dedicated hou.readFile that knows about opdef paths, but for VEX is this not possible?

Thanks :)

Link to comment
Share on other sites

opdef references are parameter level references inside Houdini that are valid at the time of a node cooking.

VEX can be compiled on the command line by vcc outside of Houdini. It's also only compiled once, where opdef can change depending on what OTL was loaded. Since the include statement is only evaluated when VEX is compiled, then I don't think it's possible to have an opdef reference.

I could be wrong as I've never written VEX by hand.

  • Downvote 1
Link to comment
Share on other sites

It's a shame if it can't be done. Because I have a lot of code libraries that I include but if Extra Files can't be used, then I will have to copy paste everywhere and keep track of every little code and make sure to update them if any of them changes.

You did write VEX though, I got you to do it :)

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.

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...