ikoon Posted June 19, 2017 Share Posted June 19, 2017 (edited) 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 June 19, 2017 by ikoon Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 19, 2017 Share Posted June 19, 2017 I think the method is to define constant: #define data {1, 2, 3, 4, 5} Check $HH/vex/include/ for houdini libs. 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted June 19, 2017 Author Share Posted June 19, 2017 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. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 19, 2017 Share Posted June 19, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.