void Map::onResourceRealise() { if (m_resource == NULL) { return; } if (isUnnamed() || !m_resource->load()) { // Map is unnamed or load failed, reset map resource node to empty m_resource->setNode(NewMapRoot("")); MapFilePtr map = Node_getMapFile(m_resource->getNode()); if (map != NULL) { map->save(); } // Rename the map to "unnamed" in any case to avoid overwriting the failed map setMapName(_(MAP_UNNAMED_STRING)); } // Take the new node and insert it as map root GlobalSceneGraph().setRoot(m_resource->getNode()); // Associate the Scenegaph with the global RenderSystem // This usually takes a while since all editor textures are loaded - display a dialog to inform the user { ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Loading textures..."), true); // force display GlobalSceneGraph().root()->setRenderSystem(boost::dynamic_pointer_cast<RenderSystem>( module::GlobalModuleRegistry().getModule(MODULE_RENDERSYSTEM))); } AutoSaver().clearChanges(); setValid(true); }
static NodeSmartReference MapResource_load (const MapFormat& format, const std::string& path, const std::string& name) { NodeSmartReference root(NewMapRoot(name)); std::string fullpath = path + name; if (g_path_is_absolute(fullpath.c_str())) { MapResource_loadFile(format, root, fullpath); } else { globalErrorStream() << "ERROR: map path is not fully qualified: " << fullpath << "\n"; } return root; }
NodeSmartReference MapResource_load(const MapFormat& format, const char* path, const char* name) { NodeSmartReference root(NewMapRoot(name)); StringOutputStream fullpath(256); fullpath << path << name; if(path_is_absolute(fullpath.c_str())) { MapResource_loadFile(format, root, fullpath.c_str()); } else { globalErrorStream() << "map path is not fully qualified: " << makeQuoted(fullpath.c_str()) << "\n"; } return root; }