本文整理汇总了C++中KeyedArchive类的典型用法代码示例。如果您正苦于以下问题:C++ KeyedArchive类的具体用法?C++ KeyedArchive怎么用?C++ KeyedArchive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KeyedArchive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindLandscapeEntity
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));
}
示例2: OnIntPropertyChanged
void NodesPropertyControl::OnIntPropertyChanged(PropertyList *, const String &forKey, int newValue)
{
bool needUpdatePropertyPanel = false;
if(!createNodeProperties)
{
if(currentSceneNode)
{
KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
if(customProperties->IsKeyExists(forKey))
{
customProperties->SetInt32(forKey, newValue);
needUpdatePropertyPanel = true;
}
}
}
if(nodesDelegate)
{
nodesDelegate->NodesPropertyChanged(forKey);
}
if(needUpdatePropertyPanel)
UpdateFieldsForCurrentNode();
}
示例3: if
void NodesPropertyControl::OnStringPropertyChanged(PropertyList *, const String &forKey, const String &newValue)
{
if(forKey == SCENE_NODE_NAME_PROPERTY_NAME) //Entity
{
if(currentSceneNode)
{
currentSceneNode->SetName(newValue);
}
else if(currentDataNode)
{
currentDataNode->SetName(newValue);
}
}
else if(!createNodeProperties)
{
if(currentSceneNode)
{
KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
if(customProperties->IsKeyExists(forKey))
{
customProperties->SetString(forKey, newValue);
}
}
}
if(nodesDelegate)
{
nodesDelegate->NodesPropertyChanged(forKey);
}
}
示例4: OnMinus
void NodesPropertyControl::OnMinus(BaseObject * , void * , void * )
{
if(propControl->GetParent() || listHolder->GetParent())
{
return;
}
if(currentSceneNode)
{
KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
Map<String, VariantType*> propsData = customProperties->GetArchieveData();
int32 size = propsData.size();
if(size)
{
Rect r = listHolder->GetRect();
r.dy = Min(r.dy, (float32)size * CellHeight(NULL, 0));
r.y = listHolder->GetRect().dy - r.dy - ControlsFactory::BUTTON_HEIGHT;
deletionList = new UIList(r, UIList::ORIENTATION_VERTICAL);
ControlsFactory::SetScrollbar(deletionList);
ControlsFactory::CustomizePropertyCell(deletionList, false);
deletionList->SetDelegate(this);
listHolder->AddControl(deletionList);
deletionList->Refresh();
AddControl(listHolder);
}
}
}
示例5: GetActiveScene
void VisibilityToolPanel::RestoreState()
{
SceneEditor2* sceneEditor = GetActiveScene();
bool enabled = sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled();
int32 brushSize = AreaSizeSystemToUI(sceneEditor->visibilityToolSystem->GetBrushSize());
VisibilityToolSystem::eVisibilityToolState state = sceneEditor->visibilityToolSystem->GetState();
int32 areaSizeMin = DEF_AREA_MIN_SIZE;
int32 areaSizeMax = DEF_AREA_MAX_SIZE;
KeyedArchive* customProperties = GetCustomPropertiesArchieve(sceneEditor);
if (customProperties)
{
areaSizeMin = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN, DEF_AREA_MIN_SIZE);
areaSizeMax = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX, DEF_AREA_MAX_SIZE);
}
SetWidgetsState(enabled);
BlockAllSignals(true);
sliderWidgetAreaSize->SetRangeMin(areaSizeMin);
sliderWidgetAreaSize->SetRangeMax(areaSizeMax);
sliderWidgetAreaSize->SetValue(brushSize);
buttonSetVisibilityPoint->setChecked(state == VisibilityToolSystem::VT_STATE_SET_POINT);
buttonSetVisibilityArea->setChecked(state == VisibilityToolSystem::VT_STATE_SET_AREA);
BlockAllSignals(!enabled);
}
示例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: Command
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;
}
示例8: 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);
}
}
示例9: FindCurrentBody
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);
}
示例10: UIListCell
UIListCell *NodesPropertyControl::CellAtIndex(UIList *list, int32 index)
{
UIListCell *c = (UIListCell *)list->GetReusableCell("Deletion list");
if (!c)
{
c = new UIListCell(Rect(0, 0, 200, 20), "Deletion list");
}
if(currentSceneNode)
{
KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
Map<String, VariantType*> propsData = customProperties->GetArchieveData();
int32 i = 0;
for (Map<String, VariantType*>::iterator it = propsData.begin(); it != propsData.end(); ++it, ++i)
{
if(i == index)
{
String name = it->first;
ControlsFactory::CustomizeListCell(c, StringToWString(name));
break;
}
}
}
return c;
}
示例11: ProcessIsSolidChanging
void EditorBodyControl::ProcessIsSolidChanging()
{
Entity *selectedNode = scene->GetSelection();
if(selectedNode)
{
KeyedArchive *customProperties = selectedNode->GetCustomProperties();
if(customProperties && customProperties->IsKeyExists(String(Entity::SCENE_NODE_IS_SOLID_PROPERTY_NAME)))
{
bool isSolid = selectedNode->GetSolid();
selectedNode->SetSolid(!isSolid);
SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
activeScene->RebuildSceneGraphNode(selectedNode);
/* #### dock -->
KeyedArchive *properties = selectedNode->GetCustomProperties();
if(properties && properties->IsKeyExists(String("editor.referenceToOwner")))
{
String filePathname = properties->GetString(String("editor.referenceToOwner"));
activeScene->OpenLibraryForFile(filePathname);
}
<-- */
sceneGraph->SelectNode(selectedNode);
}
}
}
示例12: switch
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);
}
示例13: GetOrCreateCustomProperties
void VisibilityToolPanel::StoreState()
{
KeyedArchive* customProperties = GetOrCreateCustomProperties(GetActiveScene())->GetArchive();
customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN,
sliderWidgetAreaSize->GetRangeMin());
customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX,
sliderWidgetAreaSize->GetRangeMax());
}
示例14: AddActionToMenu
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);
}
示例15: ElementsCount
int32 NodesPropertyControl::ElementsCount(UIList * )
{
if(currentSceneNode)
{
KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
Map<String, VariantType*> propsData = customProperties->GetArchieveData();
return propsData.size();
}
return 0;
}