本文整理汇总了C++中ToolManager::registerToolFactory方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolManager::registerToolFactory方法的具体用法?C++ ToolManager::registerToolFactory怎么用?C++ ToolManager::registerToolFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolManager
的用法示例。
在下文中一共展示了ToolManager::registerToolFactory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char** argv)
{
if (argc < 2)
{
printHelp();
return -1;
}
ToolManager manager;
manager.registerToolFactory(new TransformToolFactory());
manager.registerToolFactory(new InfoToolFactory());
manager.registerToolFactory(new MeshMergeToolFactory());
manager.registerToolFactory(new RenameToolFactory());
manager.registerToolFactory(new OptimiseToolFactory());
OgreEnvironment* ogreEnv = new OgreEnvironment();
ogreEnv->initialize();
CommandLine cmdLine = parseCommandLine(argc, argv);
// Define allowed global arguments
OptionDefinitionSet globalOptionDefs = OptionDefinitionSet();
globalOptionDefs.insert(OptionDefinition("help", OT_STRING, false, false, Any(String())));
globalOptionDefs.insert(OptionDefinition("list"));
globalOptionDefs.insert(OptionDefinition("no-follow-skeleton"));
globalOptionDefs.insert(OptionDefinition("version"));
globalOptionDefs.insert(OptionDefinition("quiet"));
globalOptionDefs.insert(OptionDefinition("verbose"));
OptionList globalOptions;
try
{
globalOptions = OptionsParser::parseOptions(
cmdLine.globalArgc, cmdLine.globalArgv, globalOptionDefs);
}
catch (std::exception& se)
{
std::cout << "Parsing global options failed:" << std::endl;
std::cout << se.what() << std::endl;
return -1;
}
catch (...)
{
std::cout << "Parsing global options failed." << std::endl;
return -1;
}
// Evaluate global options (as far as they are of interest here...)
for (OptionList::const_iterator it = globalOptions.begin(); it != globalOptions.end(); ++it)
{
if (it->first == "version")
{
std::cout << "MeshMagick version "
<< MESHMAGICK_VERSION_MAJOR << "."
<< MESHMAGICK_VERSION_MINOR << "."
<< MESHMAGICK_VERSION_PATCH << std::endl;
std::cout << "using Ogre version "
<< OGRE_VERSION_MAJOR << "."
<< OGRE_VERSION_MINOR << "."
<< OGRE_VERSION_PATCH
<< " (" << OGRE_VERSION_NAME ")"
<< std::endl;
return 0;
}
else if (it->first == "help")
{
String toolName = any_cast<String>(it->second);
if (!toolName.empty())
{
// toolhelp
try
{
manager.printToolHelp(toolName, std::cout);
}
catch (std::exception& se)
{
std::cout << se.what() << std::endl << std::endl;
// global help
printHelp();
}
return 0;
}
else
{
// global help
printHelp();
return 0;
}
}
else if (it->first == "list")
{
manager.printToolList(std::cout);
return 0;
}
}
if (cmdLine.toolName.empty())
{
std::cout << "No tool given." << std::endl << "call \""
<< argv[0] << "\" -h for help" << std::endl;
//.........这里部分代码省略.........