C++ Plugins Example

This example registers multiple node plug-ins written in C++.

  • LerpExample.cpp: A simple node to interpolate two floats.

  • OpenGLExample.cpp: A node to do some OpenGL rendering.

  • TransformGeometryExample.cpp: A node to transform a geometry vertices by a matrix.

  • register.cpp: Registers the plugins.

  • opengl_utils.h, opengl_utils.cpp: OpenGL utility functions.

Warning

A Rumba plug-in filename must be postfixed by “_plugin”, like “examples_cxx_plugin.dll” on Windows or “examples_cxx_plugin.so” on Linux.

Windows Compilation

Prerequisite

  • Visual Studio with the Visual Studio 2019 (v142) Plateform Toolset installed.

  • CMake >= 3.10

  • Glew >= 2.1.0

Compile

cd rumba/sdk/examples/cxx_plugins
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64 "-Drumba_DIR=rumba/sdk/"
cmake --build . --config Release

Linux Compilation

Prerequisite

  • GCC 9.3.0 (that precise version is important)

  • CMake >= 3.10

  • Glew >= 2.1.0

Installing GCC 9.3.0

In case you don’t have GCC 9.3.0 installed, you can use our provided script to build it locally :

PREFIX=~/gcc-9.3.0 rumba/sdk/build_gcc-9.3.0.sh

That command downloads, compiles and installs GCC 9.3.0 in the ~/gcc-9.3.0 home directory. Feel free to change the PREFIX variable to change the installation folder. The script takes roughly 40min with 40 threads.

Compile

To compile the example plugins with the previously installed GCC :

cd rumba/sdk/examples/cxx_plugins
mkdir build
cd build
CXX=~/gcc-9.3.0/bin/g++ cmake .. "-Drumba_DIR=rumba/maquina/sdk/"
cmake --build .

Installing the plug-ins

You have now to register your plug-ins in Rumba. To do that, add the directory plug-in path to the RUMBA_USER_PLUGINS environment variable:

RUMBA_USER_PLUGINS=path_to_the_plugin_binaries

See Environment Variables.

Creating a node in Rumba

To create for instance a OpenGLExample node, type in the Python command window:

import rumba
doc = rumba.active_document()
node = Node("OpenGLExample", "MyOpenGLExample", doc)

Register with MTORBA

If your plug-in is the translation of an existing Maya plug-in, you also want to register it with MTORBA in order to be exported from Maya.

To do that, you need to write a MTORBA ‘exporter’ script. You have lot of exporter samples in module/python/mtorba/exporters/. Place your exporters in a folder and add the path of this folder to the MTORBA_USER_EXPORTERS environment variable. MTORBA will load them automatically.