2020-10-17 16:32:16 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013-2017 Chukong Technologies Inc.
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
https://axys1.github.io/
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCARMATURE_DATAS_H__
|
|
|
|
#define __CCARMATURE_DATAS_H__
|
|
|
|
|
|
|
|
#include "base/CCRef.h"
|
|
|
|
#include "base/ccTypes.h"
|
|
|
|
#include "base/CCVector.h"
|
|
|
|
#include "base/CCMap.h"
|
|
|
|
#include "math/CCAffineTransform.h"
|
|
|
|
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "CCArmatureDefine.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
#include "2d/CCTweenFunction.h"
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "CocosStudioExport.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-16 10:43:05 +08:00
|
|
|
#define AX_CREATE_NO_PARAM_NO_INIT(varType) \
|
2021-12-25 10:04:45 +08:00
|
|
|
public: \
|
|
|
|
static inline varType* create(void) \
|
|
|
|
{ \
|
|
|
|
varType* var = new varType(); \
|
|
|
|
var->autorelease(); \
|
|
|
|
return var; \
|
|
|
|
}
|
|
|
|
|
2022-07-16 10:43:05 +08:00
|
|
|
#define AX_CREATE_NO_PARAM(varType) \
|
2021-12-25 10:04:45 +08:00
|
|
|
public: \
|
|
|
|
static inline varType* create(void) \
|
|
|
|
{ \
|
|
|
|
varType* var = new varType(); \
|
|
|
|
if (var->init()) \
|
|
|
|
{ \
|
|
|
|
var->autorelease(); \
|
|
|
|
return var; \
|
|
|
|
} \
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_DELETE(var); \
|
2021-12-25 10:04:45 +08:00
|
|
|
return nullptr; \
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace cocostudio
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The base node include a lot of attributes.
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL BaseData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(BaseData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
BaseData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~BaseData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/*
|
2021-12-25 10:04:45 +08:00
|
|
|
* Copy data from node
|
|
|
|
* @param node A BaseData to copy data
|
|
|
|
*/
|
|
|
|
virtual void copy(const BaseData* node);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/*
|
2021-12-25 10:04:45 +08:00
|
|
|
* Calculate two BaseData's between value(to - from) and set to self
|
|
|
|
*
|
|
|
|
* @param from from BaseData
|
|
|
|
* @param to to BaseData
|
|
|
|
*/
|
|
|
|
virtual void subtract(BaseData* from, BaseData* to, bool limit);
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
virtual void setColor(const ax::Color4B& color);
|
|
|
|
virtual ax::Color4B getColor();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
2021-12-25 10:04:45 +08:00
|
|
|
float x; //! position x attribute
|
|
|
|
float y; //! position y attribute
|
|
|
|
int zOrder; //! zorder attribute, used to order the Bone's depth order
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* x y skewX skewY scaleX scaleY used to calculate transform matrix
|
|
|
|
* skewX, skewY can have rotation effect
|
|
|
|
* To get more matrix information, you can have a look at this paper :
|
|
|
|
* http://www.senocular.com/flash/tutorials/transformmatrix/
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
float skewX;
|
|
|
|
float skewY;
|
|
|
|
float scaleX;
|
|
|
|
float scaleY;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
float tweenRotate; //! SkewX, SkewY, and TweenRotate effect the rotation
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
bool isUseColorInfo; //! Whether or not this frame have the color changed Info
|
2019-11-23 20:27:39 +08:00
|
|
|
int a, r, g, b;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* DisplayType distinguish which type your display is.
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
enum DisplayType
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
CS_DISPLAY_SPRITE, //! display is a single Sprite
|
|
|
|
CS_DISPLAY_ARMATURE, //! display is a Armature
|
|
|
|
CS_DISPLAY_PARTICLE, //! display is a CCParticle.
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
CS_DISPLAY_MAX
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL DisplayData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(DisplayData)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
static std::string changeDisplayToTexture(std::string_view displayName);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
DisplayData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
virtual ~DisplayData(void) {}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
virtual void copy(DisplayData* displayData);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
DisplayType displayType; //! mark which type your display is
|
2019-11-23 20:27:39 +08:00
|
|
|
std::string displayName;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
class CCS_DLL SpriteDisplayData : public DisplayData
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(SpriteDisplayData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
SpriteDisplayData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
virtual ~SpriteDisplayData(){};
|
|
|
|
|
|
|
|
void copy(DisplayData* displayData);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
BaseData skinData;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
class CCS_DLL ArmatureDisplayData : public DisplayData
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(ArmatureDisplayData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
ArmatureDisplayData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
|
|
|
virtual ~ArmatureDisplayData() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
class CCS_DLL ParticleDisplayData : public DisplayData
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(ParticleDisplayData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
ParticleDisplayData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
virtual ~ParticleDisplayData(){};
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* BoneData used to init a Bone.
|
|
|
|
* BoneData keeps a DisplayData list, a Bone can have many display to change.
|
|
|
|
* The display information saved in the DisplayData
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
class CCS_DLL BoneData : public BaseData
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM(BoneData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
BoneData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~BoneData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
virtual bool init();
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void addDisplayData(DisplayData* displayData);
|
|
|
|
DisplayData* getDisplayData(int index);
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
2021-12-25 10:04:45 +08:00
|
|
|
std::string name; //! the bone's name
|
|
|
|
std::string parentName; //! the bone parent's name
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vector<DisplayData*> displayDataList; //! save DisplayData informations for the Bone
|
|
|
|
ax::AffineTransform boneDataTransform;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* ArmatureData saved the Armature name and Bonedata needed for the CCBones in this Armature
|
|
|
|
* When we create a Armature, we need to get each Bone's BoneData as it's init information.
|
|
|
|
* So we can get a BoneData from the Dictionary saved in the ArmatureData.
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL ArmatureData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM(ArmatureData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
ArmatureData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
|
|
|
~ArmatureData();
|
|
|
|
|
|
|
|
bool init();
|
2021-12-25 10:04:45 +08:00
|
|
|
void addBoneData(BoneData* boneData);
|
2021-12-31 12:12:40 +08:00
|
|
|
BoneData* getBoneData(std::string_view boneName);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
std::string name;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::StringMap<BoneData*> boneDataDic;
|
2019-11-23 20:27:39 +08:00
|
|
|
float dataVersion;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BlendType
|
|
|
|
{
|
|
|
|
BLEND_NORMAL,
|
|
|
|
BLEND_LAYER,
|
|
|
|
BLEND_DARKEN,
|
|
|
|
BLEND_MULTIPLY,
|
|
|
|
BLEND_LIGHTEN,
|
|
|
|
BLEND_SCREEN,
|
|
|
|
BLEND_OVERLAY,
|
|
|
|
BLEND_HARD_LIGHT,
|
|
|
|
BLEND_ADD,
|
|
|
|
BLEND_SUBSTRACT,
|
|
|
|
BLEND_DIFFERENCE,
|
|
|
|
BLEND_INVERT,
|
|
|
|
BLEND_ALPHA,
|
|
|
|
BLEND_ERASE
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
class CCS_DLL FrameData : public BaseData
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(FrameData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
FrameData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
|
|
|
~FrameData();
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
virtual void copy(const BaseData* baseData);
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
int frameID;
|
2021-12-25 10:04:45 +08:00
|
|
|
int duration; //! The frame will last duration frames
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::tweenfunc::TweenType tweenEasing; //! Every frame's tween easing effect
|
2019-11-23 20:27:39 +08:00
|
|
|
int easingParamNumber;
|
2021-12-25 10:04:45 +08:00
|
|
|
float* easingParams;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
bool isTween; //! Whether it's a tween key frame
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* The current display index when change to this frame.
|
|
|
|
* If value is -1, then display will not be shown.
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
int displayIndex;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::BlendFunc blendFunc;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
std::string strEvent;
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* strMovement, strEvent, strSound, strSoundEffect do not support yet
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
std::string strMovement;
|
|
|
|
std::string strSound;
|
|
|
|
std::string strSoundEffect;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL MovementBoneData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM(MovementBoneData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
MovementBoneData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~MovementBoneData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
virtual bool init();
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void addFrameData(FrameData* frameData);
|
|
|
|
FrameData* getFrameData(int index);
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
2021-12-25 10:04:45 +08:00
|
|
|
float delay; //! movement delay percent, this value can produce a delay effect
|
|
|
|
float scale; //! scale this movement
|
|
|
|
float duration; //! this Bone in this movement will last m_iDuration frames
|
|
|
|
std::string name; //! bone name
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vector<FrameData*> frameList;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL MovementData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(MovementData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
MovementData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~MovementData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void addMovementBoneData(MovementBoneData* movBoneData);
|
2021-12-31 12:12:40 +08:00
|
|
|
MovementBoneData* getMovementBoneData(std::string_view boneName);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
std::string name;
|
2021-12-25 10:04:45 +08:00
|
|
|
int duration; //! the frames this movement will last
|
|
|
|
float scale; //! scale this movement
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* Change to this movement will last durationTo frames. Use this effect can avoid too suddenly changing.
|
|
|
|
*
|
|
|
|
* Example : current movement is "stand", we want to change to "run", then we fill durationTo frames before
|
|
|
|
* change to "run" instead of changing to "run" directly.
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
int durationTo;
|
|
|
|
|
|
|
|
/*
|
2021-12-25 10:04:45 +08:00
|
|
|
* This is different from duration, durationTween contain tween effect.
|
|
|
|
* duration is the raw time that the animation will last, it's the same with the time you edit in the Action Editor.
|
|
|
|
* durationTween is the actual time you want this animation last.
|
|
|
|
* Example : If we edit 10 frames in the flash, then duration is 10. When we set durationTween to 50, the movement
|
|
|
|
* will last 50 frames, the extra 40 frames will auto filled with tween effect
|
|
|
|
*/
|
2019-11-23 20:27:39 +08:00
|
|
|
int durationTween;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
bool loop; //! whether the movement was looped
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* Which tween easing effect the movement use
|
|
|
|
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::tweenfunc::TweenType tweenEasing;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* @brief save movement bone data
|
2021-12-31 12:12:40 +08:00
|
|
|
* @key std::string_view
|
2021-12-25 10:04:45 +08:00
|
|
|
* @value MovementBoneData *
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::StringMap<MovementBoneData*> movBoneDataDic;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-12-25 10:04:45 +08:00
|
|
|
* AnimationData include all movement information for the Armature
|
|
|
|
* The struct is AnimationData -> MovementData -> MovementBoneData -> FrameData
|
|
|
|
* -> MovementFrameData
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL AnimationData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM_NO_INIT(AnimationData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
AnimationData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~AnimationData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void addMovement(MovementData* movData);
|
2021-12-31 12:12:40 +08:00
|
|
|
MovementData* getMovement(std::string_view movementName);
|
2019-11-23 20:27:39 +08:00
|
|
|
ssize_t getMovementCount();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
std::string name;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::StringMap<MovementData*> movementDataDic;
|
2019-11-23 20:27:39 +08:00
|
|
|
std::vector<std::string> movementNames;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2021-12-25 10:04:45 +08:00
|
|
|
* ContourData include a contour vertex information
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL ContourData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM(ContourData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
ContourData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~ContourData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
virtual bool init();
|
2022-08-08 18:02:17 +08:00
|
|
|
virtual void addVertex(ax::Vec2& vertex);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
2022-08-08 18:02:17 +08:00
|
|
|
std::vector<ax::Vec2> vertexList; //! Save contour vertex info, vertex saved in a Vec2
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2021-12-25 10:04:45 +08:00
|
|
|
* TextureData include a texture's information
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2022-08-08 18:02:17 +08:00
|
|
|
class CCS_DLL TextureData : public ax::Ref
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_CREATE_NO_PARAM(TextureData)
|
2019-11-23 20:27:39 +08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
|
|
|
TextureData();
|
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2020-10-17 16:32:16 +08:00
|
|
|
~TextureData(void);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
virtual bool init();
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void addContourData(ContourData* contourData);
|
|
|
|
ContourData* getContourData(int index);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
public:
|
|
|
|
float height; //! The texture's width, height
|
2019-11-23 20:27:39 +08:00
|
|
|
float width;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
float pivotX; //! The texture's anchor point
|
2019-11-23 20:27:39 +08:00
|
|
|
float pivotY;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
std::string name; //! The texture's name
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vector<ContourData*> contourDataList;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
} // namespace cocostudio
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#endif /*__CCARMATURE_DATAS_H__*/
|