OROCHI
 
Loading...
Searching...
No Matches
GxToolMotionIK.h
Go to the documentation of this file.
1//===========================================================================
8//
9//===========================================================================
10#pragma once
11
12#if GX_EDITOR
13
14GX_MOTION_NAMESPACE_BEGIN()
15
16//===========================================================================
18//===========================================================================
19class GxToolMotionIK : public GxToolResourceEditBase
20{
21 //-----------------------------------------------------------
23 //-----------------------------------------------------------
25public:
26 // RTTI定義
27 GX_RTTI_CLASS_NAME_ICON(GxToolMotionIK, GxToolResourceEditBase, "モーションIK編集", GxRtti::ICON_TYPE::MOTION)
28 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxToolMotionIK );
29private:
31 static constexpr u32 OFFSET_MOTION_LIST = 230;
33 static constexpr u32 OFFSET_FILE_PATH = 117;
35 static constexpr u32 OFFSET_PARAMETER_TABLE = 60;
36
37 class GxGuiFormControl;
38 class GxGuiPropertyTableIKParam;
39 class GxGuiPropertyTableIKAttribute;
40
42 //-----------------------------------------------------------
44 //-----------------------------------------------------------
46public:
48 GxToolMotionIK(void);
50 void cleanup(void) override;
52 b32 initialize( void ) override;
53
55 //-----------------------------------------------------------
57 //-----------------------------------------------------------
59private:
61 void save(void) override;
63 void load(u32 attribute) override;
65 void convertAs( u32 attribute ) override;
67 void convert( void ) override;
69 void setResource(GxResBase* pRes) override;
71 void setResourceModel( GxResModel* pResModel, GxResCollisionObject* pResModelCollision);
73 void setResourceMotionPackage( GxResMotionPackage* pResMotionPackage );
75 void setResourceMotionIKXml( GxResMotionIKXml* pResMotionBlend );
77 void setResourceBackground(GxResModel* pResModel, GxResCollisionMesh* pResCollision);
78
79public:
81 void onCreate(void) override;
83 void update(void) override;
85 void addMenuOwnProperty(GxPropertyTable& table) override;
87 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0);
88private:
90 static GxString removeReservedCharacters(GxString string);
92 void createUnitModel(void);
94 void changeMotion(s32 motionNumber);
96 b32 createGuiFilePath(void);
98 void createGuiIKParamTable(void);
100 void createGuiIKAttributeTable(void);
102 void eventButtonCreateBlendResource(void);
104 void createBlendResource(void);
106 void createUnitBackground(void);
107protected:
109 virtual GxUnitMotion* newUnit(void);
111 virtual GxUnitBackgroundBase* newBackgroundUnit(void);
112
114 //-----------------------------------------------------------
116 //-----------------------------------------------------------
118public:
120 constexpr void getPropertyResModel(void* const pValue) { *static_cast<GxResModel**>(pValue) = _pResModel; }
122 void setPropertyResModel(const void* const pValue);
124 constexpr void getPropertyResModelCollision(void* const pValue) { *static_cast<GxResCollisionObject**>(pValue) = _pResModelCollision; }
126 void setPropertyResModelCollision(const void* const pValue);
128 constexpr void getPropertyGxResMotionPackage(void* const pValue) { *static_cast<GxResMotionPackage**>(pValue) = _pResMotionPackage; }
130 void setPropertyGxResMotionPackage(const void* const pValue);
132 constexpr void getPropertyResMotionBlendXml(void* const pValue) { *static_cast<GxResMotionIKXml**>(pValue) = _pResMotionIKXml; }
134 void setPropertyResMotionBlendXml(const void* const pValue);
136 void getPropertyInterpolateXTranslate(const void* pValue);
138 void getPropertyInterpolateYTranslate(const void* pValue);
140 void getPropertyInterpolateZTranslate(const void* pValue);
142 void getPropertyInterpolatePosition(const void* pValue);
144 void getPropertyInterpolateRotate(const void* pValue);
146 void getPropertyInterpolateScale(const void* pValue);
148 void getPropertyInterpolateLoop(const void* pValue);
150 void setPropertyInterpolateXTranslate(const void* pValue);
152 void setPropertyInterpolateYTranslate(const void* pValue);
154 void setPropertyInterpolateZTranslate(const void* pValue);
156 void setPropertyInterpolatePosition(const void* pValue);
158 void setPropertyInterpolateRotate(const void* pValue);
160 void setPropertyInterpolateScale(const void* pValue);
162 void setPropertyInterpolateLoop(const void* pValue);
164 constexpr void getPropertyBackgroundResModel(void* const pValue) { *static_cast<GxResModel**>(pValue) = _pBackgroundResModel; }
166 void setPropertyBackgroundResModel(const void* const pValue);
168 constexpr void getPropertyBackgroundResCollision(void* const pValue) { *static_cast<GxResCollisionMesh**>(pValue) = _pBackgroundResCollision; }
170 void setPropertyBackgroundResCollision(const void* const pValue);
171
173 constexpr GxUnitMotion* getModel(void) const { return _pUnitModel; }
175 constexpr GxResMotionIKXml* getResMotionBlendXml(void) const { return _pResMotionIKXml; }
177 GX_FORCE_INLINE GxMotionNamesList* getMotionNamesList(void){ return &_motionNamesList; }
179 constexpr GxGuiFormControl* getFormControl(void) const { return _pFormControl; }
181 constexpr GxUnitBackgroundBase* getBackgroundUnit(void) const { return _pUnitBackground; }
182
184 //-----------------------------------------------------------
186 //-----------------------------------------------------------
188private:
189 GxResModel* _pResModel;
190 GxUnitMotion* _pUnitModel;
191 GxResMotionPackage* _pResMotionPackage;
192 GxResMotionIKXml* _pResMotionIKXml;
193 GxMotionNamesList _motionNamesList;
194 GxString _resBlendPathByDialog;
195 GxGuiSplitter* _pSplitterMain;
196 GxGuiSplitter* _pSplitterFile;
197 GxGuiSplitter* _pSplitterAttribute;
198 GxGuiFormControl* _pFormControl;
199 GxGuiPropertyTableIKParam* _pIKParamTable;
200 GxGuiPropertyTableIKAttribute* _pIKAttributeTable;
201 s32 _oldBaseMotion;
202 GxResModel* _pBackgroundResModel;
203 GxResCollisionMesh* _pBackgroundResCollision;
204 GxResCollisionObject* _pResModelCollision;
205 GxUnitBackgroundBase* _pUnitBackground;
206
208};
209
210//===========================================================================
212//===========================================================================
213class GxToolMotionIK::GxGuiFormControl : public GxGuiForm
214{
215 //-----------------------------------------------------------
217 //-----------------------------------------------------------
219public:
220 // RTTI定義
221 GX_RTTI_CLASS(GxToolMotionIK::GxGuiFormControl, GxGuiForm)
222 // GxClassBaseReference継承クラス用禁止宣言
223 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiFormControl );
224
226 //-----------------------------------------------------------
228 //-----------------------------------------------------------
230public:
232 GxGuiFormControl(GxToolMotionIK* pRoot=nullptr);
234 b32 initialize( void ) override;
235
237 //-----------------------------------------------------------
239 //-----------------------------------------------------------
241public:
243 void createMotionGui(void);
245 void pushButtonPlay(void);
247 void onPlay (void);
249 void offPlay(void);
251 void addFrame(f32 addFrame);
253 void pushButtonTop(void);
255 void pushButtonBottom(void);
257 void pushButtonBack(void);
259 void pushButtonForward(void);
260
262 //-----------------------------------------------------------
264 //-----------------------------------------------------------
266public:
268 constexpr GxUnitMotion* getModel(void){ if(!_pRoot){ return nullptr; } return _pRoot->getModel(); }
270 GX_FORCE_INLINE b32 isPlay(void) const { return _isMotionPlaying; }
272 constexpr s32 getBaseMotionNumber (void) const { return _baseMotionNb; }
274 GX_FORCE_INLINE b32 isDrawModel(void) const { return _isDrawModel; }
276 GX_FORCE_INLINE b32 isDrawJointLine(void) const { return _isDrawJointLine; }
278 GX_FORCE_INLINE b32 isDrawJointName(void) const { return _isDrawJointName; }
280 constexpr s32 getWaistJointNumber(void) const { return _waistJointNumber; }
282 constexpr INTERPOLATE getWaistJointCurveType (void) const { return _waistJointCurveType; }
284 constexpr f32 getWaistJointCurveTargetFrameCount(void) const { return _waistJointCurveTargetFrameCount; }
286 constexpr f32 getWaistJointCurvature(void) const { return _waistJointCurvature; }
288 constexpr f32 getWaistJointAcceptDegree(void) const { return _waistJointAcceptDegree; }
290 constexpr f32 getHeightOfSole(void) const { return _heightOfSole; }
291
293 constexpr void setWaistJointNumber(s32 waistJointNumber) { _waistJointNumber = waistJointNumber; }
295 constexpr void setWaistJointCurveType (INTERPOLATE waistJointCurveType ){ _waistJointCurveType = waistJointCurveType; }
297 constexpr void setWaistJointCurveTargetFrameCount(f32 waistJointCurveTargetFrameCount) { _waistJointCurveTargetFrameCount = waistJointCurveTargetFrameCount; }
299 constexpr void setWaistJointCurvature (f32 waistJointCurvature ){ _waistJointCurvature = waistJointCurvature; }
301 constexpr void setWaistJointAcceptDegree(f32 waistJointAcceptDegree){_waistJointAcceptDegree = waistJointAcceptDegree;}
303 constexpr void setHeightOfSole(f32 heightOfSole){_heightOfSole = heightOfSole;}
304
306 //-----------------------------------------------------------
308 //-----------------------------------------------------------
310private:
311 GxToolMotionIK* _pRoot;
312 GxGuiButton* _pButtonPlay;
313 f32 _motionSpeed;
314 b32 _isMotionPlaying;
315 s32 _baseMotionNb;
316 GxGuiPropertyComboBoxEnum* _pGuiEnumStartMotion;
317 b32 _isDrawModel;
318 b32 _isDrawJointLine;
319 b32 _isDrawJointName;
320 s32 _waistJointNumber;
321 INTERPOLATE _waistJointCurveType;
322 f32 _waistJointCurveTargetFrameCount;
323 f32 _waistJointCurvature;
324 f32 _waistJointAcceptDegree;
325 f32 _heightOfSole;
326
328};
329
330//===========================================================================
332//===========================================================================
333class GxToolMotionIK::GxGuiPropertyTableIKParam : public gx::core::GxGuiPropertyTable
334{
335 //-----------------------------------------------------------
337 //-----------------------------------------------------------
339public:
340 GX_RTTI_CLASS( GxToolMotionIK::GxGuiPropertyTableIKParam, gx::core::GxGuiPropertyTable );
341 // GxClassBaseReference継承クラス用禁止宣言
342 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertyTableIKParam);
343
345 //-----------------------------------------------------------
347 //-----------------------------------------------------------
349private:
351 GxGuiPropertyTableIKParam( void ) : _pRoot(nullptr), _pSelectObject(nullptr){}
352public:
354 GxGuiPropertyTableIKParam( GxToolMotionIK* pTool, const GxProperty& property, GxTypedObject* pObject, u32 index = 0, b32 useFilter = false, TYPE type = TYPE::HORIZON );
355
357 //-----------------------------------------------------------
359 //-----------------------------------------------------------
361public:
363 GX_FORCE_INLINE b32 isChange( void ){ return updateObjectList(); }
365 GX_FORCE_INLINE b32 isChangeIKParamCount(void) const { return _isChangeIKParamCount; }
367 constexpr void resetIsChangeIKParamCount(void){ _isChangeIKParamCount = false; }
368
370 //-----------------------------------------------------------
372 //-----------------------------------------------------------
374private:
376 void onClick( const GxPoint2& position, u32 button ) override;
378 void createPopUpMenu(const GxPoint2& position);
380 void eventDeleteInterpolationSettings(void);
382 void eventCreateInterpolationSettings(void);
383
385 //-----------------------------------------------------------
387 //-----------------------------------------------------------
389private:
390 GxToolMotionIK* _pRoot;
391 GxResMotionIK::IKParam* _pSelectObject;
392 b32 _isChangeIKParamCount;
393
395};
396
397//===========================================================================
399//===========================================================================
400class GxToolMotionIK::GxGuiPropertyTableIKAttribute : public gx::core::GxGuiPropertyTable
401{
402 //-----------------------------------------------------------
404 //-----------------------------------------------------------
406public:
407 GX_RTTI_CLASS( GxToolMotionIK::GxGuiPropertyTableIKAttribute, gx::core::GxGuiPropertyTable );
408 // GxClassBaseReference継承クラス用禁止宣言
409 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertyTableIKAttribute);
410
412 //-----------------------------------------------------------
414 //-----------------------------------------------------------
416private:
418 GxGuiPropertyTableIKAttribute( void ) : _pRoot(nullptr), _pSelectObject(nullptr){}
419public:
421 GxGuiPropertyTableIKAttribute( GxToolMotionIK* pTool, const GxProperty& property, GxTypedObject* pObject, u32 index = 0, b32 useFilter = false, TYPE type = TYPE::HORIZON );
422
424 //-----------------------------------------------------------
426 //-----------------------------------------------------------
428public:
430 GX_FORCE_INLINE b32 isChange( void ){ return updateObjectList(); }
432 GX_FORCE_INLINE b32 isChangeIKAttributeCount(void) const { return _isChangeIKAttributeCount; }
434 constexpr void resetIsChangeIKAttributeCount(void){ _isChangeIKAttributeCount = false; }
435
437 //-----------------------------------------------------------
439 //-----------------------------------------------------------
441private:
443 void onClick( const GxPoint2& position, u32 button ) override;
445 void createPopUpMenu(const GxPoint2& position);
447 void eventDeleteAttributeSettings(void);
449 void eventCreateAttributeSettings(void);
450
452 //-----------------------------------------------------------
454 //-----------------------------------------------------------
456private:
457 GxToolMotionIK* _pRoot;
458 GxResMotionIK::IKAttribute* _pSelectObject;
459 b32 _isChangeIKAttributeCount;
460
462};
463
464GX_MOTION_NAMESPACE_END()
465#endif // GX_EDITOR
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
INTERPOLATE
補間タイプ
Definition GxMotionDefine.h:17
プロパティクラス
Definition GxProperty.h:48
プロパティテーブルクラス
Definition GxProperty.h:1641
リソース基底クラス
Definition GxResBase.h:23
メッシュコリジョンリソースクラス
Definition GxResCollisionMesh.h:19
コリジョンリソースクラス
Definition GxResCollisionObject.h:23
モデルリソースクラス
Definition GxResModel.h:20
IK用属性
Definition GxResMotionIK.h:69
IK用パラメーター
Definition GxResMotionIK.h:31
モーションパッケージリソース
Definition GxResMotionPackage.h:20
実行時型情報クラス
Definition GxRtti.h:154
背景ユニット基底クラス
Definition GxUnitBackgroundBase.h:20
モーションユニット
Definition GxUnitMotion.h:20
座標
Definition GxStruct.h:867
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173