Jump to content
Christian S

Creating VEX libraries

Recommended Posts

Christian S    2

Hi,

I've tried to find information about this but it's hard to come by or maybe I'm not looking in the right spot. After all I'm an improvise programmer.

I want to create VEX libraries of functions and possibly structs (but let's start with functions). You know, functions I would use often and that I would not have to copy paste from AttribWrangle to AttribWrangle nodes.

These functions should be accessible using #include (I think). So here is a few questions to get me started...

1) How to structure the inside of the file? I don't want to compile them into an asset. For example if I put this straight into a .vfl file and compile it will it work or it needs a header?

// Function to Round at specified intervals
int roundToInterval(float val; int interval) {
    float new_val = ceil(val / interval) * interval;
    return int(new_val);
}

2) How to compile those files? Seriously I don't understand any of the compiler stuff... Do I even have to compile them??? What is a .h and do I need to use it? :(

3) Where to put the files? I want a common location that is not inside any of Houdini folder structure. Where do you specify that Houdini should look in an external folder for these extra functions? You know like adding HOUDINI_OTLSCAN_PATH to the houdini.env file. Is there a HOUDINI_VEX_PATH that I could use???

4) Finally, is using the files as simple as doing #include?

It would be nice that this was written somewhere because some of us don't have the programming background necessary to understand these easily.

Any help would be appreciated.

Thx!

Christian

Share this post


Link to post
Share on other sites
bonsak    23

Hi

1. Just like that.
2. You don't have to compile these files. Vfl-files will be compiled at runtime so if your function is huge it can be a good solution to compile them first. To compile vfl-files you use "C:\Program Files\Side Effects Software\Houdini 15.5.535\bin\vcc.exe" More info int the doc's
3. The files has to be placed in the "HOUDINI_VEX_PATH". So either set up a custom path to store your files or make a "vex" folder with an "include" folder inside in your preference folder, and place your files there.
4. Yes.

-b

Edited by bonsak
  • Like 3

Share this post


Link to post
Share on other sites
Christian S    2

Looks like there is a problem after all :(

Some of the default Houdini VEX libraries are missing when we define a HOUDINI_VEX_PATH.

The AttribFromMap node doesnt work for instance. Saying some files are missing (voplib.h I think). It can be fixed by including the path where these are located into the HOUDINI_VEX_PATH value but the Mantra render node doesnt work even with this fix.

I'll contact Side FX. For now the only solution is to put my .vfl files in vex\include in my document folder.

Still, thx for you help!

C

 

Share this post


Link to post
Share on other sites
Christian S    2

Ok so here is what I ended up doing after writting to Side FX.

If you want to have files for you project outside the main Houdini folder structure, you need to add the path to the HOUDINI_PATH environment variable. the "&" character will tell Houdini to use the default path too.

In houdini.env I ended up just adding this like only (notice the & at the end):

HOUDINI_PATH = R:/PROJECTNAME/tools/dcc/houdini;&

Then, you project folder structure should copy the Houdini one. So:

houdini/otls      (for assets, otl or hda files)

houdini/vex      (for ??? VEX assets?)

houdini/vex/include       (for vex library)

Hope it helps.

Christian

  • Like 1

Share this post


Link to post
Share on other sites
mestela    452

Resurrecting an old thread;

So I have this all working (made a documents/houdini16.0/vex/includes folder, put my stuff in foo.h, can call it from a wrangle), but stuck on a simple thing; how do I tell houdini to refresh the file?

At the moment it seems it only detects changes to my foo.h if I restart houdini, which seems a little unwieldy.

 

 

Share this post


Link to post
Share on other sites
mestela    452

Ah, spinynormal pointed to a fix in chat:

I thought toggling the bypass flag would be enough to trigger a refresh, but apparently not. Turns out you have to make a change to the code, and hit ctrl-enter, that'll force vex to recompile, and detect the updated header. Luckily that can be as simple as adding a space within a comment, so its quick to trigger (once you know how).

 

Share this post


Link to post
Share on other sites
f1480187    454

There is "Force Compile" button on Attribute VOP. If you include the header in wrangle, you could unlock node and promote the button via Edit Parameter Interface / From nodes.

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×