Skip to content

Commit

Permalink
Stop/clear all animations on closing a map
Browse files Browse the repository at this point in the history
Should hopefully fix #1711, though I couldn't reproduce it myself
  • Loading branch information
sirjuddington committed Dec 23, 2024
1 parent e689720 commit 1828a4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MapEditor/MapEditContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ void MapEditContext::clearMap()
// Clear other data
updateTagged();
info_3d_.reset();
renderer_.clearAnimations();

// Clear map
map_.clearMap();
Expand Down
8 changes: 8 additions & 0 deletions src/MapEditor/Renderer/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1753,3 +1753,11 @@ void Renderer::addAnimation(unique_ptr<MCAnimation> animation)
{
animations_.push_back(std::move(animation));
}

// -----------------------------------------------------------------------------
// Clears all active animations
// -----------------------------------------------------------------------------
void Renderer::clearAnimations()
{
animations_.clear();
}
1 change: 1 addition & 0 deletions src/MapEditor/Renderer/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace mapeditor
void animateSelectionChange(const ItemSelection& selection);
void animateHilightChange(const mapeditor::Item& old_item, MapObject* old_object = nullptr);
void addAnimation(unique_ptr<MCAnimation> animation);
void clearAnimations();

private:
MapEditContext& context_;
Expand Down

0 comments on commit 1828a4a

Please sign in to comment.