Interface Querying

When navigating a scene a plug-in reference will often be retrieved without knowledge of the concrete type of the plug-in. There are two separate mechanism used for querying run-time type information from a plug-in. Each mechanism uses a method named "GetInterface()". These methods both return an abstract base class (interface) using an interface identifier.

InterfaceServer::GetInterface()

The first mechanism to retrieve interfaces is the InterfaceServer::GetInterface() which uses the type Interface_ID to identify interfaces. An Interface_ID for a given interface can usually be found as a macro in the same file as the interface definition. For example IDX8PixelShader has its interface ID defined in the same header file idx8pixelshader.h.

Animatable::GetInterface()

The other mechanism to retrieve interfaces is Animatable::GetInterface() which uses integers to identify interface IDs. Consult the C++ Reference's "Modules > List of interface IDs supported by different plugin types" for the list of pre-defined constants used to identify interfaces. Checking whether an animatable implements a certain interface is the recommended way for determining if that animatable can be used as the type represented by that interfaced, as opposed to performing casts using dynamic_cast or static_cast.

Note: Animatable derives from InterfaceServer, so objects deriving from Animatable will need to support both InterfaceServer::GetInterface() and Animatable::GetInterface().