本文整理汇总了C++中KeyedArchive::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyedArchive::GetString方法的具体用法?C++ KeyedArchive::GetString怎么用?C++ KeyedArchive::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyedArchive
的用法示例。
在下文中一共展示了KeyedArchive::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SafeRetain
CommandInternalRemoveSceneNode::CommandInternalRemoveSceneNode(Entity* node, bool removeSimilar)
: Command(Command::COMMAND_UNDO_REDO, CommandList::ID_COMMAND_INTERNAL_REMOVE_SCENE_NODE)
{
commandName = "Remove Object";
if (removeSimilar)
commandName += "s";
if (!node || !node->GetParent())
return;
if (removeSimilar)
{
String referenceToOwner;
Entity* nodeParent = node->GetParent();
KeyedArchive *customProperties = node->GetCustomProperties();
if(customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
{
referenceToOwner = customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER);
}
nodesForDeletion.reserve(nodeParent->GetChildrenCount());
for (int32 i = 0; i < nodeParent->GetChildrenCount(); ++i)
{
Entity* child = nodeParent->GetChild(i);
customProperties = child->GetCustomProperties();
if (customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
{
if (customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER) == referenceToOwner)
{
RemoveNodeRec removeNodeRec;
removeNodeRec.node = SafeRetain(child);
removeNodeRec.nodeParent = nodeParent;
int32 i = GetNodeIndex(removeNodeRec);
if (i >= 0 && i < nodeParent->GetChildrenCount() - 1)
removeNodeRec.insertBeforeNode = nodeParent->GetChild(i + 1);
nodesForDeletion.push_back(removeNodeRec);
}
}
}
}
else
{
RemoveNodeRec removeNodeRec;
removeNodeRec.node = SafeRetain(node);
removeNodeRec.nodeParent = node->GetParent();
int32 i = GetNodeIndex(removeNodeRec);
if (i >= 0 && i < removeNodeRec.nodeParent->GetChildrenCount() - 1)
removeNodeRec.insertBeforeNode = removeNodeRec.nodeParent->GetChild(i + 1);
nodesForDeletion.push_back(removeNodeRec);
}
selectedNode = node;
}
示例2: SetUpConnectionToDB
// Read DB parameters from config file and set connection to it
void AutotestingSystem::SetUpConnectionToDB()
{
KeyedArchive *option = new KeyedArchive();
bool res = option->LoadFromYamlFile("~res:/Autotesting/dbConfig.yaml");
if (!res)
{
ForceQuit("Couldn't open file ~res:/Autotesting/dbConfig.yaml");
}
String dbName = option->GetString("name");
String dbAddress = option->GetString("hostname");
String collection = option->GetString("collection");
int32 dbPort = option->GetInt32("port");
Logger::Debug("AutotestingSystem::SetUpConnectionToDB %s -> %s[%s:%d]", collection.c_str(), dbName.c_str(), dbAddress.c_str(), dbPort);
if(! AutotestingDB::Instance()->ConnectToDB(collection, dbName, dbAddress, dbPort))
{
ForceQuit("Couldn't connect to Test DB");
}
else
{
isDB = true;
}
SafeRelease(option);
}
示例3: ReloadNode
void EditorBodyControl::ReloadNode(Entity *node, const FilePath &pathToFile)
{//если в рут ноды сложить такие же рут ноды то на релоаде все накроет пиздой
KeyedArchive *customProperties = node->GetCustomProperties();
if (customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER, "") == pathToFile.GetAbsolutePathname())
{
Entity *newNode = scene->GetRootNode(pathToFile)->Clone();
newNode->SetLocalTransform(node->GetLocalTransform());
newNode->GetCustomProperties()->SetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER, pathToFile.GetAbsolutePathname());
newNode->SetSolid(true);
Entity *parent = node->GetParent();
AddedNode addN;
addN.nodeToAdd = newNode;
addN.nodeToRemove = node;
addN.parent = parent;
nodesToAdd.push_back(addN);
return;
}
int32 csz = node->GetChildrenCount();
for (int ci = 0; ci < csz; ++ci)
{
Entity * child = node->GetChild(ci);
ReloadNode(child, pathToFile);
}
}
示例4: SaveToFolder
void SceneEditorScreenMain::SaveToFolder(const String & folder)
{
BodyItem *iBody = FindCurrentBody();
iBody->bodyControl->PushDebugCamera();
SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive();
String filePath = sceneData->GetScenePathname();
String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath();
String::size_type pos = filePath.find(dataSourcePath);
if(String::npos != pos)
{
filePath = filePath.replace(pos, dataSourcePath.length(), "");
}
else
{
DVASSERT(0);
}
// Get project path
KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings();
String projectPath = keyedArchieve->GetString(String("ProjectPath"));
if(!SceneSaver::Instance()) new SceneSaver();
String inFolder = projectPath + String("DataSource/3d/");
SceneSaver::Instance()->SetInFolder(inFolder);
SceneSaver::Instance()->SetOutFolder(folder);
Set<String> errorsLog;
SceneSaver::Instance()->SaveScene(iBody->bodyControl->GetScene(), filePath, errorsLog);
iBody->bodyControl->PopDebugCamera();
ShowErrorDialog(errorsLog);
}
示例5: CopyCustomColorTexture
void SceneSaver::CopyCustomColorTexture(Scene *scene, const FilePath & sceneFolder, Set<String> &errorLog)
{
Entity *land = FindLandscapeEntity(scene);
if(!land) return;
KeyedArchive* customProps = land->GetCustomProperties();
if(!customProps) return;
String pathname = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
if(pathname.empty()) return;
FilePath projectPath = CreateProjectPathFromPath(sceneFolder);
if(projectPath.IsEmpty())
{
Logger::Error("[SceneSaver::CopyCustomColorTexture] Can't copy custom colors texture (%s)", pathname.c_str());
return;
}
FilePath texPathname = projectPath + pathname;
sceneUtils.CopyFile(texPathname, errorLog);
FilePath newTexPathname = sceneUtils.GetNewFilePath(texPathname);
FilePath newProjectPathname = CreateProjectPathFromPath(sceneUtils.dataFolder);
if(newProjectPathname.IsEmpty())
{
Logger::Error("[SceneSaver::CopyCustomColorTexture] Can't save custom colors texture (%s)", pathname.c_str());
return;
}
//save new path to custom colors texture
customProps->SetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP, newTexPathname.GetRelativePathname(newProjectPathname));
}
示例6: Load
void RenderObject::Load(KeyedArchive * archive, SceneFileV2 *sceneFile)
{
if(NULL != archive)
{
if(archive->IsKeyExists("ro.type")) type = archive->GetUInt32("ro.type");
if(archive->IsKeyExists("ro.flags")) flags = archive->GetUInt32("ro.flags");
if(archive->IsKeyExists("ro.debugflags")) debugFlags = archive->GetUInt32("ro.debugflags");
if(archive->IsKeyExists("ro.batchCount"))
{
KeyedArchive *batchesArch = archive->GetArchive("ro.batches");
for(uint32 i = 0; i < archive->GetUInt32("ro.batchCount"); ++i)
{
KeyedArchive *batchArch = batchesArch->GetArchive(KeyedArchive::GenKeyFromIndex(i));
if(NULL != batchArch)
{
RenderBatch *batch = (RenderBatch *) ObjectFactory::Instance()->New(batchArch->GetString("rb.classname"));
if(NULL != batch)
{
batch->Load(batchArch, sceneFile);
AddRenderBatch(batch);
batch->Release();
}
}
}
}
}
AnimatedObject::Load(archive);
}
示例7: ExportAs
void SceneEditorScreenMain::ExportAs(ImageFileFormat format)
{
String formatStr;
switch (format)
{
case DAVA::PNG_FILE:
formatStr = String("png");
break;
case DAVA::PVR_FILE:
formatStr = String("pvr");
break;
case DAVA::DXT_FILE:
formatStr = String("dds");
break;
default:
DVASSERT(0);
return;
}
BodyItem *iBody = FindCurrentBody();
iBody->bodyControl->PushDebugCamera();
SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive();
String filePath = sceneData->GetScenePathname();
String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath();
String::size_type pos = filePath.find(dataSourcePath);
if(String::npos != pos)
{
filePath = filePath.replace(pos, dataSourcePath.length(), "");
}
else
{
DVASSERT(0);
}
// Get project path
KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings();
String projectPath = keyedArchieve->GetString(String("ProjectPath"));
if(!SceneExporter::Instance()) new SceneExporter();
String inFolder = projectPath + String("DataSource/3d/");
SceneExporter::Instance()->SetInFolder(inFolder);
SceneExporter::Instance()->SetOutFolder(projectPath + String("Data/3d/"));
SceneExporter::Instance()->SetExportingFormat(formatStr);
//TODO: how to be with removed nodes?
Set<String> errorsLog;
SceneExporter::Instance()->ExportScene(iBody->bodyControl->GetScene(), filePath, errorsLog);
iBody->bodyControl->PopDebugCamera();
ShowErrorDialog(errorsLog);
}
示例8: ShowSceneGraphMenu
void QSceneGraphTreeView::ShowSceneGraphMenu(const QModelIndex &index, const QPoint &point)
{
if(!index.isValid())
{
return;
}
QMenu menu;
// For "custom" Particles Editor nodes the "generic" ones aren't needed".
if (sceneGraphModel->GetParticlesEditorSceneModelHelper().NeedDisplaySceneEditorPopupMenuItems(index))
{
SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
LandscapesController *landsacpesController = activeScene->GetLandscapesController();
SceneEditorScreenMain *screen = static_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen(SCREEN_MAIN_OLD));
EditorBodyControl *c = screen->FindCurrentBody()->bodyControl;
bool canChangeScene = !landsacpesController->EditorLandscapeIsActive() && !c->LandscapeEditorActive();
if(!canChangeScene)
return;
AddActionToMenu(&menu, QString("Look at Object"), new CommandLockAtObject());
AddActionToMenu(&menu, QString("Remove Object"), new CommandRemoveSceneNode());
AddActionToMenu(&menu, QString("Debug Flags"), new CommandDebugFlags());
Entity *node = static_cast<Entity *>(sceneGraphModel->ItemData(index));
if (node)
{
SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
if(node->GetParent() == activeScene->GetScene())
{
KeyedArchive *properties = node->GetCustomProperties();
if (properties && properties->IsKeyExists(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER)))
{
String filePathname = properties->GetString(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER));
AddActionToMenu(&menu, QString("Remove Root Nodes"), new CommandRemoveRootNodes());
}
}
FilePath filePathForSaveAs(activeScene->GetScenePathname());
AddActionToMenu(&menu, QString("Save Scene As"), new CommandSaveSpecifiedScene(node, filePathForSaveAs));
}
}
// For "custom" Particles Editor nodes the "generic" ones aren't needed".
// We might need more menu items/actions for Particles Editor.
sceneGraphModel->GetParticlesEditorSceneModelHelper().AddPopupMenuItems(menu, index);
connect(&menu, SIGNAL(triggered(QAction *)), this, SLOT(SceneGraphMenuTriggered(QAction *)));
menu.exec(point);
}
示例9: FetchParametersFromIdTxt
// Get test parameters from id.tx
void AutotestingSystem::FetchParametersFromIdTxt()
{
FilePath file = "~res:/Autotesting/id.yaml";
Logger::Debug("AutotestingSystem::FetchParametersFromIdTxt %s", file.GetAbsolutePathname().c_str());
KeyedArchive *option = new KeyedArchive();
bool res = option->LoadFromYamlFile(file);
if (!res)
{
ForceQuit("Couldn't open file " + file.GetAbsolutePathname());
}
buildId = option->GetString("buildId");
buildDate = option->GetString("date");
branch = option->GetString("branch");
framework = option->GetString("framework");
branchRev = option->GetString("branchRev");
frameworkRev = option->GetString("frameworkRev");
SafeRelease(option);
}
示例10: GetCurrentSaveFileName
FilePath CustomColorsSystem::GetCurrentSaveFileName()
{
String currentSaveName;
KeyedArchive* customProps = drawSystem->GetLandscapeCustomProperties();
if (customProps && customProps->IsKeyExists(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP))
{
currentSaveName = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
}
return GetAbsolutePathFromProjectPath(currentSaveName);
}
示例11: CopyReferencedObject
void SceneSaver::CopyReferencedObject( Entity *node, Set<String> &errorLog )
{
KeyedArchive *customProperties = node->GetCustomProperties();
if(customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
{
String path = customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER);
sceneUtils.CopyFile(path, errorLog);
}
for (int i = 0; i < node->GetChildrenCount(); i++)
{
CopyReferencedObject(node->GetChild(i), errorLog);
}
}
示例12: CopyReferencedObject
void SceneSaver::CopyReferencedObject( Entity *node, Set<String> &errorLog )
{
KeyedArchive *customProperties = node->GetCustomProperties();
if(customProperties && customProperties->IsKeyExists("editor.referenceToOwner"))
{
String path = customProperties->GetString("editor.referenceToOwner");
sceneUtils.CopyFile(path, errorLog);
}
for (int i = 0; i < node->GetChildrenCount(); i++)
{
CopyReferencedObject(node->GetChild(i), errorLog);
}
}
示例13: GetCurrentSaveFileName
FilePath LandscapeEditorCustomColors::GetCurrentSaveFileName()
{
if(NULL != workingLandscapeEntity)
{
KeyedArchive* customProps = workingLandscapeEntity->GetCustomProperties();
if(customProps->IsKeyExists(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP))
{
String currentSaveName = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
FilePath projectPath = EditorSettings::Instance()->GetProjectPath();
return projectPath + currentSaveName;
}
}
return FilePath();
}
示例14:
DAVA::Vector<String> RecentFilesManager::GetRecentFiles()
{
DAVA::Vector<String> retVector;
VariantType recentFilesVariant = SettingsManager::GetValue(Settings::Internal_RecentFiles);
if(recentFilesVariant.GetType() == DAVA::VariantType::TYPE_KEYED_ARCHIVE)
{
KeyedArchive* archiveRecentFiles = recentFilesVariant.AsKeyedArchive();
DAVA::uint32 size = archiveRecentFiles->Count();
retVector.resize(size);
for (DAVA::uint32 i = 0; i < size; ++i)
{
retVector[i] = archiveRecentFiles->GetString(Format("%d", i));
}
}
return retVector;
}
示例15: ValidateCustomColorsTexture
void SceneValidator::ValidateCustomColorsTexture(Entity *landscapeEntity, Set<String> &errorsLog)
{
KeyedArchive* customProps = landscapeEntity->GetCustomProperties();
if(customProps->IsKeyExists(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP))
{
String currentSaveName = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
FilePath path = "/" + currentSaveName;
if(!path.IsEqualToExtension(".png"))
{
errorsLog.insert("Custom colors texture has to have .png extension.");
}
String::size_type foundPos = currentSaveName.find("DataSource/3d/");
if(String::npos == foundPos)
{
errorsLog.insert("Custom colors texture has to begin from DataSource/3d/.");
}
}
}