1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-16 06:29:31 +00:00

Merge branch 'experimental' of file:///Users/User/code/coding/Aquaria_fg_clean into experimental

This commit is contained in:
fgenesis 2014-01-05 16:59:13 +00:00
commit 81de2b8e9d
4 changed files with 17 additions and 6 deletions

View file

@ -516,6 +516,10 @@ void AnimationEditor::pushUndo()
SkeletalSprite sk; SkeletalSprite sk;
sk.animations = editSprite->animations; sk.animations = editSprite->animations;
undoHistory.push_back(sk); undoHistory.push_back(sk);
if(undoHistory.size() > 50)
undoHistory.pop_front();
undoEntry = undoHistory.size()-1; undoEntry = undoHistory.size()-1;
} }
@ -1328,8 +1332,10 @@ void AnimationEditor::cloneBoneAhead()
void AnimationEditor::saveFile() void AnimationEditor::saveFile()
{ {
editSprite->saveSkeletal(editingFile); if(editSprite->saveSkeletal(editingFile))
dsq->screenMessage("Saved anim: " + editingFile); dsq->screenMessage("Saved anim: " + editingFile);
else
dsq->screenMessage("FAILED TO SAVE: " + editingFile);
} }
void AnimationEditor::loadFile() void AnimationEditor::loadFile()

View file

@ -204,7 +204,7 @@ public:
void moveNextWidgets(float dt); void moveNextWidgets(float dt);
std::vector<SkeletalSprite> undoHistory; std::deque<SkeletalSprite> undoHistory;
int undoEntry; int undoEntry;

View file

@ -846,15 +846,20 @@ void AnimationLayer::update(float dt)
} }
} }
void SkeletalSprite::saveSkeletal(const std::string &fn) bool SkeletalSprite::saveSkeletal(const std::string &fn)
{ {
std::string file, filename=fn; std::string file, filename=fn;
stringToLower(filename); stringToLower(filename);
if (!secondaryAnimationPath.empty()) if (!secondaryAnimationPath.empty())
{
createDir(secondaryAnimationPath);
file = secondaryAnimationPath + filename + ".xml"; file = secondaryAnimationPath + filename + ".xml";
}
else else
{
file = animationPath + filename + ".xml"; file = animationPath + filename + ".xml";
}
int i = 0; int i = 0;
TiXmlDocument& xml = _retrieveSkeletalXML(file); TiXmlDocument& xml = _retrieveSkeletalXML(file);
@ -1032,7 +1037,7 @@ void SkeletalSprite::saveSkeletal(const std::string &fn)
animations.InsertEndChild(animation); animations.InsertEndChild(animation);
} }
xml.InsertEndChild(animations); xml.InsertEndChild(animations);
xml.SaveFile(file); return xml.SaveFile(file);
} }
int SkeletalSprite::getBoneIdx(Bone *b) int SkeletalSprite::getBoneIdx(Bone *b)

View file

@ -203,7 +203,7 @@ public:
SkeletalSprite(); SkeletalSprite();
void loadSkeletal(const std::string &fn); void loadSkeletal(const std::string &fn);
void saveSkeletal(const std::string &fn); bool saveSkeletal(const std::string &fn);
void loadSkin(const std::string &fn); void loadSkin(const std::string &fn);
Bone *getBoneByIdx(int idx); Bone *getBoneByIdx(int idx);