add support for tweenRotate property

This commit is contained in:
yinkaile 2013-12-19 21:12:25 +08:00
parent b367896f94
commit c58963bd45
2 changed files with 9 additions and 13 deletions

View File

@ -59,8 +59,6 @@ static const char *A_MOVEMENT_SCALE = "sc";
static const char *A_MOVEMENT_DELAY = "dl";
static const char *A_DISPLAY_INDEX = "dI";
// static const char *A_VERT = "vert";
// static const char *A_FRAG = "frag";
static const char *A_PLIST = "plist";
static const char *A_PARENT = "parent";
@ -73,9 +71,8 @@ static const char *A_EVENT = "evt";
static const char *A_SOUND = "sd";
static const char *A_SOUND_EFFECT = "sdE";
static const char *A_TWEEN_EASING = "twE";
//static const char *A_EASING_PARAM_NUMBER = "twEPN";
static const char *A_EASING_PARAM = "twEP";
//static const char *A_TWEEN_ROTATE = "twR";
static const char *A_TWEEN_ROTATE = "twR";
static const char *A_IS_ARMATURE = "isArmature";
static const char *A_DISPLAY_TYPE = "displayType";
static const char *A_MOVEMENT = "mov";
@ -108,17 +105,12 @@ static const char *A_GREEN_OFFSET = "gM";
static const char *A_BLUE_OFFSET = "bM";
static const char *A_COLOR_TRANSFORM = "colorTransform";
static const char *A_TWEEN_FRAME = "tweenFrame";
//static const char *A_ROTATION = "rotation";
//static const char *A_USE_COLOR_INFO = "uci";
static const char *CONTOUR = "con";
static const char *CONTOUR_VERTEX = "con_vt";
//static const char *MOVEMENT_EVENT_FRAME = "movementEventFrame";
//static const char *SOUND_FRAME = "soundFrame";
static const char *FL_NAN = "NaN";
@ -921,8 +913,8 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(tinyxml2::XMLElement *mov
FrameData *DataReaderHelper::decodeFrame(tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, BoneData *boneData, DataInfo *dataInfo)
{
float x, y, scale_x, scale_y, skew_x, skew_y = 0;
int duration, displayIndex, zOrder, tweenEasing, blendType = 0;
float x = 0, y = 0, scale_x = 0, scale_y = 0, skew_x = 0, skew_y = 0, tweenRotate = 0;
int duration = 0, displayIndex = 0, zOrder = 0, tweenEasing = 0, blendType = 0;
FrameData *frameData = new FrameData();
@ -1005,6 +997,10 @@ FrameData *DataReaderHelper::decodeFrame(tinyxml2::XMLElement *frameXML, tinyxm
{
frameData->zOrder = zOrder;
}
if( frameXML->QueryFloatAttribute(A_TWEEN_ROTATE, &tweenRotate) == tinyxml2::XML_SUCCESS )
{
frameData->tweenRotate = tweenRotate;
}
if ( frameXML->QueryIntAttribute(A_BLEND_TYPE, &blendType) == tinyxml2::XML_SUCCESS )
{
switch (blendType)

View File

@ -123,8 +123,8 @@ void BaseData::subtract(BaseData *from, BaseData *to, bool limit)
if (to->tweenRotate)
{
skewX += to->tweenRotate;
skewY -= to->tweenRotate;
skewX += to->tweenRotate * M_PI * 2;
skewY -= to->tweenRotate * M_PI * 2;
}
}