TranslationBuilder.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "TranslationBuilder.h"
  9. #include "TranslationAsset.h"
  10. namespace GraphCanvas
  11. {
  12. AZ::Uuid TranslationAssetWorker::GetUUID()
  13. {
  14. return AZ::Uuid::CreateString("{459EF910-CAAF-465A-BA19-C91979DA5729}");
  15. }
  16. const char* TranslationAssetWorker::GetFingerprintString() const
  17. {
  18. if (m_fingerprintString.empty())
  19. {
  20. // compute it the first time
  21. const AZStd::string runtimeAssetTypeId = azrtti_typeid<TranslationAsset>().ToString<AZStd::string>();
  22. m_fingerprintString = AZStd::string::format("%i%s", GetVersionNumber(), runtimeAssetTypeId.c_str());
  23. }
  24. return m_fingerprintString.c_str();
  25. }
  26. void TranslationAssetWorker::Activate()
  27. {
  28. // Use AssetCatalog service to register ScriptCanvas asset type and extension
  29. m_assetHandler = AZStd::make_unique<TranslationAssetHandler>();
  30. AssetBuilderSDK::AssetBuilderCommandBus::Handler::BusConnect(GetUUID());
  31. }
  32. void TranslationAssetWorker::Deactivate()
  33. {
  34. AssetBuilderSDK::AssetBuilderCommandBus::Handler::BusDisconnect();
  35. if (AZ::Data::AssetManager::Instance().GetHandler(AZ::Data::AssetType{ azrtti_typeid<TranslationAsset>() }))
  36. {
  37. AZ::Data::AssetManager::Instance().UnregisterHandler(m_assetHandler.get());
  38. }
  39. }
  40. void TranslationAssetWorker::ShutDown()
  41. {
  42. m_isShuttingDown = true;
  43. }
  44. }