2011-10-23 17:52:20 +00:00
|
|
|
/*
|
2011-05-24 07:52:29 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2011-07-04 21:21:49 +00:00
|
|
|
* Contributor(s): Mitchell Stokes.
|
2011-05-24 07:52:29 +00:00
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2011-07-07 03:53:24 +00:00
|
|
|
|
|
|
|
/** \file BL_Action.h
|
|
|
|
* \ingroup ketsji
|
|
|
|
*/
|
|
|
|
|
2012-02-23 10:41:31 +00:00
|
|
|
#ifndef __BL_ACTION_H__
|
|
|
|
#define __BL_ACTION_H__
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-06-29 01:05:12 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2011-05-24 07:52:29 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class BL_Action
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
struct bAction* m_action;
|
2014-04-06 23:30:59 +00:00
|
|
|
struct bAction* m_tmpaction;
|
2011-05-24 07:52:29 +00:00
|
|
|
struct bPose* m_blendpose;
|
2011-07-04 21:19:11 +00:00
|
|
|
struct bPose* m_blendinpose;
|
2011-08-17 09:38:50 +00:00
|
|
|
std::vector<class SG_Controller*> m_sg_contr_list;
|
2011-05-24 07:52:29 +00:00
|
|
|
class KX_GameObject* m_obj;
|
2011-06-29 01:05:12 +00:00
|
|
|
std::vector<float> m_blendshape;
|
2011-07-04 21:19:11 +00:00
|
|
|
std::vector<float> m_blendinshape;
|
2011-05-24 07:52:29 +00:00
|
|
|
|
|
|
|
float m_startframe;
|
|
|
|
float m_endframe;
|
|
|
|
float m_starttime;
|
|
|
|
float m_endtime;
|
|
|
|
float m_localtime;
|
|
|
|
|
|
|
|
float m_blendin;
|
|
|
|
float m_blendframe;
|
|
|
|
float m_blendstart;
|
|
|
|
|
2011-07-03 01:59:17 +00:00
|
|
|
float m_layer_weight;
|
|
|
|
|
2011-05-28 07:15:27 +00:00
|
|
|
float m_speed;
|
|
|
|
|
2011-06-23 22:12:49 +00:00
|
|
|
short m_priority;
|
|
|
|
|
2011-05-24 07:52:29 +00:00
|
|
|
short m_playmode;
|
2013-08-14 23:31:49 +00:00
|
|
|
short m_blendmode;
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-06-16 01:18:52 +00:00
|
|
|
short m_ipo_flags;
|
|
|
|
|
2011-05-24 07:52:29 +00:00
|
|
|
bool m_done;
|
2011-08-08 04:28:30 +00:00
|
|
|
bool m_calc_localtime;
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-08-17 09:38:50 +00:00
|
|
|
void ClearControllerList();
|
2011-05-28 07:15:27 +00:00
|
|
|
void InitIPO();
|
2011-05-24 07:52:29 +00:00
|
|
|
void SetLocalTime(float curtime);
|
2011-08-08 04:28:30 +00:00
|
|
|
void ResetStartTime(float curtime);
|
2011-06-29 01:05:12 +00:00
|
|
|
void IncrementBlending(float curtime);
|
2011-07-04 21:19:11 +00:00
|
|
|
void BlendShape(struct Key* key, float srcweight, std::vector<float>& blendshape);
|
2011-05-24 07:52:29 +00:00
|
|
|
public:
|
2011-06-11 00:14:47 +00:00
|
|
|
BL_Action(class KX_GameObject* gameobj);
|
|
|
|
~BL_Action();
|
|
|
|
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Play an action
|
|
|
|
*/
|
2011-06-29 01:53:17 +00:00
|
|
|
bool Play(const char* name,
|
2011-05-24 07:52:29 +00:00
|
|
|
float start,
|
|
|
|
float end,
|
2011-06-23 22:12:49 +00:00
|
|
|
short priority,
|
2011-05-24 07:52:29 +00:00
|
|
|
float blendin,
|
|
|
|
short play_mode,
|
2011-07-03 01:59:17 +00:00
|
|
|
float layer_weight,
|
2011-06-16 01:18:52 +00:00
|
|
|
short ipo_flags,
|
2013-08-14 23:31:49 +00:00
|
|
|
float playback_speed,
|
|
|
|
short blend_mode);
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Stop playing the action
|
|
|
|
*/
|
2011-06-11 00:14:47 +00:00
|
|
|
void Stop();
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the action is still playing
|
|
|
|
*/
|
2011-06-29 02:45:08 +00:00
|
|
|
bool IsDone();
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Update the action's frame, etc.
|
|
|
|
*/
|
2011-05-24 07:52:29 +00:00
|
|
|
void Update(float curtime);
|
2014-05-04 22:37:18 +00:00
|
|
|
/**
|
|
|
|
* Update object IPOs (note: not thread-safe!)
|
|
|
|
*/
|
|
|
|
void UpdateIPOs();
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-06-01 07:42:40 +00:00
|
|
|
// Accessors
|
|
|
|
float GetFrame();
|
2011-07-05 05:22:02 +00:00
|
|
|
struct bAction *GetAction();
|
2011-06-01 07:42:40 +00:00
|
|
|
|
|
|
|
// Mutators
|
|
|
|
void SetFrame(float frame);
|
2011-08-08 04:28:30 +00:00
|
|
|
void SetPlayMode(short play_mode);
|
|
|
|
void SetTimes(float start, float end);
|
2011-06-01 07:42:40 +00:00
|
|
|
|
2013-08-14 23:31:49 +00:00
|
|
|
enum
|
2011-05-24 07:52:29 +00:00
|
|
|
{
|
|
|
|
ACT_MODE_PLAY = 0,
|
|
|
|
ACT_MODE_LOOP,
|
|
|
|
ACT_MODE_PING_PONG,
|
|
|
|
ACT_MODE_MAX,
|
|
|
|
};
|
|
|
|
|
2013-08-14 23:31:49 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACT_BLEND_BLEND=0,
|
|
|
|
ACT_BLEND_ADD=1,
|
|
|
|
ACT_BLEND_MAX,
|
|
|
|
};
|
|
|
|
|
2011-06-16 01:18:52 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACT_IPOFLAG_FORCE = 1,
|
|
|
|
ACT_IPOFLAG_LOCAL = 2,
|
|
|
|
ACT_IPOFLAG_ADD = 4,
|
|
|
|
ACT_IPOFLAG_CHILD = 8,
|
|
|
|
};
|
|
|
|
|
2011-05-24 07:52:29 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
2012-06-25 09:14:37 +00:00
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_Action")
|
2011-05-24 07:52:29 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* BL_ACTION */
|