bool QQmlMemoryProfiler::isEnabled() { if (openLibrary()) return memprofile_is_enabled(); return false; }
QQmlMemoryScope::QQmlMemoryScope(const QUrl &url) : pushed(false) { if (openLibrary() && memprofile_is_enabled()) { memprofile_push_location(url.path().toUtf8().constData(), 0); pushed = true; } }
//--------------------------------------------------------------- void LibraryAnimationClips::addAnimationClip ( const ColladaAnimationClip& animationClip ) { // Opens the library, if it is not already open. openLibrary(); mSW->openElement ( CSWC::CSW_ELEMENT_ANIMATION_CLIP ); if ( !animationClip.getAnimationClipId().empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_ID, animationClip.getAnimationClipId() ); if ( animationClip.getStartTime() != ( -1.0f ) ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_START, animationClip.getStartTime() ); if ( animationClip.getEndTime() != ( -1.0f ) ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_END, animationClip.getEndTime() ); const AnimationInstances instancedAnimations = animationClip.getInstancedAnimations(); AnimationInstances::const_iterator instancedAnimationsIter = instancedAnimations.begin(); for ( ; instancedAnimationsIter != instancedAnimations.end(); ++instancedAnimationsIter ) { String instanceName = *instancedAnimationsIter; mSW->openElement ( CSWC::CSW_ELEMENT_INSTANCE_ANIMATION ); mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_URL, "#" + instanceName ); mSW->closeElement(); } if (animationClip.isAnimationEvent()) animationClip.addExtraTechniques(mSW); mSW->closeElement(); }
void * PluginLoaderBase::mainFunc( const QString & type, const char * mf_name ) const { if ( type.isEmpty() || !mPluginMap.contains( type ) ) return 0; const QString libName = mPluginMap[ type ].library; if ( libName.isEmpty() ) return 0; const KLibrary * lib = openLibrary( libName ); if ( !lib ) return 0; mPluginMap[ type ].loaded = true; const QString factory_name = libName + '_' + mf_name; if ( !lib->hasSymbol( factory_name.latin1() ) ) { warning() << "No symbol named \"" << factory_name.latin1() << "\" (" << factory_name << ") was found in library \"" << libName << "\"" << endl; return 0; } return lib->symbol( factory_name.latin1() ); }
QQmlMemoryScope::QQmlMemoryScope(const char *string) : pushed(false) { if (openLibrary() && memprofile_is_enabled()) { memprofile_push_location(string, 0); pushed = true; } }
/** * Opens suitable DLLs on a given path. * @param libpath A Poco::File object pointing to a directory where the * libraries are. * @param loadingBehaviour Control how libraries are searched for * @param excludes If not empty then each string is considered as a substring * to search within each library to be opened. If the substring is found then * the library is not opened. * @return The number of libraries opened. */ int LibraryManagerImpl::openLibraries( const Poco::File &libpath, LibraryManagerImpl::LoadLibraries loadingBehaviour, const std::vector<std::string> &excludes) { int libCount(0); if (libpath.exists() && libpath.isDirectory()) { // Iterate over the available files Poco::DirectoryIterator end_itr; for (Poco::DirectoryIterator itr(libpath); itr != end_itr; ++itr) { const Poco::File &item = *itr; if (item.isFile()) { if (shouldBeLoaded(itr.path().getFileName(), excludes)) libCount += openLibrary(itr.path(), itr.path().getFileName()); else continue; } else if (loadingBehaviour == LoadLibraries::Recursive) { // it must be a directory libCount += openLibraries(item, LoadLibraries::Recursive, excludes); } } } else { g_log.error("In OpenAllLibraries: " + libpath.path() + " must be a directory."); } return libCount; }
void CamerasExporter::exportCameras(Scene *sce) { openLibrary(); forEachCameraObjectInScene(sce, *this, this->export_settings->selected); closeLibrary(); }
void LightsExporter::exportLights(Scene *sce, bool export_selected) { openLibrary(); forEachLampObjectInScene(sce, *this, export_selected); closeLibrary(); }
void LightsExporter::exportLights(Scene *sce) { openLibrary(); forEachLightObjectInExportSet(sce, *this, this->export_settings.get_export_set()); closeLibrary(); }
void GeometryExporter::exportGeom(Scene *sce) { openLibrary(); mScene = sce; GeometryFunctor gf; gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this, this->export_settings->selected); closeLibrary(); }
void ImagesExporter::exportImages(Scene *sce, bool export_selected) { if(hasImages(sce)) { openLibrary(); MaterialFunctor mf; mf.forEachMaterialInScene<ImagesExporter>(sce, *this, export_selected); closeLibrary(); } }
void EffectsExporter::exportEffects(Scene *sce) { if (hasEffects(sce)) { this->scene = sce; openLibrary(); MaterialFunctor mf; mf.forEachMaterialInExportSet<EffectsExporter>(sce, *this, this->export_settings->export_set); closeLibrary(); } }
void MaterialsExporter::exportMaterials(Scene *sce) { if (hasMaterials(sce)) { openLibrary(); MaterialFunctor mf; mf.forEachMaterialInExportSet<MaterialsExporter>(sce, *this, this->export_settings->export_set); closeLibrary(); } }
void ControllerExporter::export_controllers(Scene *sce) { scene = sce; openLibrary(); GeometryFunctor gf; gf.forEachMeshObjectInExportSet<ControllerExporter>(sce, *this, this->export_settings->export_set); closeLibrary(); }
void ArmatureExporter::export_controllers(Scene *sce, bool export_selected) { scene = sce; openLibrary(); GeometryFunctor gf; gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this, export_selected); closeLibrary(); }
//--------------------------------------------------------------- void LibraryPhysicsScenes::openPhysicsScene ( const String &nodeId, const String &nodeName) { openLibrary(); mCurrentPhysicsSceneCloser = mSW->openElement ( CSWC::CSW_ELEMENT_PHYSICS_SCENE ); if ( !nodeId.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_ID, nodeId ); if ( !nodeName.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_NAME, nodeName ); }
//--------------------------------------------------------------- void LibraryPhysicsModels::openPhysicsModel(const String & id, const String & name) { openLibrary(); mCurrentPhysicsModelCloser = mSW->openElement(CSWC::CSW_ELEMENT_PHYSICS_MODEL); if( !id.empty() ) mSW->appendAttribute( CSWC::CSW_ATTRIBUTE_ID, id ); if( !name.empty() ) mSW->appendAttribute( CSWC::CSW_ATTRIBUTE_NAME, name ); }
//------------------------------------------------------------------------------ // Opens the Extend libraries that are usually required by SEI models. // // Return: // true no errors occured // false error occured // //------------------------------------------------------------------------------ bool ExtendBridge::openStdLibraries() { bool result = true; // open the libraries for (LibMap::iterator lib = libraries.begin(); lib != libraries.end(); lib++) { result = openLibrary(lib->second.c_str()); if (!result) { return(false); } } return(result); }
void AnimationExporter::exportAnimations(Scene *sce) { if (hasAnimations(sce)) { this->scene = sce; openLibrary(); forEachObjectInExportSet(sce, *this, this->export_settings->export_set); closeLibrary(); } }
void AnimationExporter::exportAnimations(Scene *sce) { if(hasAnimations(sce)) { this->scene = sce; openLibrary(); forEachObjectInScene(sce, *this); closeLibrary(); } }
//--------------------------------------------------------------- void LibraryControllers::openController ( const String &controllerId, const String &controllerName ) { openLibrary(); mControllerCloser = mSW->openElement ( CSWC::CSW_ELEMENT_CONTROLLER ); if ( !controllerId.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_ID, controllerId ); if ( !controllerName.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_NAME, controllerName ); }
// really we should only attempt to add a library once, // however if we opened it previously at the same path as the // one we try now, we allow it const Library & addLibrary( str_cref name, str_cref path ) { LibraryPtr & pLib = prepare( name, path ); if( !pLib ) { // becase this can throw we are slightly overcautious to put it into a // local variable and only swap it after it has been shown to work. LibraryPtr openLib = openLibrary( name, path ); openLib.swap( pLib ); } return *pLib; }
bool AnimationExporter::exportAnimations(Scene *sce) { bool has_animations = hasAnimations(sce); if (has_animations) { this->scene = sce; openLibrary(); forEachObjectInExportSet(sce, *this, this->export_settings->export_set); closeLibrary(); } return has_animations; }
//------------------------------------- void LibraryMaterials::openMaterial( const String& materialId /*= EMPTY_STRING */, const String& materialName /*= EMPTY_STRING */ ) { openLibrary(); mMaterialCloser = mSW->openElement ( CSWC::CSW_ELEMENT_MATERIAL ); if ( !materialId.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_ID, materialId ); if ( !materialName.empty() ) mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_NAME, materialName ); }
void ImagesExporter::exportImages(Scene *sce) { openLibrary(); MaterialFunctor mf; if (this->export_settings->include_material_textures) { mf.forEachMaterialInExportSet<ImagesExporter>(sce, *this, this->export_settings->export_set); } if (this->export_settings->include_uv_textures) { export_UV_Images(); } closeLibrary(); }
void MaterialsExporter::exportMaterials(Scene *sce) { if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT) { if (hasMaterials(sce)) { openLibrary(); MaterialFunctor mf; mf.forEachMaterialInExportSet<MaterialsExporter>(sce, *this, this->export_settings->export_set); closeLibrary(); } } else { std::set<Image *> uv_images = bc_getUVImages(sce, !this->export_settings->active_uv_only); if (uv_images.size() > 0) { openLibrary(); std::set<Image *>::iterator uv_images_iter; for (uv_images_iter = uv_images.begin(); uv_images_iter != uv_images.end(); uv_images_iter++) { Image *ima = *uv_images_iter; std::string matid(id_name(ima)); openMaterial(get_material_id_from_id(matid), translate_id(matid)); std::string efid = translate_id(matid) + "-effect"; addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid)); closeMaterial(); } closeLibrary(); } } }
void MaterialExporter::add() { char tempStr[1024]; openLibrary(); for (int i = 0; i < m_bsp->numShaders; ++i) { sprintf(tempStr, "material%d", i); std::string matId = tempStr; sprintf(tempStr, "material%d-fx", i); std::string fxId = tempStr; openMaterial(matId, matId); addInstanceEffect(COLLADASW::URI(EMPTY_STRING, fxId)); closeMaterial(); } closeLibrary(); }
void MaterialExporter::doExport() { vgLogDebug("Exporting materials"); openLibrary(); if( m_exportSettings.getLevel() > GEOMETRY ) { typedef collectedMapType::right_map::const_iterator right_const_iterator; for( right_const_iterator right_iter = m_collectedMap.right.begin(), iend = m_collectedMap.right.end(); right_iter != iend; ++right_iter ) { vgd::Shp< vge::technique::CollectedMaterial > collectedMaterial = right_iter->first; if( collectedMaterial->getMaterial() ) { std::string effectName = collectedMaterial->getEffectId(); std::string materialName = effectName + MATERIAL_ID_SUFFIX; collectedMaterial->setMaterialId( materialName ); openMaterial ( materialName, COLLADABU::Utils::checkNCName(materialName) ); addInstanceEffect ( "#" + effectName ); closeMaterial (); } } } else { std::string effectName = "DefaultWhole"; std::string materialName = effectName + MATERIAL_ID_SUFFIX; openMaterial ( materialName, COLLADABU::Utils::checkNCName(materialName) ); addInstanceEffect ( "#" + effectName ); closeMaterial (); } closeLibrary(); }
/** * \brief Create interface actions */ void MainWindow :: createAction() { _openLibAction = new QAction(tr("Open library"), this); Q_ASSERT(_openLibAction); _openLibAction->setIcon(QIcon(":res/png/folder.png")); _openLibAction->setCheckable(false); connect(_openLibAction, SIGNAL(triggered()), SLOT(openLibrary())); _settingAction = new QAction(tr("Setting"), this); Q_ASSERT(_settingAction); _settingAction->setIcon(QIcon(":res/png/gear.png")); _settingAction->setCheckable(false); connect(_settingAction, SIGNAL(triggered()), _cw, SLOT(setting())); _startAction = new QAction(tr("Start"), this); Q_ASSERT(_startAction); _startAction->setIcon(QIcon(":res/png/play.png")); _startAction->setDisabled(true); connect(_startAction, SIGNAL(triggered()), SLOT(start())); _stopAction = new QAction(tr("Stop"), this); Q_ASSERT(_stopAction); _stopAction->setIcon(QIcon(":res/png/stop.png")); _stopAction->setDisabled(true); connect(_stopAction, SIGNAL(triggered()), SLOT(stop())); _showHintAction = new QAction(tr("Hint"), this); Q_ASSERT(_showHintAction); _showHintAction->setIcon(QIcon(":res/png/hint.png")); _showHintAction->setDisabled(true); connect(_showHintAction, SIGNAL(triggered()), _cw, SLOT(hint())); _fileDialog = new QFileDialog(this, Qt::Window | Qt::WindowStaysOnTopHint); Q_ASSERT(_fileDialog); _fileDialog->setWindowTitle(tr("Choose library")); _fileDialog->setWindowState(Qt::WindowFullScreen); }
void QQmlMemoryProfiler::save(const char *filename) { if (openLibrary()) memprofile_save(filename); }