[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16908] branches/harmonic-skeleton/source/ gameengine/Converter/BL_ShapeActionActuator.cpp: fix conflict in merged file.
Martin Poirier
theeth at yahoo.com
Sat Oct 4 01:36:02 CEST 2008
Revision: 16908
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16908
Author: theeth
Date: 2008-10-04 01:36:02 +0200 (Sat, 04 Oct 2008)
Log Message:
-----------
fix conflict in merged file. weird, it compiled ok wednesday.
Modified Paths:
--------------
branches/harmonic-skeleton/source/gameengine/Converter/BL_ShapeActionActuator.cpp
Modified: branches/harmonic-skeleton/source/gameengine/Converter/BL_ShapeActionActuator.cpp
===================================================================
--- branches/harmonic-skeleton/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2008-10-03 21:50:42 UTC (rev 16907)
+++ branches/harmonic-skeleton/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2008-10-03 23:36:02 UTC (rev 16908)
@@ -1,6 +1,5 @@
-<<<<<<< .working
/**
-* $Id:BL_ShapeActionActuator.cpp 15330 2008-06-23 16:37:51Z theeth $
+* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -50,6 +49,8 @@
#include "BLI_arithb.h"
#include "MT_Matrix4x4.h"
#include "BKE_utildefines.h"
+#include "FloatValue.h"
+#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -92,352 +93,256 @@
{
m_localtime = m_endframe;
return true;
-=======
-/**
-* $Id$
-*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 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.
- *
- * ***** END GPL LICENSE BLOCK *****
-*/
-
-#if defined (__sgi)
-#include <math.h>
-#else
-#include <cmath>
-#endif
-
-#include "SCA_LogicManager.h"
-#include "BL_ShapeActionActuator.h"
-#include "BL_ActionActuator.h"
-#include "BL_ShapeDeformer.h"
-#include "KX_GameObject.h"
-#include "STR_HashedString.h"
-#include "DNA_action_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_actuator_types.h"
-#include "BKE_action.h"
-#include "DNA_armature_types.h"
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "MT_Matrix4x4.h"
-#include "BKE_utildefines.h"
-#include "FloatValue.h"
-#include "PyObjectPlus.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-BL_ShapeActionActuator::~BL_ShapeActionActuator()
-{
-}
-
-void BL_ShapeActionActuator::ProcessReplica()
-{
- m_localtime=m_startframe;
- m_lastUpdate=-1;
-}
-
-void BL_ShapeActionActuator::SetBlendTime (float newtime)
-{
- m_blendframe = newtime;
-}
-
-CValue* BL_ShapeActionActuator::GetReplica()
-{
- BL_ShapeActionActuator* replica = new BL_ShapeActionActuator(*this);//m_float,GetName());
- replica->ProcessReplica();
-
- // this will copy properties and so on...
- CValue::AddDataToReplica(replica);
- return replica;
-}
-
-bool BL_ShapeActionActuator::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;
-}
-
-void BL_ShapeActionActuator::SetStartTime(float curtime)
-{
- float direction = m_startframe < m_endframe ? 1.0 : -1.0;
-
- if (!(m_flag & ACT_FLAG_REVERSE))
- m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
- else
- m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
-}
-
-void BL_ShapeActionActuator::SetLocalTime(float curtime)
-{
- float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
-
- if (m_endframe < m_startframe)
- delta_time = -delta_time;
-
- if (!(m_flag & ACT_FLAG_REVERSE))
- m_localtime = m_startframe + delta_time;
- else
- m_localtime = m_endframe - delta_time;
-}
-
-void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight)
-{
- vector<float>::const_iterator it;
- float dstweight;
- KeyBlock *kb;
-
- dstweight = 1.0F - srcweight;
-
- for (it=m_blendshape.begin(), kb = (KeyBlock*)key->block.first;
- kb && it != m_blendshape.end();
- kb = (KeyBlock*)kb->next, it++) {
- kb->curval = kb->curval * dstweight + (*it) * srcweight;
- }
-}
-
-bool BL_ShapeActionActuator::Update(double curtime, bool frame)
-{
- bool bNegativeEvent = false;
- bool bPositiveEvent = false;
- bool keepgoing = true;
- bool wrap = false;
- bool apply=true;
- int priority;
- float newweight;
-
- curtime -= KX_KetsjiEngine::GetSuspendedDelta();
-
- // result = true if animation has to be continued, false if animation stops
- // maybe there are events for us in the queue !
- if (frame)
- {
- for (vector<CValue*>::iterator i=m_events.begin(); !(i==m_events.end());i++)
- {
- if ((*i)->GetNumber() == 0.0f)
- bNegativeEvent = true;
- else
- bPositiveEvent= true;
- (*i)->Release();
-
- }
- m_events.clear();
-
- if (bPositiveEvent)
- m_flag |= ACT_FLAG_ACTIVE;
-
- if (bNegativeEvent)
- {
- if (!(m_flag & ACT_FLAG_ACTIVE))
- return false;
- m_flag &= ~ACT_FLAG_ACTIVE;
- }
- }
-
- /* This action can only be attached to a deform object */
- BL_DeformableGameObject *obj = (BL_DeformableGameObject*)GetParent();
- float length = m_endframe - m_startframe;
-
- priority = m_priority;
-
- /* Determine pre-incrementation behaviour and set appropriate flags */
- switch (m_playtype){
- case ACT_ACTION_MOTION:
- if (bNegativeEvent){
- keepgoing=false;
- apply=false;
- };
- break;
- case ACT_ACTION_FROM_PROP:
- if (bNegativeEvent){
- apply=false;
- keepgoing=false;
- }
- break;
- case ACT_ACTION_LOOP_END:
- if (bPositiveEvent){
- if (!(m_flag & ACT_FLAG_LOCKINPUT)){
- m_flag &= ~ACT_FLAG_KEYUP;
- m_flag &= ~ACT_FLAG_REVERSE;
- m_flag |= ACT_FLAG_LOCKINPUT;
- m_localtime = m_startframe;
- m_starttime = curtime;
- }
- }
- if (bNegativeEvent){
- m_flag |= ACT_FLAG_KEYUP;
- }
- break;
- case ACT_ACTION_LOOP_STOP:
- if (bPositiveEvent){
- if (!(m_flag & ACT_FLAG_LOCKINPUT)){
- m_flag &= ~ACT_FLAG_REVERSE;
- m_flag &= ~ACT_FLAG_KEYUP;
- m_flag |= ACT_FLAG_LOCKINPUT;
- SetStartTime(curtime);
- }
- }
- if (bNegativeEvent){
- m_flag |= ACT_FLAG_KEYUP;
- m_flag &= ~ACT_FLAG_LOCKINPUT;
- keepgoing=false;
- apply=false;
- }
- break;
- case ACT_ACTION_FLIPPER:
- if (bPositiveEvent){
- if (!(m_flag & ACT_FLAG_LOCKINPUT)){
- m_flag &= ~ACT_FLAG_REVERSE;
- m_flag |= ACT_FLAG_LOCKINPUT;
- SetStartTime(curtime);
- }
- }
- else if (bNegativeEvent){
- m_flag |= ACT_FLAG_REVERSE;
- m_flag &= ~ACT_FLAG_LOCKINPUT;
- SetStartTime(curtime);
- }
- break;
- case ACT_ACTION_PLAY:
- if (bPositiveEvent){
- if (!(m_flag & ACT_FLAG_LOCKINPUT)){
- m_flag &= ~ACT_FLAG_REVERSE;
- m_localtime = m_starttime;
- m_starttime = curtime;
- m_flag |= ACT_FLAG_LOCKINPUT;
- }
- }
- break;
- default:
- break;
- }
-
- /* Perform increment */
- if (keepgoing){
- if (m_playtype == ACT_ACTION_MOTION){
- MT_Point3 newpos;
- MT_Point3 deltapos;
-
- newpos = obj->NodeGetWorldPosition();
-
- /* Find displacement */
- deltapos = newpos-m_lastpos;
- m_localtime += (length/m_stridelength) * deltapos.length();
- m_lastpos = newpos;
- }
- else{
- SetLocalTime(curtime);
- }
- }
-
- /* Check if a wrapping response is needed */
- if (length){
- if (m_localtime < m_startframe || m_localtime > m_endframe)
- {
- m_localtime = m_startframe + fmod(m_localtime, length);
- wrap = true;
- }
- }
- else
- m_localtime = m_startframe;
-
- /* Perform post-increment tasks */
- switch (m_playtype){
- case ACT_ACTION_FROM_PROP:
- {
- CValue* propval = GetParent()->GetProperty(m_propname);
- if (propval)
- m_localtime = propval->GetNumber();
-
- if (bNegativeEvent){
- keepgoing=false;
- }
- }
- break;
- case ACT_ACTION_MOTION:
- break;
- case ACT_ACTION_LOOP_STOP:
- break;
- case ACT_ACTION_FLIPPER:
- if (wrap){
- if (!(m_flag & ACT_FLAG_REVERSE)){
- m_localtime=m_endframe;
- //keepgoing = false;
- }
- else {
- m_localtime=m_startframe;
- keepgoing = false;
- }
- }
- break;
- case ACT_ACTION_LOOP_END:
- if (wrap){
- if (m_flag & ACT_FLAG_KEYUP){
- keepgoing = false;
- m_localtime = m_endframe;
- m_flag &= ~ACT_FLAG_LOCKINPUT;
- }
- SetStartTime(curtime);
- }
- break;
- case ACT_ACTION_PLAY:
- if (wrap){
- m_localtime = m_endframe;
- keepgoing = false;
- m_flag &= ~ACT_FLAG_LOCKINPUT;
- }
- break;
- default:
- keepgoing = false;
- break;
- }
-
+ }
+ } 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;
+}
+
+void BL_ShapeActionActuator::SetStartTime(float curtime)
+{
+ float direction = m_startframe < m_endframe ? 1.0 : -1.0;
+
+ if (!(m_flag & ACT_FLAG_REVERSE))
+ m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
+ else
+ m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
+}
+
+void BL_ShapeActionActuator::SetLocalTime(float curtime)
+{
+ float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
+
+ if (m_endframe < m_startframe)
+ delta_time = -delta_time;
+
+ if (!(m_flag & ACT_FLAG_REVERSE))
+ m_localtime = m_startframe + delta_time;
+ else
+ m_localtime = m_endframe - delta_time;
+}
+
+void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight)
+{
+ vector<float>::const_iterator it;
+ float dstweight;
+ KeyBlock *kb;
+
+ dstweight = 1.0F - srcweight;
+
+ for (it=m_blendshape.begin(), kb = (KeyBlock*)key->block.first;
+ kb && it != m_blendshape.end();
+ kb = (KeyBlock*)kb->next, it++) {
+ kb->curval = kb->curval * dstweight + (*it) * srcweight;
+ }
+}
+
+bool BL_ShapeActionActuator::Update(double curtime, bool frame)
+{
+ bool bNegativeEvent = false;
+ bool bPositiveEvent = false;
+ bool keepgoing = true;
+ bool wrap = false;
+ bool apply=true;
+ int priority;
+ float newweight;
+
+ curtime -= KX_KetsjiEngine::GetSuspendedDelta();
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list