/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_EDITOR_MANNEQUIN_MANNEQUINPLAYBACK_H #define CRYINCLUDE_EDITOR_MANNEQUIN_MANNEQUINPLAYBACK_H #pragma once #include "MannequinBase.h" class CFragmentPlayback : public CBasicAction { public: DEFINE_ACTION("FragmentPlayback"); CFragmentPlayback(ActionScopes scopeMask, uint32 flags); virtual void Enter(); virtual void Exit(); void TriggerExit(); void SetFragment(FragmentID fragmentID, TagState fragTags, uint32 option, float maxTime); void Restart(float time = -1.0f); void SetTime(float time, bool bForce = false); float GetTimeSinceInstall() const; bool ReachedEnd() const; virtual IAction::EStatus Update(float timePassed); virtual void OnSequenceFinished(int layer, uint32 scopeID); virtual int GetPriority() const { return 102; } private: void InternalSetFragment(FragmentID fragmentID, TagState fragTags, uint32 option); float m_timeSinceInstall; float m_maxTime; }; ////////////////////////////////////////////////////////////////////////// class CFragmentSequencePlayback { public: CFragmentSequencePlayback(const CFragmentHistory& history, IActionController& actionController, EMannequinEditorMode mode, const ActionScopes& scopeMask = ACTION_SCOPES_ALL) : m_time(0.0f) , m_maxTime(5.0f) , m_curIdx(0) , m_playScale(1.0f) , m_history(history) , m_actionController(actionController) , m_mode(mode) , m_scopeMask(scopeMask) { } ~CFragmentSequencePlayback(); void Restart(float time = -1.0f); void SetTime(float time, bool bForce = false); void Update(float time, class CMannequinModelViewport * pViewport); float GetTime() const { return m_time; } void SetScopeMask(const ActionScopes& scopeMask) { m_scopeMask = scopeMask; } void SetSpeedBias(float playScale); private: void StopPrevious(ActionScopes scopeMask); void UpdateDebugParams(); const CFragmentHistory& m_history; IActionController& m_actionController; std::vector m_actions; EMannequinEditorMode m_mode; ActionScopes m_scopeMask; float m_time; float m_maxTime; uint32 m_curIdx; float m_playScale; }; #endif // CRYINCLUDE_EDITOR_MANNEQUIN_MANNEQUINPLAYBACK_H