Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Animation Chooser interface and implementation
- Loading branch information
1 parent
1e5fb84
commit 39484f0
Showing
13 changed files
with
186 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace ui | ||
{ | ||
|
||
class IAnimationChooser | ||
{ | ||
public: | ||
virtual ~IAnimationChooser() {} | ||
|
||
struct Result | ||
{ | ||
// The selected model | ||
std::string model; | ||
|
||
// The selected animation | ||
std::string anim; | ||
|
||
bool cancelled() | ||
{ | ||
return model.empty() && anim.empty(); | ||
} | ||
}; | ||
|
||
// Run the dialog and return the selected model/anim combination. | ||
// The dialog will enter a new event loop and block the UI until it's closed again. | ||
// The returned Result will be empty if the user clicks cancel. | ||
virtual Result runDialog(const std::string& preselectModel = std::string(), | ||
const std::string& preselectAnim = std::string()) = 0; | ||
|
||
// Destroys the window. Don't rely on the destructor, it won't call Destroy() for you. | ||
virtual void destroyDialog() = 0; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
plugins/uimanager/animationpreview/MD5AnimationChooser.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "MD5AnimationChooser.h" | ||
|
||
namespace ui | ||
{ | ||
|
||
MD5AnimationChooser::MD5AnimationChooser(wxWindow* parent) : | ||
MD5AnimationViewer(parent, RunMode::Selection) | ||
{} | ||
|
||
MD5AnimationChooser::Result MD5AnimationChooser::runDialog(const std::string& preselectModel, | ||
const std::string& preselectAnim) | ||
{ | ||
MD5AnimationChooser::Result result; | ||
|
||
// TODO: Pre-select | ||
|
||
if (MD5AnimationViewer::ShowModal() == wxID_OK) | ||
{ | ||
result.model = getSelectedModel(); | ||
result.anim = getSelectedAnim(); | ||
} | ||
else | ||
{ | ||
result.model.clear(); | ||
result.anim.clear(); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
void MD5AnimationChooser::destroyDialog() | ||
{ | ||
Destroy(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "ianimationchooser.h" | ||
#include "MD5AnimationViewer.h" | ||
|
||
namespace ui | ||
{ | ||
|
||
class MD5AnimationChooser : | ||
public MD5AnimationViewer, | ||
public IAnimationChooser | ||
{ | ||
public: | ||
MD5AnimationChooser(wxWindow* parent = nullptr); | ||
|
||
Result runDialog(const std::string& preselectModel = std::string(), | ||
const std::string& preselectAnim = std::string()) override; | ||
|
||
void destroyDialog() override; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters