MaterialShaderDetailsController.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <MaterialShaderDetailsController.h>
  9. #include <AtomLyIntegration/AtomImGuiTools/AtomImGuiToolsBus.h>
  10. #include <AzCore/Component/ComponentApplicationBus.h>
  11. namespace AtomImGuiTools
  12. {
  13. void MaterialShaderDetailsController::SetSelectedEntityId(AZ::EntityId entityId)
  14. {
  15. m_materialDetailsSelectedEntityId = entityId;
  16. }
  17. const AZ::RPI::MeshDrawPacketLods* MaterialShaderDetailsController::GetMeshDrawPackets() const
  18. {
  19. const AZ::RPI::MeshDrawPacketLods* drawPackets = nullptr;
  20. AtomImGuiMeshCallbackBus::EventResult(drawPackets, m_materialDetailsSelectedEntityId, &AtomImGuiMeshCallbacks::GetDrawPackets);
  21. return drawPackets;
  22. }
  23. AZStd::string MaterialShaderDetailsController::GetSelectionName() const
  24. {
  25. AZStd::string name;
  26. AZ::ComponentApplicationBus::BroadcastResult(name, &AZ::ComponentApplicationRequests::GetEntityName, m_materialDetailsSelectedEntityId);
  27. if (!name.empty())
  28. {
  29. name = AZStd::string::format("Entity \"%s\"", name.c_str());
  30. }
  31. return name;
  32. }
  33. } // namespace AtomImGuiTools