本文整理汇总了C++中FilePath::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::IsEmpty方法的具体用法?C++ FilePath::IsEmpty怎么用?C++ FilePath::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::IsEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFile
void SceneUtils::AddFile(const DAVA::FilePath &sourcePath)
{
String workingPathname = sourcePath.GetRelativePathname(dataSourceFolder);
FilePath destinationPath = dataFolder + workingPathname;
if(sourcePath != destinationPath)
{
DVASSERT(!sourcePath.IsEmpty());
DVASSERT(!destinationPath.IsEmpty());
filesForCopy[sourcePath] = destinationPath;
}
}
示例2: SaveTileMaskTexture
void LandscapeEditorDrawSystem::SaveTileMaskTexture()
{
if (!baseLandscape)
{
return;
}
if (!GetLandscapeProxy()->IsTilemaskChanged())
{
return;
}
Texture* texture = baseLandscape->GetTexture(Landscape::TEXTURE_TILE_MASK);
if (texture)
{
FilePath texturePathname = baseLandscape->GetTextureName(Landscape::TEXTURE_TILE_MASK);
if (texturePathname.IsEmpty())
{
return;
}
texturePathname.ReplaceExtension(".png");
eBlendMode srcBlend = RenderManager::Instance()->GetSrcBlend();
eBlendMode dstBlend = RenderManager::Instance()->GetDestBlend();
RenderManager::Instance()->SetBlendMode(BLEND_ONE, BLEND_ZERO);
Image *image = texture->CreateImageFromMemory();
RenderManager::Instance()->SetBlendMode(srcBlend, dstBlend);
if(image)
{
ImageLoader::Save(image, texturePathname);
SafeRelease(image);
}
FilePath descriptorPathname = TextureDescriptor::GetDescriptorPathname(texturePathname);
TextureDescriptor *descriptor = TextureDescriptor::CreateFromFile(descriptorPathname);
if(!descriptor)
{
descriptor = new TextureDescriptor();
descriptor->pathname = descriptorPathname;
descriptor->Save();
}
SafeRelease(descriptor);
GetLandscapeProxy()->ResetTilemaskChanged();
}
}
示例3: EnableLandscapeEditing
LandscapeEditorDrawSystem::eErrorType CustomColorsSystem::EnableLandscapeEditing()
{
if (enabled)
{
return LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS;
}
LandscapeEditorDrawSystem::eErrorType canBeEnabledError = IsCanBeEnabled();
if ( canBeEnabledError!= LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS)
{
return canBeEnabledError;
}
LandscapeEditorDrawSystem::eErrorType enableCustomDrawError = drawSystem->EnableCustomDraw();
if (enableCustomDrawError != LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS)
{
return enableCustomDrawError;
}
selectionSystem->SetLocked(true);
modifSystem->SetLocked(true);
landscapeSize = drawSystem->GetTextureSize(Landscape::TEXTURE_TILE_FULL);
FilePath filePath = GetCurrentSaveFileName();
if (!filePath.IsEmpty())
{
const bool isTextureLoaded = LoadTexture(filePath, false);
drawSystem->GetCustomColorsProxy()->ResetLoadedState(isTextureLoaded);
}
else
{
drawSystem->GetCustomColorsProxy()->UpdateSpriteFromConfig();
}
drawSystem->EnableCursor(landscapeSize);
drawSystem->SetCursorTexture(cursorTexture);
drawSystem->SetCursorSize(cursorSize);
Texture* customColorsTexture = drawSystem->GetCustomColorsProxy()->GetSprite()->GetTexture();
drawSystem->GetLandscapeProxy()->SetCustomColorsTexture(customColorsTexture);
drawSystem->GetLandscapeProxy()->SetCustomColorsTextureEnabled(true);
if (!toolImageSprite)
{
CreateToolImage(512, "~res:/LandscapeEditor/Tools/customcolorsbrush/circle.tex");
}
enabled = true;
return LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS;
}
示例4: SaveTexture
void VisibilityToolPanel::SaveTexture()
{
FilePath currentPath = FileSystem::Instance()->GetUserDocumentsPath();
QString filePath = QtFileDialog::getSaveFileName(NULL,
QString(ResourceEditor::VISIBILITY_TOOL_SAVE_CAPTION.c_str()),
QString(currentPath.GetAbsolutePathname().c_str()),
QString(ResourceEditor::VISIBILITY_TOOL_FILE_FILTER.c_str()));
FilePath selectedPathname = PathnameToDAVAStyle(filePath);
if(!selectedPathname.IsEmpty())
{
GetActiveScene()->visibilityToolSystem->SaveTexture(selectedPathname);
}
}
示例5: AddTopResourcesFolder
void FilePath::AddTopResourcesFolder(const FilePath & folder)
{
DVASSERT(!folder.IsEmpty());
for(List<FilePath>::iterator it = resourceFolders.begin(); it != resourceFolders.end(); ++it)
{
if(folder == *it)
{
DVASSERT(false);
}
}
FilePath resPath = folder;
resPath.pathType = PATH_IN_RESOURCES;
resourceFolders.push_front(resPath);
}
示例6: SetBundleName
void FilePath::SetBundleName(const FilePath & newBundlePath)
{
FilePath virtualBundlePath = newBundlePath;
if(!virtualBundlePath.IsEmpty())
{
virtualBundlePath.MakeDirectoryPathname();
}
virtualBundlePath.pathType = PATH_IN_RESOURCES;
if(resourceFolders.size())
resourceFolders.pop_front();
resourceFolders.push_front(virtualBundlePath);
}
示例7: ValidateMaterial
void SceneValidator::ValidateMaterial(Material *material, Set<String> &errorsLog)
{
for(int32 iTex = 0; iTex < Material::TEXTURE_COUNT; ++iTex)
{
Texture *texture = material->GetTexture((Material::eTextureLevel)iTex);
if(texture)
{
ValidateTexture(texture, material->GetTextureName((Material::eTextureLevel)iTex), Format("Material: %s. TextureLevel %d.", material->GetName().c_str(), iTex), errorsLog);
FilePath matTexName = material->GetTextureName((Material::eTextureLevel)iTex);
if(!matTexName.IsEmpty() && !IsTextureDescriptorPath(matTexName))
{
material->SetTexture((Material::eTextureLevel)iTex, TextureDescriptor::GetDescriptorPathname(matTexName));
}
}
}
}
示例8: SaveTextureAction
void LandscapeEditorCustomColors::SaveTextureAction(const FilePath &pathToFile)
{
if(pathToFile.IsEmpty())
return;
if(colorSprite)
{
Image *img = colorSprite->GetTexture()->CreateImageFromMemory();
if(img)
{
StoreSaveFileName(pathToFile.GetAbsolutePathname());
ImageLoader::Save(img, pathToFile.GetAbsolutePathname());
SafeRelease(img);
unsavedChanges = false;
}
}
}
示例9: Execute
void CommandSaveTextureVisibilityTool::Execute()
{
FilePath currentPath = FileSystem::Instance()->GetUserDocumentsPath();
QString filePath = QFileDialog::getSaveFileName(NULL,
QString("Save texture"),
QString(currentPath.GetAbsolutePathname().c_str()),
QString("PNG image (*.png)"));
FilePath selectedPathname = PathnameToDAVAStyle(filePath);
if(!selectedPathname.IsEmpty())
{
SceneEditorScreenMain *screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen());
if(screen)
{
screen->VisibilityToolSaveTexture(selectedPathname);
}
}
}
示例10: AbsoluteToRelative
String FilePath::AbsoluteToRelative(const FilePath &directoryPathname, const FilePath &absolutePathname)
{
if(absolutePathname.IsEmpty())
return String();
DVASSERT(directoryPathname.IsDirectoryPathname());
Vector<String> folders;
Vector<String> fileFolders;
if(directoryPathname.GetType() == PATH_IN_RESOURCES && absolutePathname.GetType() == PATH_IN_RESOURCES)
{
Split(directoryPathname.absolutePathname, "/", folders);
Split(absolutePathname.GetDirectory().absolutePathname, "/", fileFolders);
}
else
{
Split(directoryPathname.GetAbsolutePathname(), "/", folders);
Split(absolutePathname.GetDirectory().GetAbsolutePathname(), "/", fileFolders);
}
Vector<String>::size_type equalCount = 0;
for(; equalCount < folders.size() && equalCount < fileFolders.size(); ++equalCount)
{
if(folders[equalCount] != fileFolders[equalCount])
{
break;
}
}
String retPath = "";
for(Vector<String>::size_type i = equalCount; i < folders.size(); ++i)
{
retPath += "../";
}
for(Vector<String>::size_type i = equalCount; i < fileFolders.size(); ++i)
{
retPath += fileFolders[i] + "/";
}
return (retPath + absolutePathname.GetFilename());
}
示例11: LoadTextureAction
void LandscapeEditorCustomColors::LoadTextureAction(const FilePath &pathToFile)
{
if(pathToFile.IsEmpty())
return;
Vector<Image*> images = ImageLoader::CreateFromFile(pathToFile);
if(images.empty())
return;
Image* image = images.front();
if(image)
{
Texture* texture = Texture::CreateFromData(image->GetPixelFormat(),
image->GetData(),
image->GetWidth(),
image->GetHeight(),
false);
SafeRelease(colorSprite);
colorSprite = Sprite::CreateAsRenderTarget(texSurf->GetWidth(), texSurf->GetHeight(), FORMAT_RGBA8888);
Sprite* sprite = Sprite::CreateFromTexture(texture, 0, 0, texture->GetWidth(), texture->GetHeight());
StoreOriginalState();
RenderManager::Instance()->SetRenderTarget(colorSprite);
sprite->Draw();
RenderManager::Instance()->RestoreRenderTarget();
PerformLandscapeDraw();
SafeRelease(sprite);
SafeRelease(texture);
for_each(images.begin(), images.end(), SafeRelease<Image>);
StoreSaveFileName(pathToFile);
CreateUndoPoint();
}
}
示例12: ValidateInstanceMaterialState
void SceneValidator::ValidateInstanceMaterialState(InstanceMaterialState *materialState, Set<String> &errorsLog)
{
if(materialState->GetLightmap())
{
ValidateTexture(materialState->GetLightmap(), materialState->GetLightmapName(), "InstanceMaterialState, lightmap", errorsLog);
}
FilePath lightmapName = materialState->GetLightmapName();
if(!IsTextureDescriptorPath(lightmapName))
{
Texture *lightmap = SafeRetain(materialState->GetLightmap());
if(lightmapName.IsEmpty())
{
materialState->SetLightmap(lightmap, FilePath());
}
else
{
materialState->SetLightmap(lightmap, TextureDescriptor::GetDescriptorPathname(lightmapName));
}
SafeRelease(lightmap);
}
}