123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #ifndef CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWCURVEEDITOR_H
- #define CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWCURVEEDITOR_H
- #pragma once
- #include "TrackViewDopeSheetBase.h"
- #include "TrackViewSplineCtrl.h"
- #include "Controls/TimelineCtrl.h"
- #include "TrackViewTimeline.h"
- #include <QWidget>
- namespace Ui
- {
- class TrackViewCurveEditor;
- }
- /** CTrackViewGraph dialog.
- Placed at the same position as tracks dialog, and display spline graphs of track.
- */
- class CTrackViewCurveEditor
- : public QWidget
- , public IAnimationContextListener
- , public IEditorNotifyListener
- , public ITrackViewSequenceListener
- {
- friend class TrackViewCurveEditorDialog;
- public:
- CTrackViewCurveEditor(QWidget* parent);
- virtual ~CTrackViewCurveEditor();
- void SetEditLock(bool bLock);
- void SetFPS(float fps);
- float GetFPS() const;
- void SetTickDisplayMode(ETVTickMode mode);
- CTrackViewSplineCtrl& GetSplineCtrl();
- void ResetSplineCtrlZoomLevel();
- void SetPlayCallback(const std::function<void()>& callback);
- // IAnimationContextListener
- void OnSequenceChanged(CTrackViewSequence* pNewSequence) override;
- void OnTimeChanged(float newTime) override;
- protected:
- void showEvent(QShowEvent* event) override;
- private:
- void OnSplineChange();
- void OnSplineCmd(UINT cmd);
- void OnSplineCmdUpdateUI();
- void OnTimelineChange();
- void OnSplineTimeMarkerChange();
- // IEditorNotifyListener
- void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
- //ITrackViewSequenceListener
- void OnKeysChanged(CTrackViewSequence* pSequence) override;
- void OnKeyAdded(CTrackViewKeyHandle& addedKeyHandle) override;
- void OnKeySelectionChanged(CTrackViewSequence* pSequence) override;
- void OnNodeChanged(CTrackViewNode* pNode, ENodeChangeType type) override;
- void OnNodeSelectionChanged(CTrackViewSequence* pSequence) override;
- void OnSequenceSettingsChanged(CTrackViewSequence* pSequence) override;
- //~ITrackViewSequenceListener
- void UpdateSplines();
- void UpdateTimeRange(CTrackViewSequence* pSequence);
- void AddSpline(CTrackViewTrack* pTrack);
- TrackView::CTrackViewTimelineWidget m_timelineCtrl;
- bool m_bIgnoreSelfEvents;
- bool m_bLevelClosing;
- QScopedPointer<Ui::TrackViewCurveEditor> m_ui;
- };
- class TrackViewCurveEditorDialog
- : public QWidget
- , public ITrackViewSequenceListener
- , public IAnimationContextListener
- {
- public:
- TrackViewCurveEditorDialog(QWidget* parent);
- virtual ~TrackViewCurveEditorDialog() {}
- void SetPlayCallback(const std::function<void()>& callback) { m_widget->SetPlayCallback(callback); }
- void SetEditLock(bool bLock) { m_widget->SetEditLock(bLock); }
- CTrackViewSplineCtrl& GetSplineCtrl(){ return m_widget->GetSplineCtrl(); }
- void SetFPS(float fps) { m_widget->SetFPS(fps); }
- float GetFPS() const { return m_widget->GetFPS(); }
- void SetTickDisplayMode(ETVTickMode mode) { m_widget->SetTickDisplayMode(mode); }
- void OnSequenceChanged(CTrackViewSequence* pNewSequence) override { m_widget->OnSequenceChanged(pNewSequence); }
- void OnTimeChanged(float newTime) override { m_widget->OnTimeChanged(newTime); }
- // ITrackViewSequenceListener delegation to m_widget
- void OnKeysChanged(CTrackViewSequence* pSequence) override { m_widget->OnKeysChanged(pSequence); }
- void OnKeyAdded(CTrackViewKeyHandle& addedKeyHandle) override { m_widget->OnKeyAdded(addedKeyHandle); }
- void OnKeySelectionChanged(CTrackViewSequence* pSequence) override { m_widget->OnKeySelectionChanged(pSequence); }
- void OnNodeChanged(CTrackViewNode* pNode, ENodeChangeType type) override { m_widget->OnNodeChanged(pNode, type); }
- void OnNodeSelectionChanged(CTrackViewSequence* pSequence) override { m_widget->OnNodeSelectionChanged(pSequence); }
- void OnSequenceSettingsChanged(CTrackViewSequence* pSequence) override { m_widget->OnSequenceSettingsChanged(pSequence); }
- //~ITrackViewSequenceListener
- private:
- CTrackViewCurveEditor* m_widget;
- };
- #endif // CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWCURVEEDITOR_H
|