RhythmGame 1.4.3
Loading...
Searching...
No Matches
Lr2TimelineState.h
Go to the documentation of this file.
1#pragma once
2
3#include "Lr2SkinClock.h"
7
8#include <QObject>
9#include <QMetaObject>
10#include <QPointer>
11#include <QSet>
12#include <QVariant>
13#include <QVariantList>
14#include <QVector>
15#include <QtQml/qqmlregistration.h>
16
17class Lr2TimelineState : public QObject {
18 Q_OBJECT
19 QML_ELEMENT
21 Q_PROPERTY(int clockMode READ clockMode WRITE setClockMode NOTIFY clockModeChanged)
22 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
23 Q_PROPERTY(QVariantList dsts READ dsts WRITE setDsts NOTIFY dstsChanged)
24 Q_PROPERTY(int skinTime READ skinTime WRITE setSkinTime NOTIFY skinTimeChanged)
25 Q_PROPERTY(QVariant timers READ timers WRITE setTimers NOTIFY timersChanged)
26 Q_PROPERTY(int timerFire READ timerFire WRITE setTimerFire NOTIFY timerFireChanged)
39 Q_PROPERTY(bool hasState READ hasState NOTIFY hasStateChanged)
40 Q_PROPERTY(qreal stateX READ stateX NOTIFY stateChanged)
41 Q_PROPERTY(qreal stateY READ stateY NOTIFY stateChanged)
42 Q_PROPERTY(qreal stateW READ stateW NOTIFY stateChanged)
43 Q_PROPERTY(qreal stateH READ stateH NOTIFY stateChanged)
44 Q_PROPERTY(qreal stateA READ stateA NOTIFY stateChanged)
45 Q_PROPERTY(qreal stateR READ stateR NOTIFY stateChanged)
46 Q_PROPERTY(qreal stateG READ stateG NOTIFY stateChanged)
47 Q_PROPERTY(qreal stateB READ stateB NOTIFY stateChanged)
48 Q_PROPERTY(qreal stateAngle READ stateAngle NOTIFY stateChanged)
49 Q_PROPERTY(int stateCenter READ stateCenter NOTIFY stateChanged)
50 Q_PROPERTY(qreal stateSortId READ stateSortId NOTIFY stateChanged)
51 Q_PROPERTY(int stateBlend READ stateBlend NOTIFY stateChanged)
52 Q_PROPERTY(int stateFilter READ stateFilter NOTIFY stateChanged)
53 Q_PROPERTY(int stateOp1 READ stateOp1 NOTIFY stateChanged)
54 Q_PROPERTY(int stateOp2 READ stateOp2 NOTIFY stateChanged)
55 Q_PROPERTY(int stateOp3 READ stateOp3 NOTIFY stateChanged)
56 Q_PROPERTY(int stateOp4 READ stateOp4 NOTIFY stateChanged)
63 Q_PROPERTY(int firstTimer READ firstTimer NOTIFY analysisChanged)
64 Q_PROPERTY(int firstSortId READ firstSortId NOTIFY analysisChanged)
65
66public:
76 Q_ENUM(ClockMode)
77
78 explicit Lr2TimelineState(QObject* parent = nullptr);
79
80 Lr2SkinClock* skinClock() const;
81 void setSkinClock(Lr2SkinClock* clock);
82
83 int clockMode() const;
84 void setClockMode(int mode);
85
86 bool isEnabled() const;
87 void setEnabled(bool enabled);
88
89 QVariantList dsts() const;
90 void setDsts(const QVariantList& dsts);
91
92 int skinTime() const;
93 void setSkinTime(int time);
94
95 QVariant timers() const;
96 void setTimers(const QVariant& timers);
97
98 int timerFire() const;
99 void setTimerFire(int timerFire);
100
103
104 QVariant activeOptions() const;
105 void setActiveOptions(const QVariant& options);
106
107 bool sliderTranslationEnabled() const;
109
110 qreal sliderPosition() const;
111 void setSliderPosition(qreal position);
112
113 int sliderRange() const;
114 void setSliderRange(int range);
115
116 int sliderDirection() const;
117 void setSliderDirection(int direction);
118
119 bool dstOffsetsEnabled() const;
120 void setDstOffsetsEnabled(bool enabled);
121
122 qreal dstOffsetLiftY() const;
123 void setDstOffsetLiftY(qreal value);
124
125 qreal dstOffsetLaneCoverY() const;
126 void setDstOffsetLaneCoverY(qreal value);
127
128 qreal dstOffsetHiddenY() const;
129 void setDstOffsetHiddenY(qreal value);
130
131 qreal dstOffsetHiddenA() const;
132 void setDstOffsetHiddenA(qreal value);
133
135 bool hasState() const;
136 qreal stateX() const;
137 qreal stateY() const;
138 qreal stateW() const;
139 qreal stateH() const;
140 qreal stateA() const;
141 qreal stateR() const;
142 qreal stateG() const;
143 qreal stateB() const;
144 qreal stateAngle() const;
145 int stateCenter() const;
146 qreal stateSortId() const;
147 int stateBlend() const;
148 int stateFilter() const;
149 int stateOp1() const;
150 int stateOp2() const;
151 int stateOp3() const;
152 int stateOp4() const;
153 bool canUseStaticState() const;
155 bool usesActiveOptions() const;
156 bool usesDynamicTimer() const;
157 bool loopsContinuously() const;
158 int scratchRotationSide() const;
159 int firstTimer() const;
160 int firstSortId() const;
161
162 Q_INVOKABLE Lr2TimelineStateValue stateFor(const QVariantList& dsts,
163 int skinTime,
164 const QVariant& timers,
165 const QVariant& activeOptions) const;
166 Q_INVOKABLE Lr2TimelineStateValue stateFromTimerFire(const QVariantList& dsts,
167 int skinTime,
168 int timerFire,
169 const QVariant& activeOptions) const;
170 Q_INVOKABLE Lr2TimelineStateValue staticStateFor(const QVariantList& dsts) const;
171 Q_INVOKABLE bool canUseStaticStateFor(const QVariantList& dsts) const;
172 Q_INVOKABLE bool usesActiveOptionsFor(const QVariantList& dsts) const;
173 Q_INVOKABLE bool usesDynamicTimerFor(const QVariantList& dsts) const;
174 Q_INVOKABLE bool loopsContinuouslyFor(const QVariantList& dsts) const;
175 Q_INVOKABLE int scratchRotationSideFor(const QVariantList& dsts) const;
176 Q_INVOKABLE int firstTimerFor(const QVariantList& dsts) const;
177 Q_INVOKABLE int firstSortIdFor(const QVariantList& dsts) const;
178 Q_INVOKABLE int timerFireFor(const QVariant& timers, int timerIdx) const;
179 Q_INVOKABLE int sourceTimerFor(const QVariant& src) const;
180 Q_INVOKABLE bool sourceUsesDynamicTimer(const QVariant& src) const;
181 Q_INVOKABLE bool sourceCyclesContinuously(const QVariant& src) const;
182
183signals:
198
199private:
202
203 void rebuildDsts();
204 void rebuildActiveOptionSet();
205 void rebuildAnalysis();
206 void reconnectClock();
207 void reconnectActiveOptionsState();
208 void activeOptionsStateDidChange();
209 void updateSkinTimeFromClock();
210 void updateAnimationLimit();
211 void updateState();
212 int clockSkinTime() const;
213 int effectiveSkinTime(int requestedTime) const;
214 qreal effectiveTimerFire() const;
215 qreal timerValue(int timerIdx) const;
216 State translatedSliderState(State state) const;
217 State offsetDstState(State state) const;
218 void assignState(const State& state);
219
220 bool m_enabled = true;
221 QPointer<Lr2SkinClock> m_skinClock;
222 QMetaObject::Connection m_clockConnection;
223 int m_clockMode = ManualClock;
224 QVariantList m_dstsValue;
225 QVector<Dst> m_dsts;
226 int m_requestedSkinTime = 0;
227 int m_effectiveSkinTime = 0;
228 QVariant m_timers;
229 int m_timerFire = -2147483648;
230 QPointer<Lr2SkinElementActiveOptionsState> m_activeOptionsState;
231 QMetaObject::Connection m_activeOptionsStateConnection;
232 QVariant m_activeOptions;
233 QSet<int> m_activeOptionSet;
234 bool m_sliderTranslationEnabled = false;
235 qreal m_sliderPosition = 0.0;
236 int m_sliderRange = 0;
237 int m_sliderDirection = 0;
238 bool m_dstOffsetsEnabled = false;
239 qreal m_dstOffsetLiftY = 0.0;
240 qreal m_dstOffsetLaneCoverY = 0.0;
241 qreal m_dstOffsetHiddenY = 0.0;
242 qreal m_dstOffsetHiddenA = 0.0;
243 State m_state;
244 int m_animationLimit = -1;
245 bool m_canUseStaticState = false;
246 bool m_usesActiveOptions = false;
247 bool m_usesDynamicTimer = false;
248 bool m_loopsContinuously = false;
249 int m_scratchRotationSide = 0;
250 int m_firstTimer = 0;
251 int m_firstSortId = 0;
252};
double value
Definition BmsNotesData.cpp:35
Definition Lr2SkinClock.h:7
Definition Lr2SkinElementActiveOptionsState.h:8
Definition Lr2TimelineStateValue.h:8
Definition Lr2TimelineState.h:17
Q_INVOKABLE int scratchRotationSideFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:478
int stateBlend
Definition Lr2TimelineState.h:51
void setTimerFire(int timerFire)
Definition Lr2TimelineState.cpp:117
Lr2TimelineStateValue staticState
Definition Lr2TimelineState.h:58
QVariantList dsts
Definition Lr2TimelineState.h:23
int stateCenter
Definition Lr2TimelineState.h:49
Q_INVOKABLE bool canUseStaticStateFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:462
void setDstOffsetsEnabled(bool enabled)
Definition Lr2TimelineState.cpp:227
Q_INVOKABLE Lr2TimelineStateValue stateFromTimerFire(const QVariantList &dsts, int skinTime, int timerFire, const QVariant &activeOptions) const
Definition Lr2TimelineState.cpp:438
void setSliderPosition(qreal position)
Definition Lr2TimelineState.cpp:181
qreal dstOffsetHiddenA
Definition Lr2TimelineState.h:37
void timerFireChanged()
qreal stateB
Definition Lr2TimelineState.h:47
qreal stateG
Definition Lr2TimelineState.h:46
int skinTime
Definition Lr2TimelineState.h:24
void setDstOffsetHiddenA(qreal value)
Definition Lr2TimelineState.cpp:292
int firstTimer
Definition Lr2TimelineState.h:63
qreal stateW
Definition Lr2TimelineState.h:42
qreal stateY
Definition Lr2TimelineState.h:41
int stateOp1
Definition Lr2TimelineState.h:53
Q_INVOKABLE bool usesDynamicTimerFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:470
void setTimers(const QVariant &timers)
Definition Lr2TimelineState.cpp:103
qreal sliderPosition
Definition Lr2TimelineState.h:30
bool hasState
Definition Lr2TimelineState.h:39
int sliderDirection
Definition Lr2TimelineState.h:32
void dstOffsetsChanged()
void setActiveOptions(const QVariant &options)
Definition Lr2TimelineState.cpp:149
bool sliderTranslationEnabled
Definition Lr2TimelineState.h:29
void setSliderDirection(int direction)
Definition Lr2TimelineState.cpp:213
int firstSortId
Definition Lr2TimelineState.h:64
void analysisChanged()
void skinTimeChanged()
void setDsts(const QVariantList &dsts)
Definition Lr2TimelineState.cpp:61
void setDstOffsetLiftY(qreal value)
Definition Lr2TimelineState.cpp:241
void setSliderTranslationEnabled(bool enabled)
Definition Lr2TimelineState.cpp:167
void setEnabled(bool enabled)
Definition Lr2TimelineState.cpp:46
Q_INVOKABLE Lr2TimelineStateValue stateFor(const QVariantList &dsts, int skinTime, const QVariant &timers, const QVariant &activeOptions) const
Definition Lr2TimelineState.cpp:419
void setSliderRange(int range)
Definition Lr2TimelineState.cpp:198
QVariant activeOptions
Definition Lr2TimelineState.h:28
bool usesDynamicTimer
Definition Lr2TimelineState.h:60
Q_INVOKABLE bool loopsContinuouslyFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:474
void sliderTranslationChanged()
void activeOptionsStateChanged()
qreal stateAngle
Definition Lr2TimelineState.h:48
bool dstOffsetsEnabled
Definition Lr2TimelineState.h:33
qreal dstOffsetLaneCoverY
Definition Lr2TimelineState.h:35
void setDstOffsetLaneCoverY(qreal value)
Definition Lr2TimelineState.cpp:258
bool enabled
Definition Lr2TimelineState.h:22
int stateOp3
Definition Lr2TimelineState.h:55
void clockModeChanged()
void skinClockChanged()
Q_INVOKABLE int timerFireFor(const QVariant &timers, int timerIdx) const
Definition Lr2TimelineState.cpp:490
Q_INVOKABLE int sourceTimerFor(const QVariant &src) const
Definition Lr2TimelineState.cpp:496
Q_INVOKABLE int firstSortIdFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:486
QVariant timers
Definition Lr2TimelineState.h:25
bool isEnabled() const
Definition Lr2TimelineState.cpp:42
int stateFilter
Definition Lr2TimelineState.h:52
Q_INVOKABLE bool sourceCyclesContinuously(const QVariant &src) const
Definition Lr2TimelineState.cpp:506
QML_ELEMENTLr2SkinClock * skinClock
Definition Lr2TimelineState.h:20
bool usesActiveOptions
Definition Lr2TimelineState.h:59
void hasStateChanged()
void activeOptionsChanged()
qreal stateX
Definition Lr2TimelineState.h:40
int timerFire
Definition Lr2TimelineState.h:26
bool loopsContinuously
Definition Lr2TimelineState.h:61
void setDstOffsetHiddenY(qreal value)
Definition Lr2TimelineState.cpp:275
void setClockMode(int mode)
Definition Lr2TimelineState.cpp:31
Q_INVOKABLE bool usesActiveOptionsFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:466
int stateOp2
Definition Lr2TimelineState.h:54
Q_INVOKABLE bool sourceUsesDynamicTimer(const QVariant &src) const
Definition Lr2TimelineState.cpp:501
void setSkinTime(int time)
Definition Lr2TimelineState.cpp:78
Lr2TimelineStateValue state
Definition Lr2TimelineState.h:38
int stateOp4
Definition Lr2TimelineState.h:56
qreal stateSortId
Definition Lr2TimelineState.h:50
qreal stateH
Definition Lr2TimelineState.h:43
bool canUseStaticState
Definition Lr2TimelineState.h:57
Q_INVOKABLE Lr2TimelineStateValue staticStateFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:453
Q_INVOKABLE int firstTimerFor(const QVariantList &dsts) const
Definition Lr2TimelineState.cpp:482
void setActiveOptionsState(Lr2SkinElementActiveOptionsState *state)
Definition Lr2TimelineState.cpp:131
qreal stateA
Definition Lr2TimelineState.h:44
int scratchRotationSide
Definition Lr2TimelineState.h:62
qreal dstOffsetHiddenY
Definition Lr2TimelineState.h:36
ClockMode
Definition Lr2TimelineState.h:67
@ SelectLiveClock
Definition Lr2TimelineState.h:73
@ RenderClock
Definition Lr2TimelineState.h:69
@ ManualClock
Definition Lr2TimelineState.h:68
@ BarClock
Definition Lr2TimelineState.h:71
@ SelectSourceClock
Definition Lr2TimelineState.h:70
@ GlobalClock
Definition Lr2TimelineState.h:72
@ SelectInfoClock
Definition Lr2TimelineState.h:74
Lr2SkinElementActiveOptionsState * activeOptionsState
Definition Lr2TimelineState.h:27
void setSkinClock(Lr2SkinClock *clock)
Definition Lr2TimelineState.cpp:17
qreal stateR
Definition Lr2TimelineState.h:45
int sliderRange
Definition Lr2TimelineState.h:31
int clockMode
Definition Lr2TimelineState.h:21
qreal dstOffsetLiftY
Definition Lr2TimelineState.h:34
Definition Lr2SkinRuntimeTypes.h:33