Beispiel #1
0
	virtual Command* build(int commandID, ServiceThread* service) {
		CommandMap::iterator i = commandsV1.find((SAFMQ_COM_CMD)commandID);
		if (i != commandsV1.end()) {
			return (i->second)(service);
		}
		return NULL;
	}
Beispiel #2
0
bool CursorDependantKeyHandler::onKeyPressed( QShell& shell, QKeyEvent* e )
{
	static CommandMap fns = CreateCursorDependantFunctions();
	auto it = fns.find(e->key());
	if (it != end(fns))
	{
		MoveCursorAtEndIfBadPosition(shell);
		return it->second(shell, e);
	}
	return false;
}
Beispiel #3
0
bool MiscKeyHandler::onKeyPressed( QShell& shell, QKeyEvent* e )
{
	static vector<int> specKeys = SpecialKeys();
	static CommandMap fns = CreateCursorIndependantFunctions();
	auto key = e->key();
	
	if (e->matches(QKeySequence::Copy) || e->matches(QKeySequence::Undo) || 
		e->matches(QKeySequence::Redo) || find(begin(specKeys), end(specKeys), key) != end(specKeys))
	{
		shell.processKeyEvent(e);
		return true;
	}

	auto it = fns.find(key);
	if (it != end(fns))
	{
		auto res = it->second(shell, e);
		AcceptEvent(shell, e);
		return res;
	}

	return false;
}
static void ComposeFunctions( const KBData &composition, KBSTATE k )
{
    std::string s = composition.data;
    while ( s.length() ) {
        std::string::size_type where = s.find( " " );
        std::string t = s.substr( 0, where );
        if (where != std::string::npos)
            s = s.substr( where+1 );
        else
            s = "";
        where = t.find( "(" );
        std::string args;
        if (where != string::npos) {
            args = t.substr( where+1 );
            std::string::size_type paren = args.find( ")" );
            if (paren != string::npos)
                args = args.substr( 0, paren );
            t = t.substr( 0, where );
        }
        CommandMap::iterator i = commandMap.find( t );
        if ( i != commandMap.end() )
            (*i).second( args, k );
    }
}
Beispiel #5
0
void Run(CommandMap & commands){


	FbxScene * scene = nullptr;

	try{

		auto & fbx = FBX::GetInstance();

		// IMPORT
		cout << "Importing..." << std::endl;

		auto input = commands.find(kInputCommand);

		scene = fbx.Import(input->second.front());

		//EXECUTION

		//if (commands.find(kTriangulateCommand) != commands.end()){

		cout << "Triangulating (this could take a couple of minutes)..." << std::endl;

		fbx.Triangulate(*scene);

		//}

		CommandMap::iterator cmd;
	
		if (commands.find(kRemap) != commands.end()){

			cout << "Re-mapping mesh attributes..." << std::endl;

			fbx.RemapAttributes(*scene);

		}
		
		if ((cmd = commands.find(kExtension)) != commands.end()){

			cout << "Normalizing texture paths..." << std::endl;

			fbx.NormalizeTexturePaths(*scene, 
									  input->second.front(),
									  cmd->second.size() <= 0 ? "" : cmd->second.front());

		}

		// EXPORT

		cout << "Exporting to FBX..." << std::endl;

		auto output = commands.find(kOutputCommand);

		fbx.Export(*scene, output->second.front());

		// YAY!

		cout << "Done!" << std::endl;

	}
	catch (std::exception & e){

		//Darn...
		cout << e.what() << std::endl;

	}

	//Cleanup
	if (scene != nullptr){

		scene->Destroy();

	}

}