Interface Querying
When navigating a scene, a plug-in reference will often be retrieved without knowing the concrete type of the plug-in. There are two mechanisms used for querying run-time type information from a plug-in. Each mechanism uses a function named GetInterface()
. The first one is InterfaceServer::GetInterface()
and the second one is Animatable:: GetInterface().
These functions both return an abstract base class (interface) using an interface identifier.
InterfaceServer::GetInterface()
The function InterfaceServer::GetInterface()
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 d3dx8.h .
Plug-ins should correctly handle the requests for interfaces in their implementation of InterfaceServer::GetInterface()
, or they may not be displayed correctly in the Nitrous viewport. Developers are encouraged to read the Handling Requests for Interfaces best practices to find more information on this issue.
Animatable::GetInterface()
The function Animatable::GetInterface()
uses integers to identify the 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. To determine if an animatable can be used as the type a certain interface is representing, it is recommended to see if that animatable implements that interface or not, rather than to perform casts using dynamic_cast
or static_cast.
Animatable
derives from InterfaceServer
, so objects deriving from Animatable
will need to support both InterfaceServer::GetInterface()
and Animatable::GetInterface()
.
See also: