Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

ikoon

vex #include file, only to define constants

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

I think the method is to define constant:

#define data {1, 2, 3, 4, 5}

Check $HH/vex/include/ for houdini libs.

1 person likes this

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.

1 person likes this

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