This Houdini node allows you to write wrangle nodes in C++ instead of VEX.
VEX is an amazing tool for prototyping and fast production, however it is quite simplistic and sometimes broken language. Writing wrangle nodes in C++ brings the full expressive power of C++ and access to HDK(Houdini C++ API) in the expense of slow compilation times compared to VEX.
To make the transition from VEX to C++ as simple as possible, we provide C++ implementation of VEX functions. Therefore you can write almost the same code in C++ as you would write it with VEX.
This node is an extension of the node made by animatrix. My version should be easier to use for people experienced with VEX.
To use C++ Wrangle download this repository and modify hcustom
to support c++17
. Right now, it has been tested only with Houdini 17.0 and gcc-8.1.
To download this repository run the standard command where ever you like
git clone https://github.com/lecopivo/cpp-wrangle.git
Next, find hcustom
in <path/to/houdini>/bin/
, the default directory is /opt/hfs17.0/bin/
, and change the two following lines of code
from
set CCFLAGS="$CCFLAGS -std=c++14" set WFLAGS = "-Wall -W -Wno-parentheses -Wno-sign-compare -Wno-reorder -Wno-uninitialized -Wunused -Wno-unused-parameter -Wno-unused-local-typedefs"
to
set CCFLAGS="$CCFLAGS -std=c++17" set WFLAGS = "-Wall -W -Wno-parentheses -Wno-sign-compare -Wno-reorder -Wno-uninitialized -Wunused -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-unused-but-set-variable -Wno-comment -Wno-int-in-bool-context -Wno-misleading-indentation"
The first line enables c++17 and the second one removes tons of warnings cause by Eigen.
This can be done by running the following commands in the directory where hcustom
is.
cp hcustom hcustom_backup # backup old hcustom
sed -i 's/c++14/c++17/g' hcustom
sed -i 's/no-unused-local-typedefs"/no-unused-local-typedefs -Wno-ignored-attributes -Wno-unused-but-set-variable -Wno-comment -Wno-int-in-bool-context -Wno-misleading-indentation"/g' hcustom
To test if everything is working, just open up the scene in cpp-wrangle/houdini/hip/examples.hipnc
and you should be greeted by the colorful pig:
Houdini will freeze for couple of seconds because the c++ code is being compiled, see Slow compilation.
To enable finite element functions you have to do a little bit more work. Go to directory cpp-wrangle/houdini/cpp/houfem
and build the module with the following commands
mkdir build; cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../../..
make install
To test the finite element module, open the example scene, cpp-wrangle/houdini/hip/examples.hipnc
. For example, have a look at the minimal_surface
and you should see the following:
Yeah, I know…is sucks :( The compilation is really slow. But the power of c++ and HDK over VEX is worth it in many situations. The general strategy is to untick Continuous Recompile
during development and force compilation only manually with button Recompile
. Once you are done with the development, tick Continuous Recompile
back on, this will automatically compile and load the c++ code.
C++ impelementation of VEX functions
connection between Houdini and Eigen
finite element library