OROCHI
 
Loading...
Searching...
No Matches
GxToolRealTimeDemo.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_EDITOR
14
15GX_UTILITY_NAMESPACE_BEGIN()
16
17//===========================================================================
19//===========================================================================
20class GxToolRealTimeDemo : public GxToolResourceEditBase
21{
22 //-----------------------------------------------------------
24 //-----------------------------------------------------------
26public:
27 class GxUnitListUI;
28 class GxGuiKeyFrame;
29 // RTTI定義
30 GX_RTTI_CLASS_NAME_ICON(GxToolRealTimeDemo, GxToolResourceEditBase, "リアルタイムデモ編集", GxRtti::ICON_TYPE::UTILITY)
31
32private:
34 class GxDefaultProp : public GxClassBaseReference
35 {
36 //-----------------------------------------------------------
38 //-----------------------------------------------------------
40 public:
41 // RTTI定義
42 GX_RTTI_CLASS(GxDefaultProp, GxClassBaseReference)
43
44
45 //-----------------------------------------------------------
47 //-----------------------------------------------------------
49
50 u32 _parentId;
51 GX_CSTR _propertyName;
52 u32 _interpolateType;
53
55 };
56
58 //-----------------------------------------------------------
60 //-----------------------------------------------------------
62public:
64 GxToolRealTimeDemo(void);
66 ~GxToolRealTimeDemo(void) override;
67
69 class GxMoveParamProp : public GxClassBaseReference
70 {
71 //-----------------------------------------------------------
73 //-----------------------------------------------------------
75 public:
76 // RTTI定義
77 GX_RTTI_CLASS(GxMoveParamProp, GxClassBaseReference)
78
79
80 //-----------------------------------------------------------
82 //-----------------------------------------------------------
84
86 GxMoveParamProp(void)
87 : _unitNodeId(0)
88 , _propertyId(0)
89 , _rowNumber(0)
90 {}
91
93 //-----------------------------------------------------------
95 //-----------------------------------------------------------
97
98 u32 _unitNodeId;
99 u32 _propertyId;
100 u32 _rowNumber;
101
103 };
104
106 //-----------------------------------------------------------
108 //-----------------------------------------------------------
110public:
112 void update(void) override;
114 virtual void updatePropForm(void);
116 void reloadSelectKey(void);
117protected:
119 GX_FORCE_INLINE void createUnit(void){ _pRealTimeDemoUnit->createUnit(); }
120
122 void addMenuOwnProperty(GxPropertyTable& table ) override;
124 GX_FORCE_INLINE virtual void addMenuPlay(GxPropertyTable&){}
126 GX_FORCE_INLINE virtual void addMenuEdit(GxPropertyTable&){}
127
129 virtual GxGuiFormProperty* createGuiPropertyForm(void);
131 virtual GxUnitListUI* createGuiUnitList(void);
133 virtual GxGuiKeyFrame* createGuiKeyFrame(void);
134
136 void getPropertyIsRecreateUnit (const void* pValue);
138 void setPropertyIsRecreateUnit (const void* pValue);
139
141 void getPropertyIsFrameSkip (const void* pValue);
143 void setPropertyIsFrameSkip (const void* pValue);
145 void getPropertyIsEnableMidFrameStart(const void* pValue);
147 void setPropertyIsEnableMidFrameStart(const void* pValue);
149 void getPropertyMidFramePosition (const void* pValue);
151 void setPropertyMidFramePosition (const void* pValue);
153 void getPropertySkipNotification (const void* pValue);
155 void setPropertySkipNotification (const void* pValue);
156
157private:
159 void initializeSub(void);
161 void play(void);
163 void playLoop(void);
165 void pause(void);
167 void resume(void);
169 void stop(void);
170
172 //-----------------------------------------------------------
174 //-----------------------------------------------------------
176public:
178 void setResource(GxResBase* pResource) override;
180 void getValue( void* const pValue );
182 void setValue( const void* const pValue );
184 constexpr u32 getSelectedUnitNodeId(void) const { return _selectedUnitNodeId; }
186 constexpr u32 getSelectedPropertyNodeId(void) const { return _selectedPropertyNodeId; }
188 constexpr GxUnitRealTimeDemo* getRealTimeDemoUnit(void) const { return _pRealTimeDemoUnit; }
190 constexpr u32 getEditResIndex(void) const { return _editResIndex; }
191
193 GX_FORCE_INLINE b32 isMoveParam(void) const { return _moveParamMode; }
195 GX_FORCE_INLINE void setMoveParam(b32 mode){ _moveParamMode = mode; }
197 void addMoveProperty(u32 unitid, u32 propertyid, u32 RowNumber);
199 GxMoveParamProp* getMoveProperty(u32 index);
201 constexpr u32 getMovePropertyCount(void) const { return _moveParam.getCount(); }
203 void deleteMoveProperty(void);
204
206 virtual GxResRealTimeDemo::GxRtdUnit* addUnit(GxRtti* pUnitRtti);
208 virtual void deleteUnit(u32 UnitNodeId);
210 GX_FORCE_INLINE virtual GxRtti& getRtdUnitType(void) const { return GxResRealTimeDemo::GxRtdUnit::GX_RTTI; }
211
213 virtual GxResRealTimeDemo::GxRtdProp* addProperty(u32 unitNodeId, u32 parentPropertyNodeId, GxProperty* pProperty);
215 virtual void deleteProperty(u32 propertyNodeId);
217 GX_FORCE_INLINE virtual GxRtti& getRtdPropertyType(void) const { return GxResRealTimeDemo::GxRtdProp::GX_RTTI; }
218
220 virtual GxResRealTimeDemo::GxRtdKeyBase* addKey(u32 unitNodeId, u32 propertyNodeId, u32 frame);
222 virtual void deleteKey(u32 propertyNodeId, u32 frame);
224 GX_FORCE_INLINE virtual GxRtti& getRtdKeyType(void) const { return GxResRealTimeDemo::GxRtdKeyBase::GX_RTTI; }
226 virtual GxResRealTimeDemo::GxRtdKeyBase* getKey(u32 unitNodeId, u32 propertyNodeId, u32 frame);
227
229 GX_FORCE_INLINE b32 isNotReady(void) const { return ( (getResource() == nullptr) || (_pRealTimeDemoUnit == nullptr) ); }
231 u32 getNowCursorFrame(void) const;
232
234 constexpr s32 getMidFrameGuiHeight(void) const { return _midFrameGuiHeight; }
235
237 GX_FORCE_INLINE GxSize getDefaultWindowSize(void) const override { return GxSize(720, 240); }
238
239protected:
241 constexpr GxGuiFormProperty* getGuiPropertyForm(void) const { return _pPropertyForm; }
243 constexpr GxUnitListUI* getGuiUnitList(void) const { return _pUnitListUI; }
245 constexpr GxGuiKeyFrame* getGuiKeyFrame(void) const { return _pKeyFrameUI; }
247 void setSelectUnit(u32 unitNodeId);
249 void setSelectProp(u32 propertyNodeId);
251 GX_FORCE_INLINE virtual GxRtti* getRealTimeDemoUnitRtti(void) const { return &GxUnitRealTimeDemo::GX_RTTI; }
253 GX_FORCE_INLINE virtual u32 getRtdUnitRegisterList(void) const { return 0; }
255 GX_FORCE_INLINE virtual GxUnitRealTimeDemo* createUnitRealTimeDemo(void){ return gx_cast<GxUnitRealTimeDemo*>(getGxSysUnit()->createAndAddTop(getRtdUnitRegisterList(), getRtdUnitRegisterList(), *getRealTimeDemoUnitRtti())); }
256
258 void addDefaultProp(const GxRtti& unitRtti, GX_CSTR propertyName, u32 interpolateType);
260 void addDefaultProp(const GxProperty* pProperty, GX_CSTR propertyName, u32 interpolateType);
262 void setDefaultProp(GxResRealTimeDemo::GxRtdUnit* pUnit);
264 void setDefaultProp(GxResRealTimeDemo::GxRtdProp* pProperty);
266 void removeDefaultProp(void);
267
268private:
270 constexpr void getResourceProperty(void* pValue){ *static_cast<GxResBase**>(pValue) = getResource(); }
272 GX_FORCE_INLINE void setResourceProperty(const void* pValue){ setResource(*static_cast<GxResBase**>(const_cast<void*>(pValue))); }
273
275 void getSelectGxUnit(void* pValue);
277 void getSelectUnit(void* pValue);
279 void getSelectProperty(void* pValue);
281 void getSelectKey(void* pValue);
283 static GxToolRealTimeDemo* getParentTool(GxGuiBase* pGui);
284
286 GxTypedObject* getPropertyObject(GxTypedObject* pOwner, GxResRealTimeDemo::GxRtdUnit* pRtdUnit, u32 selectedPropertyNodeId);
288 GxTypedObject* getPropertyObject(GxTypedObject* pOwner, GxResRealTimeDemo::GxRtdProp* pRtdProperty, u32 selectedPropertyNodeId);
289
291 //-----------------------------------------------------------
293 //-----------------------------------------------------------
295protected:
296 u32 _defautlWindowSplitterLeft;
297 u32 _defautlWindowSplitterRight;
298
299private:
300 b32 _isInitialized;
301 GxResBase* _pInitialResource;
302 GxString _dialogPath;
303
304 GxGuiFormProperty* _pPropertyForm;
305 GxUnitListUI* _pUnitListUI;
306 GxGuiKeyFrame* _pKeyFrameUI;
307 GxGuiSplitter* _pSplitter[2];
308
309 u32 _selectedUnitNodeId;
310 u32 _selectedPropertyNodeId;
311
312 GxUnitRealTimeDemo* _pRealTimeDemoUnit;
313 u32 _editResIndex;
314 b32 _isPrivateUnit;
315
316 GxArrayClassBase _defaultPropertyUnit;
317 GxArrayClassBase _defaultPropertyProperty;
318
319 b32 _oldIsPlaying;
320
321 b32 _moveParamMode;
322 GxArray _moveParam;
323
324 s32 _midFrameGuiHeight;
325
327};
328
329//===========================================================================
331//===========================================================================
332class GxToolRealTimeDemo::GxUnitListUI : public GxGuiForm
333{
334 //-----------------------------------------------------------
336 //-----------------------------------------------------------
338public:
339 // RTTI定義
340 GX_RTTI_CLASS(GxToolRealTimeDemo::GxUnitListUI, GxGuiForm)
341
342
343 //-----------------------------------------------------------
345 //-----------------------------------------------------------
347public:
349 GxUnitListUI(void)
350 : _copyValueType(GxProperty::TYPE::UNKNOWN)
351 {}
353 ~GxUnitListUI(void) override
354 {
355 // コピーデータをクリアする
356 clearCopyData();
357 }
358
360 //-----------------------------------------------------------
362 //-----------------------------------------------------------
364public:
366 void onDraw(void) override;
368 void onClick(const GxPoint2&, u32) override;
370 void onDoubleClick(const GxPoint2&, u32) override;
372 void onMouseUp(const GxPoint2& position, u32 button) override;
374 void addUnit(void* pUnit);
376 void createAddUnitMenu(GxGuiMenu& Menu, const GxRtti& rtti);
377protected:
379 GX_FORCE_INLINE virtual void addSubMenu(GxGuiMenu*){}
381 GX_FORCE_INLINE virtual void addSubMenuAddUnit(GxGuiMenu*){}
382private:
384 void onDrawSub(GxResRealTimeDemo::GxRtdProp* pProperty, u32& rowCount, u32& nest);
386 void createSubMenu(const GxPoint2& position);
388 void deleteUnit(void);
390 void addProperty(void* pProperty);
392 void openPropertyForm(void);
394 void updateUnit(b32 up);
396 void addChildProperty(void* pProperty);
398 void deleteProperty(void);
400 void reloadArrayElementNum(void);
402 void updateProperty(b32 up);
404 void copyProperty(void);
406 void pasteProperty(void);
408 b32 isPastePropertyAvailable(void);
410 b32 isCopyableProperty( GxResRealTimeDemo::GxRtdProp* pProperty );
412 void clearCopyData(void);
413
414private:
416 b32 selectFromPointSub(const s32 y, s32& height, GxResRealTimeDemo::GxRtdProp* pProperty);
418 b32 selMovePropertyFromPointSub(const s32 startY, const s32 endY, s32& height, GxResRealTimeDemo::GxRtdProp* pProperty, const GxResRealTimeDemo::GxRtdUnit* pUnit, u32& rowCount);
419
421 static void drawIcon(s32 x, s32 y, const GxResRealTimeDemo::GxRtdUnit* pUnit);
423 static void drawIcon(s32 x, s32 y, const GxResRealTimeDemo::GxRtdProp* pProperty);
424
426 //-----------------------------------------------------------
428 //-----------------------------------------------------------
430public:
432 static u32 getUnitUIHeight(const GxResRealTimeDemo::GxRtdUnit* pUnit);
434 static u32 getPropertyUIHeight(const GxResRealTimeDemo::GxRtdProp* pProperty);
436 void selectFromPoint(const s32 y);
438 void selMovePropertyFromPoint(const s32 startY, const s32 endY);
439private:
441 void setInterpolateType(u32 type);
442
444 //-----------------------------------------------------------
446 //-----------------------------------------------------------
448private:
449 GxArrayClassBase _copyKeyArray;
450 GxProperty::TYPE _copyValueType;
451
453};
454
455//===========================================================================
457//===========================================================================
458class GxToolRealTimeDemo::GxGuiKeyFrame : public GxGuiTimeLine
459{
460 //-----------------------------------------------------------
462 //-----------------------------------------------------------
464public:
465 // RTTI定義
466 GX_RTTI_CLASS(GxToolRealTimeDemo::GxGuiKeyFrame, GxGuiTimeLine)
467
468
469 //-----------------------------------------------------------
471 //-----------------------------------------------------------
473public:
475 GxGuiKeyFrame(void)
476 : _pSelectKey(nullptr)
477 , _selectedUnitId(0)
478 , _selectedPropertyId(0)
479 , _selectedFrame(0)
480 , _pCopyValue(nullptr)
481 , _pCopyKeyTypeRtti(nullptr)
482 , _visibleToolTipPopUp(-1)
483 {
484 _moveUIMode = false;
485 _moveStartFrame = 0;
486 _moveEndFrame = 0;
487 }
489 ~GxGuiKeyFrame(void) override
490 {
491 GX_SAFE_FREE_MEMORY( _pCopyValue );
492 }
493
495 //-----------------------------------------------------------
497 //-----------------------------------------------------------
499public:
501 void onDraw(void) override;
503 void onClick(const GxPoint2&, u32) override;
505 void onMouseDown( const GxPoint2& position, u32 button ) override;
507 void onMouseMove(const GxPoint2&) override{}
509 void onMouseWheel( const GxPoint2& position, s32 rotate ) override;
511 void onNoClientMouseWheel( const GxPoint2& position, s32 rotate ) override;
513 void update(void) override;
515 void onNoClientClick(const GxPoint2& position, u32 button) override;
517 virtual void scroll(s32 wheelRotate );
518
519protected:
521 GX_FORCE_INLINE virtual void addSubMenu(GxGuiMenu*){}
522private:
524 void onDrawSub(GxResRealTimeDemo::GxRtdProp* pProperty, u32& rowCount);
526 void onDrawOverDraw(void);
528 void moveParamPre(void);
529
530private:
532 b32 getKeyArrayIndex(GxResRealTimeDemo::GxRtdProp* pProperty, u32 nowFrame, u32& nowKey, b32 mode);
534 void createSubMenu(const GxPoint2& position);
536 void createSubMenuMoveProperty(const GxPoint2& position);
538 void copyKeyList(GxArrayClassBase& temporaryKeyArray, GxResRealTimeDemo::GxRtdProp* Property);
540 void moveArea(u32 dstFrame);
541
543 void addKey(void);
545 void deleteKey(void);
547 void checkAreaMove(void);
549 constexpr void setPropertyCancel(void){};
551 void editString( b32 mode );
553 void copyKey(void);
555 void pasteKey(void);
557 b32 isCopyableKey(void);
559 b32 isPasteKeyAvailable(void);
561 s32 getFrameFromPosition(GxPoint2 position);
562#if defined( _WINDOWS )
564 static LRESULT CALLBACK myDialogProc( HWND handleDialogWindow, UINT message, WPARAM wParam, LPARAM lParam );
565#endif //_WINDOWS
567 void moveKey(u32 dstFrame);
568
570 //-----------------------------------------------------------
572 //-----------------------------------------------------------
574private:
576 u32 _selectedUnitId;
577 u32 _selectedPropertyId;
578 u32 _selectedFrame;
579 void* _pCopyValue;
580 GxString _pCopyString;
581 GxRtti* _pCopyKeyTypeRtti;
582 b32 _moveUIMode;
583 GxPoint2 _moveStartPosition;
584 GxPoint2 _moveEndPosition;
585 u32 _moveStartFrame;
586 u32 _moveEndFrame;
587 s32 _visibleToolTipPopUp;
588
590};
591
592GX_UTILITY_NAMESPACE_END()
593#endif //GX_EDITOR
#define GX_SAFE_FREE_MEMORY(pAddress)
Definition GxAllocator.h:594
T gx_cast(GxClassBaseRoot *pObject)
Definition GxBase.h:264
void GxTypedObject
その他
Definition GxDefine.h:213
@ UNKNOWN
未定義
配列クラス
Definition GxArrayClassBase.h:18
配列クラス
Definition GxArray.h:18
参照オブジェクト基底クラス
Definition GxBase.h:122
プロパティクラス
Definition GxProperty.h:48
TYPE
タイプ定義
Definition GxProperty.h:56
プロパティテーブルクラス
Definition GxProperty.h:1641
リソース基底クラス
Definition GxResBase.h:23
RTD再生用キー
Definition GxResRealTimeDemo.h:356
RTD再生用プロパティ
Definition GxResRealTimeDemo.h:257
RTDユニット
Definition GxResRealTimeDemo.h:54
実行時型情報クラス
Definition GxRtti.h:154
リアルタイムデモ管理ユニット
Definition GxUnitRealTimeDemo.h:19
座標
Definition GxStruct.h:867
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173