NodeSmartReference Model_load(ModelLoader* loader, const char* path, const char* name, const char* type) { if(loader != 0) { return ModelResource_load(loader, name); } else { const char* moduleName = findModuleName(&GlobalFiletypes(), MapFormat::Name(), type); if(string_not_empty(moduleName)) { const MapFormat* format = ReferenceAPI_getMapModules().findModule(moduleName); if(format != 0) { return MapResource_load(*format, path, name); } else { globalErrorStream() << "ERROR: Map type incorrectly registered: \"" << moduleName << "\"\n"; return g_nullModel; } } else { if(string_not_empty(type)) { globalErrorStream() << "Model type not supported: \"" << name << "\"\n"; } return g_nullModel; } } }
DynamicLibrary( const char* filename ){ m_library = LoadLibrary( filename ); if ( m_library == 0 ) { globalErrorStream() << "LoadLibrary failed: '" << filename << "'\n"; globalErrorStream() << "GetLastError: " << FormatGetLastError(); } }
// Returns a new ModelNode for the given model name scene::INodePtr PicoModelLoader::loadModel(const std::string& modelName) { // Initialise the paths, this is all needed for realisation std::string path = rootPath(modelName); std::string name = os::getRelativePath(modelName, path); /* greebo: Path is empty for models in PK4 files, don't give up on this if (path.empty()) { // Empty path => empty model return scene::INodePtr(); }*/ // Try to load the model from the given VFS path IModelPtr model = GlobalModelCache().getModel(name); if (model == NULL) { globalErrorStream() << "PicoModelLoader: Could not load model << " << modelName.c_str() << "\n"; return scene::INodePtr(); } // The cached model should be an MD5Model, otherwise we're in the wrong movie RenderablePicoModelPtr picoModel = boost::dynamic_pointer_cast<RenderablePicoModel>(model); if (picoModel != NULL) { // Load was successful, construct a modelnode using this resource return PicoModelNodePtr(new PicoModelNode(picoModel)); } else { globalErrorStream() << "PicoModelLoader: Cached model is not a PicoModel?\n"; } return scene::INodePtr(); }
void PicoPrintFunc( int level, const char *str ) { if( str == 0 ) return; switch( level ) { case PICO_NORMAL: globalOutputStream() << str << "\n"; break; case PICO_VERBOSE: //globalOutputStream() << "PICO_VERBOSE: " << str << "\n"; break; case PICO_WARNING: globalErrorStream() << "PICO_WARNING: " << str << "\n"; break; case PICO_ERROR: globalErrorStream() << "PICO_ERROR: " << str << "\n"; break; case PICO_FATAL: globalErrorStream() << "PICO_FATAL: " << str << "\n"; break; } }
FunctionPointer findSymbol( const char* symbol ){ FunctionPointer address = (FunctionPointer) GetProcAddress( m_library, symbol ); if ( address == 0 ) { globalErrorStream() << "GetProcAddress failed: '" << symbol << "'\n"; globalErrorStream() << "GetLastError: " << FormatGetLastError(); } return address; }
static NodeSmartReference Entity_parseTokens (Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser, int index) { NodeSmartReference entity(g_nullNode); KeyValues keyValues; std::string classname = ""; int count_primitives = 0; while (1) { std::string token = tokeniser.getToken(); if (token.empty()) { Tokeniser_unexpectedError(tokeniser, token, "#entity-token"); return g_nullNode; } if (token == "}") { // end entity if (entity == g_nullNode) { // entity does not have brushes entity = Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, false), keyValues); } return entity; } else if (token == "{") { // begin primitive if (entity == g_nullNode) { // entity has brushes entity = Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, true), keyValues); } NodeSmartReference primitive(parser.parsePrimitive(tokeniser)); if (primitive == g_nullNode || !Node_getMapImporter(primitive)->importTokens(tokeniser)) { globalErrorStream() << "brush " << count_primitives << ": parse error\n"; return g_nullNode; } scene::Traversable* traversable = Node_getTraversable(entity); if (Node_getEntity(entity)->isContainer() && traversable != 0) { traversable->insert(primitive); } else { globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush " << count_primitives << "\n"; } ++count_primitives; } else { // epair const std::string key = token; token = tokeniser.getToken(); if (token.empty()) { Tokeniser_unexpectedError(tokeniser, token, "#epair-value"); return g_nullNode; } keyValues.push_back(KeyValues::value_type(key, token)); if (key == "classname") classname = keyValues.back().second; } } // unreachable code return g_nullNode; }
RGBAImagePtr LoadTGABuff(const byte* buffer) { PointerInputStream istream(buffer); TargaHeader targa_header; targa_header_read_istream(targa_header, istream); if (targa_header.image_type != 2 && targa_header.image_type != 10 && targa_header.image_type != 3) { globalErrorStream() << "LoadTGA: TGA type " << targa_header.image_type << " not supported\n"; globalErrorStream() << "LoadTGA: Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported\n"; return RGBAImagePtr(); } if (targa_header.colormap_type != 0) { globalErrorStream() << "LoadTGA: colormaps not supported\n"; return RGBAImagePtr(); } if ((targa_header.pixel_size != 32 && targa_header.pixel_size != 24) && targa_header.image_type != 3) { globalErrorStream() << "LoadTGA: Only 32 or 24 bit images supported\n"; return RGBAImagePtr(); } if ((targa_header.attributes & (TGA_FLIP_HORIZONTAL|TGA_FLIP_VERTICAL)) == 0) { return Targa_decodeImageData(targa_header, istream, Flip00()); } if((targa_header.attributes & TGA_FLIP_HORIZONTAL) == 0 && (targa_header.attributes & TGA_FLIP_VERTICAL) != 0) { return Targa_decodeImageData(targa_header, istream, Flip01()); } if ((targa_header.attributes & TGA_FLIP_HORIZONTAL) != 0 && (targa_header.attributes & TGA_FLIP_VERTICAL) == 0) { return Targa_decodeImageData(targa_header, istream, Flip10()); } if ((targa_header.attributes & TGA_FLIP_HORIZONTAL) != 0 && (targa_header.attributes & TGA_FLIP_VERTICAL) != 0) { return Targa_decodeImageData(targa_header, istream, Flip11()); } // unreachable return RGBAImagePtr(); }
void Brush_ConstructSphere(Brush& brush, const AABB& bounds, std::size_t sides, const char* shader, const TextureProjection& projection) { if(sides < c_brushSphere_minSides) { globalErrorStream() << c_brushSphere_name << ": sides " << Unsigned(sides) << ": too few sides, minimum is " << Unsigned(c_brushSphere_minSides) << "\n"; return; } if(sides > c_brushSphere_maxSides) { globalErrorStream() << c_brushSphere_name << ": sides " << Unsigned(sides) << ": too many sides, maximum is " << Unsigned(c_brushSphere_maxSides) << "\n"; return; } brush.undoSave(); brush.clear(); brush.reserve(sides*sides); float radius = max_extent(bounds.extents); const Vector3& mid = bounds.origin; Vector3 planepts[3]; double dt = 2 * c_pi / sides; double dp = c_pi / sides; for(std::size_t i=0; i < sides; i++) { for(std::size_t j=0;j < sides-1; j++) { double t = i * dt; double p = float(j * dp - c_pi / 2); planepts[0] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t, p), radius)); planepts[1] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t, p + dp), radius)); planepts[2] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t + dt, p + dp), radius)); brush.addPlane(planepts[0], planepts[1], planepts[2], shader, projection); } } { double p = (sides - 1) * dp - c_pi / 2; for(std::size_t i = 0; i < sides; i++) { double t = i * dt; planepts[0] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t, p), radius)); planepts[1] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t + dt, p + dp), radius)); planepts[2] = vector3_added(mid, vector3_scaled(vector3_for_spherical(t + dt, p), radius)); brush.addPlane(planepts[0], planepts[1], planepts[2], shader, projection); } } }
void Brush_ConstructCone(Brush& brush, const AABB& bounds, std::size_t sides, const char* shader, const TextureProjection& projection) { if(sides < c_brushCone_minSides) { globalErrorStream() << c_brushCone_name << ": sides " << Unsigned(sides) << ": too few sides, minimum is " << Unsigned(c_brushCone_minSides) << "\n"; return; } if(sides > c_brushCone_maxSides) { globalErrorStream() << c_brushCone_name << ": sides " << Unsigned(sides) << ": too many sides, maximum is " << Unsigned(c_brushCone_maxSides) << "\n"; return; } brush.undoSave(); brush.clear(); brush.reserve(sides+1); Vector3 mins(vector3_subtracted(bounds.origin, bounds.extents)); Vector3 maxs(vector3_added(bounds.origin, bounds.extents)); float radius = max_extent(bounds.extents); const Vector3& mid = bounds.origin; Vector3 planepts[3]; planepts[0][0] = mins[0];planepts[0][1] = mins[1];planepts[0][2] = mins[2]; planepts[1][0] = maxs[0];planepts[1][1] = mins[1];planepts[1][2] = mins[2]; planepts[2][0] = maxs[0];planepts[2][1] = maxs[1];planepts[2][2] = mins[2]; brush.addPlane(planepts[0], planepts[1], planepts[2], shader, projection); for (std::size_t i=0 ; i<sides ; ++i) { double sv = sin (i*3.14159265*2/sides); double cv = cos (i*3.14159265*2/sides); planepts[0][0] = static_cast<float>(floor(mid[0]+radius*cv+0.5)); planepts[0][1] = static_cast<float>(floor(mid[1]+radius*sv+0.5)); planepts[0][2] = mins[2]; planepts[1][0] = mid[0]; planepts[1][1] = mid[1]; planepts[1][2] = maxs[2]; planepts[2][0] = static_cast<float>(floor(planepts[0][0] - radius * sv + 0.5)); planepts[2][1] = static_cast<float>(floor(planepts[0][1] + radius * cv + 0.5)); planepts[2][2] = maxs[2]; brush.addPlane(planepts[0], planepts[1], planepts[2], shader, projection); } }
void DBobView_setEntity( Entity& entity, float multiplier, int points, float varGravity, bool bNoUpdate, bool bShowExtra ){ DEntity trigger; trigger.LoadEPairList( &entity ); DEPair* trigger_ep = trigger.FindEPairByKey( "targetname" ); if ( trigger_ep ) { if ( !strcmp( trigger.m_Classname, "trigger_push" ) ) { DEPair* target_ep = trigger.FindEPairByKey( "target" ); if ( target_ep ) { const scene::Path* entTarget = FindEntityFromTargetname( target_ep->value ); if ( entTarget ) { if ( g_PathView ) { delete g_PathView; } g_PathView = new DBobView; Entity* target = Node_getEntity( entTarget->top() ); if ( target != 0 ) { if ( !bNoUpdate ) { g_PathView->trigger = &entity; entity.attach( *g_PathView ); g_PathView->target = target; target->attach( *g_PathView ); } g_PathView->Begin( trigger_ep->value, target_ep->value, multiplier, points, varGravity, bNoUpdate, bShowExtra ); } else{ globalErrorStream() << "bobToolz PathPlotter: trigger_push ARGH\n"; } } else{ globalErrorStream() << "bobToolz PathPlotter: trigger_push target could not be found..\n"; } } else{ globalErrorStream() << "bobToolz PathPlotter: trigger_push has no target..\n"; } } else{ globalErrorStream() << "bobToolz PathPlotter: You must select a 'trigger_push' entity..\n"; } } else{ globalErrorStream() << "bobToolz PathPlotter: Entity must have a targetname.\n"; } return; }
void EClassManager::resolveModelInheritance(const std::string& name, const Doom3ModelDefPtr& model) { if (model->resolved == true) { return; // inheritance already resolved } model->resolved = true; if (!model->parent.empty()) { Models::iterator i = _models.find(model->parent); if (i == _models.end()) { globalErrorStream() << "model " << name << " inherits unknown model " << model->parent << std::endl; } else { resolveModelInheritance(i->first, i->second); // greebo: Only inherit the "mesh" of the parent if the current declaration doesn't have one if (model->mesh.empty()) { model->mesh = i->second->mesh; } // Only inherit the "skin" of the parent if the current declaration doesn't have one if (model->skin.empty()) { model->skin = i->second->skin; } } } }
TexturePtr GLTextureManager::getBinding(const std::string& fullPath, const std::string& moduleNames) { // check if the texture has to be loaded TextureMap::iterator i = _textures.find(fullPath); if (i == _textures.end()) { ImagePtr img = ImageFileLoader::imageFromFile(fullPath, moduleNames); // see if the MapExpression returned a valid image if (img != NULL) { // Constructor returned a valid image, now create the texture object TexturePtr texture = img->bindTexture(fullPath); _textures[fullPath] = texture; globalOutputStream() << "[shaders] Loaded texture: " << fullPath << "\n"; } else { globalErrorStream() << "[shaders] Unable to load texture: " << fullPath << "\n"; // invalid image produced, return shader not found return getShaderNotFound(); } } // Cast should succeed since all single image textures will be Texture2D return _textures[fullPath]; }
void globalQueuedAccelerators_add(Accelerator accelerator, const Callback& callback) { if(!g_queuedAcceleratorsAdd.insert(AcceleratorMap::value_type(accelerator, callback)).second) { globalErrorStream() << "globalQueuedAccelerators_add: accelerator already queued: " << accelerator << "\n"; } }
void build_run(const char* name, CommandListener& listener) { for(Tools::iterator i = g_build_tools.begin(); i != g_build_tools.end(); ++i) { StringBuffer output; (*i).second.evaluate(output); build_set_variable((*i).first.c_str(), output.c_str()); } { Project::iterator i = Project_find(g_build_project, name); if(i != g_build_project.end()) { Build& build = (*i).second; for(Build::iterator j = build.begin(); j != build.end(); ++j) { StringBuffer output; (*j).evaluate(output); listener.execute(output.c_str()); } } else { globalErrorStream() << "build " << makeQuoted(name) << " not defined"; } } }
void OpenGLModule::sharedContextCreated() { // report OpenGL information globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>(glGetString(GL_VENDOR)) << "\n"; globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>(glGetString(GL_RENDERER)) << "\n"; globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*>(glGetString(GL_VERSION)) << "\n"; globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) << "\n"; GLenum err = glewInit(); if (err != GLEW_OK) { // glewInit failed globalErrorStream() << "GLEW error: " << reinterpret_cast<const char*>(glewGetErrorString(err)); } GlobalRenderSystem().extensionsInitialised(); GlobalRenderSystem().realise(); _font = glfont_create("Sans 8"); m_font = _font.getDisplayList(); m_fontHeight = _font.getPixelHeight(); }
void globalQueuedAccelerators_remove( Accelerator accelerator ){ if ( g_queuedAcceleratorsAdd.erase( accelerator ) == 0 ) { if ( !g_queuedAcceleratorsRemove.insert( accelerator ).second ) { globalErrorStream() << "globalQueuedAccelerators_remove: accelerator already queued: " << accelerator << "\n"; } } }
void NamespaceManager::attachKeyToNamespace(const std::string& key, EntityKeyValue& keyValue) { if (_namespace == NULL) return; std::string nameValue = keyValue.get(); // Check if the name already exists in that namespace if (_namespace->nameExists(nameValue)) { // We need to change our name, it seems, acquire a new one (and insert it) nameValue = _namespace->makeUniqueAndInsert(nameValue); // Lock this class, to avoid this class from being called twice _updateMutex = true; // Update the entity keyvalue keyValue.assign(nameValue); _updateMutex = false; } else { // Name is valid and not yet known to this namespace, insert it if (!_namespace->insert(nameValue)) { globalErrorStream() << "Could not insert name: " << nameValue << " into namespace!\n"; } } }
bool LoadExclusionList( char* filename, std::list<Str>* exclusionList ){ FILE* eFile = fopen( filename, "r" ); if ( eFile ) { char buffer[256]; int cnt = 0; while ( !feof( eFile ) ) { memset( buffer, 0, 256 ); fscanf( eFile, "%s\n", buffer ); if ( strlen( buffer ) > 0 ) { exclusionList->push_back( buffer ); } else{ cnt++; } } fclose( eFile ); return TRUE; } globalErrorStream() << "Failed To Load Exclusion List: " << filename << "\n"; return FALSE; }
GdkPixbuf* UIManager::getLocalPixbufWithMask(const std::string& fileName) { // Try to find a cached pixbuf before loading from disk PixBufMap::iterator i = _localPixBufsWithMask.find(fileName); if (i != _localPixBufsWithMask.end()) { return i->second; } // Not cached yet, load afresh std::string fullFileName(GlobalRegistry().get(RKEY_BITMAPS_PATH) + fileName); GdkPixbuf* rgb = gdk_pixbuf_new_from_file(fullFileName.c_str(), 0); if (rgb != NULL) { // File load successful, add alpha channel GdkPixbuf* rgba = gdk_pixbuf_add_alpha(rgb, TRUE, 255, 0, 255); gdk_pixbuf_unref(rgb); _localPixBufsWithMask.insert(PixBufMap::value_type(fileName, rgba)); // Avoid destruction of this pixbuf g_object_ref(rgba); return rgba; } else { // File load failed globalErrorStream() << "Couldn't load pixbuf " << fullFileName << std::endl; return NULL; } }
NodeSmartReference ModelResource_load(ModelLoader* loader, const char* name) { ScopeDisableScreenUpdates disableScreenUpdates(path_get_filename_start(name), "Loading Model"); NodeSmartReference model(g_nullModel); { ArchiveFile* file = GlobalFileSystem().openFile(name); if(file != 0) { globalOutputStream() << "Loaded Model: \"" << name << "\"\n"; model = loader->loadModel(*file); file->release(); } else { globalErrorStream() << "Model load failed: \"" << name << "\"\n"; } } model.get().m_isRoot = true; return model; }
bool LoadGList( char* filename, GList** loadlist ){ FILE* eFile = fopen( filename, "r" ); if ( eFile ) { char buffer[256]; int cnt = 0; while ( !feof( eFile ) ) { memset( buffer, 0, 256 ); fscanf( eFile, "%s\n", buffer ); if ( strlen( buffer ) > 0 ) { char* buffer2 = new char[strlen( buffer ) + 1]; strcpy( buffer2, buffer ); *loadlist = g_list_append( *loadlist, buffer2 ); } else{ cnt++; } } fclose( eFile ); return TRUE; } globalErrorStream() << "Failed To Load GList: " << filename << "\n"; return FALSE; }
std::string EClassTreeBuilder::getInheritancePathRecursive(const IEntityClassPtr& eclass) { std::string returnValue; try { EntityClassAttribute attribute = eclass->getAttribute(INHERIT_KEY); // Don't use empty or derived "inherit" keys if (!attribute.value.empty() && !attribute.inherited) { // Get the inherited eclass first and resolve the path IEntityClassPtr parent = GlobalEntityClassManager().findClass( attribute.value ); if (parent != NULL) { returnValue += getInheritancePathRecursive(parent); } else { globalErrorStream() << "EClassTreeBuilder: Cannot resolve inheritance path for " << eclass->getName() << std::endl; } returnValue += attribute.value + "/"; } } catch (std::runtime_error&) { // no inherit key } return returnValue; }
GdkPixbuf* UIManager::getLocalPixbuf(const std::string& fileName) { // Try to use a cached pixbuf first PixBufMap::iterator i = _localPixBufs.find(fileName); if (i != _localPixBufs.end()) { return i->second; } // Not cached yet, load afresh // Construct the full filename using the Bitmaps path std::string fullFileName(GlobalRegistry().get(RKEY_BITMAPS_PATH) + fileName); GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(fullFileName.c_str(), NULL); if (pixbuf != NULL) { _localPixBufs.insert(PixBufMap::value_type(fileName, pixbuf)); // Avoid destruction of this pixbuf g_object_ref(pixbuf); } else { globalErrorStream() << "Couldn't load pixbuf " << fullFileName << std::endl; } return pixbuf; }
void WaveFrontModule::exportSelectionAsOBJ(const cmd::ArgumentList& args) { const SelectionInfo& info = GlobalSelectionSystem().getSelectionInfo(); if (info.totalCount == 0) { globalErrorStream() << "Nothing selected, cannot export." << std::endl; return; } // Query the filename from the user ui::IFileChooserPtr chooser = GlobalDialogManager().createFileChooser( _("Save as Obj"), false, false, "*.obj", ".obj" ); chooser->setCurrentPath(GlobalRegistry().get(RKEY_MAP_PATH)); std::string path = chooser->display(); if (!path.empty()) { globalOutputStream() << "Exporting selection as OBJ to " << path << std::endl; // Instantiate a new exporter WaveFrontExporter exporter(path); exporter.exportSelection(); } }
void EntityClass_resolveInheritance( EntityClass* derivedClass ){ if ( derivedClass->inheritanceResolved == false ) { derivedClass->inheritanceResolved = true; EntityClasses::iterator i = g_EntityClassDoom3_classes.find( derivedClass->m_parent.front().c_str() ); if ( i == g_EntityClassDoom3_classes.end() ) { globalErrorStream() << "failed to find entityDef " << makeQuoted( derivedClass->m_parent.front().c_str() ) << " inherited by " << makeQuoted( derivedClass->m_name.c_str() ) << "\n"; } else { EntityClass* parentClass = ( *i ).second; EntityClass_resolveInheritance( parentClass ); if ( !derivedClass->colorSpecified ) { derivedClass->colorSpecified = parentClass->colorSpecified; derivedClass->color = parentClass->color; } if ( !derivedClass->sizeSpecified ) { derivedClass->sizeSpecified = parentClass->sizeSpecified; derivedClass->mins = parentClass->mins; derivedClass->maxs = parentClass->maxs; derivedClass->fixedsize = parentClass->fixedsize; } for ( EntityClassAttributes::iterator j = parentClass->m_attributes.begin(); j != parentClass->m_attributes.end(); ++j ) { EntityClass_insertAttribute( *derivedClass, ( *j ).first.c_str(), ( *j ).second ); } } } }
void Map_Read (scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser) { // Create an info display panel to track load progress gtkutil::ModalProgressDialog dialog(GlobalRadiant().getMainWindow(), _("Loading map")); // Read each entity in the map, until EOF is reached for (int entCount = 0; ; entCount++) { // Update the dialog text dialog.setText("Loading entity " + string::toString(entCount)); // Check for end of file if (tokeniser.getToken().empty()) break; // Create an entity node by parsing from the stream NodeSmartReference entity(Entity_parseTokens(tokeniser, entityTable, parser, entCount)); if (entity == g_nullNode) { globalErrorStream() << "entity " << entCount << ": parse error\n"; return; } // Insert the new entity into the scene graph Node_getTraversable(root)->insert(entity); } }
GtkWidget* MenuManager::insert(const std::string& insertPath, const std::string& name, eMenuItemType type, const std::string& caption, const std::string& icon, const std::string& eventName) { MenuItem* found = _root->find(insertPath); if (found != NULL) { if (found->parent() != NULL) { // Get the GTK Menu position of the child widget int position = found->parent()->getMenuPosition(found); // Allocate a new MenuItem MenuItem* newItem = new MenuItem(found->parent()); found->parent()->addChild(newItem); // Load the properties into the new child newItem->setName(name); newItem->setType(type); newItem->setCaption(caption); newItem->setEvent(eventName); newItem->setIcon(icon); GtkWidget* parentWidget = *found->parent(); // Insert it at the given position if (found->parent()->getType() == menuBar) { // The parent is a menubar, it's a menushell in the first place gtk_menu_shell_insert(GTK_MENU_SHELL(parentWidget), *newItem, position); } else if (found->parent()->getType() == menuFolder) { // The parent is a submenu (=menuitem), try to retrieve the menushell first GtkWidget* subMenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(parentWidget)); gtk_menu_shell_insert(GTK_MENU_SHELL(subMenu), *newItem, position); } return *newItem; } else { globalErrorStream() << "MenuManager: Unparented menuitem, can't determine position: "; globalErrorStream() << insertPath << "\n"; return NULL; } } else { globalErrorStream() << "MenuManager: Could not find insertPath: " << insertPath << "\n"; return NULL; } }
void Brush_Construct(EBrushType type) { if(type == eBrushTypeQuake3) { g_showAlternativeTextureProjectionOption = true; GlobalPreferenceSystem().registerPreference( "AlternativeTextureProjection", BoolImportStringCaller(g_useAlternativeTextureProjection.m_latched), BoolExportStringCaller(g_useAlternativeTextureProjection.m_latched) ); g_useAlternativeTextureProjection.useLatched(); if(g_useAlternativeTextureProjection.m_value) { type = eBrushTypeQuake3BP; } // d1223m GlobalPreferenceSystem().registerPreference( "BrushAlwaysCaulk", BoolImportStringCaller(g_brush_always_caulk), BoolExportStringCaller(g_brush_always_caulk)); } Brush_registerCommands(); Brush_registerPreferencesPage(); BrushFilters_construct(); BrushClipPlane::constructStatic(); BrushInstance::constructStatic(); Brush::constructStatic(type); Brush::m_maxWorldCoord = g_MaxWorldCoord; BrushInstance::m_counter = &g_brushCount; g_texdef_default_scale = 0.5f; const char* value = g_pGameDescription->getKeyValue("default_scale"); if(!string_empty(value)) { float scale = static_cast<float>(atof(value)); if(scale != 0) { g_texdef_default_scale = scale; } else { globalErrorStream() << "error parsing \"default_scale\" attribute\n"; } } GlobalPreferenceSystem().registerPreference("TextureLock", BoolImportStringCaller(g_brush_texturelock_enabled), BoolExportStringCaller(g_brush_texturelock_enabled)); GlobalPreferenceSystem().registerPreference("BrushSnapPlanes", makeBoolStringImportCallback(FaceImportSnapPlanesCaller()), makeBoolStringExportCallback(FaceExportSnapPlanesCaller())); GlobalPreferenceSystem().registerPreference("TexdefDefaultScale", FloatImportStringCaller(g_texdef_default_scale), FloatExportStringCaller(g_texdef_default_scale)); GridStatus_getTextureLockEnabled = getTextureLockEnabled; g_texture_lock_status_changed = FreeCaller<GridStatus_onTextureLockEnabledChanged>(); }
void keyup_accelerators_add(Accelerator accelerator, const Callback& callback) { //globalOutputStream() << "keyup_accelerators_add: " << makeQuoted(accelerator) << "\n"; if(!accelerator_map_insert(g_keyup_accelerators, accelerator, callback)) { globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n"; } }
void keyup_accelerators_remove(Accelerator accelerator) { //globalOutputStream() << "keyup_accelerators_remove: " << makeQuoted(accelerator) << "\n"; if(!accelerator_map_erase(g_keyup_accelerators, accelerator)) { globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n"; } }