Christian S Posted August 15, 2016 Share Posted August 15, 2016 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 Quote Link to comment Share on other sites More sharing options...
bonsak Posted August 15, 2016 Share Posted August 15, 2016 (edited) 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 August 15, 2016 by bonsak 4 Quote Link to comment Share on other sites More sharing options...
Christian S Posted August 15, 2016 Author Share Posted August 15, 2016 This worked perfectly. Thank you for the reply. You're the best! Christian 1 Quote Link to comment Share on other sites More sharing options...
Christian S Posted August 19, 2016 Author Share Posted August 19, 2016 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 Quote Link to comment Share on other sites More sharing options...
Christian S Posted August 19, 2016 Author Share Posted August 19, 2016 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 1 Quote Link to comment Share on other sites More sharing options...
holycause Posted August 21, 2016 Share Posted August 21, 2016 (edited) the "houdini/vex" folder holds the "VEXdso" file used for your dso vex functions Edited August 21, 2016 by holycause Quote Link to comment Share on other sites More sharing options...
mestela Posted September 10, 2017 Share Posted September 10, 2017 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. Quote Link to comment Share on other sites More sharing options...
mestela Posted September 10, 2017 Share Posted September 10, 2017 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). Quote Link to comment Share on other sites More sharing options...
f1480187 Posted September 10, 2017 Share Posted September 10, 2017 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. 2 Quote Link to comment Share on other sites More sharing options...
mestela Posted September 10, 2017 Share Posted September 10, 2017 Cool, dchow mentioned that, and said he rfe'd it be made a default, sounds like a good idea. Quote Link to comment Share on other sites More sharing options...
trzanko Posted September 17, 2017 Share Posted September 17, 2017 I've found that clicking in the network pane recompiles wrangles Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 26, 2017 Share Posted September 26, 2017 @f1480187 please, how do I "include the header in wrangle"? If I just unlock the wrangle and drag the "Force Compile" button from attribvop1 node (Vex Setup folder) to the wrangle, then it seems that I even the original button? Quote Link to comment Share on other sites More sharing options...
f1480187 Posted September 27, 2017 Share Posted September 27, 2017 (edited) You can normally include in wrangles: #include "mylib.h" Assuming that $HIP/vex/include/mylib.h is where the lib is located now. If you are editing mylib.h and not the wrangle itself, Houdini doesn't track the file's changes, and you need to force compile manually. Adding spaces in wrangle is quickest and default way. Using Force Recompile button on inside Attribute VOP also works. You could also promote it for convenience. If you see the ch("../vop_forcecompile") expression reference set on the original Attribute VOP's button (RMB / Expression / Edit Expression), everything should work. vex_library.zip Edited September 27, 2017 by f1480187 1 2 Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 27, 2017 Share Posted September 27, 2017 F1 Thank you very much! Also thank you for the PRO wrangle in the file! Now I understand the system much more! I thought that we need some header of the wrangle SOP, for it to be able to evaluate the button, I was disoriented. Quote Link to comment Share on other sites More sharing options...
haki Posted April 18, 2020 Share Posted April 18, 2020 Resurrecting again: I was playing with VS Code the other day. There's a VEX extentsion for it (which seems to have not been updated in a while, but it works ok). There's one for Sublime Text which is more up to date and you can configure Sublime to compile your vfl. Would anybody have a clue how to configure a task in VS Code for that? 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.