Jump to content

vex #include file, only to define constants

Recommended Posts

Please, I would like to reference external file with few arrays. The only way I have succeeded is this:

Inside the Attribute Wrangle I have this:

#include "$HIP/file.h"
f[]@array = getdata();

Inside the file.h, I have this:

float [] getdata()
        float data[] = {1,2,3,4,5};
        return data;


Am I doing it right? Or can I directly define constants without the function in the external file?

I could also define those arrays inside the .hiplc, without external include, in one place like this, but the external file helps me manage the data:

f[]@array = detail("op:/obj/DATA/data","array");

As regards speed in Houdini ... I could do tests ... but if anybody knows, please tell me ... is any of these methods preferred? The include should be faster, as it gets "hard" compiled just once in the first frame, right?

Edited by ikoon

Share this post

Link to post
Share on other sites

Oh yes, thank you very very much, it works! As regards the speed, it should be "flawless", am I right? It includes and compiles just once, on the first frame?


Btw I have been looking to the $HH previously and found that method to define array by function, in the skycubedaylight_coeff.h, probably it has some other reason. This #define is really great.

Share this post

Link to post
Share on other sites

Code is compiled once, if there is no time dependency on the node. AFAIK, VEX functions got injected by VCC in-place, and I think it should be the same as defining constants in terms of speed.

  • Like 1

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