The Overlay Organization example demonstrates the following:
- How to build a plugin module for the VR-Forces 3D GUI
- How to add folders to organize the overlay layers and objects under those overlays
- How to use a DtVrfSelectionFilter to return a value when something passes the filter test
Organizing Overlay Folders
The overlay Organization example demonstrates how to organize folder in the overlay tree widget. These folders are local to the application (they are not published on the network). An overlay folder organization is made when an overlay identifier is assigned as a parent to an organized overlay folder:
int fixedWingIdentifier = tgm.addOrganizedCategory("FixedWingExample", *fixedWing, rank++, "TaskEscortUnit.svg", "Fixed Wing", true, parentCategory);
tgm.addOrganizedCategory("AttackExample", *fixedWingAttack, rank++, "AttackWithAntiAirMissile.svg", "Attack", true, fixedWingIdentifier);
tgm.addOrganizedCategory("CivilianExample", *fixedWingCivillian, rank++, "ClutterAir.svg", "Civilian", true, fixedWingIdentifier);
tgm.addOrganizedCategory("RotaryWingExample", *rotaryWing, rank++, "AirDrop.svg", "Rotary Wing", true, parentCategory);
The addOrganizedCategory call will know to add a child to that category by the use of the DtVrfSelectionFilter subclass. This subclass uses the DtTopLevelCategoryFilter class. The assignment of the categories to match will allow the folder to appropriately add objects to the specified overlay folder
How to Run the Example
Usage
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.
To view the new behavior:
-
Start VR-Forces GUI and SIM.
-
Create a new scenario on any terrain.
-
Create some attack aircraft, commercial aircraft or rotary wings.
-
See the created items get added to the appropriate folder.
Plugin Entry Points
using namespace makVrf;
extern"C"
{
DtVrfSelectionFilter* CreateCategoryFilter(
makVrv::DtDe* de,
const std::vector<std::string>& categories)
{
return f;
}
{
if (parentCategory != -1)
{
int rank = 11;
DtVrfSelectionFilter* fixedWing = CreateCategoryFilter(de, {"Fixed Wing"});
DtVrfSelectionFilter* rotaryWing = CreateCategoryFilter(de, {"Rotary Wing"});
DtVrfSelectionFilter* fixedWingAttack = CreateCategoryFilter(de, {"Fixed Wing", "Attack"});
DtVrfSelectionFilter* fixedWingCivillian = CreateCategoryFilter(de, {"Fixed Wing", "Civilian"});
int fixedWingIdentifier = tgm.
addOrganizedCategory(
"FixedWingExample", *fixedWing, rank++,
"TaskEscortUnit.svg",
"Fixed Wing",
true, parentCategory);
tgm.
addOrganizedCategory(
"AttackExample", *fixedWingAttack, rank++,
"AttackWithAntiAirMissile.svg",
"Attack",
true, fixedWingIdentifier);
tgm.
addOrganizedCategory(
"CivilianExample", *fixedWingCivillian, rank++,
"ClutterAir.svg",
"Civilian",
true, fixedWingIdentifier);
tgm.
addOrganizedCategory(
"RotaryWingExample", *rotaryWing, rank++,
"AirDrop.svg",
"Rotary Wing",
true, parentCategory);
delete fixedWing;
delete rotaryWing;
delete fixedWingAttack;
delete fixedWingCivillian;
}
}
{
return true;
}
{
info.
pluginDescription =
"Example shows how to organize the overlay layer into a local folder structure.";
}
}