// DarkRadiant module entry point extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry) { pico_initialise(); const picoModule_t** modules = PicoModuleList( 0 ); while (*modules != 0) { const picoModule_t* module = *modules++; if (module->canload && module->load) { for (char*const* ext = module->defaultExts; *ext != 0; ++ext) { // greebo: File extension is expected to be UPPERCASE std::string extension(*ext); boost::algorithm::to_upper(extension); registry.registerModule( model::PicoModelLoaderPtr(new model::PicoModelLoader(module, extension)) ); } } } // Initialise the streams using the given application context module::initialiseStreams(registry.getApplicationContext()); // Remember the reference to the ModuleRegistry module::RegistryReference::Instance().setRegistry(registry); // Set up the assertion handler GlobalErrorHandler() = registry.getApplicationContext().getErrorHandlingFunction(); }
static void add_model_apis( CSynapseClient& client ){ const picoModule_t** modules = PicoModuleList( NULL ); while ( *modules != NULL ) { const picoModule_t* module = *modules++; if ( module->canload && module->load ) { for ( unsigned int j = 0; module->defaultExts[j] != NULL; j++ ) client.AddAPI( MODEL_MAJOR, module->defaultExts[j], sizeof( _QERPlugModelTable ) ); } } }
/** * @brief the meat and potatoes function */ picoModel_t *PicoLoadModel (char *fileName, int frameNum) { const picoModule_t **modules, *pm; picoModel_t *model; picoByte_t *buffer; int bufSize; /* init */ model = NULL; /* make sure we've got a file name */ if (fileName == NULL) { _pico_printf(PICO_ERROR, "PicoLoadModel: No filename given (fileName == NULL)"); return NULL; } /* load file data (buffer is allocated by host app) */ _pico_load_file(fileName, &buffer, &bufSize); if (bufSize < 0) { _pico_printf(PICO_ERROR, "PicoLoadModel: Failed loading model %s", fileName); return NULL; } /* get ptr to list of supported modules */ modules = PicoModuleList(NULL); /* run it through the various loader functions and try * to find a loader that fits the given file data */ for (; *modules != NULL; modules++) { /* get module */ pm = *modules; /* sanity check */ if (pm == NULL) break; /* module must be able to load */ if (pm->canload == NULL || pm->load == NULL) continue; model = PicoModuleLoadModel(pm, fileName, buffer, bufSize, frameNum); if (model != NULL) { /* model was loaded, so break out of loop */ break; } } /* free memory used by file buffer */ if (buffer) _pico_free_file(buffer); /* return */ return model; }
static bool model_is_supported(const char* extension) { const picoModule_t** modules = PicoModuleList( NULL ); while(*modules != NULL) { const picoModule_t* module = *modules++; if(module->canload && module->load) for(unsigned int j = 0; module->defaultExts[j] != NULL; j++) if(strcmp(extension, module->defaultExts[j]) == 0) return true; } return false; }
void ModelModules_Init (void) { pico_initialise(); const picoModule_t** modules = PicoModuleList(0); while (*modules != 0) { const picoModule_t* module = *modules++; if (module->canload && module->load) { for (const char* const* ext = module->defaultExts; *ext != 0; ++ext) { PicoModelModule *picomodule = new PicoModelModule(PicoModelAPIConstructor(*ext, module)); StaticModuleRegistryList().instance().addModule(*picomodule); /** @todo do we have to delete these PicoModelModules anywhere? */ } } } }
void init_filetypes(){ const picoModule_t **modules = PicoModuleList( NULL ); while ( *modules != NULL ) { const picoModule_t* module = *modules++; if ( module->canload && module->load ) { for ( char*const* ext = module->defaultExts; *ext != NULL; ++ext ) { char buf[16]; buf[0] = '*'; buf[1] = '.'; strcpy( buf + 2, *ext ); GetFileTypeRegistry()->addType( MODEL_MAJOR, filetype_t( module->displayName, buf ) ); } } } }
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){ initialiseModule( server ); pico_initialise(); const picoModule_t** modules = PicoModuleList( 0 ); while ( *modules != 0 ) { const picoModule_t* module = *modules++; if ( module->canload && module->load ) { for ( char*const* ext = module->defaultExts; *ext != 0; ++ext ) { g_PicoModelModules.push_back( PicoModelModule( PicoModelAPIConstructor( *ext, module ) ) ); g_PicoModelModules.back().selfRegister(); } } } }
extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush) { if( !strcmp( p, "Flush & Reload Selected" ) ) DoFlushReloadSelected(); else if( !strcmp( p, "Flush & Reload Models" ) ) DoFlushReloadAll(); else if( !strcmp( p, "About" ) ) { const picoModule_t** modules = PicoModuleList( NULL ); char about_buf[1024]; strncpy(about_buf, PLUGIN_ABOUT, sizeof(about_buf) - 1); while(*modules != NULL) { const picoModule_t* module = *modules++; strncat(about_buf, module->displayName, sizeof(about_buf) - 1); strncat(about_buf, " (", sizeof(about_buf) - 1); strncat(about_buf, module->defaultExts[0], sizeof(about_buf) - 1); strncat(about_buf, ")\n\t", sizeof(about_buf) - 1); strncat(about_buf, module->copyright, sizeof(about_buf) - 1); strncat(about_buf, "\n", sizeof(about_buf) - 1); } g_FuncTable.m_pfnMessageBox(NULL, about_buf, "About", MB_OK, NULL); } }
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server) { GlobalErrorStream::instance().setOutputStream(server.getErrorStream()); GlobalOutputStream::instance().setOutputStream(server.getOutputStream()); GlobalDebugMessageHandler::instance().setHandler(server.getDebugMessageHandler()); GlobalModuleServer::instance().set(server); pico_initialise(); const picoModule_t** modules = PicoModuleList( 0 ); while(*modules != 0) { const picoModule_t* module = *modules++; if(module->canload && module->load) { for(char*const* ext = module->defaultExts; *ext != 0; ++ext) { g_PicoModelModules.push_back(PicoModelModule(PicoModelAPIConstructor(*ext, module))); g_PicoModelModules.back().selfRegister(); } } } }