本文整理汇总了C++中FilePath::ReplaceExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::ReplaceExtension方法的具体用法?C++ FilePath::ReplaceExtension怎么用?C++ FilePath::ReplaceExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::ReplaceExtension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: Execute
void CommandConvertScene::Execute()
{
DVASSERT(CheckExtension(String(".dae")) && "Wrong extension");
// TextureDescriptorUtils::CreateDescriptorsForFolder(EditorSettings::Instance()->GetDataSourcePath());
DVASSERT(false)
eColladaErrorCodes code = ConvertDaeToSce(filePathname);
if(code == COLLADA_OK)
{
// load sce to scene object
FilePath path = FilePath::CreateWithNewExtension(filePathname, ".sce");
Scene * scene = new Scene();
Entity *rootNode = scene->GetRootNode(path);
if(rootNode)
{
rootNode = rootNode->Clone();
scene->AddNode(rootNode);
rootNode->Release();
}
scene->BakeTransforms();
// Export to *.sc2
path.ReplaceExtension(".sc2");
scene->Save(path);
SafeRelease(scene);
}
else if(code == COLLADA_ERROR_OF_ROOT_NODE)
{
ShowErrorDialog(String("Can't convert from DAE. Looks like one of materials has same name as root node."));
}
else
{
ShowErrorDialog(String("Can't convert from DAE."));
}
}
示例3: CopyEmitter
void SceneSaver::CopyEmitter( ParticleEmitter *emitter, Set<String> &errorLog )
{
sceneUtils.CopyFile(emitter->GetConfigPath(), errorLog);
const Vector<ParticleLayer*> &layers = emitter->GetLayers();
uint32 count = (uint32)layers.size();
for(uint32 i = 0; i < count; ++i)
{
if(layers[i]->type == ParticleLayer::TYPE_SUPEREMITTER_PARTICLES)
{
CopyEmitter(layers[i]->GetInnerEmitter(), errorLog);
}
else
{
Sprite *sprite = layers[i]->GetSprite();
if(!sprite) continue;
FilePath psdPath = ReplaceInString(sprite->GetRelativePathname().GetAbsolutePathname(), "/Data/", "/DataSource/");
psdPath.ReplaceExtension(".psd");
sceneUtils.CopyFile(psdPath, errorLog);
}
}
}
示例4: OnDeleteSelectedItemsClicked
void CubeMapTextureBrowser::OnDeleteSelectedItemsClicked()
{
int checkedItemCount = GetCheckedItemsCount();
int answer = MB_FLAG_NO;
if(checkedItemCount > 0)
{
QString text = QString("%1 item(s) will be deleted. Continue?").arg(QString().setNum(checkedItemCount));
answer = ShowQuestion("Confirmation",
text.toStdString(),
MB_FLAG_YES | MB_FLAG_NO,
MB_FLAG_NO);
}
if(MB_FLAG_YES == answer)
{
DAVA::Vector<DAVA::String> failedToRemove;
int itemCount = ui->listTextures->count();
for(int i = 0; i < itemCount; ++i)
{
QListWidgetItem* item = ui->listTextures->item(i);
bool checkedState = item->data(Qt::CheckStateRole).toBool();
if(checkedState)
{
FilePath fp = item->data(CUBELIST_DELEGATE_ITEMFULLPATH).toString().toStdString();
if(fp.Exists())
{
DAVA::Vector<DAVA::String> faceNames;
CubemapUtils::GenerateFaceNames(fp.GetAbsolutePathname(), faceNames);
for(size_t faceIndex = 0; faceIndex < faceNames.size(); ++faceIndex)
{
FilePath hackTex = faceNames[faceIndex];
hackTex.ReplaceExtension(".tex");
QFile::remove(hackTex.GetAbsolutePathname().c_str());
bool removeResult = QFile::remove(faceNames[faceIndex].c_str());
if(!removeResult)
{
failedToRemove.push_back(faceNames[faceIndex]);
}
}
bool removeResult = QFile::remove(fp.GetAbsolutePathname().c_str());
if(!removeResult)
{
failedToRemove.push_back(fp.GetAbsolutePathname().c_str());
}
}
}
}
if(failedToRemove.size() > 0)
{
DAVA::String fileList;
int count = failedToRemove.size();
for(int i = 0; i < count; ++i)
{
fileList += failedToRemove[i];
fileList += "\n";
}
DAVA::String message = "Failed to remove the following files. Please delete them manually.\n";
message += fileList;
ShowErrorDialog(message);
}
QString path = ui->textRootPath->text();
ReloadTexturesFromUI(path);
UpdateCheckedState();
}
}