axmol/extensions/dragonbones/model/AnimationConfig.h

321 lines
9.3 KiB
C
Raw Normal View History

2019-11-24 23:15:56 +08:00
/**
* The MIT License (MIT)
*
* Copyright (c) 2012-2018 DragonBones team and other contributors
*
* 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 DRAGONBONES_ANIMATION_CONFIG_H
#define DRAGONBONES_ANIMATION_CONFIG_H
#include "../core/BaseObject.h"
DRAGONBONES_NAMESPACE_BEGIN
/**
* - The animation config is used to describe all the information needed to play an animation state.
* The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
* @see dragonBones.AnimationState
* @beta
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD> API <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD>׶Σ<EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> bug <EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @see dragonBones.AnimationState
* @beta
* @version DragonBones 5.0
* @language zh_CN
*/
class AnimationConfig : public BaseObject
{
BIND_CLASS_TYPE_A(AnimationConfig);
public:
/**
* @private
*/
bool pauseFadeOut;
/**
* - Fade out the pattern of other animation states when the animation state is fade in.
* This property is typically used to specify the substitution of multiple animation states blend.
* @default dragonBones.AnimationFadeOutMode.All
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>
* @default dragonBones.AnimationFadeOutMode.All
* @version DragonBones 5.0
* @language zh_CN
*/
AnimationFadeOutMode fadeOutMode;
/**
* @private
*/
TweenType fadeOutTweenType;
/**
* @private
*/
float fadeOutTime;
/**
* @private
*/
bool actionEnabled;
/**
* @private
*/
bool additiveBlending;
/**
* - Whether the animation state has control over the display property of the slots.
* Sometimes blend a animation state does not want it to control the display properties of the slots,
* especially if other animation state are controlling the display properties of the slots.
* @default true
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD>Ƿ<EFBFBD><EFBFBD>Բ<EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
* @default true
* @version DragonBones 5.0
* @language zh_CN
*/
bool displayControl;
/**
* @private
*/
bool pauseFadeIn;
/**
* - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
* This property should usually be set to false when blend multiple animation states.
* @default true
* @version DragonBones 5.1
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD>״̬ʱ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Ǽܳ<EFBFBD>ʼֵ<EFBFBD><EFBFBD>
* ͨ<EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ʱӦ<EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ false<EFBFBD><EFBFBD>
* @default true
* @version DragonBones 5.1
* @language zh_CN
*/
bool resetToPose;
/**
* @private
*/
TweenType fadeInTweenType;
/**
* - The play times. [0: Loop play, [1~N]: Play N times]
* @version DragonBones 3.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, [1~N]: ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N <EFBFBD><EFBFBD>]
* @version DragonBones 3.0
* @language zh_CN
*/
int playTimes;
/**
* - The blend layer.
* High layer animation state will get the blend weight first.
* When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
* @readonly
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>
* ͼ<EFBFBD><EFBFBD><EFBFBD>ߵĶ<EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ء<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ط<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 ʱ<EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٻ<EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ط<EFBFBD><EFBFBD>
* @readonly
* @version DragonBones 5.0
* @language zh_CN
*/
int layer;
/**
* - The start time of play. (In seconds)
* @default 0.0
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD>ŵĿ<EFBFBD>ʼʱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
* @default 0.0
* @version DragonBones 5.0
* @language zh_CN
*/
float position;
/**
* - The duration of play.
* [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD>ŵij<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>
* [-1: ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵ, 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ, (0~N]: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
* @default -1.0
* @version DragonBones 5.0
* @language zh_CN
*/
float duration;
/**
* - The play speed.
* The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
* [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
* @default 1.0
* @version DragonBones 3.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȡ<EFBFBD>
* <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD> {@link dragonBones.Animation#timeScale} <EFBFBD>ǵ<EFBFBD><EFBFBD>ӹ<EFBFBD>ϵ<EFBFBD><EFBFBD>
* [(-N~0): <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 0: ֹͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, (0~1): <EFBFBD><EFBFBD><EFBFBD>ٲ<EFBFBD><EFBFBD><EFBFBD>, 1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, (1~N): <EFBFBD><EFBFBD><EFBFBD>ٲ<EFBFBD><EFBFBD><EFBFBD>]
* @default 1.0
* @version DragonBones 3.0
* @language zh_CN
*/
float timeScale;
/**
* - The blend weight.
* @default 1.0
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ء<EFBFBD>
* @default 1.0
* @version DragonBones 5.0
* @language zh_CN
*/
float weight;
/**
* - The fade in time.
* [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>
* [-1: ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵ, [0~N]: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
* @default -1.0
* @version DragonBones 5.0
* @language zh_CN
*/
float fadeInTime;
/**
* - The auto fade out time when the animation state play completed.
* [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>
* [-1: <EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, [0~N]: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>] <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
* @default -1.0
* @version DragonBones 5.0
* @language zh_CN
*/
float autoFadeOutTime;
/**
* - The name of the animation state. (Can be different from the name of the animation data)
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>ͬ<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>
* @version DragonBones 5.0
* @language zh_CN
*/
std::string name;
/**
* - The animation data name.
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
* @version DragonBones 5.0
* @language zh_CN
*/
std::string animation;
/**
* - The blend group name of the animation state.
* This property is typically used to specify the substitution of multiple animation states blend.
* @readonly
* @version DragonBones 5.0
* @language en_US
*/
/**
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>
* @readonly
* @version DragonBones 5.0
* @language zh_CN
*/
std::string group;
/**
* @private
*/
std::vector<std::string> boneMask;
protected:
virtual void _onClear() override;
public:
/**
* @private
*/
void clear();
/**
* @private
*/
void copyFrom(AnimationConfig* value);
/**
* @private
*/
bool containsBoneMask(const std::string& boneName) const;
/**
* @private
*/
void addBoneMask(Armature* armature, const std::string& boneName, bool recursive);
/**
* @private
*/
void removeBoneMask(Armature* armature, const std::string& boneName, bool recursive);
public: // For WebAssembly.
int getFadeOutMode() const { return (int)fadeOutMode; }
void setFadeOutMode(int value) { fadeOutMode = (AnimationFadeOutMode)value; }
int getFadeOutTweenType() const { return (int)fadeOutTweenType; }
void setFadeOutTweenType(int value) { fadeOutTweenType = (TweenType)value; }
int getFadeInTweenType() const { return (int)fadeInTweenType; }
void setFadeInTweenType(int value) { fadeInTweenType = (TweenType)value; }
};
DRAGONBONES_NAMESPACE_END
#endif // DRAGONBONES_ANIMATION_CONFIG_H