SelectLightAnimationDialog.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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* pMovieSystem = GetIEditor()->GetMovieSystem();
  29. if (pMovieSystem)
  30. {
  31. for (int i = 0; i < pMovieSystem->GetNumSequences(); ++i)
  32. {
  33. IAnimSequence* pSequence = pMovieSystem->GetSequence(i);
  34. if ((pSequence->GetFlags() & IAnimSequence::eSeqFlags_LightAnimationSet) == 0)
  35. {
  36. continue;
  37. }
  38. for (int k = 0; k < pSequence->GetNodeCount(); ++k)
  39. {
  40. assert(pSequence->GetNode(k)->GetType() == AnimNodeType::Light);
  41. if (pSequence->GetNode(k)->GetType() != AnimNodeType::Light)
  42. {
  43. continue;
  44. }
  45. SItem item;
  46. item.name = pSequence->GetNode(k)->GetName();
  47. outItems.push_back(item);
  48. }
  49. return;
  50. }
  51. }
  52. }
  53. #include <moc_SelectLightAnimationDialog.cpp>