SelectLightAnimationDialog.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // Description : Used in a property item to select a light animation
  9. #include "EditorDefs.h"
  10. #include "SelectLightAnimationDialog.h"
  11. // CryCommon
  12. #include <CryCommon/Maestro/Types/AnimNodeType.h> // for AnimNodeType
  13. //////////////////////////////////////////////////////////////////////////
  14. CSelectLightAnimationDialog::CSelectLightAnimationDialog(QWidget* pParent)
  15. : CGenericSelectItemDialog(pParent)
  16. {
  17. setWindowTitle(tr("Select Light Animation"));
  18. }
  19. //////////////////////////////////////////////////////////////////////////
  20. void CSelectLightAnimationDialog::OnInitDialog()
  21. {
  22. SetMode(eMODE_LIST);
  23. CGenericSelectItemDialog::OnInitDialog();
  24. }
  25. //////////////////////////////////////////////////////////////////////////
  26. void CSelectLightAnimationDialog::GetItems(std::vector<SItem>& outItems)
  27. {
  28. IMovieSystem* movieSystem = AZ::Interface<IMovieSystem>::Get();
  29. if (!movieSystem)
  30. {
  31. return;
  32. }
  33. for (int i = 0; i < movieSystem->GetNumSequences(); ++i)
  34. {
  35. IAnimSequence* pSequence = movieSystem->GetSequence(i);
  36. if ((pSequence->GetFlags() & IAnimSequence::eSeqFlags_LightAnimationSet) == 0)
  37. {
  38. continue;
  39. }
  40. for (int k = 0; k < pSequence->GetNodeCount(); ++k)
  41. {
  42. AZ_Assert(pSequence->GetNode(k)->GetType() == AnimNodeType::Light, "Expected Node Type Light");
  43. if (pSequence->GetNode(k)->GetType() != AnimNodeType::Light)
  44. {
  45. continue;
  46. }
  47. SItem item;
  48. item.name = pSequence->GetNode(k)->GetName();
  49. outItems.push_back(item);
  50. }
  51. return;
  52. }
  53. }
  54. #include <moc_SelectLightAnimationDialog.cpp>