![]() |
VR-Forces 4.0.4 Class Documentation
|
The Add Simulation Command adds a new simulation command which will send a message to the back-end that will simply print a console message. The example is intended to demonstrate the following:
Registering a new sim command item in the menu requires deriving a new class from makVrf::DtVrfSimulationCommand, configuring its key methods, and then registering the creator function in the makVrf::DtSimulationCommandMenu. Our command dialog creator class is called vrfAddSimCommandExample::DtSimulationCommandMessageCreator. The key methods of makVrf::DtVrfSimulationCommandDialogCreator that must be customized are:
| makVrf::DtVrfSimulationCommandDialogCreator::create() | Adds a new dialog object to the heap (vrfAddSimCommandExample::DtSimulationCommandMessageDialog in this example) and returns its pointer |
| makVrf::DtVrfSimulationCommandDialogCreator::supportsType() | Checks message against this dialog's task type. |
| makVrf::DtVrfSimulationCommandDialogCreator::objectNameFromStatement() | Returns empty name. |
The makVrf::DtVrfConditionalExpressionCreator class must be then registered with the dialog manager makVrf::DtVrfConditionalDialogManager. In our example, we register it in /examples/condition/conditionGui/addConditionPlugin.cxx.
this particular implementation inserts our menu item just before a menu item in the conditional combo box called "RANDOM"
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces 3D application
To view the new behavior:
Note that the text you typed in to the 'My Sim Command' window also appears in the back-end console, prefaced by the name of the entity.
| DtSimulationCommandMessageAction | The menu item that registers the dialog to be created when the menu item is selected. |
| DtSimulationCommandMessageDialog | The widget that is used to enter the message to print in the back-end console. |
| DtSimulationCommandMessageLogic | The logic that is used to enter the message to print in the back-end console. |
| MySimCommand | The subclass of DtSimCommand that is used to communicate the new simulation command. |
/******************************************************************************* ** Copyright (c) 2011 MAK Technologies, Inc. ** All rights reserved. *******************************************************************************/ //\file addSimCommandPlugin.cxx //\brief Contains plugin function //This file defines the generic DT_DLL_VRF_PLUGIN_EXPORT_MACRO. Use that macro when //you want to export symbols. Also, in your CMakeLists.txt file, make sure to //define the VRFPLUGIN_EXPORTS define to tell the compiler to define the macro as an //export #include <vrfGuiCore/vrfGuiExportPlugin.h> #include "../addSimCommandSim/mySimCommand.h" #include "DtSimulationCommandMessage.h" #include <vrfGuiConstants/vrfMenuIds.h> #include <vrfGuiCoreQt/DtSimulationCommandMenu.h> #include <vrfGuiCore/DtGuiThreadVrfRemoteController.h> #include <vrvCore/DtDe.h> using namespace makVrf; bool initDeModule(makVrv::DtDe* de) { DtSimulationCommandMenu& simCommandMenu = DtSimulationCommandMenu::instance(*de); simCommandMenu.menuConfiguration().addMenuPathAfter(makVrv::DtMenuPath::mainMenu(DtSimulationCommandMenuId).item("DtSimulationCommandMessageMenuItem"), makVrv::DtMenuPath::mainMenu(DtSimulationCommandMenuId).item(DtSimulationCommandDeleteId)); simCommandMenu.registerMenuItem(new vrfAddSimCommandExample::DtSimulationCommandMessageMenuItem(*de)); DtGuiThreadVrfRemoteController::instance(*de).addSimulationCommandCreatorFcn( MySimCommandTypeString, MySimCommandType, MySimCommand::creator); return true; } void DtPluginInformation(DtVrfPluginInformation& info) { info.pluginName = "Add Sim Command Gui"; info.pluginVersion = "1.00"; info.pluginDescription = "Front-end plugin addition to add new Simluation command"; info.pluginCreator = "MAK Technologies"; info.pluginCreatorEmail = "sales@mak.com"; info.pluginContactWebPage = "www.mak.com"; info.pluginContactMailingAddress = "68 Moulton Street - Cambridge, MA 02138"; info.pluginContactPhone = "(617) 876 8085"; }