/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. // Description : CTrackViewDialog Implementation file. #ifndef CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWDIALOG_H #define CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWDIALOG_H #pragma once #include "IMovieSystem.h" #include "TrackViewNodes.h" #include "TrackViewDopeSheetBase.h" #include "TrackViewCurveEditor.h" #include "TrackViewKeyPropertiesDlg.h" #include "TrackViewSequence.h" #include "TrackViewSequenceManager.h" #include "AnimationContext.h" #include #include class QSplitter; class QComboBox; class QLabel; class CMovieCallback; class CTrackViewFindDlg; class CTrackViewDialog : public QMainWindow , public IAnimationContextListener , public IEditorNotifyListener , public ITrackViewSequenceListener , public ITrackViewSequenceManagerListener , public AZ::EntitySystemBus::Handler , IUndoManagerListener { Q_OBJECT public: friend CMovieCallback; CTrackViewDialog(QWidget* pParent = NULL); ~CTrackViewDialog(); static void RegisterViewClass(); static const GUID& GetClassID(); static CTrackViewDialog* GetCurrentInstance() { return s_pTrackViewDialog; } void InvalidateDopeSheet(); void Update(); void ReloadSequences(); void InvalidateSequence(); void UpdateSequenceLockStatus(); void OnLayerUpdate(int event, CObjectLayer* pLayer); // IAnimationContextListener virtual void OnSequenceChanged(CTrackViewSequence* pNewSequence) override; // ITrackViewSequenceListener virtual void OnSequenceSettingsChanged(CTrackViewSequence* pSequence) override; void UpdateDopeSheetTime(CTrackViewSequence* pSequence); const CTrackViewDopeSheetBase& GetTrackViewDopeSheet() const { return *m_wndDopeSheet; } const AZStd::vector& GetDefaultTracksForEntityNode() const { return m_defaultTracksForEntityNode; } bool IsDoingUndoOperation() const { return m_bDoingUndoOperation; } ////////////////////////////////////////////////////////////////////////// // AZ::EntitySystemBus void OnEntityDestruction(const AZ::EntityId& entityId) override; //~AZ::EntitySystemBus public: // static functions static QString GetEntityIdAsString(const AZ::EntityId& entityId) { return QString::number(static_cast(entityId)); } protected slots: void OnGoToPrevKey(); void OnGoToNextKey(); void OnAddKey(); void OnDelKey(); void OnMoveKey(); void OnSlideKey(); void OnScaleKey(); void OnSyncSelectedTracksToBase(); void OnSyncSelectedTracksFromBase(); void OnAddSequence(); void OnExportFBXSequence(); void OnExportNodeKeysGlobalTime(); void OnDelSequence(); void OnEditSequence(); void OnSequenceComboBox(); void OnAddSelectedNode(); void OnAddDirectorNode(); void OnFindNode(); void OnRecord(); void OnAutoRecord(); void OnAutoRecordStep(); void OnGoToStart(); void OnGoToEnd(); void OnPlay(); void OnPlaySetScale(); void OnStop(); void OnStopHardReset(); void OnPause(); void OnLoop(); void OnSnapNone(); void OnSnapMagnet(); void OnSnapFrame(); void OnSnapTick(); void OnSnapFPS(); void OnCustomizeTrackColors(); void OnBatchRender(); void OnModeDopeSheet(); void OnModeCurveEditor(); void OnOpenCurveEditor(); void OnViewTickInSeconds(); void OnViewTickInFrames(); void OnTracksToolBar(); void OnToggleDisable(); void OnToggleMute(); void OnMuteAll(); void OnUnmuteAll(); protected: void keyPressEvent(QKeyEvent* event) override; #if defined(AZ_PLATFORM_WINDOWS) bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; #endif bool event(QEvent* event) override; private slots: void ReadLayouts(); void FillAddSelectedEntityMenu(); private: enum class ViewMode { TrackView = 1, CurveEditor = 2, Both = 3 }; void setViewMode(ViewMode); void UpdateActions(); void ReloadSequencesComboBox(); void UpdateTracksToolBar(); void ClearTracksToolBar(); void AddButtonToTracksToolBar(const CAnimParamType& paramId, const QIcon& hIcon, const QString& title); void SetNodeForTracksToolBar(CTrackViewAnimNode* pNode) { m_pNodeForTracksToolBar = pNode; } void SetEditLock(bool bLock); void OnGameOrSimModeLock(bool lock); void InitMenu(); void InitToolbar(); void InitSequences(); void OnAddEntityNodeMenu(); void OnEditorNotifyEvent(EEditorNotifyEvent event) override; BOOL OnInitDialog(); void SaveLayouts(); void SaveMiscSettings() const; void ReadMiscSettings(); void SaveTrackColors() const; void ReadTrackColors(); void SetCursorPosText(float fTime); void SaveZoomScrollSettings(); #if defined(AZ_PLATFORM_WINDOWS) bool processRawInput(MSG* pMsg); #endif virtual void OnNodeSelectionChanged(CTrackViewSequence* pSequence) override; virtual void OnNodeRenamed(CTrackViewNode* pNode, const char* pOldName) override; void OnSequenceAdded(CTrackViewSequence* pSequence) override; void OnSequenceRemoved(CTrackViewSequence* pSequence) override; void AddSequenceListeners(CTrackViewSequence* sequence); void RemoveSequenceListeners(CTrackViewSequence* sequence); void AddDialogListeners(); void RemoveDialogListeners(); virtual void BeginUndoTransaction(); virtual void EndUndoTransaction(); void SaveCurrentSequenceToFBX(); void SaveSequenceTimingToXML(); // Instance static CTrackViewDialog* s_pTrackViewDialog; // GUI QSplitter* m_wndSplitter; CTrackViewNodesCtrl* m_wndNodesCtrl; CTrackViewDopeSheetBase* m_wndDopeSheet; QDockWidget* m_wndCurveEditorDock; TrackViewCurveEditorDialog* m_wndCurveEditor; CTrackViewKeyPropertiesDlg* m_wndKeyProperties; CTrackViewFindDlg* m_findDlg; QToolBar* m_mainToolBar; QToolBar* m_keysToolBar; QToolBar* m_playToolBar; QToolBar* m_viewToolBar; QToolBar* m_tracksToolBar; QComboBox* m_sequencesComboBox; QLabel* m_cursorPos; QLabel* m_activeCamStatic; // CryMovie CMovieCallback* m_pMovieCallback; // Current sequence AZ::EntityId m_currentSequenceEntityId; // State bool m_bRecord; bool m_bAutoRecord; bool m_bPlay; bool m_bPause; bool m_bNeedReloadSequence; bool m_bIgnoreUpdates; bool m_bDoingUndoOperation; bool m_lazyInitDone; bool m_bEditLock; bool m_enteringGameOrSimModeLock = false; bool m_needReAddListeners = false; float m_fLastTime; float m_fAutoRecordStep; CTrackViewAnimNode* m_pNodeForTracksToolBar; int m_currentToolBarParamTypeId; std::vector m_toolBarParamTypes; // Default tracks menu AZStd::vector m_defaultTracksForEntityNode; QHash m_actions; ViewMode m_lastMode = ViewMode::TrackView; }; #endif // CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWDIALOG_H