BVB Source Codes

CRYENGINE Show SelectionTreeTemplate.cpp Source code

Return Download CRYENGINE: download SelectionTreeTemplate.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "SelectionTreeTemplate.h"
  5.  
  6. bool SelectionTreeTemplate::LoadFromXML(const SelectionTreeTemplateID& templateID, const BlockyXmlBlocks::Ptr& blocks,
  7.                                         const XmlNodeRef& rootNode, const char* fileName)
  8. {
  9.         const char* treeName;
  10.         rootNode->getAttr("name", &treeName);
  11.         m_name = treeName;
  12.  
  13.         BlockyXmlNodeRef blockyNode(blocks, treeName, rootNode, fileName);
  14.  
  15.         std::vector<XmlNodeRef> pending;
  16.  
  17.         while (XmlNodeRef childNode = blockyNode.next())
  18.         {
  19.                 const char* nodeType = childNode->getTag();
  20.  
  21.                 if (!stricmp(nodeType, "Blocks"))
  22.                         continue;
  23.                 else if (!stricmp(nodeType, "Variables"))
  24.                 {
  25.                         if (!m_variableDecls.LoadFromXML(blocks, childNode, treeName, fileName))
  26.                                 return false;
  27.                 }
  28.                 else if (!stricmp(nodeType, "LeafTranslations"))
  29.                 {
  30.                         pending.push_back(childNode);
  31.                 }
  32.                 else if (!stricmp(nodeType, "SignalVariables"))
  33.                 {
  34.                         pending.push_back(childNode);
  35.                 }
  36.                 else if (m_selectionTree.Empty())
  37.                 {
  38.                         SelectionTree(templateID).Swap(m_selectionTree);
  39.                         m_selectionTree.ReserveNodes(1024);
  40.  
  41.                         SelectionNodeID rootID = m_selectionTree.AddNode(SelectionTreeNode());
  42.                         SelectionTreeNode& root = m_selectionTree.GetNode(rootID);
  43.  
  44.                         if (!root.LoadFromXML(blocks, m_selectionTree, treeName, m_variableDecls, childNode, fileName))
  45.                         {
  46.                                 m_selectionTree.Clear();
  47.                                 return false;
  48.                         }
  49.                 }
  50.                 else
  51.                 {
  52.                         AIWarning("Unexpected tag '%s' in file '%s' at line %d.", childNode->getTag(), fileName, childNode->getLine());
  53.  
  54.                         return false;
  55.                 }
  56.         }
  57.  
  58.         m_selectionTree.Validate();
  59.  
  60.         if (!m_selectionTree.Empty())
  61.         {
  62.                 uint32 pendingCount = pending.size();
  63.                 for (uint32 i = 0; i < pendingCount; ++i)
  64.                 {
  65.                         XmlNodeRef& pendingNode = pending[i];
  66.                         const char* nodeType = pendingNode->getTag();
  67.  
  68.                         if (!stricmp(nodeType, "LeafTranslations"))
  69.                         {
  70.                                 if (!m_translator.LoadFromXML(blocks, m_selectionTree, pendingNode, treeName, fileName))
  71.                                         return false;
  72.                         }
  73.                         else if (!stricmp(nodeType, "SignalVariables"))
  74.                         {
  75.                                 if (!m_signalVariables.LoadFromXML(blocks, m_variableDecls, pendingNode, treeName, fileName))
  76.                                         return false;
  77.                         }
  78.                 }
  79.         }
  80.  
  81.         return true;
  82. }
  83.  
  84. const SelectionTree& SelectionTreeTemplate::GetSelectionTree() const
  85. {
  86.         return m_selectionTree;
  87. }
  88.  
  89. const SelectionVariableDeclarations& SelectionTreeTemplate::GetVariableDeclarations() const
  90. {
  91.         return m_variableDecls;
  92. }
  93.  
  94. const SelectionTranslator& SelectionTreeTemplate::GetTranslator() const
  95. {
  96.         return m_translator;
  97. }
  98.  
  99. const SelectionSignalVariables& SelectionTreeTemplate::GetSignalVariables() const
  100. {
  101.         return m_signalVariables;
  102. }
  103.  
  104. const char* SelectionTreeTemplate::GetName() const
  105. {
  106.         return m_name.c_str();
  107. }
  108.  
  109. bool SelectionTreeTemplate::Valid() const
  110. {
  111.         return !m_selectionTree.Empty();
  112. }
  113.  
downloadSelectionTreeTemplate.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top