Scene.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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/SceneCore/Containers/Scene.h>
  9. #include <AzCore/RTTI/BehaviorContext.h>
  10. namespace AZ
  11. {
  12. namespace SceneAPI
  13. {
  14. namespace Containers
  15. {
  16. Scene::Scene(const AZStd::string& name)
  17. : m_name(name)
  18. {
  19. }
  20. Scene::Scene(AZStd::string&& name)
  21. : m_name(AZStd::move(name))
  22. {
  23. }
  24. void Scene::SetSource(const AZStd::string& filename, const Uuid& guid)
  25. {
  26. m_sourceFilename = filename;
  27. m_sourceGuid = guid;
  28. }
  29. void Scene::SetSource(AZStd::string&& filename, const Uuid& guid)
  30. {
  31. m_sourceFilename = AZStd::move(filename);
  32. m_sourceGuid = guid;
  33. }
  34. const AZStd::string& Scene::GetSourceFilename() const
  35. {
  36. return m_sourceFilename;
  37. }
  38. const Uuid& Scene::GetSourceGuid() const
  39. {
  40. return m_sourceGuid;
  41. }
  42. void Scene::SetWatchFolder(const AZStd::string& watchFolder)
  43. {
  44. m_watchFolder = watchFolder;
  45. }
  46. const AZStd::string& Scene::GetWatchFolder() const
  47. {
  48. return m_watchFolder;
  49. }
  50. void Scene::SetManifestFilename(const AZStd::string& name)
  51. {
  52. m_manifestFilename = name;
  53. }
  54. void Scene::SetManifestFilename(AZStd::string&& name)
  55. {
  56. m_manifestFilename = AZStd::move(name);
  57. }
  58. const AZStd::string& Scene::GetManifestFilename() const
  59. {
  60. return m_manifestFilename;
  61. }
  62. SceneGraph& Scene::GetGraph()
  63. {
  64. return m_graph;
  65. }
  66. const SceneGraph& Scene::GetGraph() const
  67. {
  68. return m_graph;
  69. }
  70. SceneManifest& Scene::GetManifest()
  71. {
  72. return m_manifest;
  73. }
  74. const SceneManifest& Scene::GetManifest() const
  75. {
  76. return m_manifest;
  77. }
  78. const AZStd::string& Scene::GetName() const
  79. {
  80. return m_name;
  81. }
  82. void Scene::SetOriginalSceneOrientation(SceneOrientation orientation)
  83. {
  84. m_originalOrientation = orientation;
  85. }
  86. Scene::SceneOrientation Scene::GetOriginalSceneOrientation() const
  87. {
  88. return m_originalOrientation;
  89. }
  90. void Scene::Reflect(ReflectContext* context)
  91. {
  92. AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context);
  93. if (behaviorContext)
  94. {
  95. behaviorContext->Class<Scene>()
  96. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
  97. ->Attribute(AZ::Script::Attributes::Module, "scene")
  98. ->Property("name", BehaviorValueGetter(&Scene::m_name), nullptr)
  99. ->Property("manifestFilename", BehaviorValueGetter(&Scene::m_manifestFilename), nullptr)
  100. ->Property("sourceFilename", BehaviorValueGetter(&Scene::m_sourceFilename), nullptr)
  101. ->Property("sourceGuid", BehaviorValueGetter(&Scene::m_sourceGuid), nullptr)
  102. ->Property("graph", BehaviorValueGetter(&Scene::m_graph), nullptr)
  103. ->Property("manifest", BehaviorValueGetter(&Scene::m_manifest), nullptr)
  104. ->Property("watchFolder", BehaviorValueGetter(&Scene::m_watchFolder), nullptr)
  105. ->Constant("SceneOrientation_YUp", BehaviorConstant(SceneOrientation::YUp))
  106. ->Constant("SceneOrientation_ZUp", BehaviorConstant(SceneOrientation::ZUp))
  107. ->Constant("SceneOrientation_XUp", BehaviorConstant(SceneOrientation::XUp))
  108. ->Constant("SceneOrientation_NegXUp", BehaviorConstant(SceneOrientation::NegXUp))
  109. ->Constant("SceneOrientation_NegYUp", BehaviorConstant(SceneOrientation::NegYUp))
  110. ->Constant("SceneOrientation_NegZUp", BehaviorConstant(SceneOrientation::NegZUp))
  111. ->Method("GetOriginalSceneOrientation", [](Scene* self) -> int
  112. {
  113. return aznumeric_cast<int>(self->GetOriginalSceneOrientation());
  114. })
  115. ;
  116. }
  117. }
  118. } // Containers
  119. } // SceneAPI
  120. } // AZ