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;
	}
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 #3
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();

	}

}