Add resource load and save functions for animations.
This commit is contained in:
parent
fc2ce2f3de
commit
21ddb94b52
@ -60,6 +60,25 @@ void AttributeAnimation::RegisterObject(Context* context)
|
||||
context->RegisterFactory<AttributeAnimation>();
|
||||
}
|
||||
|
||||
bool AttributeAnimation::Load(Deserializer& source)
|
||||
{
|
||||
XMLFile xmlFile(context_);
|
||||
if (!xmlFile.Load(source))
|
||||
return false;
|
||||
|
||||
return LoadXML(xmlFile.GetRoot());
|
||||
}
|
||||
|
||||
bool AttributeAnimation::Save(Serializer& dest) const
|
||||
{
|
||||
XMLFile xmlFile(context_);
|
||||
|
||||
if (!SaveXML(xmlFile.CreateRoot("attributeAnimation")))
|
||||
return false;
|
||||
|
||||
return xmlFile.Save(dest);
|
||||
}
|
||||
|
||||
bool AttributeAnimation::LoadXML(const XMLElement& source)
|
||||
{
|
||||
valueType_ = VAR_NONE;
|
||||
|
@ -75,6 +75,10 @@ public:
|
||||
/// Register object factory.
|
||||
static void RegisterObject(Context* context);
|
||||
|
||||
/// Load resource. Return true if successful.
|
||||
virtual bool Load(Deserializer& source);
|
||||
/// Save resource. Return true if successful.
|
||||
virtual bool Save(Serializer& dest) const;
|
||||
/// Load from XML data. Return true if successful.
|
||||
bool LoadXML(const XMLElement& source);
|
||||
/// Save as XML data. Return true if successful.
|
||||
|
@ -45,6 +45,25 @@ void ObjectAnimation::RegisterObject(Context* context)
|
||||
context->RegisterFactory<ObjectAnimation>();
|
||||
}
|
||||
|
||||
bool ObjectAnimation::Load(Deserializer& source)
|
||||
{
|
||||
XMLFile xmlFile(context_);
|
||||
if (!xmlFile.Load(source))
|
||||
return false;
|
||||
|
||||
return LoadXML(xmlFile.GetRoot());
|
||||
}
|
||||
|
||||
bool ObjectAnimation::Save(Serializer& dest) const
|
||||
{
|
||||
XMLFile xmlFile(context_);
|
||||
|
||||
if (!SaveXML(xmlFile.CreateRoot("objectAnimation")))
|
||||
return false;
|
||||
|
||||
return xmlFile.Save(dest);
|
||||
}
|
||||
|
||||
bool ObjectAnimation::LoadXML(const XMLElement& source)
|
||||
{
|
||||
attributeAnimations_.Clear();
|
||||
|
@ -42,6 +42,10 @@ public:
|
||||
/// Register object factory.
|
||||
static void RegisterObject(Context* context);
|
||||
|
||||
/// Load resource. Return true if successful.
|
||||
virtual bool Load(Deserializer& source);
|
||||
/// Save resource. Return true if successful.
|
||||
virtual bool Save(Serializer& dest) const;
|
||||
/// Load from XML data. Return true if successful.
|
||||
bool LoadXML(const XMLElement& source);
|
||||
/// Save as XML data. Return true if successful.
|
||||
|
Loading…
Reference in New Issue
Block a user