Overview
This example shows how to build a plugin that customizes the VR-Vantage UI.
Expected Result
Custom Application Result
Example details
What if you wanted to build your own application that looked different that any of the existing VR-Vantage applications, yet also use all of the existing widgets, pages and other parts? The easist way to do that is to build a plugin that loads only the UI elements you want.
The basic strategy here is let the DtVrvApplication do its thing, then just customize the way it looks. Let it load plug-ins, settings, data, etc. and then just what GUI elements are assembled right before the code that assembles the GUI executes. In this way, you get all the benefits of the plug-in architecture, but all the control of programatically created GUI.
The trick to doing that is to install an application transform, which is really just a function that gets called at a certain point. In this example we are going to install a function that gets called right after the plug-ins are loaded and before the GUI is assembled.
Here is the function we want to install. It's signature has to be the same as the DtVrvApplication::ApplicationTransform functor:
void postPluginTransform(DtDeInitializer& initializer, DtDe& de, DtVrvApplicationConfiguration& appConfig)
{
appConfig.setMasterModePageConfiguration(createCustomPages());
appConfig.setMasterModeMenuConfiguration(createCustomMenu());
appConfig.setMasterModeToolbarConfiguration(createCustomToolbar());
}
Building the Example
VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
Running the Example
This example is a plugin. For more information about running examples, please see Running Applications and Examples.
Example Source Files
exampleCustomUI.cxx
{
return pages;
}
{
return menus;
}
{
return toolbars;
}
{
}
{
std::cout << "Loading custom GUI plugin" << std::endl;
{
if (app)
{
}
}
}
{
return true;
}
Contains makVrv::DtDe class.
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
Contains makVrv::DtVrvApplication implementation.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
virtual bool isInMasterMode() const
Returns true if the DtDe is in master mode.
The initialization configuration for the makVrv::DtDe.
Definition DtDeInitializer.h:40
A configuration of the pages in the gui.
Definition DtPageConfiguration.h:26
void addPagePath(const DtPagePath &, int weight=-1)
Adds the menu path (as well as its entire family).
void addPageCollection(const std::string &collectionClassName, const DtUnicode &pageTitle, PageCollectionLocation location, bool visible, const std::string &pageClassToShow, bool closable=true, bool floatable=true, bool movable=true)
Add a new page collection to the configuration.
@ DockLeft
Definition DtPageConfiguration.h:44
static PagePathBuilder collection(const std::string &name)
Start a main menu.
static DtUnicode fromAscii(const std::string &ascii)
Definition DtUnicode.inl:285
This owns a list of display engine configurations.
Definition DtVrvApplicationConfiguration.h:33
void setMasterModePageConfiguration(const DtPageConfiguration &pageConfig)
void setMasterModeToolbarConfiguration(const DtToolbarConfiguration &toolbarConfig)
void setMasterModeMenuConfiguration(const DtMenuConfiguration &menuConfig)
The Root IG Application object. To run the IG simply create one, initialize it and call run.
Definition DtVrvApplication.h:58
static DtVrvApplication * findFromDe(DtDe &)
virtual void installPostPluginTransform(const ApplicationTransform &transform, const std::string &id)
Add a transformer that runs after plug-ins are loaded.
boost::function< void(DtDeInitializer &, DtDe &, DtVrvApplicationConfiguration &)> ApplicationTransform
Definition DtVrvApplication.h:147
DT_DLL_EXAMPLEACCESSORY void init(makVrv::DtDe &de)
Contains DLL export macros.
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16