Esempio n. 1
0
void SceneHelper::EnumerateEntityTextures(DAVA::Scene *forScene, DAVA::Entity *forNode, DAVA::TexturesMap &textureCollection, TexturesEnumerateMode mode)
{
    if(!forNode || !forScene) return;
    
    DAVA::MaterialSystem *matSystem = forScene->GetMaterialSystem();
    
    DAVA::Set<DAVA::NMaterial *> materials;
    matSystem->BuildMaterialList(forNode, materials);
    
    Set<NMaterial *>::const_iterator endIt = materials.end();
    for(Set<NMaterial *>::const_iterator it = materials.begin(); it != endIt; ++it)
    {
        DAVA::NMaterial *mat = *it;
        
        String materialName = mat->GetMaterialName().c_str();
        String parentName = mat->GetParent() ? mat->GetParent()->GetMaterialName().c_str() : String() ;
        
        if((parentName.find("Particle") != String::npos) || (materialName.find("Particle") != String::npos))
        {   //because particle materials has textures only after first start, so we have different result during scene life.
            continue;
        }
        
        CollectTextures(*it, textureCollection, mode);
    }
}
Esempio n. 2
0
void ShowErrorDialog(const DAVA::Set<DAVA::String> &errors)
{
    if(errors.empty())
        return;
    
    String errorMessage = String("");
    Set<String>::const_iterator endIt = errors.end();
    for(Set<String>::const_iterator it = errors.begin(); it != endIt; ++it)
    {
        errorMessage += *it + String("\n");
    }
    
    ShowErrorDialog(errorMessage);
}
Esempio n. 3
0
void SceneTreeItemParticleInnerEmmiter::DoSync(QStandardItem *rootItem, DAVA::ParticleEmitter *emitter)
{
	if(NULL != rootItem && NULL != emitter)
	{
		
		DAVA::Set<DAVA::ParticleLayer *> layerSet;
		size_t itemsCount = emitter->GetLayers().size();
		for (size_t i=0; i<itemsCount; i++)
		{
			layerSet.insert(emitter->GetLayers()[i]);
		}
		for(int i = 0; i < rootItem->rowCount(); ++i)
		{	
			DVASSERT(((SceneTreeItem*)rootItem->child(i))->ItemType() == SceneTreeItem::EIT_Layer);
			SceneTreeItemParticleLayer *childItem = (SceneTreeItemParticleLayer *) rootItem->child(i);
			DAVA::Set<DAVA::ParticleLayer *>::iterator it = layerSet.find(childItem->layer);
			if (it!=layerSet.end())
			{
				layerSet.erase(it);	
				childItem->DoSync(childItem, childItem->layer);
			}
			else
			{
				rootItem->removeRow(i);
				i--;
			}
		}
		for (DAVA::Set<DAVA::ParticleLayer *>::iterator it = layerSet.begin(), e=layerSet.end(); it!=e; ++it)
		{
			rootItem->appendRow(new SceneTreeItemParticleLayer(emitter, *it));
		}					
	}
}
Esempio n. 4
0
void SceneHelper::CollectDescriptors(DAVA::Set<DAVA::FilePath> &descriptors, const DAVA::FilePath &pathname)
{
	if(pathname.GetType() == FilePath::PATH_EMPTY)
		return;

	DVASSERT(pathname.IsEqualToExtension(TextureDescriptor::GetDescriptorExtension()));

	if(!pathname.IsEmpty() && SceneValidator::Instance()->IsPathCorrectForProject(pathname))
	{
		descriptors.insert(pathname);
	}
}
Esempio n. 5
0
void SceneUtils::PrepareDestination(DAVA::Set<DAVA::String> &errorLog)
{
    DAVA::Set<DAVA::FilePath> folders;

    DAVA::Map<DAVA::FilePath, DAVA::FilePath>::const_iterator endMapIt = filesForCopy.end();
    for(DAVA::Map<DAVA::FilePath, DAVA::FilePath>::const_iterator it = filesForCopy.begin(); it != endMapIt; ++it)
    {
        folders.insert(it->second.GetDirectory());
    }
    
    DAVA::Set<DAVA::FilePath>::const_iterator endSetIt = folders.end();
    for(DAVA::Set<DAVA::FilePath>::const_iterator it = folders.begin(); it != endSetIt; ++it)
    {
        if(!(*it).Exists())
        {
            FileSystem::eCreateDirectoryResult retCreate = FileSystem::Instance()->CreateDirectory((*it), true);
            if(FileSystem::DIRECTORY_CANT_CREATE == retCreate)
            {
                errorLog.insert(String(Format("Can't create folder %s", (*it).GetAbsolutePathname().c_str())));
            }
        }
    }
}