EditorStateParentPass.cpp 1.4 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 <Pass/State/EditorStateParentPass.h>
  9. #include <Pass/State/EditorStateParentPassData.h>
  10. #include <Atom/RPI.Public/Pass/PassUtils.h>
  11. namespace AZ::Render
  12. {
  13. RPI::Ptr<EditorStateParentPass> EditorStateParentPass::Create(const RPI::PassDescriptor& descriptor)
  14. {
  15. RPI::Ptr<EditorStateParentPass> pass = aznew EditorStateParentPass(descriptor);
  16. return AZStd::move(pass);
  17. }
  18. EditorStateParentPass::EditorStateParentPass(const RPI::PassDescriptor& descriptor)
  19. : AZ::RPI::ParentPass(descriptor)
  20. , m_passDescriptor(descriptor)
  21. {
  22. }
  23. bool EditorStateParentPass::IsEnabled() const
  24. {
  25. const RPI::EditorStateParentPassData* passData =
  26. RPI::PassUtils::GetPassData<RPI::EditorStateParentPassData>(m_passDescriptor);
  27. if (passData == nullptr)
  28. {
  29. AZ_Error(
  30. "EditorStateParentPass", false, "[EditorStateParentPassData '%s']: Trying to construct without valid EditorStateParentPassData!", GetPathName().GetCStr());
  31. return false;
  32. }
  33. return passData->editorStatePass->IsEnabled();
  34. }
  35. } // namespace AZ::Render