Jump to content

vex #include file, only to define constants


ikoon

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
Link to comment
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.

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