ImportContexts.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <SceneAPI/SceneBuilder/ImportContexts/ImportContexts.h>
  9. #include <SceneAPI/SceneCore/Events/ImportEventContext.h>
  10. namespace AZ
  11. {
  12. namespace SceneAPI
  13. {
  14. namespace SceneBuilder
  15. {
  16. ImportContext::ImportContext(Containers::Scene& scene,
  17. Containers::SceneGraph::NodeIndex currentGraphPosition,
  18. RenamedNodesMap& nodeNameMap)
  19. : m_scene(scene)
  20. , m_currentGraphPosition(currentGraphPosition)
  21. , m_nodeNameMap(nodeNameMap)
  22. {
  23. }
  24. ImportContext::ImportContext(Containers::Scene& scene, RenamedNodesMap& nodeNameMap)
  25. : m_scene(scene)
  26. , m_nodeNameMap(nodeNameMap)
  27. {
  28. m_currentGraphPosition = Containers::SceneGraph::NodeIndex();
  29. }
  30. NodeEncounteredContext::NodeEncounteredContext(Containers::Scene& scene,
  31. Containers::SceneGraph::NodeIndex currentGraphPosition,
  32. RenamedNodesMap& nodeNameMap)
  33. : ImportContext(scene, currentGraphPosition, nodeNameMap)
  34. {
  35. }
  36. NodeEncounteredContext::NodeEncounteredContext(
  37. Events::ImportEventContext& parent, Containers::SceneGraph::NodeIndex currentGraphPosition,
  38. RenamedNodesMap& nodeNameMap)
  39. : ImportContext(parent.GetScene(), currentGraphPosition, nodeNameMap)
  40. {
  41. }
  42. SceneDataPopulatedContextBase::SceneDataPopulatedContextBase(NodeEncounteredContext& parent,
  43. AZStd::shared_ptr<DataTypes::IGraphObject> graphData, const AZStd::string& dataName)
  44. : ImportContext(parent.m_scene, parent.m_currentGraphPosition, parent.m_nodeNameMap)
  45. , m_graphData(AZStd::move(graphData))
  46. , m_dataName(dataName)
  47. {
  48. }
  49. SceneDataPopulatedContextBase::SceneDataPopulatedContextBase(Containers::Scene& scene,
  50. Containers::SceneGraph::NodeIndex currentGraphPosition,
  51. RenamedNodesMap& nodeNameMap,
  52. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData, const AZStd::string& dataName)
  53. : ImportContext(scene, currentGraphPosition, nodeNameMap)
  54. , m_graphData(AZStd::move(nodeData))
  55. , m_dataName(dataName)
  56. {
  57. }
  58. SceneNodeAppendedContextBase::SceneNodeAppendedContextBase(SceneDataPopulatedContextBase& parent,
  59. Containers::SceneGraph::NodeIndex newIndex)
  60. : ImportContext(parent.m_scene, newIndex, parent.m_nodeNameMap)
  61. {
  62. }
  63. SceneNodeAppendedContextBase::SceneNodeAppendedContextBase(Containers::Scene& scene,
  64. Containers::SceneGraph::NodeIndex currentGraphPosition, RenamedNodesMap& nodeNameMap)
  65. : ImportContext(scene, currentGraphPosition, nodeNameMap)
  66. {
  67. }
  68. SceneAttributeDataPopulatedContextBase::SceneAttributeDataPopulatedContextBase(SceneNodeAppendedContextBase& parent,
  69. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData,
  70. const Containers::SceneGraph::NodeIndex attributeNodeIndex, const AZStd::string& dataName)
  71. : ImportContext(parent.m_scene, attributeNodeIndex, parent.m_nodeNameMap)
  72. , m_graphData(AZStd::move(nodeData))
  73. , m_dataName(dataName)
  74. {
  75. }
  76. SceneAttributeNodeAppendedContextBase::SceneAttributeNodeAppendedContextBase(SceneAttributeDataPopulatedContextBase& parent, Containers::SceneGraph::NodeIndex newIndex)
  77. : ImportContext(parent.m_scene, newIndex, parent.m_nodeNameMap)
  78. {
  79. }
  80. SceneNodeAddedAttributesContextBase::SceneNodeAddedAttributesContextBase(SceneNodeAppendedContextBase& parent)
  81. : ImportContext(parent.m_scene, parent.m_currentGraphPosition, parent.m_nodeNameMap)
  82. {
  83. }
  84. SceneNodeFinalizeContextBase::SceneNodeFinalizeContextBase(SceneNodeAddedAttributesContextBase& parent)
  85. : ImportContext(parent.m_scene, parent.m_currentGraphPosition, parent.m_nodeNameMap)
  86. {
  87. }
  88. FinalizeSceneContextBase::FinalizeSceneContextBase(Containers::Scene& scene, RenamedNodesMap& nodeNameMap)
  89. : ImportContext(scene, nodeNameMap)
  90. {
  91. }
  92. } // namespace SceneAPI
  93. } // namespace SceneBuilder
  94. } // namespace AZ