diff --git a/source/simulation2/components/CCmpVisualActor.cpp b/source/simulation2/components/CCmpVisualActor.cpp index b3f0c376a6..894c4298aa 100644 --- a/source/simulation2/components/CCmpVisualActor.cpp +++ b/source/simulation2/components/CCmpVisualActor.cpp @@ -421,6 +421,11 @@ public: m_Unit->SetEntitySelection(key, selection); } + virtual std::string GetAnimationName() + { + return m_AnimName; + } + virtual void SelectAnimation(const std::string& name, bool once, fixed speed, const std::wstring& soundgroup) { m_AnimRunThreshold = fixed::Zero(); diff --git a/source/simulation2/components/ICmpVisual.cpp b/source/simulation2/components/ICmpVisual.cpp index 5f96630929..a0f1854aab 100644 --- a/source/simulation2/components/ICmpVisual.cpp +++ b/source/simulation2/components/ICmpVisual.cpp @@ -23,6 +23,7 @@ BEGIN_INTERFACE_WRAPPER(Visual) DEFINE_INTERFACE_METHOD_2("SetVariant", void, ICmpVisual, SetVariant, CStr, CStr) +DEFINE_INTERFACE_METHOD_0("GetAnimationName", std::string, ICmpVisual, GetAnimationName) DEFINE_INTERFACE_METHOD_4("SelectAnimation", void, ICmpVisual, SelectAnimation, std::string, bool, fixed, std::wstring) DEFINE_INTERFACE_METHOD_1("SelectMovementAnimation", void, ICmpVisual, SelectMovementAnimation, fixed) DEFINE_INTERFACE_METHOD_1("ResetMoveAnimation", void, ICmpVisual, ResetMoveAnimation, std::string) diff --git a/source/simulation2/components/ICmpVisual.h b/source/simulation2/components/ICmpVisual.h index e135fc1a19..12d08f13b7 100644 --- a/source/simulation2/components/ICmpVisual.h +++ b/source/simulation2/components/ICmpVisual.h @@ -86,6 +86,11 @@ public: */ virtual void SetVariant(const CStr& key, const CStr& selection) = 0; + /** + * Returns the name of the currently played animation. + */ + virtual std::string GetAnimationName() = 0; + /** * Start playing the given animation. If there are multiple possible animations then it will * pick one at random (not network-synchronised).