OROCHI
 
Loading...
Searching...
No Matches
GxToolCurveKey.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12#if GX_EDITOR
13
14GX_CORE_NAMESPACE_BEGIN()
15
16//===========================================================================
18//===========================================================================
19class GxToolCurveKey : public GxToolResourceEditBase
20{
21 //-------------------------------------------------------------
23 //-------------------------------------------------------------
25public:
26 GX_RTTI_CLASS_NAME_ICON(GxToolCurveKey, GxToolResourceEditBase, "カーブキー編集", GxRtti::ICON_TYPE::CORE)
27 // GxClassBaseReference継承クラス用禁止宣言
29
30 class GxGuiFormCurve;
31
33 //-----------------------------------------------------------
35 //-----------------------------------------------------------
37public:
39 GxToolCurveKey( void );
41 GxToolCurveKey( const GxRect& rect );
43 b32 initialize( void ) override;
44
46 //-----------------------------------------------------------
48 //-----------------------------------------------------------
50public:
52 void update( void ) override;
54 void setResource( GxResBase* pResource ) override;
55
57 void onViewMaxExpand( void ) override;
59 void onViewMinExpand( void ) override;
60
62 void addMenuOwnProperty( GxPropertyTable& table ) override;
63
65 void clearUpdateKeyGui( GxCurveKey* pKey );
67 void updateKeyGui( GxCurveKey* pKey );
69 void setActiveKeyGui( b32 flag );
70
71private:
73 void getPropertyAutoZoomUpdateTime( void* const pValue );
75 void setPropertyAutoZoomUpdateTime( const void* const pValue );
77 void getPropertyAutoZoomUpdateValue( void* const pValue );
79 void setPropertyAutoZoomUpdateValue( const void* const pValue );
80
82 //-----------------------------------------------------------
84 //-----------------------------------------------------------
86public:
88 constexpr void setMenuSaveOnly( void ) { _isSaveOnly = true; }
89
91 //-----------------------------------------------------------
93 //-----------------------------------------------------------
95private:
96 GxGuiSplitter* _pSplitterMain;
97 GxGuiSplitter* _pSplitterValue;
98 GxGuiFormCurve* _pCurveFormGui;
99
100 b32 _isSaveOnly;
101
103};
104
105class GxModCurve;
106
107//===========================================================================
109//===========================================================================
110class GxToolCurveKey::GxGuiFormCurve : public GxGuiForm
111{
112 //-------------------------------------------------------------
114 //-------------------------------------------------------------
116public:
117 GX_RTTI_CLASS(GxToolCurveKey::GxGuiFormCurve, GxGuiForm)
118 // GxClassBaseReference継承クラス用禁止宣言
120
121
122 enum class EDIT_MODE
123 {
124 OFF = 0,
125 SELECT_KEY,
126 MOVE_KEY,
127 MOVE_KEY_HANDLE,
128 MAX
129 };
130
132 //-----------------------------------------------------------
134 //-----------------------------------------------------------
136public:
138 GxGuiFormCurve( GxToolCurveKey* pParent );
140 void cleanup( void ) override;
141
142private:
144 GxGuiFormCurve( void );
145
147 //-----------------------------------------------------------
149 //-----------------------------------------------------------
151public:
153 void update( void ) override;
155 void onDraw( void ) override;
157 void onMouseWheel( const GxPoint2& position, s32 rotate ) override;
159 GX_FORCE_INLINE void onMouseDown( const GxPoint2& position, u32 /*button*/) override { _mousePositionDown = position; }
160
161private:
163 void drawGrid( void );
165 f32 getGridBase( f32 oneGrid );
166
168 void zoomWindow( s32 valueX, s32 valueY );
170 void setZoom( f32 min, f32 max );
172 void setZoom( void );
173
175 void eventAddCurveKey( void );
177 void eventDeleteCurveKey( void );
178
180 void updateEditModeOff( void );
182 void updateEditModeSelectKey( void );
184 void updateEditModeMoveKey( void );
186 void updateEditModeCursorKey( void );
188 void updateEditModeMoveKeyHandle( void );
189
191 GxCurveKey* getCurveKeyFromRect( const GxRect& rect );
193 GxCurveKey* getSelectCurveKeyFromRect( const GxRect& rect );
195 b32 isSelectCurveKey( GxCurveKey* pKey );
196
198 b32 isSelectCurveKeyHandle( const GxRect& rect );
199
201 void initializeSelectKeyPreviousPosition( void );
202
203public:
205 void updateSelectKeyPreviousPosition( void );
206
208 //-----------------------------------------------------------
210 //-----------------------------------------------------------
212public:
214 constexpr GxResCurveKey* getResCurveKey( void ) { return static_cast<GxResCurveKey*>(_pParent->getResource()); }
216 constexpr f32 getTimeFromX( s32 x ) const { return static_cast<f32>( x + _offsetDisplay._x ) * _zoomTime; }
218 constexpr f32 getValueFromY( s32 y ) const { return static_cast<f32>( y + _offsetDisplay._y ) * _zoomValue; }
220 constexpr s32 getXFromTime( f32 time ) const { return static_cast<s32>( time / _zoomTime ) - _offsetDisplay._x; }
222 constexpr s32 getYFromValue( f32 value ) const { return static_cast<s32>( value / _zoomValue ) - _offsetDisplay._y; }
223
225 constexpr f32 getZoomTime( void ) const { return _zoomTime; }
227 constexpr void setZoomTime( f32 time ) { _zoomTime = time; }
229 constexpr f32 getZoomValue( void ) const { return _zoomValue; }
231 constexpr void setZoomValue( f32 value ) { _zoomValue = value; }
232
234 GX_FORCE_INLINE b32 getAutoZoomUpdateTime( void ) const { return _isAutoZoomUpdateTime; }
236 GX_FORCE_INLINE void setAutoZoomUpdateTime( b32 flag ) { _isAutoZoomUpdateTime = flag; }
238 GX_FORCE_INLINE b32 getAutoZoomUpdateValue( void ) const { return _isAutoZoomUpdateValue; }
240 GX_FORCE_INLINE void setAutoZoomUpdateValue( b32 flag ) { _isAutoZoomUpdateValue = flag; }
241
242
244 GX_FORCE_INLINE void setInitializeZoom( b32 flag ) { _isInitializeZoom = flag; }
246 GX_FORCE_INLINE void setOffsetDisplay( const GxPoint2& offset ) { _offsetDisplay = offset; }
247
248private:
250 GX_FORCE_INLINE u32 getSelectCurveKeyCount( void ) const { return _selectCurveKeyList.getCount(); }
252 GX_FORCE_INLINE GxCurveKey* getSelectCurveKey( u32 index ) { return static_cast<GxCurveKey*>(_selectCurveKeyList[index]); }
253
255 //-----------------------------------------------------------
257 //-----------------------------------------------------------
259private:
260 GxToolCurveKey* _pParent;
261 EDIT_MODE _editMode;
262 GxArray _selectCurveKeyList;
263 GxCurveKey* _pSelectCurveKeyStartHandle;
264 GxCurveKey* _pSelectCurveKeyEndHandle;
265 GxVector2* _pKeyOldPosition;
266 GxVector2* _pSelectKeyPreviousPosition;
267 GxPoint2 _addPosition;
268 GxRect _rectSelect;
269 GxPoint2 _mousePosition;
270 GxPoint2 _mousePositionOld;
271 GxPoint2 _mousePositionDown;
272 GxPoint2 _offsetDisplay;
273 f32 _zoomTime;
274 f32 _zoomValue;
275 u32 _delayPopupReleaseCount;
276 GxString _menuDeleteString;
277 b32 _isAutoZoomUpdateTime;
278 b32 _isAutoZoomUpdateValue;
279 GxFloat2 _showRangeMin;
280 GxFloat2 _showRangeMax;
281 f32 _regionRate;
282 b32 _isInitializeZoom;
283
285};
286
287GX_CORE_NAMESPACE_END()
288
289#endif // GX_EDITOR
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
@ MAX
定義数
配列クラス
Definition GxArray.h:18
カーブキークラス
Definition GxModUnitCurvePlay.h:477
プロパティテーブルクラス
Definition GxProperty.h:1641
リソース基底クラス
Definition GxResBase.h:23
カーブキーリソース
Definition GxResCurveKey.h:18
2次元浮動小数点数クラス
Definition GxStruct.h:22
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
文字列型クラス
Definition GxString.h:18
2次元ベクトル
Definition GxVector.h:34
32bitブーリアン
Definition GxDefine.h:173