2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* Do Ipo stuff
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
2004-11-23 23:04:30 +00:00
|
|
|
#if defined (__sgi)
|
|
|
|
#include <math.h>
|
|
|
|
#else
|
2004-10-16 11:41:50 +00:00
|
|
|
#include <cmath>
|
2004-11-23 23:04:30 +00:00
|
|
|
#endif
|
2004-10-16 11:41:50 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "KX_IpoActuator.h"
|
|
|
|
#include "KX_GameObject.h"
|
2008-10-01 21:17:00 +00:00
|
|
|
#include "FloatValue.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2002-11-25 15:29:57 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
#include "KX_KetsjiEngine.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* Type strings */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_PLAY_STRING = "Play";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_PINGPONG_STRING = "PingPong";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_FLIPPER_STRING = "Flipper";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_LOOPSTOP_STRING = "LoopStop";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_LOOPEND_STRING = "LoopEnd";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_KEY2KEY_STRING = "Key2key";
|
|
|
|
STR_String KX_IpoActuator::S_KX_ACT_IPO_FROM_PROP_STRING = "FromProp";
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* Native functions */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
|
|
|
|
const STR_String& propname,
|
2008-10-01 21:17:00 +00:00
|
|
|
const STR_String& framePropname,
|
2002-10-12 11:37:38 +00:00
|
|
|
float starttime,
|
|
|
|
float endtime,
|
|
|
|
bool recurse,
|
|
|
|
int acttype,
|
|
|
|
bool ipo_as_force,
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
bool ipo_add,
|
|
|
|
bool ipo_local,
|
2002-10-12 11:37:38 +00:00
|
|
|
PyTypeObject* T)
|
|
|
|
: SCA_IActuator(gameobj,T),
|
2004-03-22 22:02:18 +00:00
|
|
|
m_bNegativeEvent(false),
|
2004-10-16 11:41:50 +00:00
|
|
|
m_startframe (starttime),
|
|
|
|
m_endframe(endtime),
|
2002-10-12 11:37:38 +00:00
|
|
|
m_recurse(recurse),
|
2004-03-22 22:02:18 +00:00
|
|
|
m_localtime(starttime),
|
2002-10-12 11:37:38 +00:00
|
|
|
m_direction(1),
|
|
|
|
m_propname(propname),
|
2008-10-01 21:17:00 +00:00
|
|
|
m_framepropname(framePropname),
|
2002-10-12 11:37:38 +00:00
|
|
|
m_ipo_as_force(ipo_as_force),
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
m_ipo_add(ipo_add),
|
|
|
|
m_ipo_local(ipo_local),
|
2009-03-26 01:42:01 +00:00
|
|
|
m_type(acttype)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-12-05 02:50:57 +00:00
|
|
|
m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0;
|
2007-01-21 00:56:10 +00:00
|
|
|
m_bIpoPlaying = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KX_IpoActuator::SetStart(float starttime)
|
|
|
|
{
|
2004-10-16 11:41:50 +00:00
|
|
|
m_startframe=starttime;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KX_IpoActuator::SetEnd(float endtime)
|
|
|
|
{
|
2004-10-16 11:41:50 +00:00
|
|
|
m_endframe=endtime;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2004-11-03 10:48:02 +00:00
|
|
|
bool KX_IpoActuator::ClampLocalTime()
|
|
|
|
{
|
|
|
|
if (m_startframe < m_endframe)
|
|
|
|
{
|
|
|
|
if (m_localtime < m_startframe)
|
|
|
|
{
|
|
|
|
m_localtime = m_startframe;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (m_localtime > m_endframe)
|
|
|
|
{
|
|
|
|
m_localtime = m_endframe;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (m_localtime > m_startframe)
|
|
|
|
{
|
|
|
|
m_localtime = m_startframe;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (m_localtime < m_endframe)
|
|
|
|
{
|
|
|
|
m_localtime = m_endframe;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
void KX_IpoActuator::SetStartTime(float curtime)
|
|
|
|
{
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
float direction = m_startframe < m_endframe ? 1.0f : -1.0f;
|
2005-12-18 19:10:26 +00:00
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
if (m_direction > 0)
|
2008-06-17 10:06:38 +00:00
|
|
|
m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
|
2004-10-16 11:41:50 +00:00
|
|
|
else
|
2008-06-17 10:06:38 +00:00
|
|
|
m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
|
2004-10-16 11:41:50 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
void KX_IpoActuator::SetLocalTime(float curtime)
|
|
|
|
{
|
2008-09-16 21:11:38 +00:00
|
|
|
float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
|
2005-12-18 19:10:26 +00:00
|
|
|
|
|
|
|
// negative delta_time is caused by floating point inaccuracy
|
|
|
|
// perhaps the inaccuracy could be reduced a bit
|
|
|
|
if ((m_localtime==m_startframe || m_localtime==m_endframe) && delta_time<0.0)
|
|
|
|
{
|
|
|
|
delta_time = 0.0;
|
|
|
|
}
|
2004-11-03 10:48:02 +00:00
|
|
|
|
|
|
|
if (m_endframe < m_startframe)
|
|
|
|
delta_time = -delta_time;
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
if (m_direction > 0)
|
|
|
|
m_localtime = m_startframe + delta_time;
|
|
|
|
else
|
|
|
|
m_localtime = m_endframe - delta_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KX_IpoActuator::Update(double curtime, bool frame)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
// result = true if animation has to be continued, false if animation stops
|
|
|
|
// maybe there are events for us in the queue !
|
|
|
|
bool bNegativeEvent = false;
|
2004-12-05 02:50:57 +00:00
|
|
|
int numevents = 0;
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
bool bIpoStart = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-09-16 21:11:38 +00:00
|
|
|
curtime -= KX_KetsjiEngine::GetSuspendedDelta();
|
|
|
|
|
2004-12-01 08:43:58 +00:00
|
|
|
if (frame)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-12-05 02:50:57 +00:00
|
|
|
numevents = m_events.size();
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
bNegativeEvent = IsNegativeEvent();
|
|
|
|
RemoveAllEvents();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
float start_smaller_then_end = ( m_startframe < m_endframe ? 1.0f : -1.0f);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
bool result=true;
|
2007-01-21 00:56:10 +00:00
|
|
|
if (!bNegativeEvent)
|
|
|
|
{
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (m_starttime < -2.0f*start_smaller_then_end*(m_endframe - m_startframe))
|
2007-01-21 00:56:10 +00:00
|
|
|
{
|
2008-02-15 23:12:03 +00:00
|
|
|
// start for all Ipo, initial start for LOOP_STOP
|
2008-09-16 21:11:38 +00:00
|
|
|
m_starttime = curtime;
|
2007-01-21 00:56:10 +00:00
|
|
|
m_bIpoPlaying = true;
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
bIpoStart = true;
|
2007-01-21 00:56:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-26 01:42:01 +00:00
|
|
|
switch ((IpoActType)m_type)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
case KX_ACT_IPO_PLAY:
|
2004-10-16 11:41:50 +00:00
|
|
|
{
|
|
|
|
// Check if playing forwards. result = ! finished
|
2007-01-21 00:56:10 +00:00
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (start_smaller_then_end > 0.f)
|
2008-02-15 23:12:03 +00:00
|
|
|
result = (m_localtime < m_endframe && m_bIpoPlaying);
|
2004-10-16 11:41:50 +00:00
|
|
|
else
|
2008-02-15 23:12:03 +00:00
|
|
|
result = (m_localtime > m_endframe && m_bIpoPlaying);
|
2004-10-16 11:41:50 +00:00
|
|
|
|
|
|
|
if (result)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-10-16 11:41:50 +00:00
|
|
|
SetLocalTime(curtime);
|
|
|
|
|
|
|
|
/* Perform clamping */
|
2004-11-03 10:48:02 +00:00
|
|
|
ClampLocalTime();
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
|
|
|
|
if (bIpoStart)
|
|
|
|
((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local);
|
|
|
|
((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse);
|
2004-10-16 11:41:50 +00:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
m_localtime=m_startframe;
|
|
|
|
m_direction=1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-10-16 11:41:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case KX_ACT_IPO_PINGPONG:
|
|
|
|
{
|
|
|
|
result = true;
|
2008-02-15 23:12:03 +00:00
|
|
|
if (bNegativeEvent && !m_bIpoPlaying)
|
2004-10-16 11:41:50 +00:00
|
|
|
result = false;
|
|
|
|
else
|
|
|
|
SetLocalTime(curtime);
|
2004-11-03 10:48:02 +00:00
|
|
|
|
|
|
|
if (ClampLocalTime())
|
2004-10-16 11:41:50 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2004-11-03 10:48:02 +00:00
|
|
|
m_direction = -m_direction;
|
2004-10-16 11:41:50 +00:00
|
|
|
}
|
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (bIpoStart && m_direction > 0)
|
|
|
|
((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local);
|
|
|
|
((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse);
|
2004-10-16 11:41:50 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
case KX_ACT_IPO_FLIPPER:
|
2004-10-16 11:41:50 +00:00
|
|
|
{
|
2008-02-15 23:12:03 +00:00
|
|
|
if (bNegativeEvent && !m_bIpoPlaying)
|
|
|
|
result = false;
|
2004-10-16 11:41:50 +00:00
|
|
|
if (numevents)
|
|
|
|
{
|
2008-02-15 23:12:03 +00:00
|
|
|
float oldDirection = m_direction;
|
2004-10-16 11:41:50 +00:00
|
|
|
if (bNegativeEvent)
|
|
|
|
m_direction = -1;
|
|
|
|
else
|
|
|
|
m_direction = 1;
|
2008-02-15 23:12:03 +00:00
|
|
|
if (m_direction != oldDirection)
|
|
|
|
// changing direction, reset start time
|
|
|
|
SetStartTime(curtime);
|
2004-10-16 11:41:50 +00:00
|
|
|
}
|
2004-11-22 10:19:19 +00:00
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
SetLocalTime(curtime);
|
|
|
|
|
2004-11-03 10:48:02 +00:00
|
|
|
if (ClampLocalTime() && m_localtime == m_startframe)
|
|
|
|
result = false;
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
|
|
|
|
if (bIpoStart)
|
|
|
|
((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local);
|
|
|
|
((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse);
|
2004-10-16 11:41:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case KX_ACT_IPO_LOOPSTOP:
|
|
|
|
{
|
|
|
|
if (numevents)
|
|
|
|
{
|
|
|
|
if (bNegativeEvent)
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
m_bNegativeEvent = false;
|
|
|
|
numevents = 0;
|
|
|
|
}
|
2008-02-15 23:12:03 +00:00
|
|
|
if (!m_bIpoPlaying)
|
|
|
|
{
|
|
|
|
// Ipo was stopped, make sure we will restart from where it stopped
|
|
|
|
SetStartTime(curtime);
|
|
|
|
if (!bNegativeEvent)
|
|
|
|
// positive signal will restart the Ipo
|
|
|
|
m_bIpoPlaying = true;
|
|
|
|
}
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
} // fall through to loopend, and quit the ipo animation immediatly
|
|
|
|
}
|
|
|
|
case KX_ACT_IPO_LOOPEND:
|
|
|
|
{
|
|
|
|
if (numevents){
|
2008-02-15 23:12:03 +00:00
|
|
|
if (bNegativeEvent && m_bIpoPlaying){
|
2004-10-16 11:41:50 +00:00
|
|
|
m_bNegativeEvent = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-15 23:12:03 +00:00
|
|
|
if (bNegativeEvent && !m_bIpoPlaying){
|
2004-10-16 11:41:50 +00:00
|
|
|
result = false;
|
|
|
|
}
|
2004-11-03 10:48:02 +00:00
|
|
|
else
|
|
|
|
{
|
2004-10-16 11:41:50 +00:00
|
|
|
if (m_localtime*start_smaller_then_end < m_endframe*start_smaller_then_end)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-10-16 11:41:50 +00:00
|
|
|
SetLocalTime(curtime);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if (!m_bNegativeEvent){
|
|
|
|
/* Perform wraparound */
|
|
|
|
SetLocalTime(curtime);
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (start_smaller_then_end > 0.f)
|
|
|
|
m_localtime = m_startframe + fmod(m_localtime - m_startframe, m_endframe - m_startframe);
|
|
|
|
else
|
|
|
|
m_localtime = m_startframe - fmod(m_startframe - m_localtime, m_startframe - m_endframe);
|
2004-10-16 11:41:50 +00:00
|
|
|
SetStartTime(curtime);
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
bIpoStart = true;
|
2004-10-16 11:41:50 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
else
|
2004-10-16 11:41:50 +00:00
|
|
|
{
|
|
|
|
/* Perform clamping */
|
|
|
|
m_localtime=m_endframe;
|
|
|
|
result = false;
|
|
|
|
m_bNegativeEvent = false;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-10-16 11:41:50 +00:00
|
|
|
}
|
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (m_bIpoPlaying && bIpoStart)
|
|
|
|
((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local);
|
|
|
|
((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse);
|
2004-10-16 11:41:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case KX_ACT_IPO_KEY2KEY:
|
|
|
|
{
|
|
|
|
// not implemented yet
|
|
|
|
result = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case KX_ACT_IPO_FROM_PROP:
|
|
|
|
{
|
|
|
|
result = !bNegativeEvent;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
CValue* propval = GetParent()->GetProperty(m_propname);
|
|
|
|
if (propval)
|
|
|
|
{
|
2004-12-06 10:58:38 +00:00
|
|
|
m_localtime = propval->GetNumber();
|
2004-10-16 11:41:50 +00:00
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (bIpoStart)
|
|
|
|
((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local);
|
|
|
|
((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse);
|
2004-10-16 11:41:50 +00:00
|
|
|
} else
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
}
|
2004-10-16 11:41:50 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
default:
|
2004-10-16 11:41:50 +00:00
|
|
|
result = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2008-10-01 21:17:00 +00:00
|
|
|
|
|
|
|
/* Set the property if its defined */
|
|
|
|
if (m_framepropname[0] != '\0') {
|
|
|
|
CValue* propowner = GetParent();
|
|
|
|
CValue* oldprop = propowner->GetProperty(m_framepropname);
|
|
|
|
CValue* newval = new CFloatValue(m_localtime);
|
|
|
|
if (oldprop) {
|
|
|
|
oldprop->SetValue(newval);
|
|
|
|
} else {
|
|
|
|
propowner->SetProperty(m_framepropname, newval);
|
|
|
|
}
|
|
|
|
newval->Release();
|
|
|
|
}
|
|
|
|
|
2008-02-15 23:12:03 +00:00
|
|
|
if (!result)
|
|
|
|
{
|
|
|
|
if (m_type != KX_ACT_IPO_LOOPSTOP)
|
|
|
|
m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0;
|
|
|
|
m_bIpoPlaying = false;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-03-26 01:42:01 +00:00
|
|
|
int KX_IpoActuator::string2mode(char* modename) {
|
2002-10-12 11:37:38 +00:00
|
|
|
IpoActType res = KX_ACT_IPO_NODEF;
|
|
|
|
|
|
|
|
if (modename == S_KX_ACT_IPO_PLAY_STRING) {
|
|
|
|
res = KX_ACT_IPO_PLAY;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_PINGPONG_STRING) {
|
|
|
|
res = KX_ACT_IPO_PINGPONG;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_FLIPPER_STRING) {
|
|
|
|
res = KX_ACT_IPO_FLIPPER;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_LOOPSTOP_STRING) {
|
|
|
|
res = KX_ACT_IPO_LOOPSTOP;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_LOOPEND_STRING) {
|
|
|
|
res = KX_ACT_IPO_LOOPEND;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_KEY2KEY_STRING) {
|
|
|
|
res = KX_ACT_IPO_KEY2KEY;
|
|
|
|
} else if (modename == S_KX_ACT_IPO_FROM_PROP_STRING) {
|
|
|
|
res = KX_ACT_IPO_FROM_PROP;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* Python functions */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Integration hooks ------------------------------------------------------- */
|
|
|
|
PyTypeObject KX_IpoActuator::Type = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
|
|
0,
|
|
|
|
"KX_IpoActuator",
|
|
|
|
sizeof(KX_IpoActuator),
|
|
|
|
0,
|
|
|
|
PyDestructor,
|
|
|
|
0,
|
|
|
|
__getattr,
|
|
|
|
__setattr,
|
|
|
|
0, //&MyPyCompare,
|
|
|
|
__repr,
|
|
|
|
0, //&cvalue_as_number,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
PyParentObject KX_IpoActuator::Parents[] = {
|
|
|
|
&KX_IpoActuator::Type,
|
|
|
|
&SCA_IActuator::Type,
|
|
|
|
&SCA_ILogicBrick::Type,
|
|
|
|
&CValue::Type,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
PyMethodDef KX_IpoActuator::Methods[] = {
|
2008-10-02 00:22:28 +00:00
|
|
|
{"set", (PyCFunction) KX_IpoActuator::sPySet, METH_VARARGS, (PY_METHODCHAR)Set_doc},
|
2009-03-26 01:42:01 +00:00
|
|
|
|
|
|
|
// deprecated
|
2008-10-02 00:22:28 +00:00
|
|
|
{"setProperty", (PyCFunction) KX_IpoActuator::sPySetProperty, METH_VARARGS, (PY_METHODCHAR)SetProperty_doc},
|
|
|
|
{"setStart", (PyCFunction) KX_IpoActuator::sPySetStart, METH_VARARGS, (PY_METHODCHAR)SetStart_doc},
|
|
|
|
{"getStart", (PyCFunction) KX_IpoActuator::sPyGetStart, METH_NOARGS, (PY_METHODCHAR)GetStart_doc},
|
|
|
|
{"setEnd", (PyCFunction) KX_IpoActuator::sPySetEnd, METH_VARARGS, (PY_METHODCHAR)SetEnd_doc},
|
|
|
|
{"getEnd", (PyCFunction) KX_IpoActuator::sPyGetEnd, METH_NOARGS, (PY_METHODCHAR)GetEnd_doc},
|
|
|
|
{"setIpoAsForce", (PyCFunction) KX_IpoActuator::sPySetIpoAsForce, METH_VARARGS, (PY_METHODCHAR)SetIpoAsForce_doc},
|
|
|
|
{"getIpoAsForce", (PyCFunction) KX_IpoActuator::sPyGetIpoAsForce, METH_NOARGS, (PY_METHODCHAR)GetIpoAsForce_doc},
|
|
|
|
{"setIpoAdd", (PyCFunction) KX_IpoActuator::sPySetIpoAdd, METH_VARARGS, (PY_METHODCHAR)SetIpoAdd_doc},
|
|
|
|
{"getIpoAdd", (PyCFunction) KX_IpoActuator::sPyGetIpoAdd, METH_NOARGS, (PY_METHODCHAR)GetIpoAdd_doc},
|
|
|
|
{"setForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPySetForceIpoActsLocal, METH_VARARGS, (PY_METHODCHAR)SetForceIpoActsLocal_doc},
|
|
|
|
{"getForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPyGetForceIpoActsLocal, METH_NOARGS, (PY_METHODCHAR)GetForceIpoActsLocal_doc},
|
2009-03-26 01:42:01 +00:00
|
|
|
{"setType", (PyCFunction) KX_IpoActuator::sPySetType, METH_VARARGS, (PY_METHODCHAR)SetType_doc},
|
|
|
|
{"getType", (PyCFunction) KX_IpoActuator::sPyGetType, METH_NOARGS, (PY_METHODCHAR)GetType_doc},
|
2002-10-12 11:37:38 +00:00
|
|
|
{NULL,NULL} //Sentinel
|
|
|
|
};
|
|
|
|
|
2009-02-26 09:04:06 +00:00
|
|
|
PyAttributeDef KX_IpoActuator::Attributes[] = {
|
2009-03-26 01:42:01 +00:00
|
|
|
KX_PYATTRIBUTE_FLOAT_RW("startFrame", 0, 300000, KX_IpoActuator, m_startframe),
|
|
|
|
KX_PYATTRIBUTE_FLOAT_RW("endFrame", 0, 300000, KX_IpoActuator, m_endframe),
|
|
|
|
KX_PYATTRIBUTE_STRING_RW("propName", 0, 64, false, KX_IpoActuator, m_propname),
|
|
|
|
KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 64, false, KX_IpoActuator, m_framepropname),
|
|
|
|
KX_PYATTRIBUTE_INT_RW("type", KX_ACT_IPO_NODEF+1, KX_ACT_IPO_MAX-1, true, KX_IpoActuator, m_type),
|
|
|
|
KX_PYATTRIBUTE_BOOL_RW("useIpoAsForce", KX_IpoActuator, m_ipo_as_force),
|
|
|
|
KX_PYATTRIBUTE_BOOL_RW("useIpoAdd", KX_IpoActuator, m_ipo_add),
|
|
|
|
KX_PYATTRIBUTE_BOOL_RW("useIpoLocal", KX_IpoActuator, m_ipo_local),
|
|
|
|
KX_PYATTRIBUTE_BOOL_RW("useChildren", KX_IpoActuator, m_recurse),
|
|
|
|
|
2009-02-26 09:04:06 +00:00
|
|
|
{ NULL } //Sentinel
|
|
|
|
};
|
|
|
|
|
2009-02-19 13:42:07 +00:00
|
|
|
PyObject* KX_IpoActuator::_getattr(const char *attr) {
|
2009-03-26 01:42:01 +00:00
|
|
|
PyObject* object = _getattr_self(Attributes, this, attr);
|
|
|
|
if (object != NULL)
|
|
|
|
return object;
|
|
|
|
|
|
|
|
if (!strcmp(attr, "__dict__")) { /* python 3.0 uses .__dir__()*/
|
|
|
|
return _getattr_dict(SCA_IActuator::_getattr(attr), Methods, Attributes);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
_getattr_up(SCA_IActuator);
|
|
|
|
}
|
|
|
|
|
2009-03-26 01:42:01 +00:00
|
|
|
int KX_IpoActuator::_setattr(const char *attr, PyObject *value) // _setattr method
|
|
|
|
{
|
|
|
|
int ret = _setattr_self(Attributes, this, attr, value);
|
|
|
|
if (ret >= 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return SCA_IActuator::_setattr(attr, value);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* set --------------------------------------------------------------------- */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::Set_doc[] =
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
"set(type, startframe, endframe, mode?)\n"
|
|
|
|
"\t - type: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n"
|
2002-10-12 11:37:38 +00:00
|
|
|
"\t - startframe: first frame to use (int)\n"
|
|
|
|
"\t - endframe : last frame to use (int)\n"
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
"\t - mode? : special mode (0=normal, 1=interpret location as force, 2=additive)"
|
2002-10-12 11:37:38 +00:00
|
|
|
"\tSet the properties of the actuator.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySet(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
|
|
|
|
ShowDeprecationWarning("set()", "a number properties");
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* sets modes PLAY, PINGPONG, FLIPPER, LOOPSTOP, LOOPEND */
|
|
|
|
/* arg 1 = mode string, arg 2 = startframe, arg3 = stopframe, */
|
|
|
|
/* arg4 = force toggle */
|
|
|
|
char* mode;
|
|
|
|
int forceToggle;
|
2009-03-26 01:42:01 +00:00
|
|
|
int modenum;
|
2002-10-12 11:37:38 +00:00
|
|
|
int startFrame, stopFrame;
|
|
|
|
if(!PyArg_ParseTuple(args, "siii", &mode, &startFrame,
|
|
|
|
&stopFrame, &forceToggle)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
modenum = string2mode(mode);
|
|
|
|
|
|
|
|
switch (modenum) {
|
|
|
|
case KX_ACT_IPO_PLAY:
|
|
|
|
case KX_ACT_IPO_PINGPONG:
|
|
|
|
case KX_ACT_IPO_FLIPPER:
|
|
|
|
case KX_ACT_IPO_LOOPSTOP:
|
|
|
|
case KX_ACT_IPO_LOOPEND:
|
|
|
|
m_type = modenum;
|
2004-10-16 11:41:50 +00:00
|
|
|
m_startframe = startFrame;
|
|
|
|
m_endframe = stopFrame;
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
m_ipo_as_force = forceToggle == 1;
|
|
|
|
m_ipo_add = forceToggle == 2;
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
; /* error */
|
|
|
|
}
|
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set property ----------------------------------------------------------- */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetProperty_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setProperty(propname)\n"
|
|
|
|
"\t - propname: name of the property (string)\n"
|
|
|
|
"\tSet the property to be used in FromProp mode.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetProperty(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
|
|
|
|
ShowDeprecationWarning("setProperty()", "the propName property");
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* mode is implicit here, but not supported yet... */
|
|
|
|
/* args: property */
|
|
|
|
char *propertyName;
|
|
|
|
if(!PyArg_ParseTuple(args, "s", &propertyName)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-06-04 03:00:13 +00:00
|
|
|
m_propname = propertyName;
|
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 4. setStart: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetStart_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setStart(frame)\n"
|
|
|
|
"\t - frame: first frame to use (int)\n"
|
|
|
|
"\tSet the frame from which the ipo starts playing.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetStart(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
|
|
|
|
ShowDeprecationWarning("setStart()", "the startFrame property");
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
float startArg;
|
|
|
|
if(!PyArg_ParseTuple(args, "f", &startArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
m_startframe = startArg;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* 5. getStart: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetStart_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"getStart()\n"
|
|
|
|
"\tReturns the frame from which the ipo starts playing.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetStart(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getStart()", "the startFrame property");
|
2004-10-16 11:41:50 +00:00
|
|
|
return PyFloat_FromDouble(m_startframe);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 6. setEnd: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetEnd_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setEnd(frame)\n"
|
|
|
|
"\t - frame: last frame to use (int)\n"
|
|
|
|
"\tSet the frame at which the ipo stops playing.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetEnd(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("setEnd()", "the endFrame property");
|
2002-10-12 11:37:38 +00:00
|
|
|
float endArg;
|
|
|
|
if(!PyArg_ParseTuple(args, "f", &endArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
m_endframe = endArg;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* 7. getEnd: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetEnd_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"getEnd()\n"
|
|
|
|
"\tReturns the frame at which the ipo stops playing.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetEnd(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getEnd()", "the endFrame property");
|
2004-10-16 11:41:50 +00:00
|
|
|
return PyFloat_FromDouble(m_endframe);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 6. setIpoAsForce: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetIpoAsForce_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setIpoAsForce(force?)\n"
|
|
|
|
"\t - force? : interpret this ipo as a force? (KX_TRUE, KX_FALSE)\n"
|
|
|
|
"\tSet whether to interpret the ipo as a force rather than a displacement.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetIpoAsForce(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("setIpoAsForce()", "the useIpoAsForce property");
|
2002-10-12 11:37:38 +00:00
|
|
|
int boolArg;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ipo_as_force = PyArgToBool(boolArg);
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
if (m_ipo_as_force)
|
|
|
|
m_ipo_add = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* 7. getIpoAsForce: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetIpoAsForce_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"getIpoAsForce()\n"
|
|
|
|
"\tReturns whether to interpret the ipo as a force rather than a displacement.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetIpoAsForce(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getIpoAsForce()", "the useIpoAsForce property");
|
2002-10-12 11:37:38 +00:00
|
|
|
return BoolToPyArg(m_ipo_as_force);
|
|
|
|
}
|
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
/* 6. setIpoAsForce: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetIpoAdd_doc[] =
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
"setIpoAdd(add?)\n"
|
|
|
|
"\t - add? : add flag (KX_TRUE, KX_FALSE)\n"
|
|
|
|
"\tSet whether to interpret the ipo as additive rather than absolute.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetIpoAdd(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("setIpoAdd()", "the useIpoAdd property");
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
int boolArg;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ipo_add = PyArgToBool(boolArg);
|
|
|
|
if (m_ipo_add)
|
|
|
|
m_ipo_as_force = false;
|
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
}
|
|
|
|
/* 7. getIpoAsForce: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetIpoAdd_doc[] =
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
"getIpoAsAdd()\n"
|
|
|
|
"\tReturns whether to interpret the ipo as additive rather than absolute.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetIpoAdd(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getIpoAdd()", "the useIpoAdd property");
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
return BoolToPyArg(m_ipo_add);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* 8. setType: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetType_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setType(mode)\n"
|
|
|
|
"\t - mode: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n"
|
|
|
|
"\tSet the operation mode of the actuator.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetType(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("setType()", "the type property");
|
2002-10-12 11:37:38 +00:00
|
|
|
int typeArg;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "i", &typeArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (typeArg > KX_ACT_IPO_NODEF)
|
2009-03-26 01:42:01 +00:00
|
|
|
&& (typeArg < KX_ACT_IPO_MAX) ) {
|
|
|
|
m_type = typeArg;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* 9. getType: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetType_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"getType()\n"
|
|
|
|
"\tReturns the operation mode of the actuator.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetType(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getType()", "the type property");
|
2002-10-12 11:37:38 +00:00
|
|
|
return PyInt_FromLong(m_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 10. setForceIpoActsLocal: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::SetForceIpoActsLocal_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"setForceIpoActsLocal(local?)\n"
|
|
|
|
"\t - local? : Apply the ipo-as-force in the object's local\n"
|
|
|
|
"\t coordinates? (KX_TRUE, KX_FALSE)\n"
|
|
|
|
"\tSet whether to apply the force in the object's local\n"
|
|
|
|
"\tcoordinates rather than the world global coordinates.\n";
|
|
|
|
PyObject* KX_IpoActuator::PySetForceIpoActsLocal(PyObject* self,
|
|
|
|
PyObject* args,
|
|
|
|
PyObject* kwds) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("setForceIpoActsLocal()", "the useIpoLocal property");
|
2002-10-12 11:37:38 +00:00
|
|
|
int boolArg;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
m_ipo_local = PyArgToBool(boolArg);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* 11. getForceIpoActsLocal: */
|
2008-09-20 11:08:35 +00:00
|
|
|
const char KX_IpoActuator::GetForceIpoActsLocal_doc[] =
|
2002-10-12 11:37:38 +00:00
|
|
|
"getForceIpoActsLocal()\n"
|
|
|
|
"\tReturn whether to apply the force in the object's local\n"
|
|
|
|
"\tcoordinates rather than the world global coordinates.\n";
|
2008-07-23 21:37:37 +00:00
|
|
|
PyObject* KX_IpoActuator::PyGetForceIpoActsLocal(PyObject* self) {
|
2009-03-26 01:42:01 +00:00
|
|
|
ShowDeprecationWarning("getForceIpoActsLocal()", "the useIpoLocal property");
|
BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in
the object's local coordinates.
Delta Ipo curves are handled identically to normal Ipo curve and there
is no need to work with Delta Ipo curves provided that you make sure
that the Ipo curve starts from origin. Origin means location 0 for
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for
Scale Ipo curve.
The "current object situation" means the object's location, rotation
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo
curve is restarted (later or immediately in case of Loop mode), the
object current situation at that time is used as the new base.
For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).
Location
Local=false: newLoc = oLoc+iLoc
Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
Local=false: newMat = iMat*oMat
Local=true : newMat = oMat*iMat
Scale
Local=false: newScale = oScale*iScale
Local=true : newScale = oScale*iScale
Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource,
dynamics should be disabled during the execution of the curve.
Several corrections in state system
===================================
- Object initial state is taken into account when adding object
dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
different from one.
2008-07-08 12:18:43 +00:00
|
|
|
return BoolToPyArg(m_ipo_local);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* eof */
|