当前位置: 首页>>代码示例>>C++>>正文


C++ Entity::GetCustomProperties方法代码示例

本文整理汇总了C++中Entity::GetCustomProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetCustomProperties方法的具体用法?C++ Entity::GetCustomProperties怎么用?C++ Entity::GetCustomProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity::GetCustomProperties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
        }
    }
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:27,代码来源:EditorBodyControl.cpp

示例2: 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;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:60,代码来源:SceneGraphCommands.cpp

示例3: 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));
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:32,代码来源:SceneSaver.cpp

示例4: 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);
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:55,代码来源:QSceneGraphTreeView.cpp


注:本文中的Entity::GetCustomProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。