forked from aya/aya
66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
|
|
|
|
|
|
#include "DataModel/Animation.hpp"
|
|
#include "DataModel/KeyframeSequenceProvider.hpp"
|
|
#include "DataModel/AnimationTrackState.hpp"
|
|
#include "DataModel/PartInstance.hpp"
|
|
#include "DataModel/JointInstance.hpp"
|
|
|
|
namespace Aya
|
|
{
|
|
|
|
const char* const sAnimation = "Animation";
|
|
|
|
const Reflection::PropDescriptor<Animation, AnimationId> prop_AnimationId(
|
|
"AnimationId", category_Data, &Animation::getAssetId, &Animation::setAssetId);
|
|
// const Reflection::PropDescriptor<Animation, bool> prop_Loop("Loop", category_Data, &Animation::getLoop, &Animation::setLoop);
|
|
// const Reflection::EnumPropDescriptor<Animation, Animation::Priority> prop_Priority("Priority", category_Data, &Animation::getPriority,
|
|
// &Animation::setPriority);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
//
|
|
// FRONTEND AND BACKEND
|
|
|
|
Animation::Animation()
|
|
: DescribedCreatable<Animation, Instance, sAnimation>()
|
|
{
|
|
setName(sAnimation);
|
|
}
|
|
|
|
bool Animation::isEmbeddedAsset() const
|
|
{
|
|
return !assetId.isHttp() && !assetId.isAsset();
|
|
}
|
|
|
|
shared_ptr<const KeyframeSequence> Animation::getKeyframeSequence() const
|
|
{
|
|
return getKeyframeSequence(this);
|
|
}
|
|
|
|
shared_ptr<const KeyframeSequence> Animation::getKeyframeSequence(const Instance* context) const
|
|
{
|
|
if (assetId.isNull())
|
|
{
|
|
return shared_ptr<KeyframeSequence>();
|
|
}
|
|
|
|
if (KeyframeSequenceProvider* keyframeSequenceProvider = ServiceProvider::create<KeyframeSequenceProvider>(context))
|
|
{
|
|
return keyframeSequenceProvider->getKeyframeSequence(assetId, this);
|
|
}
|
|
return shared_ptr<KeyframeSequence>();
|
|
}
|
|
|
|
void Animation::setAssetId(AnimationId value)
|
|
{
|
|
if (assetId != value)
|
|
{
|
|
assetId = value;
|
|
raisePropertyChanged(prop_AnimationId);
|
|
}
|
|
}
|
|
|
|
} // namespace Aya
|