.. _ogn_tutorial_overrideTypes:


Tutorial 24 - Overridden Types
==============================

By default the code generator will provide POD types for simple data, and USD types for tuple data (e.g. ``float`` and
``pxr::GfVec3f``). Sometimes you may have your own favourite math library and want to use its data types directly
rather than constantly using a _reinterpret_cast_ on the attribute values. To facilitate this, JSON data which
contains type overrides for one or more of the attribute types may be provided so that the generated code will use
those types directly.

OgnTutorialOverrideType.ogn
---------------------------
The *ogn* file shows the implementation of a node named "omni.graph.tutorials.OverrideType", which has one
input and one output attribute that use an overridden type for ``float[3]``.

.. literalinclude:: OgnTutorialOverrideType.ogn
    :linenos:
    :language: json

OgnTutorialOverrideType.cpp
---------------------------
The *cpp* file contains the implementation of the compute method. The default type implementation would have a return
type of ``pxr::GfVec3f`` but this one uses the override type of ``carb::Float3``

.. literalinclude:: OgnTutorialOverrideType.cpp
    :linenos:
    :language: c++
