Creating C++ Nodes

This is a guide to writing a node in C++, including how to set up and structure everything you need in your extension so that the node can be delivered to others in a consistent way. You may already have some of the pieces in place - feel free to skip ahead to just the parts you will need.

If you wish to create a Python node then see Creating Python Nodes.

Setting Up Your Extension

The Omniverse applications rely on extensions to provide functionality in a modular way and the nodes you write will be integrated best if you follow the same model.

You may choose to add much more to your extension. What is described here is the bare minimum required to make an extension containing a single C++ node integrate into a Kit-based application.

Whether you are familiar with extension development in Kit or not, the best place to start is from one of the predefined template extensions.

Important

It is assumed you understand how to build C++ files in an extension, usually using the premake5.lua build file favored by the Kit extension environment. See the templates in the Kit github C++ repo for more information.

Once you have a build directory you can copy the template extension omni.graph.template.cpp into your source/extensions directory so that the build process can access it.

See that extension’s documentation for a more thorough explanation of how to populate and build your C++ nodes once the extension is in place.

Note

If you will have a mixture of both C++ and Python files in your extension then you should instead use this template that sets up an extension with both kinds of nodes.

To see details of what capabilities the C++ node and its corresponding .ogn definition have look through some examples in the OGN User Guide, or look at some nodes that have already been implemented in the node library reference.

See in particular the OGN Code Samples - C++ for examples of how to access different types of data within a node.