Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp6
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h3
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h10
6 files changed, 36 insertions, 10 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index fa8409b123e..eb575c70ad7 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -372,6 +372,12 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
// start the engine
ketsjiengine->StartEngine(true);
+
+ // Set the animation playback rate for ipo's and actions
+ // the framerate below should patch with FPS macro defined in blendef.h
+ // Could be in StartEngine set the framerate, we need the scene to do this
+ ketsjiengine->SetAnimFrameRate( (((double) blscene->r.frs_sec) / blscene->r.frs_sec_base) );
+
// the mainloop
while (!exitrequested)
{
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 1055c8771ef..ad126ebf123 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -134,14 +134,14 @@ void BL_ActionActuator::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_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
else
- m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
}
void BL_ActionActuator::SetLocalTime(float curtime)
{
- float delta_time = (curtime - m_starttime)*KX_FIXED_FRAME_PER_SEC;
+ float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_endframe < m_startframe)
delta_time = -delta_time;
@@ -385,7 +385,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
blend_poses(m_pose, m_blendpose, 1.0 - newweight, ACTSTRIPMODE_BLEND);
/* Increment current blending percentage */
- m_blendframe = (curtime - m_blendstart)*KX_FIXED_FRAME_PER_SEC;
+ m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_blendframe>m_blendin)
m_blendframe = m_blendin;
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 56b9f3f6375..8a90ec1463a 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -45,9 +45,8 @@
#include "GEN_Map.h"
#include "GEN_HashedPtr.h"
#include "KX_Scene.h"
+#include "KX_KetsjiEngine.h" /* for m_anim_framerate */
-#define KX_FIXED_FRAME_PER_SEC 25.0f
-#define KX_FIXED_SEC_PER_FRAME (1.0f / KX_FIXED_FRAME_PER_SEC)
#define KX_OB_DYNAMIC 1
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 0f9caa456d9..cf246342cf9 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -164,14 +164,14 @@ void KX_IpoActuator::SetStartTime(float curtime)
curtime = curtime - KX_KetsjiEngine::GetSuspendedDelta();
if (m_direction > 0)
- m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
else
- m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
}
void KX_IpoActuator::SetLocalTime(float curtime)
{
- float delta_time = ((curtime - m_starttime) - KX_KetsjiEngine::GetSuspendedDelta())*KX_FIXED_FRAME_PER_SEC;
+ float delta_time = ((curtime - m_starttime) - KX_KetsjiEngine::GetSuspendedDelta())*KX_KetsjiEngine::GetAnimFrameRate();
// negative delta_time is caused by floating point inaccuracy
// perhaps the inaccuracy could be reduced a bit
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 1e3393d59a8..56a06786679 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -71,6 +71,7 @@
#include "KX_TimeCategoryLogger.h"
#include "RAS_FramingManager.h"
+#include "stdio.h"
// If define: little test for Nzc: guarded drawing. If the canvas is
// not valid, skip rendering this frame.
@@ -91,7 +92,7 @@ const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = {
};
double KX_KetsjiEngine::m_ticrate = DEFAULT_LOGIC_TIC_RATE;
-
+double KX_KetsjiEngine::m_anim_framerate = 25.0;
double KX_KetsjiEngine::m_suspendedtime = 0.0;
double KX_KetsjiEngine::m_suspendeddelta = 0.0;
@@ -1383,6 +1384,16 @@ void KX_KetsjiEngine::SetTicRate(double ticrate)
m_ticrate = ticrate;
}
+double KX_KetsjiEngine::GetAnimFrameRate()
+{
+ return m_anim_framerate;
+}
+
+void KX_KetsjiEngine::SetAnimFrameRate(double framerate)
+{
+ m_anim_framerate = framerate;
+}
+
void KX_KetsjiEngine::SetTimingDisplay(bool frameRate, bool profile, bool properties)
{
m_show_framerate = frameRate;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index bc2e3864be8..4c09bc3fcd5 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -103,6 +103,7 @@ private:
double m_remainingTime;
static double m_ticrate;
+ static double m_anim_framerate; /* for animation playback only - ipo and action */
static double m_suspendedtime;
static double m_suspendeddelta;
@@ -261,6 +262,15 @@ public:
static void SetTicRate(double ticrate);
/**
+ * Gets the framerate for playing animations. (actions and ipos)
+ */
+ static double GetAnimFrameRate();
+ /**
+ * Sets the framerate for playing animations. (actions and ipos)
+ */
+ static void SetAnimFrameRate(double framerate);
+
+ /**
* Activates or deactivates timing information display.
* @param frameRate Display for frame rate on or off.
* @param profile Display for individual components on or off.