mirror of https://github.com/axmolengine/axmol.git
Parse InnerActionFrame, AlphaFrame, modify cocostudio editor version number.
This commit is contained in:
parent
45f54e8358
commit
78b32332d3
|
@ -93,14 +93,14 @@ bool ActionTimeline::init()
|
||||||
|
|
||||||
void ActionTimeline::play(std::string name, bool loop)
|
void ActionTimeline::play(std::string name, bool loop)
|
||||||
{
|
{
|
||||||
if(_indexes.find(name) == _indexes.end())
|
if (_animationInfos.find(name) == _animationInfos.end())
|
||||||
{
|
{
|
||||||
CCLOG("Cann't find action indexes for %s.", name.c_str());
|
CCLOG("Can't find animation info for %s", name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionIndexes& indexes = _indexes[name];
|
AnimationInfo& index = _animationInfos[name];
|
||||||
gotoFrameAndPlay(indexes.startIndex, indexes.endIndex, loop);
|
gotoFrameAndPlay(index.startIndex, index.endIndex, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTimeline::gotoFrameAndPlay(int startIndex)
|
void ActionTimeline::gotoFrameAndPlay(int startIndex)
|
||||||
|
@ -278,26 +278,37 @@ void ActionTimeline::removeTimeline(Timeline* timeline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTimeline::addIndexes(const ActionIndexes& indexes)
|
|
||||||
|
void ActionTimeline::addAnimationInfo(const AnimationInfo& animationInfo)
|
||||||
{
|
{
|
||||||
if(_indexes.find(indexes.name) != _indexes.end())
|
if (_animationInfos.find(animationInfo.name) != _animationInfos.end())
|
||||||
{
|
{
|
||||||
CCLOG("ActionIndexes (%s) already exsists.", indexes.name.c_str());
|
CCLOG("Animation (%s) already exists.", animationInfo.name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_indexes[indexes.name] = indexes;
|
_animationInfos[animationInfo.name] = animationInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTimeline::removeIndexes(std::string name)
|
void ActionTimeline::removeAnimationInfo(std::string animationName)
|
||||||
{
|
{
|
||||||
if(_indexes.find(name) == _indexes.end())
|
if (_animationInfos.find(animationName) == _animationInfos.end())
|
||||||
{
|
{
|
||||||
CCLOG("ActionIndexes %s don't exsists.", name.c_str());
|
CCLOG("AnimationInfo (%s) not exists.", animationName.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_indexes.erase(name);
|
_animationInfos.erase(animationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ActionTimeline::IsAnimationInfoExists(const std::string& animationName)
|
||||||
|
{
|
||||||
|
return _animationInfos.find(animationName) != _animationInfos.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationInfo ActionTimeline::getAnimationInfo(const std::string &animationName)
|
||||||
|
{
|
||||||
|
return _animationInfos.find(animationName)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTimeline::setFrameEventCallFunc(std::function<void(Frame *)> listener)
|
void ActionTimeline::setFrameEventCallFunc(std::function<void(Frame *)> listener)
|
||||||
|
@ -348,5 +359,4 @@ void ActionTimeline::stepToFrame(int frameIndex)
|
||||||
_timelineList.at(i)->stepToFrame(frameIndex);
|
_timelineList.at(i)->stepToFrame(frameIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_TIMELINE_END
|
NS_TIMELINE_END
|
||||||
|
|
|
@ -31,7 +31,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_TIMELINE_BEGIN
|
NS_TIMELINE_BEGIN
|
||||||
|
|
||||||
struct ActionIndexes
|
struct AnimationInfo
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
int startIndex;
|
int startIndex;
|
||||||
|
@ -63,9 +63,9 @@ public:
|
||||||
ActionTimeline();
|
ActionTimeline();
|
||||||
virtual ~ActionTimeline();
|
virtual ~ActionTimeline();
|
||||||
|
|
||||||
virtual bool init();
|
virtual void play(std::string animationName, bool loop);
|
||||||
|
|
||||||
virtual void play(std::string name, bool loop);
|
virtual bool init();
|
||||||
|
|
||||||
/** Goto the specified frame index, and start playing from this index.
|
/** Goto the specified frame index, and start playing from this index.
|
||||||
* @param startIndex The animation will play from this index.
|
* @param startIndex The animation will play from this index.
|
||||||
|
@ -98,7 +98,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void gotoFrameAndPause(int startIndex);
|
virtual void gotoFrameAndPause(int startIndex);
|
||||||
|
|
||||||
|
|
||||||
/** Pause the animation. */
|
/** Pause the animation. */
|
||||||
virtual void pause();
|
virtual void pause();
|
||||||
/** Resume the animation. */
|
/** Resume the animation. */
|
||||||
|
@ -133,12 +132,14 @@ public:
|
||||||
virtual void addTimeline(Timeline* timeline);
|
virtual void addTimeline(Timeline* timeline);
|
||||||
virtual void removeTimeline(Timeline* timeline);
|
virtual void removeTimeline(Timeline* timeline);
|
||||||
|
|
||||||
/** add ActionIndexes */
|
|
||||||
virtual void addIndexes(const ActionIndexes& indexes);
|
|
||||||
virtual void removeIndexes(std::string name);
|
|
||||||
|
|
||||||
virtual const cocos2d::Vector<Timeline*>& getTimelines() const { return _timelineList; }
|
virtual const cocos2d::Vector<Timeline*>& getTimelines() const { return _timelineList; }
|
||||||
|
|
||||||
|
/** add ActionIndexes*/
|
||||||
|
virtual void addAnimationInfo(const AnimationInfo& animationInfo);
|
||||||
|
virtual void removeAnimationInfo(std::string animationName);
|
||||||
|
virtual bool IsAnimationInfoExists(const std::string& animationName);
|
||||||
|
virtual AnimationInfo getAnimationInfo(const std::string& animationName);
|
||||||
|
|
||||||
/** Set ActionTimeline's frame event callback function */
|
/** Set ActionTimeline's frame event callback function */
|
||||||
void setFrameEventCallFunc(std::function<void(Frame *)> listener);
|
void setFrameEventCallFunc(std::function<void(Frame *)> listener);
|
||||||
void clearFrameEventCallFunc();
|
void clearFrameEventCallFunc();
|
||||||
|
@ -182,7 +183,7 @@ protected:
|
||||||
|
|
||||||
std::function<void(Frame*)> _frameEventListener;
|
std::function<void(Frame*)> _frameEventListener;
|
||||||
std::function<void()> _lastFrameListener;
|
std::function<void()> _lastFrameListener;
|
||||||
std::map<std::string, ActionIndexes> _indexes;
|
std::map<std::string, AnimationInfo> _animationInfos;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_TIMELINE_END
|
NS_TIMELINE_END
|
||||||
|
|
|
@ -47,18 +47,16 @@ using namespace flatbuffers;
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
namespace timeline{
|
namespace timeline{
|
||||||
|
|
||||||
static const char* FrameType_VisibleFrame = "VisibleFrame";
|
static const char* Property_VisibleForFrame = "VisibleForFrame";
|
||||||
static const char* FrameType_PositionFrame = "PositionFrame";
|
static const char* Property_Position = "Position";
|
||||||
static const char* FrameType_ScaleFrame = "ScaleFrame";
|
static const char* Property_Scale = "Scale";
|
||||||
static const char* FrameType_RotationFrame = "RotationFrame";
|
static const char* Property_RotationSkew = "RotationSkew";
|
||||||
static const char* FrameType_SkewFrame = "SkewFrame";
|
static const char* Property_CColor = "CColor";
|
||||||
static const char* FrameType_RotationSkewFrame = "RotationSkewFrame";
|
static const char* Property_FileData = "FileData";
|
||||||
static const char* FrameType_AnchorFrame = "AnchorPointFrame";
|
static const char* Property_FrameEvent = "FrameEvent";
|
||||||
static const char* FrameType_InnerActionFrame = "InnerActionFrame";
|
static const char* Property_Alpha = "Alpha";
|
||||||
static const char* FrameType_ColorFrame = "ColorFrame";
|
static const char* Property_ZOrder = "ZOrder";
|
||||||
static const char* FrameType_TextureFrame = "TextureFrame";
|
static const char* Property_ActionValue = "ActionValue";
|
||||||
static const char* FrameType_EventFrame = "EventFrame";
|
|
||||||
static const char* FrameType_ZOrderFrame = "ZOrderFrame";
|
|
||||||
|
|
||||||
static const char* ACTION = "action";
|
static const char* ACTION = "action";
|
||||||
static const char* DURATION = "duration";
|
static const char* DURATION = "duration";
|
||||||
|
@ -108,6 +106,7 @@ void ActionTimelineCache::purge()
|
||||||
void ActionTimelineCache::init()
|
void ActionTimelineCache::init()
|
||||||
{
|
{
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
/*
|
||||||
_funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&ActionTimelineCache::loadVisibleFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&ActionTimelineCache::loadVisibleFrame, this, _1)));
|
||||||
_funcs.insert(Pair(FrameType_PositionFrame, std::bind(&ActionTimelineCache::loadPositionFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_PositionFrame, std::bind(&ActionTimelineCache::loadPositionFrame, this, _1)));
|
||||||
_funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&ActionTimelineCache::loadScaleFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&ActionTimelineCache::loadScaleFrame, this, _1)));
|
||||||
|
@ -120,6 +119,7 @@ void ActionTimelineCache::init()
|
||||||
_funcs.insert(Pair(FrameType_TextureFrame, std::bind(&ActionTimelineCache::loadTextureFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_TextureFrame, std::bind(&ActionTimelineCache::loadTextureFrame, this, _1)));
|
||||||
_funcs.insert(Pair(FrameType_EventFrame, std::bind(&ActionTimelineCache::loadEventFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_EventFrame, std::bind(&ActionTimelineCache::loadEventFrame, this, _1)));
|
||||||
_funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&ActionTimelineCache::loadZOrderFrame, this, _1)));
|
_funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&ActionTimelineCache::loadZOrderFrame, this, _1)));
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,6 +439,17 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFlatBuffersFile(cons
|
||||||
float speed = nodeAction->speed();
|
float speed = nodeAction->speed();
|
||||||
action->setTimeSpeed(speed);
|
action->setTimeSpeed(speed);
|
||||||
|
|
||||||
|
auto animationlist = csparsebinary->animationList();
|
||||||
|
int animationcount = animationlist->size();
|
||||||
|
for (int i = 0; i < animationcount; i++)
|
||||||
|
{
|
||||||
|
auto animationdata = animationlist->Get(i);
|
||||||
|
AnimationInfo info;
|
||||||
|
info.name = animationdata->name()->c_str();
|
||||||
|
info.startIndex = animationdata->startIndex();
|
||||||
|
info.endIndex = animationdata->endIndex();
|
||||||
|
action->addAnimationInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
auto timelines = nodeAction->timeLines();
|
auto timelines = nodeAction->timeLines();
|
||||||
int timelineLength = timelines->size();
|
int timelineLength = timelines->size();
|
||||||
|
@ -460,14 +471,14 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti
|
||||||
{
|
{
|
||||||
Timeline* timeline = nullptr;
|
Timeline* timeline = nullptr;
|
||||||
|
|
||||||
// get frame type
|
// property
|
||||||
std::string frameType = flatbuffers->frameType()->c_str();
|
std::string property = flatbuffers->property()->c_str();
|
||||||
if(frameType == "")
|
if(property == "")
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
CCLOG("frameType = %s", frameType.c_str());
|
CCLOG("property = %s", property.c_str());
|
||||||
|
|
||||||
if(frameType != "")
|
if(property != "")
|
||||||
{
|
{
|
||||||
timeline = Timeline::create();
|
timeline = Timeline::create();
|
||||||
|
|
||||||
|
@ -482,52 +493,62 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti
|
||||||
auto frameFlatbuf = framesFlatbuf->Get(i);
|
auto frameFlatbuf = framesFlatbuf->Get(i);
|
||||||
Frame* frame = nullptr;
|
Frame* frame = nullptr;
|
||||||
|
|
||||||
if (frameType == FrameType_VisibleFrame)
|
if (property == Property_VisibleForFrame)
|
||||||
{
|
{
|
||||||
auto visibleFrame = frameFlatbuf->visibleFrame();
|
auto boolFrame = frameFlatbuf->boolFrame();
|
||||||
frame = loadVisibleFrameWithFlatBuffers(visibleFrame);
|
frame = loadVisibleFrameWithFlatBuffers(boolFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ZOrderFrame)
|
else if (property == Property_Position)
|
||||||
{
|
{
|
||||||
auto zOrderFrame = frameFlatbuf->zOrderFrame();
|
auto potisionFrame = frameFlatbuf->pointFrame();
|
||||||
frame = loadZOrderFrameWithFlatBuffers(zOrderFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_RotationSkewFrame)
|
|
||||||
{
|
|
||||||
auto rotationSkewFrame = frameFlatbuf->rotationSkewFrame();
|
|
||||||
frame = loadRotationSkewFrameWithFlatBuffers(rotationSkewFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_EventFrame)
|
|
||||||
{
|
|
||||||
auto eventFrame = frameFlatbuf->eventFrame();
|
|
||||||
frame = loadEventFrameWithFlatBuffers(eventFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_AnchorFrame)
|
|
||||||
{
|
|
||||||
auto anchorPointFrame = frameFlatbuf->anchorPointFrame();
|
|
||||||
frame = loadAnchorPointFrameWithFlatBuffers(anchorPointFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_PositionFrame)
|
|
||||||
{
|
|
||||||
auto potisionFrame = frameFlatbuf->positionFrame();
|
|
||||||
frame = loadPositionFrameWithFlatBuffers(potisionFrame);
|
frame = loadPositionFrameWithFlatBuffers(potisionFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ScaleFrame)
|
else if (property == Property_Scale)
|
||||||
{
|
{
|
||||||
auto scaleFrame = frameFlatbuf->scaleFrame();
|
auto scaleFrame = frameFlatbuf->scaleFrame();
|
||||||
frame = loadScaleFrameWithFlatBuffers(scaleFrame);
|
frame = loadScaleFrameWithFlatBuffers(scaleFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ColorFrame)
|
else if (property == Property_RotationSkew)
|
||||||
|
{
|
||||||
|
auto scaleFrame = frameFlatbuf->scaleFrame();
|
||||||
|
frame = loadRotationSkewFrameWithFlatBuffers(scaleFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_CColor)
|
||||||
{
|
{
|
||||||
auto colorFrame = frameFlatbuf->colorFrame();
|
auto colorFrame = frameFlatbuf->colorFrame();
|
||||||
frame = loadColorFrameWithFlatBuffers(colorFrame);
|
frame = loadColorFrameWithFlatBuffers(colorFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_TextureFrame)
|
else if (property == Property_FrameEvent)
|
||||||
|
{
|
||||||
|
auto eventFrame = frameFlatbuf->eventFrame();
|
||||||
|
frame = loadEventFrameWithFlatBuffers(eventFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_FileData)
|
||||||
{
|
{
|
||||||
auto textureFrame = frameFlatbuf->textureFrame();
|
auto textureFrame = frameFlatbuf->textureFrame();
|
||||||
frame = loadTextureFrameWithFlatBuffers(textureFrame);
|
frame = loadTextureFrameWithFlatBuffers(textureFrame);
|
||||||
}
|
}
|
||||||
|
else if (property == Property_Alpha)
|
||||||
|
{
|
||||||
|
auto intFrame = frameFlatbuf->intFrame();
|
||||||
|
frame = loadAlphaFrameWithFlatBuffers(intFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_ZOrder)
|
||||||
|
{
|
||||||
|
auto intFrame = frameFlatbuf->intFrame();
|
||||||
|
frame = loadZOrderFrameWithFlatBuffers(intFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_ActionValue)
|
||||||
|
{
|
||||||
|
auto innerActionFrame = frameFlatbuf->innerActionFrame();
|
||||||
|
frame = loadInnerActionFrameWithFlatBuffers(innerActionFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!frame)
|
||||||
|
{
|
||||||
|
CCLOG("frame is invalid.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
timeline->addFrame(frame);
|
timeline->addFrame(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,15 +556,14 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadVisibleFrameWithFlatBuffers(const flatbuffers::TimeLineBoolFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadVisibleFrameWithFlatBuffers(const flatbuffers::BoolFrame *flatbuffers)
|
||||||
{
|
{
|
||||||
VisibleFrame* frame = VisibleFrame::create();
|
VisibleFrame* frame = VisibleFrame::create();
|
||||||
|
|
||||||
bool visible = flatbuffers->value();
|
bool visible = flatbuffers->value();
|
||||||
|
|
||||||
frame->setVisible(visible);
|
frame->setVisible(visible);
|
||||||
|
|
||||||
CCLOG("visible = %d", visible);
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
frame->setFrameIndex(frameIndex);
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
@ -553,80 +573,7 @@ Frame* ActionTimelineCache::loadVisibleFrameWithFlatBuffers(const flatbuffers::T
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadZOrderFrameWithFlatBuffers(const flatbuffers::TimeLineIntFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadPositionFrameWithFlatBuffers(const flatbuffers::PointFrame *flatbuffers)
|
||||||
{
|
|
||||||
ZOrderFrame* frame = ZOrderFrame::create();
|
|
||||||
|
|
||||||
int zorder = flatbuffers->value();
|
|
||||||
frame->setZOrder(zorder);
|
|
||||||
|
|
||||||
CCLOG("zorder = %d", zorder);
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
|
||||||
frame->setFrameIndex(frameIndex);
|
|
||||||
|
|
||||||
bool tween = flatbuffers->tween();
|
|
||||||
frame->setTween(tween);
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadRotationSkewFrameWithFlatBuffers(const flatbuffers::TimeLinePointFrame *flatbuffers)
|
|
||||||
{
|
|
||||||
RotationSkewFrame* frame = RotationSkewFrame::create();
|
|
||||||
|
|
||||||
auto f_rotationSkew = flatbuffers->postion();
|
|
||||||
Vec2 rotationSkew(f_rotationSkew->x(), f_rotationSkew->y());
|
|
||||||
frame->setSkewX(rotationSkew.x);
|
|
||||||
frame->setSkewY(rotationSkew.y);
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
|
||||||
frame->setFrameIndex(frameIndex);
|
|
||||||
|
|
||||||
bool tween = flatbuffers->tween();
|
|
||||||
frame->setTween(tween);
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadEventFrameWithFlatBuffers(const flatbuffers::TimeLineStringFrame *flatbuffers)
|
|
||||||
{
|
|
||||||
EventFrame* frame = EventFrame::create();
|
|
||||||
|
|
||||||
std::string event = flatbuffers->value()->c_str();
|
|
||||||
|
|
||||||
if (event != "")
|
|
||||||
frame->setEvent(event);
|
|
||||||
|
|
||||||
CCLOG("event = %s", event.c_str());
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
|
||||||
frame->setFrameIndex(frameIndex);
|
|
||||||
|
|
||||||
bool tween = flatbuffers->tween();
|
|
||||||
frame->setTween(tween);
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadAnchorPointFrameWithFlatBuffers(const flatbuffers::TimeLinePointFrame *flatbuffers)
|
|
||||||
{
|
|
||||||
AnchorPointFrame* frame = AnchorPointFrame::create();
|
|
||||||
|
|
||||||
auto f_anchorPoint = flatbuffers->postion();
|
|
||||||
Vec2 anchorPoint(f_anchorPoint->x(), f_anchorPoint->y());
|
|
||||||
frame->setAnchorPoint(anchorPoint);
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
|
||||||
frame->setFrameIndex(frameIndex);
|
|
||||||
|
|
||||||
bool tween = flatbuffers->tween();
|
|
||||||
frame->setTween(tween);
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadPositionFrameWithFlatBuffers(const flatbuffers::TimeLinePointFrame *flatbuffers)
|
|
||||||
{
|
{
|
||||||
PositionFrame* frame = PositionFrame::create();
|
PositionFrame* frame = PositionFrame::create();
|
||||||
|
|
||||||
|
@ -643,12 +590,12 @@ Frame* ActionTimelineCache::loadPositionFrameWithFlatBuffers(const flatbuffers::
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadScaleFrameWithFlatBuffers(const flatbuffers::TimeLinePointFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadScaleFrameWithFlatBuffers(const flatbuffers::ScaleFrame *flatbuffers)
|
||||||
{
|
{
|
||||||
ScaleFrame* frame = ScaleFrame::create();
|
ScaleFrame* frame = ScaleFrame::create();
|
||||||
|
|
||||||
auto f_scale = flatbuffers->postion();
|
auto f_scale = flatbuffers->scale();
|
||||||
Vec2 scale(f_scale->x(), f_scale->y());
|
Vec2 scale(f_scale->scaleX(), f_scale->scaleY());
|
||||||
frame->setScaleX(scale.x);
|
frame->setScaleX(scale.x);
|
||||||
frame->setScaleY(scale.y);
|
frame->setScaleY(scale.y);
|
||||||
|
|
||||||
|
@ -661,16 +608,14 @@ Frame* ActionTimelineCache::loadScaleFrameWithFlatBuffers(const flatbuffers::Tim
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadColorFrameWithFlatBuffers(const flatbuffers::TimeLineColorFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadRotationSkewFrameWithFlatBuffers(const flatbuffers::ScaleFrame *flatbuffers)
|
||||||
{
|
{
|
||||||
ColorFrame* frame = ColorFrame::create();
|
RotationSkewFrame* frame = RotationSkewFrame::create();
|
||||||
|
|
||||||
auto f_color = flatbuffers->color();
|
auto f_scale = flatbuffers->scale();
|
||||||
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
Vec2 rotationSkew(f_scale->scaleX(), f_scale->scaleY());
|
||||||
frame->setColor(color);
|
frame->setSkewX(rotationSkew.x);
|
||||||
|
frame->setSkewY(rotationSkew.y);
|
||||||
int alpha = f_color->a();
|
|
||||||
frame->setAlpha(alpha);
|
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
frame->setFrameIndex(frameIndex);
|
frame->setFrameIndex(frameIndex);
|
||||||
|
@ -681,7 +626,24 @@ Frame* ActionTimelineCache::loadColorFrameWithFlatBuffers(const flatbuffers::Tim
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TimeLineTextureFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadColorFrameWithFlatBuffers(const flatbuffers::ColorFrame *flatbuffers)
|
||||||
|
{
|
||||||
|
ColorFrame* frame = ColorFrame::create();
|
||||||
|
|
||||||
|
auto f_color = flatbuffers->color();
|
||||||
|
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
||||||
|
frame->setColor(color);
|
||||||
|
|
||||||
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
bool tween = flatbuffers->tween();
|
||||||
|
frame->setTween(tween);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TextureFrame *flatbuffers)
|
||||||
{
|
{
|
||||||
std::string path = "";
|
std::string path = "";
|
||||||
int resourceType = 0;
|
int resourceType = 0;
|
||||||
|
@ -689,7 +651,7 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
|
||||||
|
|
||||||
TextureFrame* frame = TextureFrame::create();
|
TextureFrame* frame = TextureFrame::create();
|
||||||
|
|
||||||
auto fileNameData = flatbuffers->fileNameData();
|
auto fileNameData = flatbuffers->textureFile();
|
||||||
|
|
||||||
resourceType = fileNameData->resourceType();
|
resourceType = fileNameData->resourceType();
|
||||||
switch (resourceType)
|
switch (resourceType)
|
||||||
|
@ -727,7 +689,6 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
frame->setTextureName(path);
|
frame->setTextureName(path);
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
@ -739,6 +700,85 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Frame* ActionTimelineCache::loadEventFrameWithFlatBuffers(const flatbuffers::EventFrame *flatbuffers)
|
||||||
|
{
|
||||||
|
EventFrame* frame = EventFrame::create();
|
||||||
|
|
||||||
|
std::string event = flatbuffers->value()->c_str();
|
||||||
|
|
||||||
|
if (event != "")
|
||||||
|
frame->setEvent(event);
|
||||||
|
|
||||||
|
CCLOG("event = %s", event.c_str());
|
||||||
|
|
||||||
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
bool tween = flatbuffers->tween();
|
||||||
|
frame->setTween(tween);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame* ActionTimelineCache::loadAlphaFrameWithFlatBuffers(const flatbuffers::IntFrame *flatbuffers)
|
||||||
|
{
|
||||||
|
AlphaFrame* frame = AlphaFrame::create();
|
||||||
|
|
||||||
|
int alpha = flatbuffers->value();
|
||||||
|
|
||||||
|
frame->setAlpha(alpha);
|
||||||
|
|
||||||
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
bool tween = flatbuffers->tween();
|
||||||
|
frame->setTween(tween);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame* ActionTimelineCache::loadZOrderFrameWithFlatBuffers(const flatbuffers::IntFrame *flatbuffers)
|
||||||
|
{
|
||||||
|
ZOrderFrame* frame = ZOrderFrame::create();
|
||||||
|
|
||||||
|
int zorder = flatbuffers->value();
|
||||||
|
|
||||||
|
frame->setZOrder(zorder);
|
||||||
|
|
||||||
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
bool tween = flatbuffers->tween();
|
||||||
|
frame->setTween(tween);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame* ActionTimelineCache::loadInnerActionFrameWithFlatBuffers(const flatbuffers::InnerActionFrame *flatbuffers)
|
||||||
|
{
|
||||||
|
InnerActionFrame* frame = InnerActionFrame::create();
|
||||||
|
|
||||||
|
InnerActionType innerActionType = (InnerActionType)flatbuffers->innerActionType();
|
||||||
|
|
||||||
|
std::string currentAnimationFrame = flatbuffers->currentAniamtionName()->c_str();
|
||||||
|
|
||||||
|
int singleFrameIndex = flatbuffers->singleFrameIndex();
|
||||||
|
|
||||||
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
frame->setFrameIndex(frameIndex);
|
||||||
|
|
||||||
|
bool tween = flatbuffers->tween();
|
||||||
|
frame->setTween(tween);
|
||||||
|
|
||||||
|
frame->setInnerActionType(innerActionType);
|
||||||
|
frame->setSingleFrameIndex(singleFrameIndex);
|
||||||
|
|
||||||
|
frame->setEnterWithName(true);
|
||||||
|
frame->setAnimationName(currentAnimationFrame);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
ActionTimeline* ActionTimelineCache::createActionWithFlatBuffersForSimulator(const std::string& fileName)
|
ActionTimeline* ActionTimelineCache::createActionWithFlatBuffersForSimulator(const std::string& fileName)
|
||||||
{
|
{
|
||||||
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
||||||
|
@ -758,6 +798,18 @@ ActionTimeline* ActionTimelineCache::createActionWithFlatBuffersForSimulator(con
|
||||||
float speed = nodeAction->speed();
|
float speed = nodeAction->speed();
|
||||||
action->setTimeSpeed(speed);
|
action->setTimeSpeed(speed);
|
||||||
|
|
||||||
|
auto animationlist = csparsebinary->animationList();
|
||||||
|
int animationcount = animationlist->size();
|
||||||
|
for (int i = 0; i < animationcount; i++)
|
||||||
|
{
|
||||||
|
auto animationdata = animationlist->Get(i);
|
||||||
|
AnimationInfo info;
|
||||||
|
info.name = animationdata->name()->c_str();
|
||||||
|
info.startIndex = animationdata->startIndex();
|
||||||
|
info.endIndex = animationdata->endIndex();
|
||||||
|
action->addAnimationInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
auto timeLines = nodeAction->timeLines();
|
auto timeLines = nodeAction->timeLines();
|
||||||
int timelineLength = timeLines->size();
|
int timelineLength = timeLines->size();
|
||||||
for (int i = 0; i < timelineLength; i++)
|
for (int i = 0; i < timelineLength; i++)
|
||||||
|
|
|
@ -38,12 +38,14 @@ namespace flatbuffers
|
||||||
|
|
||||||
struct NodeAction;
|
struct NodeAction;
|
||||||
struct TimeLine;
|
struct TimeLine;
|
||||||
struct TimeLineBoolFrame;
|
struct PointFrame;
|
||||||
struct TimeLineIntFrame;
|
struct ScaleFrame;
|
||||||
struct TimeLineStringFrame;
|
struct ColorFrame;
|
||||||
struct TimeLinePointFrame;
|
struct TextureFrame;
|
||||||
struct TimeLineColorFrame;
|
struct EventFrame;
|
||||||
struct TimeLineTextureFrame;
|
struct IntFrame;
|
||||||
|
struct BoolFrame;
|
||||||
|
struct InnerActionFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_TIMELINE_BEGIN
|
NS_TIMELINE_BEGIN
|
||||||
|
@ -55,6 +57,7 @@ class Frame;
|
||||||
class CC_STUDIO_DLL ActionTimelineCache
|
class CC_STUDIO_DLL ActionTimelineCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Gets the singleton */
|
/** Gets the singleton */
|
||||||
static ActionTimelineCache* getInstance();
|
static ActionTimelineCache* getInstance();
|
||||||
|
|
||||||
|
@ -101,15 +104,16 @@ protected:
|
||||||
|
|
||||||
Timeline* loadTimelineWithFlatBuffers(const flatbuffers::TimeLine* flatbuffers);
|
Timeline* loadTimelineWithFlatBuffers(const flatbuffers::TimeLine* flatbuffers);
|
||||||
|
|
||||||
Frame* loadVisibleFrameWithFlatBuffers (const flatbuffers::TimeLineBoolFrame* flatbuffers);
|
Frame* loadVisibleFrameWithFlatBuffers (const flatbuffers::BoolFrame* flatbuffers);
|
||||||
Frame* loadZOrderFrameWithFlatBuffers (const flatbuffers::TimeLineIntFrame* flatbuffers);
|
Frame* loadPositionFrameWithFlatBuffers (const flatbuffers::PointFrame* flatbuffers);
|
||||||
Frame* loadRotationSkewFrameWithFlatBuffers (const flatbuffers::TimeLinePointFrame* flatbuffers);
|
Frame* loadScaleFrameWithFlatBuffers (const flatbuffers::ScaleFrame* flatbuffers);
|
||||||
Frame* loadEventFrameWithFlatBuffers (const flatbuffers::TimeLineStringFrame* flatbuffers);
|
Frame* loadRotationSkewFrameWithFlatBuffers (const flatbuffers::ScaleFrame* flatbuffers);
|
||||||
Frame* loadAnchorPointFrameWithFlatBuffers (const flatbuffers::TimeLinePointFrame* flatbuffers);
|
Frame* loadColorFrameWithFlatBuffers (const flatbuffers::ColorFrame* flatbuffers);
|
||||||
Frame* loadPositionFrameWithFlatBuffers (const flatbuffers::TimeLinePointFrame* flatbuffers);
|
Frame* loadTextureFrameWithFlatBuffers (const flatbuffers::TextureFrame* flatbuffers);
|
||||||
Frame* loadScaleFrameWithFlatBuffers (const flatbuffers::TimeLinePointFrame* flatbuffers);
|
Frame* loadEventFrameWithFlatBuffers (const flatbuffers::EventFrame* flatbuffers);
|
||||||
Frame* loadColorFrameWithFlatBuffers (const flatbuffers::TimeLineColorFrame* flatbuffers);
|
Frame* loadAlphaFrameWithFlatBuffers (const flatbuffers::IntFrame* flatbuffers);
|
||||||
Frame* loadTextureFrameWithFlatBuffers (const flatbuffers::TimeLineTextureFrame* flatbuffers);
|
Frame* loadZOrderFrameWithFlatBuffers (const flatbuffers::IntFrame* flatbuffers);
|
||||||
|
Frame* loadInnerActionFrameWithFlatBuffers (const flatbuffers::InnerActionFrame* flatbuffers);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ THE SOFTWARE.
|
||||||
#include "CCActionTimeline.h"
|
#include "CCActionTimeline.h"
|
||||||
#include "2d/CCSpriteFrameCache.h"
|
#include "2d/CCSpriteFrameCache.h"
|
||||||
#include "2d/CCSpriteFrame.h"
|
#include "2d/CCSpriteFrame.h"
|
||||||
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
|
@ -466,20 +468,89 @@ InnerActionFrame* InnerActionFrame::create()
|
||||||
InnerActionFrame::InnerActionFrame()
|
InnerActionFrame::InnerActionFrame()
|
||||||
: _innerActionType(LoopAction)
|
: _innerActionType(LoopAction)
|
||||||
, _startFrameIndex(0)
|
, _startFrameIndex(0)
|
||||||
|
, _endFrameIndex(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
{
|
{
|
||||||
|
int start = _startFrameIndex;
|
||||||
|
int end = _endFrameIndex;
|
||||||
|
auto actiontimeline = static_cast<ActionTimeline*>(_node->getActionByTag(_node->getTag()));
|
||||||
|
if (InnerActionType::SingleFrame == _innerActionType)
|
||||||
|
{
|
||||||
|
actiontimeline->gotoFrameAndPause(_singleFrameIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_enterWithName)
|
||||||
|
{
|
||||||
|
if (_animationName == "-- ALL --")
|
||||||
|
{
|
||||||
|
start = 0;
|
||||||
|
end = actiontimeline->getDuration();
|
||||||
|
}
|
||||||
|
else if(actiontimeline->IsAnimationInfoExists(_animationName))
|
||||||
|
{
|
||||||
|
AnimationInfo info = actiontimeline->getAnimationInfo(_animationName);
|
||||||
|
start = info.startIndex;
|
||||||
|
end = info.endIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCLOG("Animation %s not exists!", _animationName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (InnerActionType::NoLoopAction == _innerActionType)
|
||||||
|
{
|
||||||
|
actiontimeline->gotoFrameAndPlay(start, end, false);
|
||||||
|
}
|
||||||
|
else if (InnerActionType::LoopAction == _innerActionType)
|
||||||
|
{
|
||||||
|
actiontimeline->gotoFrameAndPlay(start, end, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InnerActionFrame::setStartFrameIndex(int frameIndex) throw()
|
||||||
|
{
|
||||||
|
if(_enterWithName)
|
||||||
|
{
|
||||||
|
CCLOG(" cannot set start when enter frame with name. setEnterWithName false firstly!");
|
||||||
|
throw std::exception();
|
||||||
|
}
|
||||||
|
_startFrameIndex = frameIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InnerActionFrame::setEndFrameIndex(int frameIndex) throw()
|
||||||
|
{
|
||||||
|
if(_enterWithName)
|
||||||
|
{
|
||||||
|
CCLOG(" cannot set end when enter frame with name. setEnterWithName false firstly!");
|
||||||
|
throw std::exception();
|
||||||
|
}
|
||||||
|
_endFrameIndex = frameIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InnerActionFrame::setAnimationName(const std::string& animationName) throw()
|
||||||
|
{
|
||||||
|
if(!_enterWithName)
|
||||||
|
{
|
||||||
|
CCLOG(" cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!");
|
||||||
|
throw std::exception();
|
||||||
|
}
|
||||||
|
_animationName = animationName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Frame* InnerActionFrame::clone()
|
Frame* InnerActionFrame::clone()
|
||||||
{
|
{
|
||||||
InnerActionFrame* frame = InnerActionFrame::create();
|
InnerActionFrame* frame = InnerActionFrame::create();
|
||||||
frame->setInnerActionType(_innerActionType);
|
frame->setInnerActionType(_innerActionType);
|
||||||
frame->setStartFrameIndex(_startFrameIndex);
|
frame->setStartFrameIndex(_startFrameIndex);
|
||||||
|
frame->setEndFrameIndex(_endFrameIndex);
|
||||||
frame->cloneProperty(this);
|
frame->cloneProperty(this);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -548,6 +619,51 @@ Frame* ColorFrame::clone()
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaFrame
|
||||||
|
AlphaFrame* AlphaFrame::create()
|
||||||
|
{
|
||||||
|
AlphaFrame* frame = new (std::nothrow) AlphaFrame();
|
||||||
|
if (frame)
|
||||||
|
{
|
||||||
|
frame->autorelease();
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(frame);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
AlphaFrame::AlphaFrame()
|
||||||
|
: _alpha(255)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AlphaFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
{
|
||||||
|
_node->setOpacity(_alpha);
|
||||||
|
|
||||||
|
if (_tween)
|
||||||
|
{
|
||||||
|
_betweenAlpha = static_cast<AlphaFrame*>(nextFrame)->_alpha - _alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AlphaFrame::apply(float percent)
|
||||||
|
{
|
||||||
|
if (_tween)
|
||||||
|
{
|
||||||
|
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
||||||
|
_node->setOpacity(alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame* AlphaFrame::clone()
|
||||||
|
{
|
||||||
|
AlphaFrame* frame = AlphaFrame::create();
|
||||||
|
frame->setAlpha(_alpha);
|
||||||
|
frame->cloneProperty(this);
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
// EventFrame
|
// EventFrame
|
||||||
EventFrame* EventFrame::create()
|
EventFrame* EventFrame::create()
|
||||||
|
|
|
@ -264,12 +264,26 @@ public:
|
||||||
inline void setInnerActionType(InnerActionType type) { _innerActionType = type; }
|
inline void setInnerActionType(InnerActionType type) { _innerActionType = type; }
|
||||||
inline InnerActionType getInnerActionType() const { return _innerActionType; }
|
inline InnerActionType getInnerActionType() const { return _innerActionType; }
|
||||||
|
|
||||||
inline void setStartFrameIndex(int frameIndex) { _startFrameIndex = frameIndex; }
|
inline void setEnterWithName(bool isEnterWithName) { _enterWithName = isEnterWithName;}
|
||||||
|
|
||||||
|
void setStartFrameIndex(int frameIndex) throw();
|
||||||
inline int getStartFrameIndex() const { return _startFrameIndex; }
|
inline int getStartFrameIndex() const { return _startFrameIndex; }
|
||||||
|
|
||||||
|
void setEndFrameIndex(int frameIndex) throw();
|
||||||
|
inline int getEndFrameIndex() const { return _endFrameIndex; }
|
||||||
|
|
||||||
|
void setAnimationName(const std::string& animationNamed) throw();
|
||||||
|
|
||||||
|
inline void setSingleFrameIndex(int frameIndex) { _singleFrameIndex = frameIndex;}
|
||||||
|
inline int getSingleFrameIndex() const { return _singleFrameIndex;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InnerActionType _innerActionType;
|
InnerActionType _innerActionType;
|
||||||
int _startFrameIndex;
|
int _startFrameIndex;
|
||||||
|
int _endFrameIndex;
|
||||||
|
int _singleFrameIndex;
|
||||||
|
std::string _animationName;
|
||||||
|
bool _enterWithName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,6 +313,23 @@ protected:
|
||||||
int _betweenBlue;
|
int _betweenBlue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CC_STUDIO_DLL AlphaFrame : public Frame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static AlphaFrame* create();
|
||||||
|
AlphaFrame();
|
||||||
|
|
||||||
|
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||||
|
virtual void apply(float percent) override;
|
||||||
|
virtual Frame* clone() override;
|
||||||
|
|
||||||
|
inline void setAlpha(GLubyte alpha) { _alpha = alpha; }
|
||||||
|
inline GLubyte getAlpha() const { return _alpha; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GLubyte _alpha;
|
||||||
|
int _betweenAlpha;
|
||||||
|
};
|
||||||
|
|
||||||
class CC_STUDIO_DLL EventFrame : public Frame
|
class CC_STUDIO_DLL EventFrame : public Frame
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,7 +181,7 @@ CSLoader::CSLoader()
|
||||||
, _jsonPath("")
|
, _jsonPath("")
|
||||||
, _monoCocos2dxVersion("")
|
, _monoCocos2dxVersion("")
|
||||||
, _rootNode(nullptr)
|
, _rootNode(nullptr)
|
||||||
, _csBuildID("2.0.8.0")
|
, _csBuildID("2.1.0.0")
|
||||||
{
|
{
|
||||||
CREATE_CLASS_NODE_READER_INFO(NodeReader);
|
CREATE_CLASS_NODE_READER_INFO(NodeReader);
|
||||||
CREATE_CLASS_NODE_READER_INFO(SingleNodeReader);
|
CREATE_CLASS_NODE_READER_INFO(SingleNodeReader);
|
||||||
|
@ -285,6 +285,7 @@ ActionTimeline* CSLoader::createTimeline(const std::string &filename)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
ActionTimelineNode* CSLoader::createActionTimelineNode(const std::string& filename)
|
ActionTimelineNode* CSLoader::createActionTimelineNode(const std::string& filename)
|
||||||
{
|
{
|
||||||
Node* root = createNode(filename);
|
Node* root = createNode(filename);
|
||||||
|
@ -308,6 +309,7 @@ ActionTimelineNode* CSLoader::createActionTimelineNode(const std::string& filena
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -834,28 +836,15 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
|
||||||
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
||||||
{
|
{
|
||||||
|
|
||||||
Node* root = createNodeWithFlatBuffersFile(filePath);
|
node = createNodeWithFlatBuffersFile(filePath);
|
||||||
reader->setPropsWithFlatBuffers(root, options->data());
|
reader->setPropsWithFlatBuffers(node, options->data());
|
||||||
|
|
||||||
bool isloop = projectNodeOptions->isLoop();
|
|
||||||
bool isautoplay = projectNodeOptions->isAutoPlay();
|
|
||||||
|
|
||||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
||||||
if (action)
|
if (action)
|
||||||
{
|
{
|
||||||
root->runAction(action);
|
node->runAction(action);
|
||||||
if (isautoplay)
|
|
||||||
{
|
|
||||||
action->gotoFrameAndPlay(0, isloop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
action->gotoFrameAndPause(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node = ActionTimelineNode::create(root, action);
|
|
||||||
node->setName(root->getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (classname == "SimpleAudio")
|
else if (classname == "SimpleAudio")
|
||||||
|
@ -1183,21 +1172,10 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
||||||
node = createNodeWithFlatBuffersForSimulator(filePath);
|
node = createNodeWithFlatBuffersForSimulator(filePath);
|
||||||
reader->setPropsWithFlatBuffers(node, options->data());
|
reader->setPropsWithFlatBuffers(node, options->data());
|
||||||
|
|
||||||
bool isloop = projectNodeOptions->isLoop();
|
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
|
||||||
bool isautoplay = projectNodeOptions->isAutoPlay();
|
|
||||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
|
||||||
if (action)
|
if (action)
|
||||||
{
|
{
|
||||||
node->runAction(action);
|
node->runAction(action);
|
||||||
action->gotoFrameAndPlay(0);
|
|
||||||
if (isautoplay)
|
|
||||||
{
|
|
||||||
action->gotoFrameAndPlay(0, isloop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
action->gotoFrameAndPause(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,10 @@ public:
|
||||||
static cocos2d::Node* createNode(const std::string& filename);
|
static cocos2d::Node* createNode(const std::string& filename);
|
||||||
static cocostudio::timeline::ActionTimeline* createTimeline(const std::string& filename);
|
static cocostudio::timeline::ActionTimeline* createTimeline(const std::string& filename);
|
||||||
|
|
||||||
|
/*
|
||||||
static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename);
|
static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename);
|
||||||
static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename, int startIndex, int endIndex, bool loop);
|
static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename, int startIndex, int endIndex, bool loop);
|
||||||
|
*/
|
||||||
|
|
||||||
cocos2d::Node* createNodeFromJson(const std::string& filename);
|
cocos2d::Node* createNodeFromJson(const std::string& filename);
|
||||||
cocos2d::Node* loadNodeWithFile(const std::string& fileName);
|
cocos2d::Node* loadNodeWithFile(const std::string& fileName);
|
||||||
|
|
|
@ -33,15 +33,18 @@ struct ListViewOptions;
|
||||||
struct ProjectNodeOptions;
|
struct ProjectNodeOptions;
|
||||||
struct ComponentOptions;
|
struct ComponentOptions;
|
||||||
struct ComAudioOptions;
|
struct ComAudioOptions;
|
||||||
|
struct AnimationInfo;
|
||||||
struct NodeAction;
|
struct NodeAction;
|
||||||
struct TimeLine;
|
struct TimeLine;
|
||||||
struct Frame;
|
struct Frame;
|
||||||
struct TimeLineBoolFrame;
|
struct PointFrame;
|
||||||
struct TimeLineIntFrame;
|
struct ScaleFrame;
|
||||||
struct TimeLineStringFrame;
|
struct ColorFrame;
|
||||||
struct TimeLinePointFrame;
|
struct TextureFrame;
|
||||||
struct TimeLineColorFrame;
|
struct EventFrame;
|
||||||
struct TimeLineTextureFrame;
|
struct IntFrame;
|
||||||
|
struct BoolFrame;
|
||||||
|
struct InnerActionFrame;
|
||||||
struct RotationSkew;
|
struct RotationSkew;
|
||||||
struct Position;
|
struct Position;
|
||||||
struct Scale;
|
struct Scale;
|
||||||
|
@ -177,7 +180,8 @@ struct CSParseBinary : private flatbuffers::Table {
|
||||||
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *texturePngs() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(6); }
|
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *texturePngs() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(6); }
|
||||||
const NodeTree *nodeTree() const { return GetPointer<const NodeTree *>(8); }
|
const NodeTree *nodeTree() const { return GetPointer<const NodeTree *>(8); }
|
||||||
const NodeAction *action() const { return GetPointer<const NodeAction *>(10); }
|
const NodeAction *action() const { return GetPointer<const NodeAction *>(10); }
|
||||||
const flatbuffers::String *version() const { return GetPointer<const flatbuffers::String *>(12); }
|
const flatbuffers::Vector<flatbuffers::Offset<AnimationInfo>> *animationList() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<AnimationInfo>> *>(12); }
|
||||||
|
const flatbuffers::String *version() const { return GetPointer<const flatbuffers::String *>(14); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* textures */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* textures */) &&
|
||||||
|
@ -190,7 +194,10 @@ struct CSParseBinary : private flatbuffers::Table {
|
||||||
verifier.VerifyTable(nodeTree()) &&
|
verifier.VerifyTable(nodeTree()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* action */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* action */) &&
|
||||||
verifier.VerifyTable(action()) &&
|
verifier.VerifyTable(action()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* version */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* animationList */) &&
|
||||||
|
verifier.Verify(animationList()) &&
|
||||||
|
verifier.VerifyVectorOfTables(animationList()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* version */) &&
|
||||||
verifier.Verify(version()) &&
|
verifier.Verify(version()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
|
@ -203,11 +210,12 @@ struct CSParseBinaryBuilder {
|
||||||
void add_texturePngs(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs) { fbb_.AddOffset(6, texturePngs); }
|
void add_texturePngs(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs) { fbb_.AddOffset(6, texturePngs); }
|
||||||
void add_nodeTree(flatbuffers::Offset<NodeTree> nodeTree) { fbb_.AddOffset(8, nodeTree); }
|
void add_nodeTree(flatbuffers::Offset<NodeTree> nodeTree) { fbb_.AddOffset(8, nodeTree); }
|
||||||
void add_action(flatbuffers::Offset<NodeAction> action) { fbb_.AddOffset(10, action); }
|
void add_action(flatbuffers::Offset<NodeAction> action) { fbb_.AddOffset(10, action); }
|
||||||
void add_version(flatbuffers::Offset<flatbuffers::String> version) { fbb_.AddOffset(12, version); }
|
void add_animationList(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<AnimationInfo>>> animationList) { fbb_.AddOffset(12, animationList); }
|
||||||
|
void add_version(flatbuffers::Offset<flatbuffers::String> version) { fbb_.AddOffset(14, version); }
|
||||||
CSParseBinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
CSParseBinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
CSParseBinaryBuilder &operator=(const CSParseBinaryBuilder &);
|
CSParseBinaryBuilder &operator=(const CSParseBinaryBuilder &);
|
||||||
flatbuffers::Offset<CSParseBinary> Finish() {
|
flatbuffers::Offset<CSParseBinary> Finish() {
|
||||||
auto o = flatbuffers::Offset<CSParseBinary>(fbb_.EndTable(start_, 5));
|
auto o = flatbuffers::Offset<CSParseBinary>(fbb_.EndTable(start_, 6));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -217,9 +225,11 @@ inline flatbuffers::Offset<CSParseBinary> CreateCSParseBinary(flatbuffers::FlatB
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs = 0,
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs = 0,
|
||||||
flatbuffers::Offset<NodeTree> nodeTree = 0,
|
flatbuffers::Offset<NodeTree> nodeTree = 0,
|
||||||
flatbuffers::Offset<NodeAction> action = 0,
|
flatbuffers::Offset<NodeAction> action = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<AnimationInfo>>> animationList = 0,
|
||||||
flatbuffers::Offset<flatbuffers::String> version = 0) {
|
flatbuffers::Offset<flatbuffers::String> version = 0) {
|
||||||
CSParseBinaryBuilder builder_(_fbb);
|
CSParseBinaryBuilder builder_(_fbb);
|
||||||
builder_.add_version(version);
|
builder_.add_version(version);
|
||||||
|
builder_.add_animationList(animationList);
|
||||||
builder_.add_action(action);
|
builder_.add_action(action);
|
||||||
builder_.add_nodeTree(nodeTree);
|
builder_.add_nodeTree(nodeTree);
|
||||||
builder_.add_texturePngs(texturePngs);
|
builder_.add_texturePngs(texturePngs);
|
||||||
|
@ -1675,16 +1685,12 @@ inline flatbuffers::Offset<ListViewOptions> CreateListViewOptions(flatbuffers::F
|
||||||
struct ProjectNodeOptions : private flatbuffers::Table {
|
struct ProjectNodeOptions : private flatbuffers::Table {
|
||||||
const WidgetOptions *nodeOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
const WidgetOptions *nodeOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
||||||
const flatbuffers::String *fileName() const { return GetPointer<const flatbuffers::String *>(6); }
|
const flatbuffers::String *fileName() const { return GetPointer<const flatbuffers::String *>(6); }
|
||||||
uint8_t isLoop() const { return GetField<uint8_t>(8, 1); }
|
|
||||||
uint8_t isAutoPlay() const { return GetField<uint8_t>(10, 1); }
|
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* nodeOptions */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* nodeOptions */) &&
|
||||||
verifier.VerifyTable(nodeOptions()) &&
|
verifier.VerifyTable(nodeOptions()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* fileName */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* fileName */) &&
|
||||||
verifier.Verify(fileName()) &&
|
verifier.Verify(fileName()) &&
|
||||||
VerifyField<uint8_t>(verifier, 8 /* isLoop */) &&
|
|
||||||
VerifyField<uint8_t>(verifier, 10 /* isAutoPlay */) &&
|
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1694,26 +1700,20 @@ struct ProjectNodeOptionsBuilder {
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_nodeOptions(flatbuffers::Offset<WidgetOptions> nodeOptions) { fbb_.AddOffset(4, nodeOptions); }
|
void add_nodeOptions(flatbuffers::Offset<WidgetOptions> nodeOptions) { fbb_.AddOffset(4, nodeOptions); }
|
||||||
void add_fileName(flatbuffers::Offset<flatbuffers::String> fileName) { fbb_.AddOffset(6, fileName); }
|
void add_fileName(flatbuffers::Offset<flatbuffers::String> fileName) { fbb_.AddOffset(6, fileName); }
|
||||||
void add_isLoop(uint8_t isLoop) { fbb_.AddElement<uint8_t>(8, isLoop, 1); }
|
|
||||||
void add_isAutoPlay(uint8_t isAutoPlay) { fbb_.AddElement<uint8_t>(10, isAutoPlay, 1); }
|
|
||||||
ProjectNodeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
ProjectNodeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
ProjectNodeOptionsBuilder &operator=(const ProjectNodeOptionsBuilder &);
|
ProjectNodeOptionsBuilder &operator=(const ProjectNodeOptionsBuilder &);
|
||||||
flatbuffers::Offset<ProjectNodeOptions> Finish() {
|
flatbuffers::Offset<ProjectNodeOptions> Finish() {
|
||||||
auto o = flatbuffers::Offset<ProjectNodeOptions>(fbb_.EndTable(start_, 4));
|
auto o = flatbuffers::Offset<ProjectNodeOptions>(fbb_.EndTable(start_, 2));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<ProjectNodeOptions> CreateProjectNodeOptions(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<ProjectNodeOptions> CreateProjectNodeOptions(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
flatbuffers::Offset<WidgetOptions> nodeOptions = 0,
|
flatbuffers::Offset<WidgetOptions> nodeOptions = 0,
|
||||||
flatbuffers::Offset<flatbuffers::String> fileName = 0,
|
flatbuffers::Offset<flatbuffers::String> fileName = 0) {
|
||||||
uint8_t isLoop = 1,
|
|
||||||
uint8_t isAutoPlay = 1) {
|
|
||||||
ProjectNodeOptionsBuilder builder_(_fbb);
|
ProjectNodeOptionsBuilder builder_(_fbb);
|
||||||
builder_.add_fileName(fileName);
|
builder_.add_fileName(fileName);
|
||||||
builder_.add_nodeOptions(nodeOptions);
|
builder_.add_nodeOptions(nodeOptions);
|
||||||
builder_.add_isAutoPlay(isAutoPlay);
|
|
||||||
builder_.add_isLoop(isLoop);
|
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1814,10 +1814,50 @@ inline flatbuffers::Offset<ComAudioOptions> CreateComAudioOptions(flatbuffers::F
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct AnimationInfo : private flatbuffers::Table {
|
||||||
|
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(4); }
|
||||||
|
int32_t startIndex() const { return GetField<int32_t>(6, 0); }
|
||||||
|
int32_t endIndex() const { return GetField<int32_t>(8, 0); }
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* name */) &&
|
||||||
|
verifier.Verify(name()) &&
|
||||||
|
VerifyField<int32_t>(verifier, 6 /* startIndex */) &&
|
||||||
|
VerifyField<int32_t>(verifier, 8 /* endIndex */) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AnimationInfoBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(4, name); }
|
||||||
|
void add_startIndex(int32_t startIndex) { fbb_.AddElement<int32_t>(6, startIndex, 0); }
|
||||||
|
void add_endIndex(int32_t endIndex) { fbb_.AddElement<int32_t>(8, endIndex, 0); }
|
||||||
|
AnimationInfoBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
AnimationInfoBuilder &operator=(const AnimationInfoBuilder &);
|
||||||
|
flatbuffers::Offset<AnimationInfo> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<AnimationInfo>(fbb_.EndTable(start_, 3));
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<AnimationInfo> CreateAnimationInfo(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||||
|
int32_t startIndex = 0,
|
||||||
|
int32_t endIndex = 0) {
|
||||||
|
AnimationInfoBuilder builder_(_fbb);
|
||||||
|
builder_.add_endIndex(endIndex);
|
||||||
|
builder_.add_startIndex(startIndex);
|
||||||
|
builder_.add_name(name);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
struct NodeAction : private flatbuffers::Table {
|
struct NodeAction : private flatbuffers::Table {
|
||||||
int32_t duration() const { return GetField<int32_t>(4, 0); }
|
int32_t duration() const { return GetField<int32_t>(4, 0); }
|
||||||
float speed() const { return GetField<float>(6, 0); }
|
float speed() const { return GetField<float>(6, 0); }
|
||||||
const flatbuffers::Vector<flatbuffers::Offset<TimeLine>> *timeLines() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TimeLine>> *>(8); }
|
const flatbuffers::Vector<flatbuffers::Offset<TimeLine>> *timeLines() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TimeLine>> *>(8); }
|
||||||
|
const flatbuffers::String *currentAnimationName() const { return GetPointer<const flatbuffers::String *>(10); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* duration */) &&
|
VerifyField<int32_t>(verifier, 4 /* duration */) &&
|
||||||
|
@ -1825,6 +1865,8 @@ struct NodeAction : private flatbuffers::Table {
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* timeLines */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* timeLines */) &&
|
||||||
verifier.Verify(timeLines()) &&
|
verifier.Verify(timeLines()) &&
|
||||||
verifier.VerifyVectorOfTables(timeLines()) &&
|
verifier.VerifyVectorOfTables(timeLines()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* currentAnimationName */) &&
|
||||||
|
verifier.Verify(currentAnimationName()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1835,10 +1877,11 @@ struct NodeActionBuilder {
|
||||||
void add_duration(int32_t duration) { fbb_.AddElement<int32_t>(4, duration, 0); }
|
void add_duration(int32_t duration) { fbb_.AddElement<int32_t>(4, duration, 0); }
|
||||||
void add_speed(float speed) { fbb_.AddElement<float>(6, speed, 0); }
|
void add_speed(float speed) { fbb_.AddElement<float>(6, speed, 0); }
|
||||||
void add_timeLines(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TimeLine>>> timeLines) { fbb_.AddOffset(8, timeLines); }
|
void add_timeLines(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TimeLine>>> timeLines) { fbb_.AddOffset(8, timeLines); }
|
||||||
|
void add_currentAnimationName(flatbuffers::Offset<flatbuffers::String> currentAnimationName) { fbb_.AddOffset(10, currentAnimationName); }
|
||||||
NodeActionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
NodeActionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
NodeActionBuilder &operator=(const NodeActionBuilder &);
|
NodeActionBuilder &operator=(const NodeActionBuilder &);
|
||||||
flatbuffers::Offset<NodeAction> Finish() {
|
flatbuffers::Offset<NodeAction> Finish() {
|
||||||
auto o = flatbuffers::Offset<NodeAction>(fbb_.EndTable(start_, 3));
|
auto o = flatbuffers::Offset<NodeAction>(fbb_.EndTable(start_, 4));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1846,8 +1889,10 @@ struct NodeActionBuilder {
|
||||||
inline flatbuffers::Offset<NodeAction> CreateNodeAction(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<NodeAction> CreateNodeAction(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t duration = 0,
|
int32_t duration = 0,
|
||||||
float speed = 0,
|
float speed = 0,
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TimeLine>>> timeLines = 0) {
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TimeLine>>> timeLines = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::String> currentAnimationName = 0) {
|
||||||
NodeActionBuilder builder_(_fbb);
|
NodeActionBuilder builder_(_fbb);
|
||||||
|
builder_.add_currentAnimationName(currentAnimationName);
|
||||||
builder_.add_timeLines(timeLines);
|
builder_.add_timeLines(timeLines);
|
||||||
builder_.add_speed(speed);
|
builder_.add_speed(speed);
|
||||||
builder_.add_duration(duration);
|
builder_.add_duration(duration);
|
||||||
|
@ -1855,13 +1900,13 @@ inline flatbuffers::Offset<NodeAction> CreateNodeAction(flatbuffers::FlatBufferB
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLine : private flatbuffers::Table {
|
struct TimeLine : private flatbuffers::Table {
|
||||||
const flatbuffers::String *frameType() const { return GetPointer<const flatbuffers::String *>(4); }
|
const flatbuffers::String *property() const { return GetPointer<const flatbuffers::String *>(4); }
|
||||||
int32_t actionTag() const { return GetField<int32_t>(6, 0); }
|
int32_t actionTag() const { return GetField<int32_t>(6, 0); }
|
||||||
const flatbuffers::Vector<flatbuffers::Offset<Frame>> *frames() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Frame>> *>(8); }
|
const flatbuffers::Vector<flatbuffers::Offset<Frame>> *frames() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Frame>> *>(8); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* frameType */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* property */) &&
|
||||||
verifier.Verify(frameType()) &&
|
verifier.Verify(property()) &&
|
||||||
VerifyField<int32_t>(verifier, 6 /* actionTag */) &&
|
VerifyField<int32_t>(verifier, 6 /* actionTag */) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* frames */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* frames */) &&
|
||||||
verifier.Verify(frames()) &&
|
verifier.Verify(frames()) &&
|
||||||
|
@ -1873,7 +1918,7 @@ struct TimeLine : private flatbuffers::Table {
|
||||||
struct TimeLineBuilder {
|
struct TimeLineBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameType(flatbuffers::Offset<flatbuffers::String> frameType) { fbb_.AddOffset(4, frameType); }
|
void add_property(flatbuffers::Offset<flatbuffers::String> property) { fbb_.AddOffset(4, property); }
|
||||||
void add_actionTag(int32_t actionTag) { fbb_.AddElement<int32_t>(6, actionTag, 0); }
|
void add_actionTag(int32_t actionTag) { fbb_.AddElement<int32_t>(6, actionTag, 0); }
|
||||||
void add_frames(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Frame>>> frames) { fbb_.AddOffset(8, frames); }
|
void add_frames(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Frame>>> frames) { fbb_.AddOffset(8, frames); }
|
||||||
TimeLineBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
TimeLineBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
@ -1885,46 +1930,43 @@ struct TimeLineBuilder {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLine> CreateTimeLine(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<TimeLine> CreateTimeLine(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
flatbuffers::Offset<flatbuffers::String> frameType = 0,
|
flatbuffers::Offset<flatbuffers::String> property = 0,
|
||||||
int32_t actionTag = 0,
|
int32_t actionTag = 0,
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Frame>>> frames = 0) {
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Frame>>> frames = 0) {
|
||||||
TimeLineBuilder builder_(_fbb);
|
TimeLineBuilder builder_(_fbb);
|
||||||
builder_.add_frames(frames);
|
builder_.add_frames(frames);
|
||||||
builder_.add_actionTag(actionTag);
|
builder_.add_actionTag(actionTag);
|
||||||
builder_.add_frameType(frameType);
|
builder_.add_property(property);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Frame : private flatbuffers::Table {
|
struct Frame : private flatbuffers::Table {
|
||||||
const TimeLineBoolFrame *visibleFrame() const { return GetPointer<const TimeLineBoolFrame *>(4); }
|
const PointFrame *pointFrame() const { return GetPointer<const PointFrame *>(4); }
|
||||||
const TimeLineIntFrame *zOrderFrame() const { return GetPointer<const TimeLineIntFrame *>(6); }
|
const ScaleFrame *scaleFrame() const { return GetPointer<const ScaleFrame *>(6); }
|
||||||
const TimeLinePointFrame *rotationSkewFrame() const { return GetPointer<const TimeLinePointFrame *>(8); }
|
const ColorFrame *colorFrame() const { return GetPointer<const ColorFrame *>(8); }
|
||||||
const TimeLineStringFrame *eventFrame() const { return GetPointer<const TimeLineStringFrame *>(10); }
|
const TextureFrame *textureFrame() const { return GetPointer<const TextureFrame *>(10); }
|
||||||
const TimeLinePointFrame *anchorPointFrame() const { return GetPointer<const TimeLinePointFrame *>(12); }
|
const EventFrame *eventFrame() const { return GetPointer<const EventFrame *>(12); }
|
||||||
const TimeLinePointFrame *positionFrame() const { return GetPointer<const TimeLinePointFrame *>(14); }
|
const IntFrame *intFrame() const { return GetPointer<const IntFrame *>(14); }
|
||||||
const TimeLinePointFrame *scaleFrame() const { return GetPointer<const TimeLinePointFrame *>(16); }
|
const BoolFrame *boolFrame() const { return GetPointer<const BoolFrame *>(16); }
|
||||||
const TimeLineColorFrame *colorFrame() const { return GetPointer<const TimeLineColorFrame *>(18); }
|
const InnerActionFrame *innerActionFrame() const { return GetPointer<const InnerActionFrame *>(18); }
|
||||||
const TimeLineTextureFrame *textureFrame() const { return GetPointer<const TimeLineTextureFrame *>(20); }
|
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* visibleFrame */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* pointFrame */) &&
|
||||||
verifier.VerifyTable(visibleFrame()) &&
|
verifier.VerifyTable(pointFrame()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* zOrderFrame */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* scaleFrame */) &&
|
||||||
verifier.VerifyTable(zOrderFrame()) &&
|
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* rotationSkewFrame */) &&
|
|
||||||
verifier.VerifyTable(rotationSkewFrame()) &&
|
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* eventFrame */) &&
|
|
||||||
verifier.VerifyTable(eventFrame()) &&
|
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* anchorPointFrame */) &&
|
|
||||||
verifier.VerifyTable(anchorPointFrame()) &&
|
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* positionFrame */) &&
|
|
||||||
verifier.VerifyTable(positionFrame()) &&
|
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* scaleFrame */) &&
|
|
||||||
verifier.VerifyTable(scaleFrame()) &&
|
verifier.VerifyTable(scaleFrame()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* colorFrame */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* colorFrame */) &&
|
||||||
verifier.VerifyTable(colorFrame()) &&
|
verifier.VerifyTable(colorFrame()) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 20 /* textureFrame */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* textureFrame */) &&
|
||||||
verifier.VerifyTable(textureFrame()) &&
|
verifier.VerifyTable(textureFrame()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* eventFrame */) &&
|
||||||
|
verifier.VerifyTable(eventFrame()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* intFrame */) &&
|
||||||
|
verifier.VerifyTable(intFrame()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* boolFrame */) &&
|
||||||
|
verifier.VerifyTable(boolFrame()) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* innerActionFrame */) &&
|
||||||
|
verifier.VerifyTable(innerActionFrame()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1932,123 +1974,197 @@ struct Frame : private flatbuffers::Table {
|
||||||
struct FrameBuilder {
|
struct FrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_visibleFrame(flatbuffers::Offset<TimeLineBoolFrame> visibleFrame) { fbb_.AddOffset(4, visibleFrame); }
|
void add_pointFrame(flatbuffers::Offset<PointFrame> pointFrame) { fbb_.AddOffset(4, pointFrame); }
|
||||||
void add_zOrderFrame(flatbuffers::Offset<TimeLineIntFrame> zOrderFrame) { fbb_.AddOffset(6, zOrderFrame); }
|
void add_scaleFrame(flatbuffers::Offset<ScaleFrame> scaleFrame) { fbb_.AddOffset(6, scaleFrame); }
|
||||||
void add_rotationSkewFrame(flatbuffers::Offset<TimeLinePointFrame> rotationSkewFrame) { fbb_.AddOffset(8, rotationSkewFrame); }
|
void add_colorFrame(flatbuffers::Offset<ColorFrame> colorFrame) { fbb_.AddOffset(8, colorFrame); }
|
||||||
void add_eventFrame(flatbuffers::Offset<TimeLineStringFrame> eventFrame) { fbb_.AddOffset(10, eventFrame); }
|
void add_textureFrame(flatbuffers::Offset<TextureFrame> textureFrame) { fbb_.AddOffset(10, textureFrame); }
|
||||||
void add_anchorPointFrame(flatbuffers::Offset<TimeLinePointFrame> anchorPointFrame) { fbb_.AddOffset(12, anchorPointFrame); }
|
void add_eventFrame(flatbuffers::Offset<EventFrame> eventFrame) { fbb_.AddOffset(12, eventFrame); }
|
||||||
void add_positionFrame(flatbuffers::Offset<TimeLinePointFrame> positionFrame) { fbb_.AddOffset(14, positionFrame); }
|
void add_intFrame(flatbuffers::Offset<IntFrame> intFrame) { fbb_.AddOffset(14, intFrame); }
|
||||||
void add_scaleFrame(flatbuffers::Offset<TimeLinePointFrame> scaleFrame) { fbb_.AddOffset(16, scaleFrame); }
|
void add_boolFrame(flatbuffers::Offset<BoolFrame> boolFrame) { fbb_.AddOffset(16, boolFrame); }
|
||||||
void add_colorFrame(flatbuffers::Offset<TimeLineColorFrame> colorFrame) { fbb_.AddOffset(18, colorFrame); }
|
void add_innerActionFrame(flatbuffers::Offset<InnerActionFrame> innerActionFrame) { fbb_.AddOffset(18, innerActionFrame); }
|
||||||
void add_textureFrame(flatbuffers::Offset<TimeLineTextureFrame> textureFrame) { fbb_.AddOffset(20, textureFrame); }
|
|
||||||
FrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
FrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
FrameBuilder &operator=(const FrameBuilder &);
|
FrameBuilder &operator=(const FrameBuilder &);
|
||||||
flatbuffers::Offset<Frame> Finish() {
|
flatbuffers::Offset<Frame> Finish() {
|
||||||
auto o = flatbuffers::Offset<Frame>(fbb_.EndTable(start_, 9));
|
auto o = flatbuffers::Offset<Frame>(fbb_.EndTable(start_, 8));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<Frame> CreateFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<Frame> CreateFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
flatbuffers::Offset<TimeLineBoolFrame> visibleFrame = 0,
|
flatbuffers::Offset<PointFrame> pointFrame = 0,
|
||||||
flatbuffers::Offset<TimeLineIntFrame> zOrderFrame = 0,
|
flatbuffers::Offset<ScaleFrame> scaleFrame = 0,
|
||||||
flatbuffers::Offset<TimeLinePointFrame> rotationSkewFrame = 0,
|
flatbuffers::Offset<ColorFrame> colorFrame = 0,
|
||||||
flatbuffers::Offset<TimeLineStringFrame> eventFrame = 0,
|
flatbuffers::Offset<TextureFrame> textureFrame = 0,
|
||||||
flatbuffers::Offset<TimeLinePointFrame> anchorPointFrame = 0,
|
flatbuffers::Offset<EventFrame> eventFrame = 0,
|
||||||
flatbuffers::Offset<TimeLinePointFrame> positionFrame = 0,
|
flatbuffers::Offset<IntFrame> intFrame = 0,
|
||||||
flatbuffers::Offset<TimeLinePointFrame> scaleFrame = 0,
|
flatbuffers::Offset<BoolFrame> boolFrame = 0,
|
||||||
flatbuffers::Offset<TimeLineColorFrame> colorFrame = 0,
|
flatbuffers::Offset<InnerActionFrame> innerActionFrame = 0) {
|
||||||
flatbuffers::Offset<TimeLineTextureFrame> textureFrame = 0) {
|
|
||||||
FrameBuilder builder_(_fbb);
|
FrameBuilder builder_(_fbb);
|
||||||
|
builder_.add_innerActionFrame(innerActionFrame);
|
||||||
|
builder_.add_boolFrame(boolFrame);
|
||||||
|
builder_.add_intFrame(intFrame);
|
||||||
|
builder_.add_eventFrame(eventFrame);
|
||||||
builder_.add_textureFrame(textureFrame);
|
builder_.add_textureFrame(textureFrame);
|
||||||
builder_.add_colorFrame(colorFrame);
|
builder_.add_colorFrame(colorFrame);
|
||||||
builder_.add_scaleFrame(scaleFrame);
|
builder_.add_scaleFrame(scaleFrame);
|
||||||
builder_.add_positionFrame(positionFrame);
|
builder_.add_pointFrame(pointFrame);
|
||||||
builder_.add_anchorPointFrame(anchorPointFrame);
|
|
||||||
builder_.add_eventFrame(eventFrame);
|
|
||||||
builder_.add_rotationSkewFrame(rotationSkewFrame);
|
|
||||||
builder_.add_zOrderFrame(zOrderFrame);
|
|
||||||
builder_.add_visibleFrame(visibleFrame);
|
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLineBoolFrame : private flatbuffers::Table {
|
struct PointFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
uint8_t value() const { return GetField<uint8_t>(8, 0); }
|
const Position *postion() const { return GetStruct<const Position *>(8); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
VerifyField<uint8_t>(verifier, 8 /* value */) &&
|
VerifyField<Position>(verifier, 8 /* postion */) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimeLineBoolFrameBuilder {
|
struct PointFrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_value(uint8_t value) { fbb_.AddElement<uint8_t>(8, value, 0); }
|
void add_postion(const Position *postion) { fbb_.AddStruct(8, postion); }
|
||||||
TimeLineBoolFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
PointFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
TimeLineBoolFrameBuilder &operator=(const TimeLineBoolFrameBuilder &);
|
PointFrameBuilder &operator=(const PointFrameBuilder &);
|
||||||
flatbuffers::Offset<TimeLineBoolFrame> Finish() {
|
flatbuffers::Offset<PointFrame> Finish() {
|
||||||
auto o = flatbuffers::Offset<TimeLineBoolFrame>(fbb_.EndTable(start_, 3));
|
auto o = flatbuffers::Offset<PointFrame>(fbb_.EndTable(start_, 3));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLineBoolFrame> CreateTimeLineBoolFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<PointFrame> CreatePointFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
uint8_t value = 0) {
|
const Position *postion = 0) {
|
||||||
TimeLineBoolFrameBuilder builder_(_fbb);
|
PointFrameBuilder builder_(_fbb);
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_postion(postion);
|
||||||
builder_.add_value(value);
|
|
||||||
builder_.add_tween(tween);
|
|
||||||
return builder_.Finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TimeLineIntFrame : private flatbuffers::Table {
|
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
|
||||||
int32_t value() const { return GetField<int32_t>(8, 0); }
|
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
|
||||||
return VerifyTableStart(verifier) &&
|
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
|
||||||
VerifyField<int32_t>(verifier, 8 /* value */) &&
|
|
||||||
verifier.EndTable();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TimeLineIntFrameBuilder {
|
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
|
||||||
flatbuffers::uoffset_t start_;
|
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
|
||||||
void add_value(int32_t value) { fbb_.AddElement<int32_t>(8, value, 0); }
|
|
||||||
TimeLineIntFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
|
||||||
TimeLineIntFrameBuilder &operator=(const TimeLineIntFrameBuilder &);
|
|
||||||
flatbuffers::Offset<TimeLineIntFrame> Finish() {
|
|
||||||
auto o = flatbuffers::Offset<TimeLineIntFrame>(fbb_.EndTable(start_, 3));
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLineIntFrame> CreateTimeLineIntFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
|
||||||
int32_t frameIndex = 0,
|
|
||||||
uint8_t tween = 1,
|
|
||||||
int32_t value = 0) {
|
|
||||||
TimeLineIntFrameBuilder builder_(_fbb);
|
|
||||||
builder_.add_value(value);
|
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLineStringFrame : private flatbuffers::Table {
|
struct ScaleFrame : private flatbuffers::Table {
|
||||||
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
|
const Scale *scale() const { return GetStruct<const Scale *>(8); }
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
|
VerifyField<Scale>(verifier, 8 /* scale */) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ScaleFrameBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
|
void add_scale(const Scale *scale) { fbb_.AddStruct(8, scale); }
|
||||||
|
ScaleFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
ScaleFrameBuilder &operator=(const ScaleFrameBuilder &);
|
||||||
|
flatbuffers::Offset<ScaleFrame> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<ScaleFrame>(fbb_.EndTable(start_, 3));
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<ScaleFrame> CreateScaleFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
int32_t frameIndex = 0,
|
||||||
|
uint8_t tween = 1,
|
||||||
|
const Scale *scale = 0) {
|
||||||
|
ScaleFrameBuilder builder_(_fbb);
|
||||||
|
builder_.add_scale(scale);
|
||||||
|
builder_.add_frameIndex(frameIndex);
|
||||||
|
builder_.add_tween(tween);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ColorFrame : private flatbuffers::Table {
|
||||||
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
|
const Color *color() const { return GetStruct<const Color *>(8); }
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
|
VerifyField<Color>(verifier, 8 /* color */) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ColorFrameBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
|
void add_color(const Color *color) { fbb_.AddStruct(8, color); }
|
||||||
|
ColorFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
ColorFrameBuilder &operator=(const ColorFrameBuilder &);
|
||||||
|
flatbuffers::Offset<ColorFrame> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<ColorFrame>(fbb_.EndTable(start_, 3));
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<ColorFrame> CreateColorFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
int32_t frameIndex = 0,
|
||||||
|
uint8_t tween = 1,
|
||||||
|
const Color *color = 0) {
|
||||||
|
ColorFrameBuilder builder_(_fbb);
|
||||||
|
builder_.add_color(color);
|
||||||
|
builder_.add_frameIndex(frameIndex);
|
||||||
|
builder_.add_tween(tween);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TextureFrame : private flatbuffers::Table {
|
||||||
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
|
const ResourceData *textureFile() const { return GetPointer<const ResourceData *>(8); }
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* textureFile */) &&
|
||||||
|
verifier.VerifyTable(textureFile()) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TextureFrameBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
|
void add_textureFile(flatbuffers::Offset<ResourceData> textureFile) { fbb_.AddOffset(8, textureFile); }
|
||||||
|
TextureFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
TextureFrameBuilder &operator=(const TextureFrameBuilder &);
|
||||||
|
flatbuffers::Offset<TextureFrame> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<TextureFrame>(fbb_.EndTable(start_, 3));
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<TextureFrame> CreateTextureFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
int32_t frameIndex = 0,
|
||||||
|
uint8_t tween = 1,
|
||||||
|
flatbuffers::Offset<ResourceData> textureFile = 0) {
|
||||||
|
TextureFrameBuilder builder_(_fbb);
|
||||||
|
builder_.add_textureFile(textureFile);
|
||||||
|
builder_.add_frameIndex(frameIndex);
|
||||||
|
builder_.add_tween(tween);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct EventFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
const flatbuffers::String *value() const { return GetPointer<const flatbuffers::String *>(8); }
|
const flatbuffers::String *value() const { return GetPointer<const flatbuffers::String *>(8); }
|
||||||
|
@ -2062,141 +2178,151 @@ struct TimeLineStringFrame : private flatbuffers::Table {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimeLineStringFrameBuilder {
|
struct EventFrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_value(flatbuffers::Offset<flatbuffers::String> value) { fbb_.AddOffset(8, value); }
|
void add_value(flatbuffers::Offset<flatbuffers::String> value) { fbb_.AddOffset(8, value); }
|
||||||
TimeLineStringFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
EventFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
TimeLineStringFrameBuilder &operator=(const TimeLineStringFrameBuilder &);
|
EventFrameBuilder &operator=(const EventFrameBuilder &);
|
||||||
flatbuffers::Offset<TimeLineStringFrame> Finish() {
|
flatbuffers::Offset<EventFrame> Finish() {
|
||||||
auto o = flatbuffers::Offset<TimeLineStringFrame>(fbb_.EndTable(start_, 3));
|
auto o = flatbuffers::Offset<EventFrame>(fbb_.EndTable(start_, 3));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLineStringFrame> CreateTimeLineStringFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<EventFrame> CreateEventFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
flatbuffers::Offset<flatbuffers::String> value = 0) {
|
flatbuffers::Offset<flatbuffers::String> value = 0) {
|
||||||
TimeLineStringFrameBuilder builder_(_fbb);
|
EventFrameBuilder builder_(_fbb);
|
||||||
builder_.add_value(value);
|
builder_.add_value(value);
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLinePointFrame : private flatbuffers::Table {
|
struct IntFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
const Position *postion() const { return GetStruct<const Position *>(8); }
|
int32_t value() const { return GetField<int32_t>(8, 0); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
VerifyField<Position>(verifier, 8 /* postion */) &&
|
VerifyField<int32_t>(verifier, 8 /* value */) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimeLinePointFrameBuilder {
|
struct IntFrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_postion(const Position *postion) { fbb_.AddStruct(8, postion); }
|
void add_value(int32_t value) { fbb_.AddElement<int32_t>(8, value, 0); }
|
||||||
TimeLinePointFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
IntFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
TimeLinePointFrameBuilder &operator=(const TimeLinePointFrameBuilder &);
|
IntFrameBuilder &operator=(const IntFrameBuilder &);
|
||||||
flatbuffers::Offset<TimeLinePointFrame> Finish() {
|
flatbuffers::Offset<IntFrame> Finish() {
|
||||||
auto o = flatbuffers::Offset<TimeLinePointFrame>(fbb_.EndTable(start_, 3));
|
auto o = flatbuffers::Offset<IntFrame>(fbb_.EndTable(start_, 3));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLinePointFrame> CreateTimeLinePointFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<IntFrame> CreateIntFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
const Position *postion = 0) {
|
int32_t value = 0) {
|
||||||
TimeLinePointFrameBuilder builder_(_fbb);
|
IntFrameBuilder builder_(_fbb);
|
||||||
builder_.add_postion(postion);
|
builder_.add_value(value);
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLineColorFrame : private flatbuffers::Table {
|
struct BoolFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
const Color *color() const { return GetStruct<const Color *>(8); }
|
uint8_t value() const { return GetField<uint8_t>(8, 1); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
VerifyField<Color>(verifier, 8 /* color */) &&
|
VerifyField<uint8_t>(verifier, 8 /* value */) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimeLineColorFrameBuilder {
|
struct BoolFrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_color(const Color *color) { fbb_.AddStruct(8, color); }
|
void add_value(uint8_t value) { fbb_.AddElement<uint8_t>(8, value, 1); }
|
||||||
TimeLineColorFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
BoolFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
TimeLineColorFrameBuilder &operator=(const TimeLineColorFrameBuilder &);
|
BoolFrameBuilder &operator=(const BoolFrameBuilder &);
|
||||||
flatbuffers::Offset<TimeLineColorFrame> Finish() {
|
flatbuffers::Offset<BoolFrame> Finish() {
|
||||||
auto o = flatbuffers::Offset<TimeLineColorFrame>(fbb_.EndTable(start_, 3));
|
auto o = flatbuffers::Offset<BoolFrame>(fbb_.EndTable(start_, 3));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLineColorFrame> CreateTimeLineColorFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<BoolFrame> CreateBoolFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
const Color *color = 0) {
|
uint8_t value = 1) {
|
||||||
TimeLineColorFrameBuilder builder_(_fbb);
|
BoolFrameBuilder builder_(_fbb);
|
||||||
builder_.add_color(color);
|
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
|
builder_.add_value(value);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeLineTextureFrame : private flatbuffers::Table {
|
struct InnerActionFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
const ResourceData *fileNameData() const { return GetPointer<const ResourceData *>(8); }
|
int32_t innerActionType() const { return GetField<int32_t>(8, 0); }
|
||||||
|
const flatbuffers::String *currentAniamtionName() const { return GetPointer<const flatbuffers::String *>(10); }
|
||||||
|
int32_t singleFrameIndex() const { return GetField<int32_t>(12, 0); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* fileNameData */) &&
|
VerifyField<int32_t>(verifier, 8 /* innerActionType */) &&
|
||||||
verifier.VerifyTable(fileNameData()) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* currentAniamtionName */) &&
|
||||||
|
verifier.Verify(currentAniamtionName()) &&
|
||||||
|
VerifyField<int32_t>(verifier, 12 /* singleFrameIndex */) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TimeLineTextureFrameBuilder {
|
struct InnerActionFrameBuilder {
|
||||||
flatbuffers::FlatBufferBuilder &fbb_;
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_fileNameData(flatbuffers::Offset<ResourceData> fileNameData) { fbb_.AddOffset(8, fileNameData); }
|
void add_innerActionType(int32_t innerActionType) { fbb_.AddElement<int32_t>(8, innerActionType, 0); }
|
||||||
TimeLineTextureFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
void add_currentAniamtionName(flatbuffers::Offset<flatbuffers::String> currentAniamtionName) { fbb_.AddOffset(10, currentAniamtionName); }
|
||||||
TimeLineTextureFrameBuilder &operator=(const TimeLineTextureFrameBuilder &);
|
void add_singleFrameIndex(int32_t singleFrameIndex) { fbb_.AddElement<int32_t>(12, singleFrameIndex, 0); }
|
||||||
flatbuffers::Offset<TimeLineTextureFrame> Finish() {
|
InnerActionFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
auto o = flatbuffers::Offset<TimeLineTextureFrame>(fbb_.EndTable(start_, 3));
|
InnerActionFrameBuilder &operator=(const InnerActionFrameBuilder &);
|
||||||
|
flatbuffers::Offset<InnerActionFrame> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<InnerActionFrame>(fbb_.EndTable(start_, 5));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline flatbuffers::Offset<TimeLineTextureFrame> CreateTimeLineTextureFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<InnerActionFrame> CreateInnerActionFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
flatbuffers::Offset<ResourceData> fileNameData = 0) {
|
int32_t innerActionType = 0,
|
||||||
TimeLineTextureFrameBuilder builder_(_fbb);
|
flatbuffers::Offset<flatbuffers::String> currentAniamtionName = 0,
|
||||||
builder_.add_fileNameData(fileNameData);
|
int32_t singleFrameIndex = 0) {
|
||||||
|
InnerActionFrameBuilder builder_(_fbb);
|
||||||
|
builder_.add_singleFrameIndex(singleFrameIndex);
|
||||||
|
builder_.add_currentAniamtionName(currentAniamtionName);
|
||||||
|
builder_.add_innerActionType(innerActionType);
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
|
|
|
@ -68,15 +68,16 @@ using namespace flatbuffers;
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
static const char* FrameType_VisibleFrame = "VisibleFrame";
|
static const char* Property_VisibleForFrame = "VisibleForFrame";
|
||||||
static const char* FrameType_PositionFrame = "PositionFrame";
|
static const char* Property_Position = "Position";
|
||||||
static const char* FrameType_ScaleFrame = "ScaleFrame";
|
static const char* Property_Scale = "Scale";
|
||||||
static const char* FrameType_RotationSkewFrame = "RotationSkewFrame";
|
static const char* Property_RotationSkew = "RotationSkew";
|
||||||
static const char* FrameType_AnchorFrame = "AnchorPointFrame";
|
static const char* Property_CColor = "CColor";
|
||||||
static const char* FrameType_ColorFrame = "ColorFrame";
|
static const char* Property_FileData = "FileData";
|
||||||
static const char* FrameType_TextureFrame = "TextureFrame";
|
static const char* Property_FrameEvent = "FrameEvent";
|
||||||
static const char* FrameType_EventFrame = "EventFrame";
|
static const char* Property_Alpha = "Alpha";
|
||||||
static const char* FrameType_ZOrderFrame = "ZOrderFrame";
|
static const char* Property_ZOrder = "ZOrder";
|
||||||
|
static const char* Property_ActionValue = "ActionValue";
|
||||||
|
|
||||||
static FlatBuffersSerialize* _instanceFlatBuffersSerialize = nullptr;
|
static FlatBuffersSerialize* _instanceFlatBuffersSerialize = nullptr;
|
||||||
|
|
||||||
|
@ -232,7 +233,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
|
|
||||||
Offset<NodeTree> nodeTree;
|
Offset<NodeTree> nodeTree;
|
||||||
Offset<NodeAction> aciton;
|
Offset<NodeAction> aciton;
|
||||||
|
std::vector<Offset<flatbuffers::AnimationInfo>> animationInfos;
|
||||||
|
|
||||||
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
||||||
|
|
||||||
|
@ -250,15 +251,26 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
const tinyxml2::XMLElement* objectData = child;
|
const tinyxml2::XMLElement* objectData = child;
|
||||||
nodeTree = createNodeTree(objectData, rootType);
|
nodeTree = createNodeTree(objectData, rootType);
|
||||||
}
|
}
|
||||||
|
else if (name == "AnimationList") // animation list
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLElement* animationinfoElement = child->FirstChildElement();
|
||||||
|
while (animationinfoElement)
|
||||||
|
{
|
||||||
|
auto animationinfo = createAnimationInfo(animationinfoElement);
|
||||||
|
animationInfos.push_back(animationinfo);
|
||||||
|
animationinfoElement = animationinfoElement->NextSiblingElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto csparsebinary = CreateCSParseBinary(*_builder,
|
auto csparsebinary = CreateCSParseBinary(*_builder,
|
||||||
_builder->CreateVector(_textures),
|
_builder->CreateVector(_textures),
|
||||||
_builder->CreateVector(_texturePngs),
|
_builder->CreateVector(_texturePngs),
|
||||||
nodeTree,
|
nodeTree,
|
||||||
aciton,
|
aciton,
|
||||||
|
_builder->CreateVector(animationInfos),
|
||||||
_builder->CreateString(_csdVersion));
|
_builder->CreateString(_csdVersion));
|
||||||
_builder->Finish(csparsebinary);
|
_builder->Finish(csparsebinary);
|
||||||
|
|
||||||
|
@ -514,6 +526,7 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle
|
||||||
{
|
{
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
float speed = 0.0f;
|
float speed = 0.0f;
|
||||||
|
std::string currentAnimationName = "";
|
||||||
|
|
||||||
// CCLOG("animation name = %s", objectData->Name());
|
// CCLOG("animation name = %s", objectData->Name());
|
||||||
|
|
||||||
|
@ -534,6 +547,10 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle
|
||||||
{
|
{
|
||||||
speed = atof(value.c_str());
|
speed = atof(value.c_str());
|
||||||
}
|
}
|
||||||
|
else if (name == "ActivedAnimationName")
|
||||||
|
{
|
||||||
|
currentAnimationName = value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
attribute = attribute->Next();
|
attribute = attribute->Next();
|
||||||
}
|
}
|
||||||
|
@ -552,13 +569,43 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle
|
||||||
return CreateNodeAction(*_builder,
|
return CreateNodeAction(*_builder,
|
||||||
duration,
|
duration,
|
||||||
speed,
|
speed,
|
||||||
_builder->CreateVector(timelines));
|
_builder->CreateVector(timelines),
|
||||||
|
_builder->CreateString(currentAnimationName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Offset<flatbuffers::AnimationInfo> FlatBuffersSerialize::createAnimationInfo(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
std::string infoName = "";
|
||||||
|
int startIndex = 0;
|
||||||
|
int endIndex = 0;
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string attriname = attribute->Name();
|
||||||
|
std::string attrivalue = attribute->Value();
|
||||||
|
if (attriname == "Name")
|
||||||
|
{
|
||||||
|
infoName = attrivalue;
|
||||||
|
}
|
||||||
|
else if (attriname == "StartIndex")
|
||||||
|
{
|
||||||
|
startIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (attriname == "EndIndex")
|
||||||
|
{
|
||||||
|
endIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
return CreateAnimationInfo(*_builder, _builder->CreateString(infoName), startIndex, endIndex);
|
||||||
|
}
|
||||||
|
|
||||||
Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement *objectData)
|
Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement *objectData)
|
||||||
{
|
{
|
||||||
int actionTag = 0;
|
int actionTag = 0;
|
||||||
std::string frameType = "";
|
std::string property = "";
|
||||||
|
|
||||||
// TimelineData attrsibutes
|
// TimelineData attrsibutes
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
@ -571,9 +618,9 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
{
|
{
|
||||||
actionTag = atoi(value.c_str());
|
actionTag = atoi(value.c_str());
|
||||||
}
|
}
|
||||||
else if (name == "FrameType")
|
else if (name == "Property")
|
||||||
{
|
{
|
||||||
frameType = value;
|
property = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute = attribute->Next();
|
attribute = attribute->Next();
|
||||||
|
@ -587,210 +634,113 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
{
|
{
|
||||||
Offset<flatbuffers::Frame> frame;
|
Offset<flatbuffers::Frame> frame;
|
||||||
|
|
||||||
if (frameType == FrameType_VisibleFrame)
|
if (property == Property_VisibleForFrame)
|
||||||
{
|
{
|
||||||
auto visibleFrame = createTimeLineBoolFrame(frameElement);
|
auto boolFrame = createBoolFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
visibleFrame);
|
0, // PointFrame
|
||||||
}
|
0, // ScaleFrame
|
||||||
else if (frameType == FrameType_ZOrderFrame)
|
0, // ColorFrame
|
||||||
{
|
0, // TextureFrame
|
||||||
auto zOrderFrame = createTimeLineIntFrame(frameElement);
|
|
||||||
frame = CreateFrame(*_builder,
|
|
||||||
0, // VisibleFrame
|
|
||||||
zOrderFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_RotationSkewFrame)
|
|
||||||
{
|
|
||||||
auto rotationSkewFrame = createTimeLinePointFrame(frameElement);
|
|
||||||
frame = CreateFrame(*_builder,
|
|
||||||
0, // VisibleFrame
|
|
||||||
0, // ZOrderFrame
|
|
||||||
rotationSkewFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_EventFrame)
|
|
||||||
{
|
|
||||||
auto eventFrame = createTimeLineStringFrame(frameElement);
|
|
||||||
frame = CreateFrame(*_builder,
|
|
||||||
0, // VisibleFrame
|
|
||||||
0, // ZOrderFrame
|
|
||||||
0, // RotationSkewFrame
|
|
||||||
eventFrame);
|
|
||||||
}
|
|
||||||
else if (frameType == FrameType_AnchorFrame)
|
|
||||||
{
|
|
||||||
auto anchorPointFrame = createTimeLinePointFrame(frameElement);
|
|
||||||
frame = CreateFrame(*_builder,
|
|
||||||
0, // VisibleFrame
|
|
||||||
0, // ZOrderFrame
|
|
||||||
0, // RotationSkewFrame
|
|
||||||
0, // EventFrame
|
0, // EventFrame
|
||||||
anchorPointFrame);
|
0, // IntFrame
|
||||||
|
boolFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_PositionFrame)
|
else if (property == Property_Position)
|
||||||
{
|
{
|
||||||
auto positionFrame = createTimeLinePointFrame(frameElement);
|
auto pointFrame = createPointFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
pointFrame);
|
||||||
0, // ZOrderFrame
|
|
||||||
0, // RotationSkewFrame
|
|
||||||
0, // EventFrame
|
|
||||||
0, // AnchorPointFrame
|
|
||||||
positionFrame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ScaleFrame)
|
else if (property == Property_Scale)
|
||||||
{
|
{
|
||||||
auto scaleFrame = createTimeLinePointFrame(frameElement);
|
auto scaleFrame = createScaleFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // PointFrame
|
||||||
0, // ZOrderFrame
|
|
||||||
0, // RotationSkewFrame
|
|
||||||
0, // EventFrame
|
|
||||||
0, // AnchorPointFrame
|
|
||||||
0, // PositionFrame
|
|
||||||
scaleFrame);
|
scaleFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ColorFrame)
|
else if (property == Property_RotationSkew)
|
||||||
{
|
{
|
||||||
auto colorFrame = createTimeLineColorFrame(frameElement);
|
auto scaleFrame = createScaleFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // PointFrame
|
||||||
0, // ZOrderFrame
|
scaleFrame);
|
||||||
0, // RotationSkewFrame
|
}
|
||||||
0, // EventFrame
|
else if (property == Property_CColor)
|
||||||
0, // AnchorPointFrame
|
{
|
||||||
0, // PositionFrame
|
auto colorFrame = createColorFrame(frameElement);
|
||||||
|
frame = CreateFrame(*_builder,
|
||||||
|
0, // PointFrame
|
||||||
0, // ScaleFrame
|
0, // ScaleFrame
|
||||||
colorFrame);
|
colorFrame);
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_TextureFrame)
|
else if (property == Property_FileData)
|
||||||
{
|
{
|
||||||
auto textureFrame = createTimeLineTextureFrame(frameElement);
|
auto textureFrame = createTextureFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // PointFrame
|
||||||
0, // ZOrderFrame
|
|
||||||
0, // RotationSkewFrame
|
|
||||||
0, // EventFrame
|
|
||||||
0, // AnchorPointFrame
|
|
||||||
0, // PositionFrame
|
|
||||||
0, // ScaleFrame
|
0, // ScaleFrame
|
||||||
0, // ColorFrame
|
0, // ColorFrame
|
||||||
textureFrame);
|
textureFrame);
|
||||||
}
|
}
|
||||||
|
else if (property == Property_FrameEvent)
|
||||||
|
{
|
||||||
|
auto eventFrame = createEventFrame(frameElement);
|
||||||
|
frame = CreateFrame(*_builder,
|
||||||
|
0, // PointFrame
|
||||||
|
0, // ScaleFrame
|
||||||
|
0, // ColorFrame
|
||||||
|
0, // TextureFrame
|
||||||
|
eventFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_Alpha)
|
||||||
|
{
|
||||||
|
auto intFrame = createIntFrame(frameElement);
|
||||||
|
frame = CreateFrame(*_builder,
|
||||||
|
0, // PointFrame
|
||||||
|
0, // ScaleFrame
|
||||||
|
0, // ColorFrame
|
||||||
|
0, // TextureFrame
|
||||||
|
0, // EventFrame
|
||||||
|
intFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_ZOrder)
|
||||||
|
{
|
||||||
|
auto intFrame = createIntFrame(frameElement);
|
||||||
|
frame = CreateFrame(*_builder,
|
||||||
|
0, // PointFrame
|
||||||
|
0, // ScaleFrame
|
||||||
|
0, // ColorFrame
|
||||||
|
0, // TextureFrame
|
||||||
|
0, // EventFrame
|
||||||
|
intFrame);
|
||||||
|
}
|
||||||
|
else if (property == Property_ActionValue)
|
||||||
|
{
|
||||||
|
auto innerActionFrame = createInnerActionFrame(frameElement);
|
||||||
|
frame = CreateFrame(*_builder,
|
||||||
|
0, // PointFrame
|
||||||
|
0, // ScaleFrame
|
||||||
|
0, // ColorFrame
|
||||||
|
0, // TextureFrame
|
||||||
|
0, // EventFrame
|
||||||
|
0, // IntFrame
|
||||||
|
0, // BoolFrame
|
||||||
|
innerActionFrame);
|
||||||
|
}
|
||||||
|
|
||||||
frames.push_back(frame);
|
frames.push_back(frame);
|
||||||
|
|
||||||
frameElement = frameElement->NextSiblingElement();
|
frameElement = frameElement->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreateTimeLine(*_builder,
|
return CreateTimeLine(*_builder,
|
||||||
_builder->CreateString(frameType),
|
_builder->CreateString(property),
|
||||||
actionTag,
|
actionTag,
|
||||||
_builder->CreateVector(frames));
|
_builder->CreateVector(frames));
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<TimeLineBoolFrame> FlatBuffersSerialize::createTimeLineBoolFrame(const tinyxml2::XMLElement *objectData)
|
Offset<flatbuffers::PointFrame> FlatBuffersSerialize::createPointFrame(const tinyxml2::XMLElement *objectData)
|
||||||
{
|
|
||||||
int frameIndex = 0;
|
|
||||||
bool tween = true;
|
|
||||||
bool value = false;
|
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string name = attribute->Name();
|
|
||||||
std::string attrivalue = attribute->Value();
|
|
||||||
|
|
||||||
if (name == "Value")
|
|
||||||
{
|
|
||||||
value = (attrivalue == "True") ? true : false;
|
|
||||||
}
|
|
||||||
else if (name == "FrameIndex")
|
|
||||||
{
|
|
||||||
frameIndex = atoi(attrivalue.c_str());
|
|
||||||
}
|
|
||||||
else if (name == "Tween")
|
|
||||||
{
|
|
||||||
tween = atoi(attrivalue.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreateTimeLineBoolFrame(*_builder,
|
|
||||||
frameIndex,
|
|
||||||
tween,
|
|
||||||
value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset<TimeLineIntFrame> FlatBuffersSerialize::createTimeLineIntFrame(const tinyxml2::XMLElement *objectData)
|
|
||||||
{
|
|
||||||
int frameIndex = 0;
|
|
||||||
bool tween = true;
|
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string name = attribute->Name();
|
|
||||||
std::string attrivalue = attribute->Value();
|
|
||||||
|
|
||||||
if (name == "Value") // to be gonna modify
|
|
||||||
{
|
|
||||||
value = atoi(attrivalue.c_str());
|
|
||||||
}
|
|
||||||
else if (name == "FrameIndex")
|
|
||||||
{
|
|
||||||
frameIndex = atoi(attrivalue.c_str());
|
|
||||||
}
|
|
||||||
else if (name == "Tween")
|
|
||||||
{
|
|
||||||
tween = (attrivalue == "True") ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreateTimeLineIntFrame(*_builder,
|
|
||||||
frameIndex,
|
|
||||||
tween,
|
|
||||||
value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset<TimeLineStringFrame> FlatBuffersSerialize::createTimeLineStringFrame(const tinyxml2::XMLElement *objectData)
|
|
||||||
{
|
|
||||||
int frameIndex = 0;
|
|
||||||
bool tween = true;
|
|
||||||
std::string value = "";
|
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string name = attribute->Name();
|
|
||||||
std::string attrivalue = attribute->Value();
|
|
||||||
|
|
||||||
if (name == "Value") // to be gonna modify
|
|
||||||
{
|
|
||||||
value = attrivalue;
|
|
||||||
}
|
|
||||||
else if (name == "FrameIndex")
|
|
||||||
{
|
|
||||||
frameIndex = atoi(attrivalue.c_str());
|
|
||||||
}
|
|
||||||
else if (name == "Tween")
|
|
||||||
{
|
|
||||||
tween = (attrivalue == "True") ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreateTimeLineStringFrame(*_builder,
|
|
||||||
frameIndex,
|
|
||||||
tween,
|
|
||||||
_builder->CreateString(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset<TimeLinePointFrame> FlatBuffersSerialize::createTimeLinePointFrame(const tinyxml2::XMLElement *objectData)
|
|
||||||
{
|
{
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
bool tween = true;
|
bool tween = true;
|
||||||
|
@ -824,17 +774,57 @@ Offset<TimeLinePointFrame> FlatBuffersSerialize::createTimeLinePointFrame(const
|
||||||
|
|
||||||
Position f_position(position.x, position.y);
|
Position f_position(position.x, position.y);
|
||||||
|
|
||||||
return CreateTimeLinePointFrame(*_builder,
|
return CreatePointFrame(*_builder,
|
||||||
frameIndex,
|
frameIndex,
|
||||||
tween,
|
tween,
|
||||||
&f_position);
|
&f_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<TimeLineColorFrame> FlatBuffersSerialize::createTimeLineColorFrame(const tinyxml2::XMLElement *objectData)
|
Offset<flatbuffers::ScaleFrame> FlatBuffersSerialize::createScaleFrame(const tinyxml2::XMLElement *objectData)
|
||||||
{
|
{
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
bool tween = true;
|
bool tween = true;
|
||||||
Color4B color;
|
Vec2 scale;
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string name = attribute->Name();
|
||||||
|
std::string value = attribute->Value();
|
||||||
|
|
||||||
|
if (name == "X")
|
||||||
|
{
|
||||||
|
scale.x = atof(value.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Y")
|
||||||
|
{
|
||||||
|
scale.y = atof(value.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "FrameIndex")
|
||||||
|
{
|
||||||
|
frameIndex = atoi(value.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Tween")
|
||||||
|
{
|
||||||
|
tween = (value == "True") ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scale f_scale(scale.x, scale.y);
|
||||||
|
|
||||||
|
return CreateScaleFrame(*_builder,
|
||||||
|
frameIndex,
|
||||||
|
tween,
|
||||||
|
&f_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<flatbuffers::ColorFrame> FlatBuffersSerialize::createColorFrame(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
int frameIndex = 0;
|
||||||
|
bool tween = true;
|
||||||
|
Color3B color;
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
while (attribute)
|
while (attribute)
|
||||||
|
@ -846,10 +836,6 @@ Offset<TimeLineColorFrame> FlatBuffersSerialize::createTimeLineColorFrame(const
|
||||||
{
|
{
|
||||||
frameIndex = atoi(value.c_str());
|
frameIndex = atoi(value.c_str());
|
||||||
}
|
}
|
||||||
else if (name == "Alpha")
|
|
||||||
{
|
|
||||||
color.a = atoi(value.c_str());
|
|
||||||
}
|
|
||||||
else if (name == "Tween")
|
else if (name == "Tween")
|
||||||
{
|
{
|
||||||
tween = (value == "True") ? true : false;
|
tween = (value == "True") ? true : false;
|
||||||
|
@ -887,16 +873,16 @@ Offset<TimeLineColorFrame> FlatBuffersSerialize::createTimeLineColorFrame(const
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color f_color(color.a, color.r, color.g, color.b);
|
Color f_color(255, color.r, color.g, color.b);
|
||||||
|
|
||||||
return CreateTimeLineColorFrame(*_builder,
|
return CreateColorFrame(*_builder,
|
||||||
frameIndex,
|
frameIndex,
|
||||||
tween,
|
tween,
|
||||||
&f_color);
|
&f_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(const tinyxml2::XMLElement *objectData)
|
Offset<flatbuffers::TextureFrame> FlatBuffersSerialize::createTextureFrame(const tinyxml2::XMLElement *objectData)
|
||||||
{
|
{
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
bool tween = true;
|
bool tween = true;
|
||||||
|
|
||||||
|
@ -959,13 +945,172 @@ Offset<TimeLineColorFrame> FlatBuffersSerialize::createTimeLineColorFrame(const
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreateTimeLineTextureFrame(*_builder,
|
return CreateTextureFrame(*_builder,
|
||||||
frameIndex,
|
frameIndex,
|
||||||
tween,
|
tween,
|
||||||
CreateResourceData(*_builder,
|
CreateResourceData(*_builder,
|
||||||
_builder->CreateString(path),
|
_builder->CreateString(path),
|
||||||
_builder->CreateString(plistFile),
|
_builder->CreateString(plistFile),
|
||||||
resourceType));
|
resourceType));
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<flatbuffers::EventFrame> FlatBuffersSerialize::createEventFrame(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
int frameIndex = 0;
|
||||||
|
bool tween = true;
|
||||||
|
std::string value = "";
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string name = attribute->Name();
|
||||||
|
std::string attrivalue = attribute->Value();
|
||||||
|
|
||||||
|
if (name == "Value") // to be gonna modify
|
||||||
|
{
|
||||||
|
value = attrivalue;
|
||||||
|
}
|
||||||
|
else if (name == "FrameIndex")
|
||||||
|
{
|
||||||
|
frameIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Tween")
|
||||||
|
{
|
||||||
|
tween = (attrivalue == "True") ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateEventFrame(*_builder,
|
||||||
|
frameIndex,
|
||||||
|
tween,
|
||||||
|
_builder->CreateString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<flatbuffers::IntFrame> FlatBuffersSerialize::createIntFrame(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
int frameIndex = 0;
|
||||||
|
bool tween = true;
|
||||||
|
int value = 0;
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string name = attribute->Name();
|
||||||
|
std::string attrivalue = attribute->Value();
|
||||||
|
|
||||||
|
if (name == "Value") // to be gonna modify
|
||||||
|
{
|
||||||
|
value = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "FrameIndex")
|
||||||
|
{
|
||||||
|
frameIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Tween")
|
||||||
|
{
|
||||||
|
tween = (attrivalue == "True") ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateIntFrame(*_builder,
|
||||||
|
frameIndex,
|
||||||
|
tween,
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<flatbuffers::BoolFrame> FlatBuffersSerialize::createBoolFrame(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
int frameIndex = 0;
|
||||||
|
bool tween = true;
|
||||||
|
bool value = true;
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string name = attribute->Name();
|
||||||
|
std::string attrivalue = attribute->Value();
|
||||||
|
|
||||||
|
if (name == "Value")
|
||||||
|
{
|
||||||
|
value = (attrivalue == "True") ? true : false;
|
||||||
|
}
|
||||||
|
else if (name == "FrameIndex")
|
||||||
|
{
|
||||||
|
frameIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Tween")
|
||||||
|
{
|
||||||
|
tween = (attrivalue == "True") ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateBoolFrame(*_builder,
|
||||||
|
frameIndex,
|
||||||
|
tween,
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<flatbuffers::InnerActionFrame> FlatBuffersSerialize::createInnerActionFrame(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
int frameIndex = 0;
|
||||||
|
bool tween = true;
|
||||||
|
int innerActionType = 0;
|
||||||
|
std::string currentAniamtionName = "";
|
||||||
|
int singleFrameIndex = 0;
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string name = attribute->Name();
|
||||||
|
std::string attrivalue = attribute->Value();
|
||||||
|
|
||||||
|
if (name == "InnerActionType")
|
||||||
|
{
|
||||||
|
if (attrivalue == "LoopAction")
|
||||||
|
{
|
||||||
|
innerActionType = 0;
|
||||||
|
}
|
||||||
|
else if (attrivalue == "NoLoopAction")
|
||||||
|
{
|
||||||
|
innerActionType = 1;
|
||||||
|
}
|
||||||
|
else if (attrivalue == "SingleFrame")
|
||||||
|
{
|
||||||
|
innerActionType = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (name == "CurrentAniamtionName")
|
||||||
|
{
|
||||||
|
currentAniamtionName = attrivalue;
|
||||||
|
}
|
||||||
|
else if (name == "SingleFrameIndex")
|
||||||
|
{
|
||||||
|
singleFrameIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "FrameIndex")
|
||||||
|
{
|
||||||
|
frameIndex = atoi(attrivalue.c_str());
|
||||||
|
}
|
||||||
|
else if (name == "Tween")
|
||||||
|
{
|
||||||
|
tween = (attrivalue == "True") ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateInnerActionFrame(*_builder,
|
||||||
|
frameIndex,
|
||||||
|
tween,
|
||||||
|
innerActionType,
|
||||||
|
_builder->CreateString(currentAniamtionName),
|
||||||
|
singleFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create flat buffers with XML */
|
/* create flat buffers with XML */
|
||||||
|
@ -1040,7 +1185,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato
|
||||||
|
|
||||||
Offset<NodeTree> nodeTree;
|
Offset<NodeTree> nodeTree;
|
||||||
Offset<NodeAction> aciton;
|
Offset<NodeAction> aciton;
|
||||||
|
std::vector<Offset<flatbuffers::AnimationInfo> > animationInfos;
|
||||||
|
|
||||||
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
||||||
|
|
||||||
|
@ -1058,6 +1203,16 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato
|
||||||
const tinyxml2::XMLElement* objectData = child;
|
const tinyxml2::XMLElement* objectData = child;
|
||||||
nodeTree = createNodeTreeForSimulator(objectData, rootType);
|
nodeTree = createNodeTreeForSimulator(objectData, rootType);
|
||||||
}
|
}
|
||||||
|
else if (name == "AnimationList") // animation list
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLElement* animationinfoElement = child->FirstChildElement();
|
||||||
|
while (animationinfoElement)
|
||||||
|
{
|
||||||
|
auto animationinfo = createAnimationInfo(animationinfoElement);
|
||||||
|
animationInfos.push_back(animationinfo);
|
||||||
|
animationinfoElement = animationinfoElement->NextSiblingElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
@ -1067,6 +1222,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato
|
||||||
_builder->CreateVector(_texturePngs),
|
_builder->CreateVector(_texturePngs),
|
||||||
nodeTree,
|
nodeTree,
|
||||||
aciton,
|
aciton,
|
||||||
|
_builder->CreateVector(animationInfos),
|
||||||
_builder->CreateString(_csdVersion));
|
_builder->CreateString(_csdVersion));
|
||||||
_builder->Finish(csparsebinary);
|
_builder->Finish(csparsebinary);
|
||||||
|
|
||||||
|
@ -1190,26 +1346,6 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
||||||
|
|
||||||
std::string filename = "";
|
std::string filename = "";
|
||||||
|
|
||||||
|
|
||||||
bool isloop = true;
|
|
||||||
bool isAutoPlay = true;
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string attriname = attribute->Name();
|
|
||||||
std::string value = attribute->Value();
|
|
||||||
if (attriname == "IsLoop")
|
|
||||||
{
|
|
||||||
isloop = (value == "True") ? true : false;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (attriname == "IsAutoPlay")
|
|
||||||
{
|
|
||||||
isAutoPlay = (value == "True") ? true : false;
|
|
||||||
}
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FileData
|
// FileData
|
||||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||||
while (child)
|
while (child)
|
||||||
|
@ -1218,19 +1354,19 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
||||||
|
|
||||||
if (name == "FileData")
|
if (name == "FileData")
|
||||||
{
|
{
|
||||||
const tinyxml2::XMLAttribute* attributeFileData = child->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||||
|
|
||||||
while (attributeFileData)
|
while (attribute)
|
||||||
{
|
{
|
||||||
name = attributeFileData->Name();
|
name = attribute->Name();
|
||||||
std::string value = attributeFileData->Value();
|
std::string value = attribute->Value();
|
||||||
|
|
||||||
if (name == "Path")
|
if (name == "Path")
|
||||||
{
|
{
|
||||||
filename = value;
|
filename = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeFileData = attributeFileData->Next();
|
attribute = attribute->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,9 +1375,7 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
||||||
|
|
||||||
return CreateProjectNodeOptions(*_builder,
|
return CreateProjectNodeOptions(*_builder,
|
||||||
nodeOptions,
|
nodeOptions,
|
||||||
_builder->CreateString(filename),
|
_builder->CreateString(filename));
|
||||||
isloop,
|
|
||||||
isAutoPlay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,16 +65,18 @@ namespace flatbuffers
|
||||||
|
|
||||||
struct TextAtlasOptions;
|
struct TextAtlasOptions;
|
||||||
|
|
||||||
|
|
||||||
struct NodeAction;
|
struct NodeAction;
|
||||||
|
struct AnimationInfo;
|
||||||
struct TimeLine;
|
struct TimeLine;
|
||||||
struct Frame;
|
struct Frame;
|
||||||
struct TimeLineBoolFrame;
|
struct PointFrame;
|
||||||
struct TimeLineIntFrame;
|
struct ScaleFrame;
|
||||||
struct TimeLineStringFrame;
|
struct ColorFrame;
|
||||||
struct TimeLinePointFrame;
|
struct TextureFrame;
|
||||||
struct TimeLineColorFrame;
|
struct EventFrame;
|
||||||
struct TimeLineTextureFrame;
|
struct IntFrame;
|
||||||
|
struct BoolFrame;
|
||||||
|
struct InnerActionFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace tinyxml2
|
namespace tinyxml2
|
||||||
|
@ -110,12 +112,17 @@ public:
|
||||||
// NodeAction
|
// NodeAction
|
||||||
flatbuffers::Offset<flatbuffers::NodeAction> createNodeAction(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::NodeAction> createNodeAction(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLine> createTimeLine(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::TimeLine> createTimeLine(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineBoolFrame> createTimeLineBoolFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::PointFrame> createPointFrame(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineIntFrame> createTimeLineIntFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::ScaleFrame> createScaleFrame(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineStringFrame> createTimeLineStringFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::ColorFrame> createColorFrame(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLinePointFrame> createTimeLinePointFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::TextureFrame> createTextureFrame(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineColorFrame> createTimeLineColorFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::EventFrame> createEventFrame(const tinyxml2::XMLElement* objectData);
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineTextureFrame> createTimeLineTextureFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::IntFrame> createIntFrame(const tinyxml2::XMLElement* objectData);
|
||||||
|
flatbuffers::Offset<flatbuffers::BoolFrame> createBoolFrame(const tinyxml2::XMLElement* objectData);
|
||||||
|
flatbuffers::Offset<flatbuffers::InnerActionFrame> createInnerActionFrame(const tinyxml2::XMLElement* objectData);
|
||||||
|
|
||||||
|
//Animation Info
|
||||||
|
flatbuffers::Offset<flatbuffers::AnimationInfo> createAnimationInfo(const tinyxml2::XMLElement* objectData);
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
int getResourceType(std::string key);
|
int getResourceType(std::string key);
|
||||||
|
|
|
@ -69,26 +69,6 @@ namespace cocostudio
|
||||||
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||||
|
|
||||||
std::string filename = "";
|
std::string filename = "";
|
||||||
bool isloop = true;
|
|
||||||
bool isAutoPlay = true;
|
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string attriname = attribute->Name();
|
|
||||||
std::string value = attribute->Value();
|
|
||||||
|
|
||||||
if (attriname == "IsLoop")
|
|
||||||
{
|
|
||||||
isloop = (value == "True") ? true : false;
|
|
||||||
}
|
|
||||||
else if (attriname == "IsAutoPlay")
|
|
||||||
{
|
|
||||||
isAutoPlay = (value == "True") ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FileData
|
// FileData
|
||||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||||
|
@ -98,12 +78,12 @@ namespace cocostudio
|
||||||
|
|
||||||
if (name == "FileData")
|
if (name == "FileData")
|
||||||
{
|
{
|
||||||
const tinyxml2::XMLAttribute* attributeFileData = child->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||||
|
|
||||||
while (attributeFileData)
|
while (attribute)
|
||||||
{
|
{
|
||||||
name = attributeFileData->Name();
|
name = attribute->Name();
|
||||||
std::string value = attributeFileData->Value();
|
std::string value = attribute->Value();
|
||||||
|
|
||||||
if (name == "Path")
|
if (name == "Path")
|
||||||
{
|
{
|
||||||
|
@ -112,7 +92,7 @@ namespace cocostudio
|
||||||
filename = convert;
|
filename = convert;
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeFileData = attributeFileData->Next();
|
attribute = attribute->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +101,7 @@ namespace cocostudio
|
||||||
|
|
||||||
auto options = CreateProjectNodeOptions(*builder,
|
auto options = CreateProjectNodeOptions(*builder,
|
||||||
nodeOptions,
|
nodeOptions,
|
||||||
builder->CreateString(filename),
|
builder->CreateString(filename));
|
||||||
isloop,
|
|
||||||
isAutoPlay);
|
|
||||||
|
|
||||||
return *(Offset<Table>*)(&options);
|
return *(Offset<Table>*)(&options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,11 @@ void TestActionTimeline::onEnter()
|
||||||
{
|
{
|
||||||
ActionTimelineTestLayer::onEnter();
|
ActionTimelineTestLayer::onEnter();
|
||||||
|
|
||||||
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 0, 40, true);
|
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
||||||
|
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPlay(0);
|
||||||
|
// ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 0, 40, true);
|
||||||
|
|
||||||
node->setScale(0.2f);
|
node->setScale(0.2f);
|
||||||
node->setPosition(VisibleRect::center());
|
node->setPosition(VisibleRect::center());
|
||||||
|
@ -217,8 +221,14 @@ void TestChangePlaySection::onEnter()
|
||||||
{
|
{
|
||||||
ActionTimelineTestLayer::onEnter();
|
ActionTimelineTestLayer::onEnter();
|
||||||
|
|
||||||
|
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
||||||
|
action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPlay(41);
|
||||||
|
/*
|
||||||
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 41, 81, true);
|
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 41, 81, true);
|
||||||
action = node->getActionTimeline();
|
action = node->getActionTimeline();
|
||||||
|
*/
|
||||||
|
|
||||||
node->setScale(0.2f);
|
node->setScale(0.2f);
|
||||||
node->setPosition(VisibleRect::center());
|
node->setPosition(VisibleRect::center());
|
||||||
|
@ -250,8 +260,14 @@ void TestTimelineFrameEvent::onEnter()
|
||||||
{
|
{
|
||||||
ActionTimelineTestLayer::onEnter();
|
ActionTimelineTestLayer::onEnter();
|
||||||
|
|
||||||
|
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
||||||
|
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPlay(0);
|
||||||
|
/*
|
||||||
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 0, 40, true);
|
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 0, 40, true);
|
||||||
ActionTimeline* action = node->getActionTimeline();
|
ActionTimeline* action = node->getActionTimeline();
|
||||||
|
*/
|
||||||
|
|
||||||
node->setScale(0.2f);
|
node->setScale(0.2f);
|
||||||
node->setPosition(150,100);
|
node->setPosition(150,100);
|
||||||
|
@ -291,7 +307,11 @@ void TestTimelinePerformance::onEnter()
|
||||||
|
|
||||||
for (int i = 0; i< 100; i++)
|
for (int i = 0; i< 100; i++)
|
||||||
{
|
{
|
||||||
ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 41, 81, true);
|
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
||||||
|
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
||||||
|
node->runAction(action);
|
||||||
|
action->gotoFrameAndPlay(41);
|
||||||
|
// ActionTimelineNode* node = CSLoader::createActionTimelineNode("ActionTimeline/DemoPlayer.csb", 41, 81, true);
|
||||||
|
|
||||||
node->setScale(0.1f);
|
node->setScale(0.1f);
|
||||||
node->setPosition(i*2,100);
|
node->setPosition(i*2,100);
|
||||||
|
|
Loading…
Reference in New Issue