ScriptingPrefabLoader.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 <Prefab/ScriptingPrefabLoader.h>
  9. namespace AzToolsFramework::Prefab
  10. {
  11. void ScriptingPrefabLoader::Connect(PrefabLoaderInterface* prefabLoaderInterface)
  12. {
  13. AZ_Assert(prefabLoaderInterface, "prefabLoaderInterface must not be null");
  14. m_prefabLoaderInterface = prefabLoaderInterface;
  15. PrefabLoaderScriptingBus::Handler::BusConnect();
  16. }
  17. void ScriptingPrefabLoader::Disconnect()
  18. {
  19. PrefabLoaderScriptingBus::Handler::BusDisconnect();
  20. }
  21. AZ::Outcome<AZStd::string, void> ScriptingPrefabLoader::SaveTemplateToString(TemplateId templateId)
  22. {
  23. AZStd::string json;
  24. if (m_prefabLoaderInterface->SaveTemplateToString(templateId, json))
  25. {
  26. return AZ::Success(json);
  27. }
  28. return AZ::Failure();
  29. }
  30. } // namespace AzToolsFramework::Prefab