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:
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/BL_BlenderShader.h9
-rw-r--r--source/gameengine/Ketsji/BL_Material.h2
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp2
-rw-r--r--source/gameengine/Ketsji/BL_Shader.h6
-rw-r--r--source/gameengine/Ketsji/BL_Texture.h2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt1
-rw-r--r--source/gameengine/Ketsji/KXNetwork/CMakeLists.txt1
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/Makefile2
-rw-r--r--source/gameengine/Ketsji/KX_ArmatureSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp43
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h14
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h2
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp37
-rw-r--r--source/gameengine/Ketsji/KX_Camera.h4
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_CameraIpoSGController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_CameraIpoSGController.h2
-rw-r--r--source/gameengine/Ketsji/KX_ClientObjectInfo.h2
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.h2
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Dome.h2
-rw-r--r--source/gameengine/Ketsji/KX_EmptyObject.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_EmptyObject.h2
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp98
-rw-r--r--source/gameengine/Ketsji/KX_IInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_IPO_SGController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_IPO_SGController.h2
-rw-r--r--source/gameengine/Ketsji/KX_IPhysicsController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_IPhysicsController.h2
-rw-r--r--source/gameengine/Ketsji/KX_IScalarInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_ISceneConverter.h2
-rw-r--r--source/gameengine/Ketsji/KX_ISystem.h2
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp46
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h5
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_LightIpoSGController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_LightIpoSGController.h2
-rw-r--r--source/gameengine/Ketsji/KX_MaterialIpoController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_MaterialIpoController.h2
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_MotionState.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_MotionState.h2
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ObColorIpoSGController.h2
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp47
-rw-r--r--source/gameengine/Ketsji/KX_OrientationInterpolator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_OrientationInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp165
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.h10
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.h1
-rw-r--r--source/gameengine/Ketsji/KX_PositionInterpolator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PositionInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp145
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h1
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.h4
-rw-r--r--source/gameengine/Ketsji/KX_RayEventManager.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_RayEventManager.h2
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h2
-rw-r--r--source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SG_NodeRelationships.h6
-rw-r--r--source/gameengine/Ketsji/KX_ScalarInterpolator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ScalarInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_ScalingInterpolator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ScalingInterpolator.h2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h10
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp203
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TimeCategoryLogger.h2
-rw-r--r--source/gameengine/Ketsji/KX_TimeLogger.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TimeLogger.h2
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.h2
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp458
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.h31
-rw-r--r--source/gameengine/Ketsji/KX_VisibilityActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_WorldInfo.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_WorldInfo.h2
-rw-r--r--source/gameengine/Ketsji/KX_WorldIpoController.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_WorldIpoController.h2
-rw-r--r--source/gameengine/Ketsji/Makefile6
113 files changed, 827 insertions, 853 deletions
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.h b/source/gameengine/Ketsji/BL_BlenderShader.h
index 073ce8f1ca5..c2d4245b77f 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.h
+++ b/source/gameengine/Ketsji/BL_BlenderShader.h
@@ -56,12 +56,19 @@ public:
void ReloadMaterial();
int GetBlendMode();
+ void SetScene(KX_Scene *scene)
+ {
+ mScene = scene;
+ mBlenderScene = scene->GetBlenderScene();
+ ReloadMaterial();
+ }
+
bool Equals(BL_BlenderShader *blshader);
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderShader"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderShader"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index 6b53e7fa8b1..62e5a6e638b 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -106,7 +106,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Material"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Material"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index 55be606378d..8edefe7ac2d 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -884,7 +884,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
{
int loc = GetUniformLocation(uniform);
if(loc != -1) {
- if(index >= MAXTEX && index < 0)
+ if(index >= MAXTEX || index < 0)
spit("Invalid texture sample index: " << index);
#ifdef SORT_UNIFORMS
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index ebd2e491f35..5108acea0ff 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -28,7 +28,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Sampler"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Sampler"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
@@ -75,7 +75,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Uniform"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Uniform"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
@@ -100,7 +100,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DefUniform"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DefUniform"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/BL_Texture.h b/source/gameengine/Ketsji/BL_Texture.h
index 2dfd9c542d3..eb3888b4862 100644
--- a/source/gameengine/Ketsji/BL_Texture.h
+++ b/source/gameengine/Ketsji/BL_Texture.h
@@ -70,7 +70,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Texture"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Texture"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index c4af701f87b..d8f6e3164ec 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -80,4 +80,3 @@ IF(WITH_FFMPEG)
ENDIF(WITH_FFMPEG)
BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
-#env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags )
diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
index 40079f3f83e..ce3d8fa22fc 100644
--- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
+++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
@@ -45,4 +45,3 @@ ELSE(WITH_PYTHON)
ENDIF(WITH_PYTHON)
BLENDERLIB(kx_network "${SRC}" "${INC}")
-#env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['game2', 'player'], priority=[5, 155] )
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
index bc4c18ff795..d922fb63b4f 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
@@ -39,10 +39,6 @@
#include "NG_NetworkMessage.h"
#include "NG_NetworkObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_NetworkEventManager::KX_NetworkEventManager(class SCA_LogicManager*
logicmgr, class NG_NetworkDeviceInterface *ndi) :
SCA_EventManager(logicmgr, NETWORK_EVENTMGR), m_ndi(ndi)
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index a9b56836fa9..e047a9aa273 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -31,10 +31,6 @@
#include "NG_NetworkScene.h"
#include "KX_NetworkMessageActuator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_NetworkMessageActuator::KX_NetworkMessageActuator(
SCA_IObject* gameobj, // the actuator controlling object
NG_NetworkScene* networkscene, // needed for replication
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index ef9f4d33a28..56ccac9a93e 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -38,10 +38,6 @@
#include "ListValue.h"
#include "StringValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef NAN_NET_DEBUG
#include <iostream>
#endif
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp
index 948821b157b..5350c32fff7 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp
@@ -26,7 +26,3 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp
index f3898fc7bd4..aca0805c337 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp
@@ -27,7 +27,3 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
diff --git a/source/gameengine/Ketsji/KXNetwork/Makefile b/source/gameengine/Ketsji/KXNetwork/Makefile
index 365ed8fc9c3..aebbd7921cb 100644
--- a/source/gameengine/Ketsji/KXNetwork/Makefile
+++ b/source/gameengine/Ketsji/KXNetwork/Makefile
@@ -15,7 +15,7 @@
#
# 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.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp
index 31b92232de6..a47a1972beb 100644
--- a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp
+++ b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp
@@ -39,10 +39,6 @@
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_ArmatureSensor::KX_ArmatureSensor(class SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
const char *posechannel,
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index bab7c54a310..d88997e2128 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -2,10 +2,6 @@
// ------------------------------------
// ...
// ------------------------------------
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GL/glew.h"
#include "KX_BlenderMaterial.h"
@@ -798,9 +794,9 @@ PyMethodDef KX_BlenderMaterial::Methods[] =
};
PyAttributeDef KX_BlenderMaterial::Attributes[] = {
- //KX_PYATTRIBUTE_TODO("shader"),
- //KX_PYATTRIBUTE_TODO("materialIndex"),
- //KX_PYATTRIBUTE_TODO("blending"),
+ KX_PYATTRIBUTE_RO_FUNCTION("shader", KX_BlenderMaterial, pyattr_get_shader),
+ KX_PYATTRIBUTE_RO_FUNCTION("material_index", KX_BlenderMaterial, pyattr_get_materialIndex),
+ KX_PYATTRIBUTE_RW_FUNCTION("blending", KX_BlenderMaterial, pyattr_get_blending, pyattr_set_blending),
{ NULL } //Sentinel
};
@@ -826,6 +822,37 @@ PyTypeObject KX_BlenderMaterial::Type = {
py_base_new
};
+PyObject* KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+ return self->PygetShader(NULL, NULL);
+}
+
+PyObject* KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+ return PyLong_FromSsize_t(self->GetMaterialIndex());
+}
+
+PyObject* KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+ unsigned int* bfunc = self->getBlendFunc();
+ return Py_BuildValue("(ll)", (long int)bfunc[0], (long int)bfunc[1]);
+}
+
+int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+ PyObject* obj = self->PysetBlending(value, NULL);
+ if(obj)
+ {
+ Py_DECREF(obj);
+ return 0;
+ }
+ return -1;
+}
+
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
{
if( !GLEW_ARB_fragment_shader) {
@@ -912,7 +939,7 @@ static unsigned int GL_array[11] = {
GL_SRC_ALPHA_SATURATE
};
-KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)")
+KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)")
{
unsigned int b[2];
if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index c5f5e23c6e7..239e334f68a 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -79,6 +79,9 @@ public:
Image * getImage (unsigned int idx) {
return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL;
}
+ unsigned int* getBlendFunc() {
+ return mBlendFunc;
+ }
// for ipos
void UpdateIPO(
MT_Vector4 rgba, MT_Vector3 specrgb,
@@ -88,13 +91,22 @@ public:
virtual void Replace_IScene(SCA_IScene *val)
{
- mScene= static_cast<KX_Scene *>(val);
+ if (mBlenderShader)
+ {
+ mScene= static_cast<KX_Scene *>(val);
+ mBlenderShader->SetScene(mScene);
+ }
};
#ifndef DISABLE_PYTHON
// --------------------------------
virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
+ static PyObject* pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture );
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
index 7fc799abb7e..48a3c98ff81 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
@@ -83,7 +83,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BulletPhysicsController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BulletPhysicsController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 42d35798095..2402baf92ac 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -34,10 +34,6 @@
#include "KX_PythonInit.h"
#include "KX_Python.h"
#include "KX_PyMath.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_Camera::KX_Camera(void* sgReplicationInfo,
SG_Callbacks callbacks,
const RAS_CameraData& camdata,
@@ -503,6 +499,7 @@ PyAttributeDef KX_Camera::Attributes[] = {
KX_PYATTRIBUTE_RW_FUNCTION("perspective", KX_Camera, pyattr_get_perspective, pyattr_set_perspective),
KX_PYATTRIBUTE_RW_FUNCTION("lens", KX_Camera, pyattr_get_lens, pyattr_set_lens),
+ KX_PYATTRIBUTE_RW_FUNCTION("ortho_scale", KX_Camera, pyattr_get_ortho_scale, pyattr_set_ortho_scale),
KX_PYATTRIBUTE_RW_FUNCTION("near", KX_Camera, pyattr_get_near, pyattr_set_near),
KX_PYATTRIBUTE_RW_FUNCTION("far", KX_Camera, pyattr_get_far, pyattr_set_far),
@@ -556,8 +553,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
"\tcenter = the center of the sphere (in world coordinates.)\n"
"\tradius = the radius of the sphere\n\n"
"\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
"\tcam = co.GetOwner()\n\n"
"\t# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]\n"
"\tif (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):\n"
@@ -589,8 +586,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
"\tinside/outside/intersects this camera's viewing frustum.\n\n"
"\tbox = a list of the eight (8) corners of the box (in world coordinates.)\n\n"
"\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
"\tcam = co.GetOwner()\n\n"
"\tbox = []\n"
"\tbox.append([-1.0, -1.0, -1.0])\n"
@@ -633,8 +630,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
"\treturns 1 if the given point is inside this camera's viewing frustum.\n\n"
"\tpoint = The point to test (in world coordinates.)\n\n"
"\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
"\tcam = co.GetOwner()\n\n"
"\t# Test point [0.0, 0.0, 0.0]"
"\tif (cam.pointInsideFrustum([0.0, 0.0, 0.0])):\n"
@@ -732,6 +729,26 @@ int KX_Camera::pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef,
return PY_SET_ATTR_SUCCESS;
}
+PyObject* KX_Camera::pyattr_get_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_Camera* self= static_cast<KX_Camera*>(self_v);
+ return PyFloat_FromDouble(self->m_camdata.m_scale);
+}
+
+int KX_Camera::pyattr_set_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_Camera* self= static_cast<KX_Camera*>(self_v);
+ float param = PyFloat_AsDouble(value);
+ if (param == -1) {
+ PyErr_SetString(PyExc_AttributeError, "camera.ortho_scale = float: KX_Camera, expected a float greater then zero");
+ return PY_SET_ATTR_FAIL;
+ }
+
+ self->m_camdata.m_scale= param;
+ self->m_set_projection_matrix = false;
+ return PY_SET_ATTR_SUCCESS;
+}
+
PyObject* KX_Camera::pyattr_get_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_Camera* self= static_cast<KX_Camera*>(self_v);
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index e209f0461b9..ad2460d34ef 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -51,7 +51,7 @@ class KX_Camera : public KX_GameObject
Py_Header;
protected:
friend class KX_Scene;
- /** Camera parameters (clips distances, focal lenght). These
+ /** Camera parameters (clips distances, focal length). These
* params are closely tied to Blender. In the gameengine, only the
* projection and modelview matrices are relevant. There's a
* conversion being done in the engine class. Why is it stored
@@ -289,6 +289,8 @@ public:
static PyObject* pyattr_get_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static PyObject* pyattr_get_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index f9ec503478c..bc67ecbe1a5 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -38,10 +38,6 @@
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
@@ -380,7 +376,7 @@ PyTypeObject KX_CameraActuator::Type = {
};
PyMethodDef KX_CameraActuator::Methods[] = {
- {NULL,NULL,NULL,NULL} //Sentinel
+ {NULL, NULL} //Sentinel
};
PyAttributeDef KX_CameraActuator::Attributes[] = {
diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp
index 6ae9bbc0931..0bfa1133a1c 100644
--- a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp
+++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp
@@ -31,10 +31,6 @@
#include "KX_Camera.h"
#include "RAS_CameraData.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.h b/source/gameengine/Ketsji/KX_CameraIpoSGController.h
index 3690043f4a9..e6596edbd1d 100644
--- a/source/gameengine/Ketsji/KX_CameraIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.h
@@ -88,7 +88,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_CameraIpoSGController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_CameraIpoSGController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
index f08988c842a..c42843274b3 100644
--- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h
+++ b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
@@ -78,7 +78,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ClientObjectInfo"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ClientObjectInfo"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index 3ef689ec94f..9380f4b5d2f 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -40,10 +40,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index de6530bf54a..b1baa5fe9e1 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -31,10 +31,6 @@
#include "KX_ConstraintWrapper.h"
#include "PHY_IPhysicsEnvironment.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_ConstraintWrapper::KX_ConstraintWrapper(
PHY_ConstraintType ctype,
int constraintId,
@@ -114,8 +110,14 @@ PyMethodDef KX_ConstraintWrapper::Methods[] = {
};
PyAttributeDef KX_ConstraintWrapper::Attributes[] = {
- //KX_PYATTRIBUTE_TODO("constraintId"),
+ KX_PYATTRIBUTE_RO_FUNCTION("constraint_id", KX_ConstraintWrapper, pyattr_get_constraintId),
{ NULL } //Sentinel
};
+PyObject* KX_ConstraintWrapper::pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_ConstraintWrapper* self= static_cast<KX_ConstraintWrapper*>(self_v);
+ return self->PyGetConstraintId();
+}
+
#endif // DISABLE_PYTHON
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
index 530ecf16fed..db9543c23ae 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
@@ -44,6 +44,8 @@ public:
KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId);
KX_PYMETHOD(KX_ConstraintWrapper,SetParam);
KX_PYMETHOD(KX_ConstraintWrapper,GetParam);
+
+ static PyObject* pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
#endif
private:
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index b62593b7911..94258088e9f 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -754,7 +754,7 @@ So I came out with this formula:
verts_height = tan((rad_ang/2) - (MT_PI/2))*sqrt(2.0);
Here we take half the sphere(rad_ang/2) and subtract a quarter of it (MT_PI/2)
-Therefore we have the lenght in radians of the dome/sphere over the horizon.
+Therefore we have the length in radians of the dome/sphere over the horizon.
Once we take the tangent of that angle, you have the verts coordinate corresponding to the verts on the side faces.
Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on the diagonal of the original cube.
*/
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index 9ff33fe2852..749fbebe61c 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -188,7 +188,7 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_Dome"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_Dome"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_EmptyObject.cpp b/source/gameengine/Ketsji/KX_EmptyObject.cpp
index 61179b29e10..7dc66b3fb88 100644
--- a/source/gameengine/Ketsji/KX_EmptyObject.cpp
+++ b/source/gameengine/Ketsji/KX_EmptyObject.cpp
@@ -28,10 +28,6 @@
*/
#include "KX_EmptyObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_EmptyObject::~KX_EmptyObject()
{
diff --git a/source/gameengine/Ketsji/KX_EmptyObject.h b/source/gameengine/Ketsji/KX_EmptyObject.h
index c82c2ec1657..c41e40fdd41 100644
--- a/source/gameengine/Ketsji/KX_EmptyObject.h
+++ b/source/gameengine/Ketsji/KX_EmptyObject.h
@@ -41,7 +41,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_EmptyObject"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_EmptyObject"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index b7c9ce6d452..208c526398a 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -39,10 +39,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 637b874ef5e..e44aac2699c 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -28,10 +28,6 @@
* Game object wrapper
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
@@ -850,7 +846,7 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac)
{
case 0: //x axis
ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); //pivot axis
- if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) //is the vector paralell to the pivot?
+ if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) //is the vector parallel to the pivot?
ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); //change the pivot!
if (fac == 1.0) {
x = vect;
@@ -1256,56 +1252,56 @@ void KX_GameObject::Relink(GEN_Map<GEN_HashedPtr, void*> *map_parameter)
static int mathutils_kxgameob_vector_cb_index= -1; /* index for our callbacks */
-static int mathutils_kxgameob_generic_check(PyObject *self_v)
+static int mathutils_kxgameob_generic_check(BaseMathObject *bmo)
{
- KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+ KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
return 1;
}
-static int mathutils_kxgameob_vector_get(PyObject *self_v, int subtype, float *vec_from)
+static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
{
- KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+ KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
switch(subtype) {
case MATHUTILS_VEC_CB_POS_LOCAL:
- self->NodeGetLocalPosition().getValue(vec_from);
+ self->NodeGetLocalPosition().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_POS_GLOBAL:
- self->NodeGetWorldPosition().getValue(vec_from);
+ self->NodeGetWorldPosition().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_SCALE_LOCAL:
- self->NodeGetLocalScaling().getValue(vec_from);
+ self->NodeGetLocalScaling().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_SCALE_GLOBAL:
- self->NodeGetWorldScaling().getValue(vec_from);
+ self->NodeGetWorldScaling().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_INERTIA_LOCAL:
if(!self->GetPhysicsController()) return 0;
- self->GetPhysicsController()->GetLocalInertia().getValue(vec_from);
+ self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_OBJECT_COLOR:
- self->GetObjectColor().getValue(vec_from);
+ self->GetObjectColor().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_LINVEL_LOCAL:
if(!self->GetPhysicsController()) return 0;
- self->GetLinearVelocity(true).getValue(vec_from);
+ self->GetLinearVelocity(true).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
if(!self->GetPhysicsController()) return 0;
- self->GetLinearVelocity(false).getValue(vec_from);
+ self->GetLinearVelocity(false).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
if(!self->GetPhysicsController()) return 0;
- self->GetAngularVelocity(true).getValue(vec_from);
+ self->GetAngularVelocity(true).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
if(!self->GetPhysicsController()) return 0;
- self->GetAngularVelocity(false).getValue(vec_from);
+ self->GetAngularVelocity(false).getValue(bmo->data);
break;
}
@@ -1313,73 +1309,69 @@ static int mathutils_kxgameob_vector_get(PyObject *self_v, int subtype, float *v
return 1;
}
-static int mathutils_kxgameob_vector_set(PyObject *self_v, int subtype, float *vec_to)
+static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype)
{
- KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+ KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
switch(subtype) {
case MATHUTILS_VEC_CB_POS_LOCAL:
- self->NodeSetLocalPosition(MT_Point3(vec_to));
+ self->NodeSetLocalPosition(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f);
break;
case MATHUTILS_VEC_CB_POS_GLOBAL:
- self->NodeSetWorldPosition(MT_Point3(vec_to));
+ self->NodeSetWorldPosition(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f);
break;
case MATHUTILS_VEC_CB_SCALE_LOCAL:
- self->NodeSetLocalScale(MT_Point3(vec_to));
+ self->NodeSetLocalScale(MT_Point3(bmo->data));
self->NodeUpdateGS(0.f);
break;
case MATHUTILS_VEC_CB_SCALE_GLOBAL:
- break;
+ PyErr_SetString(PyExc_AttributeError, "KX_GameObject.worldScale is read-only");
+ return 0;
case MATHUTILS_VEC_CB_INERTIA_LOCAL:
/* read only */
break;
case MATHUTILS_VEC_CB_OBJECT_COLOR:
- self->SetObjectColor(MT_Vector4(vec_to));
+ self->SetObjectColor(MT_Vector4(bmo->data));
break;
case MATHUTILS_VEC_CB_LINVEL_LOCAL:
- self->setLinearVelocity(MT_Point3(vec_to),true);
+ self->setLinearVelocity(MT_Point3(bmo->data),true);
break;
case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
- self->setLinearVelocity(MT_Point3(vec_to),false);
+ self->setLinearVelocity(MT_Point3(bmo->data),false);
break;
case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
- self->setAngularVelocity(MT_Point3(vec_to),true);
+ self->setAngularVelocity(MT_Point3(bmo->data),true);
break;
case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
- self->setAngularVelocity(MT_Point3(vec_to),false);
+ self->setAngularVelocity(MT_Point3(bmo->data),false);
break;
}
return 1;
}
-static int mathutils_kxgameob_vector_get_index(PyObject *self_v, int subtype, float *vec_from, int index)
+static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{
- float f[4];
/* lazy, avoid repeteing the case statement */
- if(!mathutils_kxgameob_vector_get(self_v, subtype, f))
+ if(!mathutils_kxgameob_vector_get(bmo, subtype))
return 0;
-
- vec_from[index]= f[index];
return 1;
}
-static int mathutils_kxgameob_vector_set_index(PyObject *self_v, int subtype, float *vec_to, int index)
+static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, int index)
{
- float f= vec_to[index];
+ float f= bmo->data[index];
/* lazy, avoid repeteing the case statement */
- if(!mathutils_kxgameob_vector_get(self_v, subtype, vec_to))
+ if(!mathutils_kxgameob_vector_get(bmo, subtype))
return 0;
- vec_to[index]= f;
- mathutils_kxgameob_vector_set(self_v, subtype, vec_to);
-
- return 1;
+ bmo->data[index]= f;
+ return mathutils_kxgameob_vector_set(bmo, subtype);
}
Mathutils_Callback mathutils_kxgameob_vector_cb = {
@@ -1396,18 +1388,18 @@ Mathutils_Callback mathutils_kxgameob_vector_cb = {
static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */
-static int mathutils_kxgameob_matrix_get(PyObject *self_v, int subtype, float *mat_from)
+static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype)
{
- KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+ KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
-
+
switch(subtype) {
case MATHUTILS_MAT_CB_ORI_LOCAL:
- self->NodeGetLocalOrientation().getValue3x3(mat_from);
+ self->NodeGetLocalOrientation().getValue3x3(bmo->data);
break;
case MATHUTILS_MAT_CB_ORI_GLOBAL:
- self->NodeGetWorldOrientation().getValue3x3(mat_from);
+ self->NodeGetWorldOrientation().getValue3x3(bmo->data);
break;
}
@@ -1415,21 +1407,21 @@ static int mathutils_kxgameob_matrix_get(PyObject *self_v, int subtype, float *m
}
-static int mathutils_kxgameob_matrix_set(PyObject *self_v, int subtype, float *mat_to)
+static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype)
{
- KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+ KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
MT_Matrix3x3 mat3x3;
switch(subtype) {
case MATHUTILS_MAT_CB_ORI_LOCAL:
- mat3x3.setValue3x3(mat_to);
+ mat3x3.setValue3x3(bmo->data);
self->NodeSetLocalOrientation(mat3x3);
self->NodeUpdateGS(0.f);
break;
case MATHUTILS_MAT_CB_ORI_GLOBAL:
- mat3x3.setValue3x3(mat_to);
+ mat3x3.setValue3x3(bmo->data);
self->NodeSetLocalOrientation(mat3x3);
self->NodeUpdateGS(0.f);
break;
@@ -1746,6 +1738,8 @@ PySequenceMethods KX_GameObject::Sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)Seq_Contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
PyTypeObject KX_GameObject::Type = {
@@ -2740,7 +2734,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
KX_RayCast::Callback<KX_GameObject> callback(this,spc);
KX_RayCast::RayTest(pe, fromPoint, toPoint, callback);
- if (m_pHitObject)
+ if (m_pHitObject)
return m_pHitObject->GetProxy();
Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_IInterpolator.h b/source/gameengine/Ketsji/KX_IInterpolator.h
index b08a2368e5b..aadc964fe49 100644
--- a/source/gameengine/Ketsji/KX_IInterpolator.h
+++ b/source/gameengine/Ketsji/KX_IInterpolator.h
@@ -44,7 +44,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index c174e34ae7d..1d4c64483f5 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -28,10 +28,6 @@
* Scenegraph controller for ipos.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h
index 3841cae88da..12803cde2f1 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.h
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.h
@@ -119,7 +119,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.cpp b/source/gameengine/Ketsji/KX_IPhysicsController.cpp
index 07b73a5d245..18816e92bbb 100644
--- a/source/gameengine/Ketsji/KX_IPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_IPhysicsController.cpp
@@ -29,10 +29,6 @@
*/
#include "KX_IPhysicsController.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "PHY_DynamicTypes.h"
KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool compound, void* userdata)
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h
index faab46c0673..288e779fee4 100644
--- a/source/gameengine/Ketsji/KX_IPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_IPhysicsController.h
@@ -130,7 +130,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IPhysicsController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IPhysicsController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_IScalarInterpolator.h b/source/gameengine/Ketsji/KX_IScalarInterpolator.h
index 43e07d69611..a84e1b570fd 100644
--- a/source/gameengine/Ketsji/KX_IScalarInterpolator.h
+++ b/source/gameengine/Ketsji/KX_IScalarInterpolator.h
@@ -42,7 +42,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IScalarInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IScalarInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h
index d4081daa2c4..8a11b875347 100644
--- a/source/gameengine/Ketsji/KX_ISceneConverter.h
+++ b/source/gameengine/Ketsji/KX_ISceneConverter.h
@@ -87,7 +87,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISceneConverter"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISceneConverter"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ISystem.h b/source/gameengine/Ketsji/KX_ISystem.h
index 027e6348729..fb019299135 100644
--- a/source/gameengine/Ketsji/KX_ISystem.h
+++ b/source/gameengine/Ketsji/KX_ISystem.h
@@ -55,7 +55,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISystem"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISystem"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 6d17dc45651..eca40cafb0e 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -39,10 +39,6 @@
#include "KX_GameObject.h"
#include "FloatValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "KX_KetsjiEngine.h"
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index a13cd71fdac..1a6ae69f792 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -235,7 +235,7 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer)
#ifndef DISABLE_PYTHON
/*
- * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called.
+ * At the moment the bge.logic module is imported into 'pythondictionary' after this function is called.
* if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand.
*/
void KX_KetsjiEngine::SetPyNamespace(PyObject* pythondictionary)
@@ -966,44 +966,17 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene)
KX_Camera* cam = scene->GetActiveCamera();
if (!cam)
return;
- MT_Point3 listenerposition = cam->NodeGetWorldPosition();
- MT_Vector3 listenervelocity = cam->GetLinearVelocity();
- MT_Matrix3x3 listenerorientation = cam->NodeGetWorldOrientation();
- {
- AUD_3DData data;
- float f;
-
- listenerorientation.getValue3x3(data.orientation);
- listenerposition.getValue(data.position);
- listenervelocity.getValue(data.velocity);
-
- f = data.position[1];
- data.position[1] = data.position[2];
- data.position[2] = -f;
-
- f = data.velocity[1];
- data.velocity[1] = data.velocity[2];
- data.velocity[2] = -f;
+ float f[4];
- f = data.orientation[1];
- data.orientation[1] = data.orientation[2];
- data.orientation[2] = -f;
+ cam->NodeGetWorldPosition().getValue(f);
+ AUD_setListenerLocation(f);
- f = data.orientation[3];
- data.orientation[3] = -data.orientation[6];
- data.orientation[6] = f;
+ cam->GetLinearVelocity().getValue(f);
+ AUD_setListenerVelocity(f);
- f = data.orientation[4];
- data.orientation[4] = -data.orientation[8];
- data.orientation[8] = -f;
-
- f = data.orientation[5];
- data.orientation[5] = data.orientation[7];
- data.orientation[7] = f;
-
- AUD_updateListener(&data);
- }
+ cam->NodeGetWorldOrientation().getRotation().getValue(f);
+ AUD_setListenerOrientation(f);
}
@@ -1626,7 +1599,8 @@ KX_Scene* KX_KetsjiEngine::CreateScene(Scene *scene)
m_mousedevice,
m_networkdevice,
scene->id.name+2,
- scene);
+ scene,
+ m_canvas);
m_sceneconverter->ConvertScene(tmpscene,
m_rendertools,
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 36db8685afb..f52ec8192cc 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -71,6 +71,7 @@ private:
class KX_ISceneConverter* m_sceneconverter;
class NG_NetworkDeviceInterface* m_networkdevice;
#ifndef DISABLE_PYTHON
+ /* borrowed from sys.modules["__main__"], dont manage ref's */
PyObject* m_pythondictionary;
#endif
class SCA_IInputDevice* m_keyboarddevice;
@@ -213,6 +214,8 @@ public:
RAS_IRasterizer* GetRasterizer(){return m_rasterizer;};
RAS_ICanvas* GetCanvas(){return m_canvas;};
RAS_IRenderTools* GetRenderTools(){return m_rendertools;};
+ SCA_IInputDevice* GetKeyboardDevice(){return m_keyboarddevice;};
+ SCA_IInputDevice* GetMouseDevice(){return m_mousedevice;};
/// Dome functions
void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text);
@@ -410,7 +413,7 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_KetsjiEngine"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_KetsjiEngine"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index db708d25d40..ac20b4f2f56 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
#pragma warning (disable : 4786)
@@ -70,7 +66,7 @@ KX_LightObject::~KX_LightObject()
if((lamp = GetGPULamp())) {
float obmat[4][4] = {{0}};
- GPU_lamp_update(lamp, 0, obmat);
+ GPU_lamp_update(lamp, 0, 0, obmat);
}
m_rendertools->RemoveLight(&m_lightobj);
@@ -203,7 +199,7 @@ void KX_LightObject::Update()
for(int j=0; j<4; j++, dobmat++)
obmat[i][j] = (float)*dobmat;
- GPU_lamp_update(lamp, m_lightobj.m_layer, obmat);
+ GPU_lamp_update(lamp, m_lightobj.m_layer, 0, obmat);
GPU_lamp_update_colors(lamp, m_lightobj.m_red, m_lightobj.m_green,
m_lightobj.m_blue, m_lightobj.m_energy);
}
@@ -352,6 +348,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
} else if (!strcmp(type, "NORMAL")) {
retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
}
+ else {
+ /* should never happen */
+ PyErr_SetString(PyExc_TypeError, "light.type: internal error, invalid light type");
+ retvalue = NULL;
+ }
return retvalue;
}
diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp b/source/gameengine/Ketsji/KX_LightIpoSGController.cpp
index 9eae2590308..3a010556cfe 100644
--- a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp
+++ b/source/gameengine/Ketsji/KX_LightIpoSGController.cpp
@@ -31,10 +31,6 @@
#include "KX_Light.h"
#include "RAS_LightObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.h b/source/gameengine/Ketsji/KX_LightIpoSGController.h
index 97034d34429..c857994d145 100644
--- a/source/gameengine/Ketsji/KX_LightIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_LightIpoSGController.h
@@ -96,7 +96,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_LightIpoSGController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_LightIpoSGController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp
index 85d514bd22f..13d272ee92d 100644
--- a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp
+++ b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp
@@ -5,10 +5,6 @@
#include "BLO_sys_types.h" // for intptr_t support
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
bool KX_MaterialIpoController::Update(double currentTime)
{
if (m_modified)
diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.h b/source/gameengine/Ketsji/KX_MaterialIpoController.h
index 906c12426eb..a979f59ec95 100644
--- a/source/gameengine/Ketsji/KX_MaterialIpoController.h
+++ b/source/gameengine/Ketsji/KX_MaterialIpoController.h
@@ -54,7 +54,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MaterialIpoController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MaterialIpoController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 1cea0f88a24..a5ff7ebcbc1 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -28,10 +28,6 @@
#ifndef DISABLE_PYTHON
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "KX_MeshProxy.h"
#include "RAS_IPolygonMaterial.h"
#include "RAS_MeshObject.h"
diff --git a/source/gameengine/Ketsji/KX_MotionState.cpp b/source/gameengine/Ketsji/KX_MotionState.cpp
index 57ef8e105a4..08f8ee556d1 100644
--- a/source/gameengine/Ketsji/KX_MotionState.cpp
+++ b/source/gameengine/Ketsji/KX_MotionState.cpp
@@ -29,10 +29,6 @@
#include "KX_MotionState.h"
#include "SG_Spatial.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_MotionState::KX_MotionState(SG_Spatial* node) : m_node(node)
{
diff --git a/source/gameengine/Ketsji/KX_MotionState.h b/source/gameengine/Ketsji/KX_MotionState.h
index 80bdd8bca48..1267abc7fa9 100644
--- a/source/gameengine/Ketsji/KX_MotionState.h
+++ b/source/gameengine/Ketsji/KX_MotionState.h
@@ -55,7 +55,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MotionState"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MotionState"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp
index a166f54d37b..36c1b0f5bd1 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.cpp
+++ b/source/gameengine/Ketsji/KX_NearSensor.cpp
@@ -38,9 +38,6 @@
#include "PHY_IPhysicsController.h"
#include "PHY_IMotionState.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
KX_GameObject* gameobj,
float margin,
diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp
index 69ed7d80744..108cff0232d 100644
--- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp
+++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp
@@ -30,10 +30,6 @@
#include "KX_ScalarInterpolator.h"
#include "KX_GameObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
index fd8de7a70d0..4bb18fb392b 100644
--- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
@@ -71,7 +71,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ObColorIpoSGController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ObColorIpoSGController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index df98d58b4e8..0d0cac3c084 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -34,10 +34,6 @@
#include "KX_PyMath.h" // For PyVecTo - should this include be put in PyObjectPlus?
#include "KX_IPhysicsController.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
@@ -387,74 +383,69 @@ PyAttributeDef KX_ObjectActuator::Attributes[] = {
static int mathutils_kxobactu_vector_cb_index= -1; /* index for our callbacks */
-static int mathutils_obactu_generic_check(PyObject *self_v)
+static int mathutils_obactu_generic_check(BaseMathObject *bmo)
{
- KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v);
+ KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
return 1;
}
-static int mathutils_obactu_vector_get(PyObject *self_v, int subtype, float *vec_from)
+static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype)
{
- KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v);
+ KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
switch(subtype) {
case MATHUTILS_VEC_CB_LINV:
- self->m_linear_velocity.getValue(vec_from);
+ self->m_linear_velocity.getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGV:
- self->m_angular_velocity.getValue(vec_from);
+ self->m_angular_velocity.getValue(bmo->data);
break;
}
return 1;
}
-static int mathutils_obactu_vector_set(PyObject *self_v, int subtype, float *vec_to)
+static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype)
{
- KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(self_v);
+ KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
switch(subtype) {
case MATHUTILS_VEC_CB_LINV:
- self->m_linear_velocity.setValue(vec_to);
+ self->m_linear_velocity.setValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGV:
- self->m_angular_velocity.setValue(vec_to);
+ self->m_angular_velocity.setValue(bmo->data);
break;
}
return 1;
}
-static int mathutils_obactu_vector_get_index(PyObject *self_v, int subtype, float *vec_from, int index)
+static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index)
{
- float f[4];
/* lazy, avoid repeteing the case statement */
- if(!mathutils_obactu_vector_get(self_v, subtype, f))
+ if(!mathutils_obactu_vector_get(bmo, subtype))
return 0;
-
- vec_from[index]= f[index];
return 1;
}
-static int mathutils_obactu_vector_set_index(PyObject *self_v, int subtype, float *vec_to, int index)
+static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, int index)
{
- float f= vec_to[index];
+ float f= bmo->data[index];
/* lazy, avoid repeteing the case statement */
- if(!mathutils_obactu_vector_get(self_v, subtype, vec_to))
+ if(!mathutils_obactu_vector_get(bmo, subtype))
return 0;
- vec_to[index]= f;
- mathutils_obactu_vector_set(self_v, subtype, vec_to);
-
- return 1;
+ bmo->data[index]= f;
+ return mathutils_obactu_vector_set(bmo, subtype);
}
Mathutils_Callback mathutils_obactu_vector_cb = {
@@ -476,6 +467,8 @@ int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *a
if (!PyVecTo(value, self->m_linear_velocity))
return PY_SET_ATTR_FAIL;
+ self->UpdateFuzzyFlags();
+
return PY_SET_ATTR_SUCCESS;
}
@@ -490,6 +483,8 @@ int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *a
if (!PyVecTo(value, self->m_angular_velocity))
return PY_SET_ATTR_FAIL;
+ self->UpdateFuzzyFlags();
+
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
index b4bf052aac9..8949a85066c 100644
--- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
@@ -30,10 +30,6 @@
#include "MT_Matrix3x3.h"
#include "KX_IScalarInterpolator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
void KX_OrientationInterpolator::Execute(float currentTime) const {
MT_Vector3 eul(m_ipos[0]->GetValue(currentTime),
m_ipos[1]->GetValue(currentTime),
diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
index fda331f126d..de41323c289 100644
--- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h
+++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
@@ -54,7 +54,7 @@ private:
#ifdef WITH_CXX_GUARDEDALLOC
private:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_OrientationInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_OrientationInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index 750b0c9d195..62740585831 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -38,10 +38,6 @@
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
index d33417be53f..15fc3e5c471 100644
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
@@ -33,10 +33,6 @@
#include "PHY_IPhysicsEnvironment.h"
#include "PHY_IPhysicsController.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper(
PHY_IPhysicsController* ctrl,
PHY_IPhysicsEnvironment* physenv) :
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 94fcb392d24..9395e57e68b 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -28,10 +28,6 @@
#ifndef DISABLE_PYTHON
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "KX_PolyProxy.h"
#include "KX_MeshProxy.h"
#include "RAS_MeshObject.h"
@@ -76,90 +72,19 @@ PyMethodDef KX_PolyProxy::Methods[] = {
};
PyAttributeDef KX_PolyProxy::Attributes[] = {
- /* All dummy's so they come up in a dir() */
- //KX_PYATTRIBUTE_TODO("DummyProps"),
- KX_PYATTRIBUTE_DUMMY("matname"),
- KX_PYATTRIBUTE_DUMMY("texture"),
- KX_PYATTRIBUTE_DUMMY("material"),
- KX_PYATTRIBUTE_DUMMY("matid"),
- KX_PYATTRIBUTE_DUMMY("v1"),
- KX_PYATTRIBUTE_DUMMY("v2"),
- KX_PYATTRIBUTE_DUMMY("v3"),
- KX_PYATTRIBUTE_DUMMY("v4"),
- KX_PYATTRIBUTE_DUMMY("visible"),
- KX_PYATTRIBUTE_DUMMY("collide"),
+ KX_PYATTRIBUTE_RO_FUNCTION("material_name", KX_PolyProxy, pyattr_get_material_name),
+ KX_PYATTRIBUTE_RO_FUNCTION("texture_name", KX_PolyProxy, pyattr_get_texture_name),
+ KX_PYATTRIBUTE_RO_FUNCTION("material", KX_PolyProxy, pyattr_get_material),
+ KX_PYATTRIBUTE_RO_FUNCTION("material_id", KX_PolyProxy, pyattr_get_material_id),
+ KX_PYATTRIBUTE_RO_FUNCTION("v1", KX_PolyProxy, pyattr_get_v1),
+ KX_PYATTRIBUTE_RO_FUNCTION("v2", KX_PolyProxy, pyattr_get_v2),
+ KX_PYATTRIBUTE_RO_FUNCTION("v3", KX_PolyProxy, pyattr_get_v3),
+ KX_PYATTRIBUTE_RO_FUNCTION("v4", KX_PolyProxy, pyattr_get_v4),
+ KX_PYATTRIBUTE_RO_FUNCTION("visible", KX_PolyProxy, pyattr_get_visible),
+ KX_PYATTRIBUTE_RO_FUNCTION("collide", KX_PolyProxy, pyattr_get_collide),
{ NULL } //Sentinel
};
-#if 0
-PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
-{
- char *attr_str= _PyUnicode_AsString(attr);
- if (!strcmp(attr_str, "matname"))
- {
- return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
- }
- if (!strcmp(attr_str, "texture"))
- {
- return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
- }
- if (!strcmp(attr_str, "material"))
- {
- RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial();
- if(polymat->GetFlag() & RAS_BLENDERMAT)
- {
- KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat);
- return mat->GetProxy();
- }
- else
- {
- KX_PolygonMaterial* mat = static_cast<KX_PolygonMaterial*>(polymat);
- return mat->GetProxy();
- }
- }
- if (!strcmp(attr_str, "matid"))
- {
- // we'll have to scan through the material bucket of the mes and compare with
- // the one of the polygon
- RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial();
- unsigned int matid;
- for (matid=0; matid<(unsigned int)m_mesh->NumMaterials(); matid++)
- {
- RAS_MeshMaterial* meshMat = m_mesh->GetMeshMaterial(matid);
- if (meshMat->m_bucket == polyBucket)
- // found it
- break;
- }
- return PyLong_FromSsize_t(matid);
- }
- if (!strcmp(attr_str, "v1"))
- {
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 0));
- }
- if (!strcmp(attr_str, "v2"))
- {
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 1));
- }
- if (!strcmp(attr_str, "v3"))
- {
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 2));
- }
- if (!strcmp(attr_str, "v4"))
- {
- return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffsetAbs(m_mesh, 3):0));
- }
- if (!strcmp(attr_str, "visible"))
- {
- return PyLong_FromSsize_t(m_polygon->IsVisible());
- }
- if (!strcmp(attr_str, "collide"))
- {
- return PyLong_FromSsize_t(m_polygon->IsCollider());
- }
- // py_getattro_up(CValue); // XXX -- todo, make all these attributes
-}
-#endif
-
KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon)
: m_polygon(polygon),
m_mesh((RAS_MeshObject*)mesh)
@@ -183,7 +108,75 @@ CValue* KX_PolyProxy::GetReplica() { return NULL;}
// stuff for python integration
-KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
+PyObject* KX_PolyProxy::pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PygetMaterialName();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PygetTextureName();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PygetMaterial();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PygetMaterialIndex();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+ return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+ return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+ return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+ if (3 < self->m_polygon->VertexCount())
+ {
+ return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+ }
+ return PyLong_FromSsize_t(0);
+}
+
+PyObject* KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PyisVisible();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+ return self->PyisCollider();
+}
+
+KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
"getMaterialIndex() : return the material index of the polygon in the mesh\n")
{
RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial();
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h
index 97d89b37435..3e669630e30 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.h
+++ b/source/gameengine/Ketsji/KX_PolyProxy.h
@@ -54,6 +54,16 @@ public:
// stuff for python integration
+ static PyObject* pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialIndex)
KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getNumVertex)
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index b94f3ee6c27..63204b16e8b 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -25,10 +25,6 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "KX_PolygonMaterial.h"
#include "BKE_mesh.h"
@@ -119,7 +115,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
{
PyObject *pyRasty = PyCObject_FromVoidPtr((void*)rasty, NULL); /* new reference */
PyObject *pyCachingInfo = PyCObject_FromVoidPtr((void*) &cachingInfo, NULL); /* new reference */
- PyObject *ret = PyObject_CallMethod(m_pymaterial, "activate", "(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy);
+ PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy);
if (ret)
{
bool value = PyLong_AsSsize_t(ret);
@@ -237,7 +233,7 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("shininess", 0.0f, 1000.0f, KX_PolygonMaterial, m_shininess),
KX_PYATTRIBUTE_FLOAT_RW("specularity", 0.0f, 1000.0f, KX_PolygonMaterial, m_specularity),
- KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_texture, pyattr_set_diffuse),
+ KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_diffuse, pyattr_set_diffuse),
KX_PYATTRIBUTE_RW_FUNCTION("specular",KX_PolygonMaterial, pyattr_get_specular, pyattr_set_specular),
KX_PYATTRIBUTE_RO_FUNCTION("tface", KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index 9d538b4a3da..03b4bf11a18 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -143,6 +143,7 @@ public:
static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
#endif
+
};
#endif // __KX_POLYGONMATERIAL_H__
diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
index 30864bb4baf..6e047180cdf 100644
--- a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
@@ -30,10 +30,6 @@
#include "MT_Point3.h"
#include "KX_IScalarInterpolator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
void KX_PositionInterpolator::Execute(float currentTime) const {
m_target.setValue(m_ipos[0]->GetValue(currentTime),
m_ipos[1]->GetValue(currentTime),
diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.h b/source/gameengine/Ketsji/KX_PositionInterpolator.h
index 3dd72a6b08f..764c7bd8750 100644
--- a/source/gameengine/Ketsji/KX_PositionInterpolator.h
+++ b/source/gameengine/Ketsji/KX_PositionInterpolator.h
@@ -54,7 +54,7 @@ private:
#ifdef WITH_CXX_GUARDEDALLOC
private:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_PositionInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_PositionInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 94b98e783bc..bbf8152bd68 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -37,10 +37,6 @@
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifndef DISABLE_PYTHON
// nasty glob variable to connect scripting language
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index ba213ebc85d..59d1c197cf3 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -28,10 +28,6 @@
* Initialize Python thingies.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
#pragma warning (disable : 4786)
#endif //WIN32
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 8c14ac0e96c..9c9688f79cd 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -45,7 +45,7 @@
#ifndef DISABLE_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
-#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
+#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */
}
#endif
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 7dec4e4f97f..3785f715803 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -38,12 +38,17 @@
extern "C" {
#include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
- #include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
- #include "Geometry.h" // Blender.Geometry module copied here so the blenderlayer can use.
+ #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
+ #include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use.
#include "bgl.h"
+ #include "blf_api.h"
#include "marshal.h" /* python header for loading/saving dicts */
}
+
+#define WITH_PYTHON
+#include "AUD_PyInit.h"
+
#endif
#include "KX_PythonInit.h"
@@ -73,6 +78,8 @@ extern "C" {
#include "SCA_PropertySensor.h"
#include "SCA_RandomActuator.h"
#include "SCA_KeyboardSensor.h" /* IsPrintable, ToCharacter */
+#include "SCA_PythonKeyboard.h"
+#include "SCA_PythonMouse.h"
#include "KX_ConstraintActuator.h"
#include "KX_IpoActuator.h"
#include "KX_SoundActuator.h"
@@ -115,21 +122,24 @@ extern "C" {
#include "KX_BlenderSceneConverter.h"
#include "KX_MeshProxy.h" /* for creating a new library of mesh objects */
extern "C" {
- #include "BLO_readfile.h"
+ #include "BKE_idcode.h"
}
-
#include "NG_NetworkScene.h" //Needed for sendMessage()
-static void setSandbox(TPythonSecurityLevel level);
-
// 'local' copy of canvas ptr, for window height/width python scripts
+
+#ifndef DISABLE_PYTHON
+
static RAS_ICanvas* gp_Canvas = NULL;
+static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = "";
+static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save
+
+#endif // DISABLE_PYTHON
+
static KX_Scene* gp_KetsjiScene = NULL;
static KX_KetsjiEngine* gp_KetsjiEngine = NULL;
static RAS_IRasterizer* gp_Rasterizer = NULL;
-static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = "";
-static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save
void KX_SetActiveScene(class KX_Scene* scene)
{
@@ -256,8 +266,8 @@ static PyObject* gPyRestartGame(PyObject*)
}
static char gPySaveGlobalDict_doc[] =
-"saveGlobalDict()\n\
-Saves GameLogic.globalDict to a file";
+ "saveGlobalDict()\n"
+ "Saves bge.logic.globalDict to a file";
static PyObject* gPySaveGlobalDict(PyObject*)
{
@@ -293,8 +303,8 @@ static PyObject* gPySaveGlobalDict(PyObject*)
}
static char gPyLoadGlobalDict_doc[] =
-"LoadGlobalDict()\n\
-Loads GameLogic.globalDict from a file";
+ "LoadGlobalDict()\n"
+ "Loads bge.logic.globalDict from a file";
static PyObject* gPyLoadGlobalDict(PyObject*)
{
@@ -369,15 +379,6 @@ static PyObject* gPyGetSpectrum(PyObject*)
return resultlist;
}
-
-static PyObject* gPyStopDSP(PyObject*, PyObject* args)
-{
- PyErr_SetString(PyExc_RuntimeError, "no audio device available");
- return NULL;
-
- Py_RETURN_NONE;
-}
-
static PyObject* gPySetLogicTicRate(PyObject*, PyObject* args)
{
float ticrate;
@@ -660,7 +661,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args)
return NULL;
}
- idcode= BLO_idcode_from_name(group);
+ idcode= BKE_idcode_from_name(group);
if(idcode==0) {
PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group);
return NULL;
@@ -746,7 +747,6 @@ static struct PyMethodDef game_methods[] = {
{"getRandomFloat",(PyCFunction) gPyGetRandomFloat, METH_NOARGS, (const char *)gPyGetRandomFloat_doc},
{"setGravity",(PyCFunction) gPySetGravity, METH_O, (const char *)"set Gravitation"},
{"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_NOARGS, (const char *)"get audio spectrum"},
- {"stopDSP",(PyCFunction) gPyStopDSP, METH_VARARGS, (const char *)"stop using the audio dsp (for performance reasons)"},
{"getMaxLogicFrame", (PyCFunction) gPyGetMaxLogicFrame, METH_NOARGS, (const char *)"Gets the max number of logic frame per render frame"},
{"setMaxLogicFrame", (PyCFunction) gPySetMaxLogicFrame, METH_VARARGS, (const char *)"Sets the max number of logic frame per render frame"},
{"getMaxPhysicsFrame", (PyCFunction) gPyGetMaxPhysicsFrame, METH_NOARGS, (const char *)"Gets the max number of physics frame per render frame"},
@@ -929,7 +929,6 @@ static PyObject* gPyDisableMist(PyObject*)
Py_RETURN_NONE;
}
-
static PyObject* gPySetMistStart(PyObject*, PyObject* args)
{
@@ -1226,7 +1225,7 @@ static struct PyMethodDef rasterizer_methods[] = {
// Initialization function for the module (*must* be called initGameLogic)
static char GameLogic_module_documentation[] =
-"This is the Python API for the game engine of GameLogic"
+"This is the Python API for the game engine of bge.logic"
;
static char Rasterizer_module_documentation[] =
@@ -1280,6 +1279,13 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item);
+ // Add keyboard and mouse attributes to this module
+ SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice());
+ PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true));
+
+ SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas);
+ PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true));
+
ErrorObject = PyUnicode_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
Py_DECREF(ErrorObject);
@@ -1308,19 +1314,25 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ROTZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPX);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY);
- KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPZ);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNX);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY);
- KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNZ);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_NORMAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_NORMAL);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_MATERIAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_MATERIAL);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_PERMANENT, KX_ConstraintActuator::KX_ACT_CONSTRAINT_PERMANENT);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DISTANCE, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DISTANCE);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL);
+ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH);
/* 4. Ipo actuator, simple part */
KX_MACRO_addTypesToDict(d, KX_IPOACT_PLAY, KX_IpoActuator::KX_ACT_IPO_PLAY);
@@ -1459,6 +1471,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_MIDDLE, SCA_IInputDevice::KX_MIDDLEMOUSE);
KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_RIGHT, SCA_IInputDevice::KX_RIGHTMOUSE);
+ /* 2D Filter Actuator */
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_ENABLED, RAS_2DFilterManager::RAS_2DFILTER_ENABLED);
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_DISABLED, RAS_2DFilterManager::RAS_2DFILTER_DISABLED);
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_NOFILTER, RAS_2DFilterManager::RAS_2DFILTER_NOFILTER);
@@ -1474,7 +1487,8 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_SEPIA, RAS_2DFilterManager::RAS_2DFILTER_SEPIA);
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_INVERT, RAS_2DFilterManager::RAS_2DFILTER_INVERT);
KX_MACRO_addTypesToDict(d, RAS_2DFILTER_CUSTOMFILTER, RAS_2DFilterManager::RAS_2DFILTER_CUSTOMFILTER);
-
+
+ /* Sound Actuator */
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYSTOP, KX_SoundActuator::KX_SOUNDACT_PLAYSTOP);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYEND, KX_SoundActuator::KX_SOUNDACT_PLAYEND);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPSTOP, KX_SoundActuator::KX_SOUNDACT_LOOPSTOP);
@@ -1482,18 +1496,12 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP);
+ /* State Actuator */
KX_MACRO_addTypesToDict(d, KX_STATE_OP_CPY, KX_StateActuator::OP_CPY);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_SET, KX_StateActuator::OP_SET);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_CLR, KX_StateActuator::OP_CLR);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_NEG, KX_StateActuator::OP_NEG);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_NORMAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_NORMAL);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_MATERIAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_MATERIAL);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_PERMANENT, KX_ConstraintActuator::KX_ACT_CONSTRAINT_PERMANENT);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DISTANCE, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DISTANCE);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL);
- KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH);
-
/* Game Actuator Modes */
KX_MACRO_addTypesToDict(d, KX_GAME_LOAD, KX_GameActuator::KX_GAME_LOAD);
KX_MACRO_addTypesToDict(d, KX_GAME_START, KX_GameActuator::KX_GAME_START);
@@ -1566,7 +1574,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
// Check for errors
if (PyErr_Occurred())
{
- Py_FatalError("can't initialize module GameLogic");
+ Py_FatalError("can't initialize module bge.logic");
}
return m;
@@ -1622,7 +1630,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
/* quick hack for GamePython modules
TODO: register builtin modules properly by ExtendInittab */
if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") ||
- !strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils") || !strcmp(name, "bgl") || !strcmp(name, "Geometry")) {
+ !strcmp(name, "Rasterizer") || !strcmp(name, "mathutils") || !strcmp(name, "bgl") || !strcmp(name, "geometry")) {
return PyImport_ImportModuleEx(name, globals, locals, fromlist);
}
@@ -1691,7 +1699,7 @@ static PyMethodDef meth_import[] = {{ "import", KXpy_import, METH_VARARGS, "our
//static PyObject *g_oldimport = 0;
//static int g_security = 0;
-void setSandbox(TPythonSecurityLevel level)
+static void setSandbox(TPythonSecurityLevel level)
{
PyObject *m = PyImport_AddModule("__builtin__");
PyObject *d = PyModule_GetDict(m);
@@ -1818,7 +1826,7 @@ static void initPySysObjects(Main *maggie)
while(lib) {
/* lib->name wont work in some cases (on win32),
* even when expanding with gp_GamePythonPath, using lib->filename is less trouble */
- initPySysObjects__append(sys_path, lib->filename);
+ initPySysObjects__append(sys_path, lib->filepath);
lib= (Library *)lib->id.next;
}
@@ -1896,9 +1904,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
first_time = false;
PyObjectPlus::ClearDeprecationWarning();
-
- PyObject* moduleobj = PyImport_AddModule("__main__");
- return PyModule_GetDict(moduleobj);
+
+ return bpy_namespace_dict_new(NULL);
}
void exitGamePlayerPythonScripting()
@@ -1933,9 +1940,8 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev
initPySysObjects(maggie);
PyObjectPlus::NullDeprecationWarning();
-
- PyObject* moduleobj = PyImport_AddModule("__main__");
- return PyModule_GetDict(moduleobj);
+
+ return bpy_namespace_dict_new(NULL);
}
void exitGamePythonScripting()
@@ -1965,20 +1971,18 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
*gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic));
- PyDict_SetItemString(dictionaryobject, "GameLogic", *gameLogic); // Same as importing the module.
initGameKeys();
initPythonConstraintBinding();
initMathutils();
initGeometry();
initBGL();
-
-#ifdef WITH_FFMPEG
+ initBLF();
+ AUD_initPython();
initVideoTexture();
-#endif
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
- PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'keys':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]");
+ PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')});import bge");
}
static struct PyModuleDef Rasterizer_module_def = {
@@ -2249,6 +2253,13 @@ PyObject* initGameKeys()
KX_MACRO_addTypesToDict(d, F10KEY, SCA_IInputDevice::KX_F10KEY);
KX_MACRO_addTypesToDict(d, F11KEY, SCA_IInputDevice::KX_F11KEY);
KX_MACRO_addTypesToDict(d, F12KEY, SCA_IInputDevice::KX_F12KEY);
+ KX_MACRO_addTypesToDict(d, F13KEY, SCA_IInputDevice::KX_F13KEY);
+ KX_MACRO_addTypesToDict(d, F14KEY, SCA_IInputDevice::KX_F14KEY);
+ KX_MACRO_addTypesToDict(d, F15KEY, SCA_IInputDevice::KX_F15KEY);
+ KX_MACRO_addTypesToDict(d, F16KEY, SCA_IInputDevice::KX_F16KEY);
+ KX_MACRO_addTypesToDict(d, F17KEY, SCA_IInputDevice::KX_F17KEY);
+ KX_MACRO_addTypesToDict(d, F18KEY, SCA_IInputDevice::KX_F18KEY);
+ KX_MACRO_addTypesToDict(d, F19KEY, SCA_IInputDevice::KX_F19KEY);
KX_MACRO_addTypesToDict(d, PAUSEKEY, SCA_IInputDevice::KX_PAUSEKEY);
KX_MACRO_addTypesToDict(d, INSERTKEY, SCA_IInputDevice::KX_INSERTKEY);
@@ -2257,6 +2268,15 @@ PyObject* initGameKeys()
KX_MACRO_addTypesToDict(d, PAGEDOWNKEY, SCA_IInputDevice::KX_PAGEDOWNKEY);
KX_MACRO_addTypesToDict(d, ENDKEY, SCA_IInputDevice::KX_ENDKEY);
+ // MOUSE
+ KX_MACRO_addTypesToDict(d, LEFTMOUSE, SCA_IInputDevice::KX_LEFTMOUSE);
+ KX_MACRO_addTypesToDict(d, MIDDLEMOUSE, SCA_IInputDevice::KX_MIDDLEMOUSE);
+ KX_MACRO_addTypesToDict(d, RIGHTMOUSE, SCA_IInputDevice::KX_RIGHTMOUSE);
+ KX_MACRO_addTypesToDict(d, WHEELUPMOUSE, SCA_IInputDevice::KX_WHEELUPMOUSE);
+ KX_MACRO_addTypesToDict(d, WHEELDOWNMOUSE, SCA_IInputDevice::KX_WHEELDOWNMOUSE);
+ KX_MACRO_addTypesToDict(d, MOUSEX, SCA_IInputDevice::KX_MOUSEX);
+ KX_MACRO_addTypesToDict(d, MOUSEY, SCA_IInputDevice::KX_MOUSEY);
+
// Check for errors
if (PyErr_Occurred())
{
@@ -2281,6 +2301,11 @@ PyObject* initBGL()
return BGL_Init();
}
+PyObject* initBLF()
+{
+ return BLF_Init();
+}
+
// utility function for loading and saving the globalDict
int saveGamePythonConfig( char **marshal_buffer)
{
@@ -2305,15 +2330,15 @@ int saveGamePythonConfig( char **marshal_buffer)
memcpy(*marshal_buffer, marshal_cstring, marshal_length);
Py_DECREF(pyGlobalDictMarshal);
} else {
- printf("Error, GameLogic.globalDict could not be marshal'd\n");
+ printf("Error, bge.logic.globalDict could not be marshal'd\n");
}
} else {
- printf("Error, GameLogic.globalDict was removed\n");
+ printf("Error, bge.logic.globalDict was removed\n");
}
Py_DECREF(gameLogic);
} else {
PyErr_Clear();
- printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
+ printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n");
}
return marshal_length;
}
@@ -2345,7 +2370,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length)
}
} else {
PyErr_Clear();
- printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
+ printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n");
}
}
return 0;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index 7c2b1226bdb..fb59a2f21eb 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -47,6 +47,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
PyObject* initMathutils();
PyObject* initGeometry();
PyObject* initBGL();
+PyObject* initBLF();
PyObject* initVideoTexture(void);
void exitGamePlayerPythonScripting();
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie);
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 278e0236b2e..6b9d7a2cccf 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -79,6 +79,8 @@
#include "SCA_RandomSensor.h"
#include "SCA_XNORController.h"
#include "SCA_XORController.h"
+#include "SCA_PythonKeyboard.h"
+#include "SCA_PythonMouse.h"
#include "KX_IpoActuator.h"
#include "KX_NearSensor.h"
#include "KX_RadarSensor.h"
@@ -239,6 +241,8 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, SCA_XNORController, init_getset);
PyType_Ready_Attr(dict, SCA_XORController, init_getset);
PyType_Ready_Attr(dict, SCA_IController, init_getset);
+ PyType_Ready_Attr(dict, SCA_PythonKeyboard, init_getset);
+ PyType_Ready_Attr(dict, SCA_PythonMouse, init_getset);
}
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index f28c9518ac4..5c87fe2e757 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -324,6 +324,8 @@ PySequenceMethods KX_PythonSeq_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)KX_PythonSeq_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods KX_PythonSeq_as_mapping = {
@@ -349,7 +351,7 @@ static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self)
return NULL;
}
- /* create a new iterator if were alredy using this one */
+ /* create a new iterator if were already using this one */
if (self->iter == -1) {
self->iter = 0;
Py_INCREF(self);
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index bf4bcc91563..041559158dd 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -32,10 +32,6 @@
#include "PHY_IPhysicsController.h"
#include "PHY_IMotionState.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/**
* RadarSensor constructor. Creates a near-sensor derived class, with a cone collision shape.
*/
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index 58bb61a51a2..7562265a536 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -86,7 +86,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_
break;
}
- // The biggest danger to to endless loop, prevent this by checking that the
+ // The biggest danger to endless loop, prevent this by checking that the
// hit point always progresses along the ray direction..
prevpoint -= callback.m_hitPoint;
if (prevpoint.length2() < MT_EPSILON)
diff --git a/source/gameengine/Ketsji/KX_RayCast.h b/source/gameengine/Ketsji/KX_RayCast.h
index f2084b7669d..1512d81e940 100644
--- a/source/gameengine/Ketsji/KX_RayCast.h
+++ b/source/gameengine/Ketsji/KX_RayCast.h
@@ -95,7 +95,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
@@ -134,7 +134,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast::Callback"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast::Callback"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_RayEventManager.cpp b/source/gameengine/Ketsji/KX_RayEventManager.cpp
index e9862fdd53f..9c9d6722784 100644
--- a/source/gameengine/Ketsji/KX_RayEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_RayEventManager.cpp
@@ -38,10 +38,6 @@ using namespace std;
#include <iostream>
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
void KX_RayEventManager::NextFrame()
{
SG_DList::iterator<SCA_ISensor> it(m_sensors);
diff --git a/source/gameengine/Ketsji/KX_RayEventManager.h b/source/gameengine/Ketsji/KX_RayEventManager.h
index 35bf57f130c..55c2b81b068 100644
--- a/source/gameengine/Ketsji/KX_RayEventManager.h
+++ b/source/gameengine/Ketsji/KX_RayEventManager.h
@@ -46,7 +46,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index c66b55edf50..e745d1f0334 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -45,10 +45,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_RaySensor::KX_RaySensor(class SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index eddad69e4c5..eee6146f6ed 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -40,10 +40,6 @@
#include "KX_IPhysicsController.h"
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index 58085b74255..bc59c63dc69 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -37,10 +37,6 @@
#include "KX_SCA_DynamicActuator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
index d6a2da3e2c7..c9ead726905 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
@@ -38,10 +38,6 @@
#include "KX_SCA_EndObjectActuator.h"
#include "SCA_IScene.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj,
SCA_IScene* scene):
SCA_IActuator(gameobj, KX_ACT_END_OBJECT),
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index 0e7364bfa3e..20c3168d7ba 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -40,10 +40,6 @@
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
index 41aeace74c9..0529195e933 100644
--- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
+++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
@@ -34,10 +34,6 @@
#include "BL_ArmatureObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/**
* Implementation of classes defined in KX_SG_BoneParentNodeRelationship.h
*/
diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
index be8c4951935..05e9d9f02de 100644
--- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
+++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
@@ -103,7 +103,7 @@ private :
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneParentRelation"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneParentRelation"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
index 21913f8b885..ccdaac8edb7 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
@@ -28,10 +28,6 @@
#include "KX_SG_NodeRelationships.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/**
* Implementation of classes defined in KX_SG_NodeRelationships.h
*/
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
index f62e18b07c3..7bb6f767308 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
@@ -93,7 +93,7 @@ private :
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
@@ -150,7 +150,7 @@ private :
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
@@ -233,7 +233,7 @@ private :
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
index 46ab82ef30b..9fc544feaff 100644
--- a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
@@ -29,10 +29,6 @@
#include "KX_ScalarInterpolator.h"
#include "KX_IScalarInterpolator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
void KX_ScalarInterpolator::Execute(float currentTime) const {
*m_target = m_ipo->GetValue(currentTime);
}
diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.h b/source/gameengine/Ketsji/KX_ScalarInterpolator.h
index 29962ddf686..5b66ad42bd9 100644
--- a/source/gameengine/Ketsji/KX_ScalarInterpolator.h
+++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.h
@@ -59,7 +59,7 @@ private:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalarInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalarInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
index 9dcccd28187..3f5ac8ee8a4 100644
--- a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
@@ -30,10 +30,6 @@
#include "MT_Vector3.h"
#include "KX_IScalarInterpolator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
void KX_ScalingInterpolator::Execute(float currentTime) const {
m_target.setValue(m_ipos[0]->GetValue(currentTime),
m_ipos[1]->GetValue(currentTime),
diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.h b/source/gameengine/Ketsji/KX_ScalingInterpolator.h
index 72e0e1185df..87b85a30d1f 100644
--- a/source/gameengine/Ketsji/KX_ScalingInterpolator.h
+++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.h
@@ -54,7 +54,7 @@ private:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalingInterpolator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalingInterpolator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 5bcaa3ee01e..d4936d7054c 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -68,7 +68,6 @@
#include "SG_Tree.h"
#include "DNA_group_types.h"
#include "DNA_scene_types.h"
-#include "BKE_anim.h"
#include "KX_SG_NodeRelationships.h"
@@ -139,7 +138,8 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
class SCA_IInputDevice* mousedevice,
class NG_NetworkDeviceInterface *ndi,
const STR_String& sceneName,
- Scene *scene):
+ Scene *scene,
+ class RAS_ICanvas* canvas):
PyObjectPlus(),
m_keyboardmgr(NULL),
m_mousemgr(NULL),
@@ -170,7 +170,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
m_timemgr = new SCA_TimeEventManager(m_logicmgr);
m_keyboardmgr = new SCA_KeyboardManager(m_logicmgr,keyboarddevice);
- m_mousemgr = new SCA_MouseManager(m_logicmgr,mousedevice);
+ m_mousemgr = new SCA_MouseManager(m_logicmgr,mousedevice, canvas);
//SCA_AlwaysEventManager* alwaysmgr = new SCA_AlwaysEventManager(m_logicmgr);
//SCA_PropertyEventManager* propmgr = new SCA_PropertyEventManager(m_logicmgr);
@@ -529,7 +529,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
// replica of the hierarchy in order to make cross-links work properly
// !
// It is VERY important that the order of sensors and actuators in
-// the replicated object is preserved: it is is used to reconnect the logic.
+// the replicated object is preserved: it is used to reconnect the logic.
// This method is more robust then using the bricks name in case of complex
// group replication. The replication of logic bricks is done in
// SCA_IObject::ReParentLogic(), make sure it preserves the order of the bricks.
@@ -961,8 +961,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
{
m_logicmgr->RemoveSensor(*its);
}
-
- SCA_ControllerList& controllers = newobj->GetControllers();
+
+ SCA_ControllerList& controllers = newobj->GetControllers();
for (SCA_ControllerList::iterator itc = controllers.begin();
!(itc==controllers.end());itc++)
{
@@ -1066,12 +1066,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
bool bHasShapeKey = blendmesh->key != NULL && blendmesh->key->type==KEY_RELATIVE;
bool bHasDvert = blendmesh->dvert != NULL;
bool bHasArmature =
+ BL_ModifierDeformer::HasArmatureDeformer(blendobj) &&
parentobj && // current parent is armature
parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE &&
oldblendobj && // needed for mesh deform
blendobj->parent && // original object had armature (not sure this test is needed)
- blendobj->parent->type == OB_ARMATURE &&
- blendobj->partype==PARSKEL &&
+ blendobj->parent->type == OB_ARMATURE &&
blendmesh->dvert!=NULL; // mesh has vertex group
bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY));
@@ -1753,7 +1753,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
}
- GetBucketManager()->MergeBucketManager(other->GetBucketManager());
+ GetBucketManager()->MergeBucketManager(other->GetBucketManager(), this);
/* move materials across, assume they both use the same scene-converters */
GetSceneConverter()->MergeScene(this, other);
@@ -1998,6 +1998,8 @@ PySequenceMethods KX_Scene::Sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)Seq_Contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index 407f3f1cf1a..cd8277ec39f 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -45,6 +45,7 @@
#include "RAS_FramingManager.h"
#include "RAS_Rect.h"
+
#include "PyObjectPlus.h"
#include "RAS_2DFilterManager.h"
@@ -83,6 +84,10 @@ class btCollisionShape;
class KX_BlenderSceneConverter;
struct KX_ClientObjectInfo;
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
/* for ID freeing */
#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
@@ -280,7 +285,8 @@ public:
class SCA_IInputDevice* mousedevice,
class NG_NetworkDeviceInterface* ndi,
const STR_String& scenename,
- struct Scene* scene);
+ struct Scene* scene,
+ class RAS_ICanvas* canvas);
virtual
~KX_Scene();
@@ -608,8 +614,6 @@ public:
//void PrintStats(int verbose_level) {
// m_bucketmanager->PrintStats(verbose_level)
//}
-
-
};
typedef std::vector<KX_Scene*> KX_SceneList;
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index 692645f8abd..8f6000ebc3d 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -36,10 +36,6 @@
#include "KX_Camera.h"
#include "KX_KetsjiEngine.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 08f235801a0..9ebb36578c4 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -31,14 +31,11 @@
*/
#include "KX_SoundActuator.h"
+#include "AUD_C-API.h"
#include "KX_GameObject.h"
#include "KX_PyMath.h" // needed for PyObjectFrom()
#include <iostream>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
@@ -79,23 +76,20 @@ void KX_SoundActuator::play()
// this is the sound that will be played and not deleted afterwards
AUD_Sound* sound = m_sound;
- // this sounds are for temporary stacked sounds, will be deleted if not NULL
+ // this sound is for temporary stacked sounds, will be deleted if not NULL
AUD_Sound* sound2 = NULL;
- AUD_Sound* sound3 = NULL;
+
+ bool loop = false;
switch (m_type)
{
case KX_SOUNDACT_LOOPBIDIRECTIONAL:
case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
- // create a ping pong sound on sound2 stacked on the orignal sound
- sound2 = AUD_pingpongSound(sound);
- // create a loop sound on sound3 stacked on the pingpong sound and let that one play (save it to sound)
- sound = sound3 = AUD_loopSound(sound2);
- break;
+ sound = sound2 = AUD_pingpongSound(sound);
+ // fall through
case KX_SOUNDACT_LOOPEND:
case KX_SOUNDACT_LOOPSTOP:
- // create a loop sound on sound2 stacked on the pingpong sound and let that one play (save it to sound)
- sound = sound2 = AUD_loopSound(sound);
+ loop = true;
break;
case KX_SOUNDACT_PLAYSTOP:
case KX_SOUNDACT_PLAYEND:
@@ -106,28 +100,27 @@ void KX_SoundActuator::play()
if(m_is3d)
{
// sound shall be played 3D
- m_handle = AUD_play3D(sound, 0);
-
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_GAIN, m_3d.max_gain);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_MIN_GAIN, m_3d.min_gain);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_REFERENCE_DISTANCE, m_3d.reference_distance);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_DISTANCE, m_3d.max_distance);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_ROLLOFF_FACTOR, m_3d.rolloff_factor);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_INNER_ANGLE, m_3d.cone_inner_angle);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_ANGLE, m_3d.cone_outer_angle);
- AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_GAIN, m_3d.cone_outer_gain);
+ m_handle = AUD_play(sound, 0);
+
+ AUD_setRelative(m_handle, false);
+ AUD_setVolumeMaximum(m_handle, m_3d.max_gain);
+ AUD_setVolumeMinimum(m_handle, m_3d.min_gain);
+ AUD_setDistanceReference(m_handle, m_3d.reference_distance);
+ AUD_setDistanceMaximum(m_handle, m_3d.max_distance);
+ AUD_setAttenuation(m_handle, m_3d.rolloff_factor);
+ AUD_setConeAngleInner(m_handle, m_3d.cone_inner_angle);
+ AUD_setConeAngleOuter(m_handle, m_3d.cone_outer_angle);
+ AUD_setConeVolumeOuter(m_handle, m_3d.cone_outer_gain);
}
else
m_handle = AUD_play(sound, 0);
+ if(loop)
+ AUD_setLoop(m_handle, -1);
AUD_setSoundPitch(m_handle, m_pitch);
AUD_setSoundVolume(m_handle, m_volume);
m_isplaying = true;
- // now we unload the pingpong and loop sounds, as we don't need them anymore
- // the started sound will continue playing like it was created, don't worry!
- if(sound3)
- AUD_unload(sound3);
if(sound2)
AUD_unload(sound2);
}
@@ -187,7 +180,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
case KX_SOUNDACT_LOOPBIDIRECTIONAL:
{
// stop the looping so that the sound stops when it finished
- AUD_setLoop(m_handle, 0, -1);
+ AUD_setLoop(m_handle, 0);
break;
}
default:
@@ -219,39 +212,15 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
{
if(m_is3d)
{
- AUD_3DData data;
- float f;
- ((KX_GameObject*)this->GetParent())->NodeGetWorldPosition().getValue(data.position);
- ((KX_GameObject*)this->GetParent())->GetLinearVelocity().getValue(data.velocity);
- ((KX_GameObject*)this->GetParent())->NodeGetWorldOrientation().getValue3x3(data.orientation);
-
- /*
- * The 3D data from blender has to be transformed for OpenAL:
- * - In blender z is up and y is forwards
- * - In OpenAL y is up and z is backwards
- * We have to do that for all 5 vectors.
- */
- f = data.position[1];
- data.position[1] = data.position[2];
- data.position[2] = -f;
-
- f = data.velocity[1];
- data.velocity[1] = data.velocity[2];
- data.velocity[2] = -f;
-
- f = data.orientation[1];
- data.orientation[1] = data.orientation[2];
- data.orientation[2] = -f;
-
- f = data.orientation[4];
- data.orientation[4] = data.orientation[5];
- data.orientation[5] = -f;
-
- f = data.orientation[7];
- data.orientation[7] = data.orientation[8];
- data.orientation[8] = -f;
-
- AUD_update3DSource(m_handle, &data);
+ KX_GameObject* obj = (KX_GameObject*)this->GetParent();
+ float f[4];
+
+ obj->NodeGetWorldPosition().getValue(f);
+ AUD_setSourceLocation(m_handle, f);
+ obj->GetLinearVelocity().getValue(f);
+ AUD_setSourceVelocity(m_handle, f);
+ obj->NodeGetWorldOrientation().getRotation().getValue(f);
+ AUD_setSourceOrientation(m_handle, f);
}
result = true;
}
@@ -299,24 +268,23 @@ PyMethodDef KX_SoundActuator::Methods[] = {
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound),
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound),
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound),
- {NULL,NULL,NULL,NULL} //Sentinel
+ {NULL, NULL} //Sentinel
};
PyAttributeDef KX_SoundActuator::Attributes[] = {
KX_PYATTRIBUTE_BOOL_RO("is3D", KX_SoundActuator, m_is3d),
- KX_PYATTRIBUTE_RW_FUNCTION("maxGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("minGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("referenceDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("maxDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("rolloffFactor3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("coneInnerAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("coneOuterAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
- KX_PYATTRIBUTE_RW_FUNCTION("coneOuterGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
-
+ KX_PYATTRIBUTE_RW_FUNCTION("volume_maximum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("volume_minimum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("distance_reference", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("distance_maximum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("attenuation", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("cone_angle_inner", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("cone_angle_outer", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+ KX_PYATTRIBUTE_RW_FUNCTION("cone_volume_outer", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property),
+
KX_PYATTRIBUTE_RW_FUNCTION("time", KX_SoundActuator, pyattr_get_audposition, pyattr_set_audposition),
KX_PYATTRIBUTE_RW_FUNCTION("volume", KX_SoundActuator, pyattr_get_gain, pyattr_set_gain),
KX_PYATTRIBUTE_RW_FUNCTION("pitch", KX_SoundActuator, pyattr_get_pitch, pyattr_set_pitch),
- KX_PYATTRIBUTE_RW_FUNCTION("rollOffFactor", KX_SoundActuator, pyattr_get_rollOffFactor, pyattr_set_rollOffFactor),
KX_PYATTRIBUTE_ENUM_RW("mode",KX_SoundActuator::KX_SOUNDACT_NODEF+1,KX_SoundActuator::KX_SOUNDACT_MAX-1,false,KX_SoundActuator,m_type),
{ NULL } //Sentinel
};
@@ -362,28 +330,28 @@ PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P
const char* prop = attrdef->m_name;
float result_value = 0.0;
- if(!strcmp(prop, "maxGain3D")) {
+ if(!strcmp(prop, "volume_maximum")) {
result_value = actuator->m_3d.max_gain;
- } else if (!strcmp(prop, "minGain3D")) {
+ } else if (!strcmp(prop, "volume_minimum")) {
result_value = actuator->m_3d.min_gain;
- } else if (!strcmp(prop, "referenceDistance3D")) {
+ } else if (!strcmp(prop, "distance_reference")) {
result_value = actuator->m_3d.reference_distance;
- } else if (!strcmp(prop, "maxDistance3D")) {
+ } else if (!strcmp(prop, "distance_maximum")) {
result_value = actuator->m_3d.max_distance;
- } else if (!strcmp(prop, "rolloffFactor3D")) {
+ } else if (!strcmp(prop, "attenuation")) {
result_value = actuator->m_3d.rolloff_factor;
- } else if (!strcmp(prop, "coneInnerAngle3D")) {
+ } else if (!strcmp(prop, "cone_angle_inner")) {
result_value = actuator->m_3d.cone_inner_angle;
- } else if (!strcmp(prop, "coneOuterAngle3D")) {
+ } else if (!strcmp(prop, "cone_angle_outer")) {
result_value = actuator->m_3d.cone_outer_angle;
- } else if (!strcmp(prop, "coneOuterGain3D")) {
+ } else if (!strcmp(prop, "cone_volume_outer")) {
result_value = actuator->m_3d.cone_outer_gain;
} else {
@@ -427,66 +395,63 @@ PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI
return result;
}
-PyObject* KX_SoundActuator::pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
- float rollofffactor = actuator->m_3d.rolloff_factor;
- PyObject* result = PyFloat_FromDouble(rollofffactor);
-
- return result;
-}
-
int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
const char* prop = attrdef->m_name;
float prop_value = 0.0;
- AUD_3DSourceSetting setting = AUD_3DSS_NONE;
if (!PyArg_Parse(value, "f", &prop_value))
return PY_SET_ATTR_FAIL;
- // update the internal value
- if(!strcmp(prop, "maxGain3D")) {
+ // if sound is working and 3D, set the new setting
+ if(!actuator->m_is3d)
+ return PY_SET_ATTR_FAIL;
+
+ if(!strcmp(prop, "volume_maximum")) {
actuator->m_3d.max_gain = prop_value;
- setting = AUD_3DSS_MAX_GAIN;
+ if(actuator->m_handle)
+ AUD_setVolumeMaximum(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "minGain3D")) {
+ } else if (!strcmp(prop, "volume_minimum")) {
actuator->m_3d.min_gain = prop_value;
- setting = AUD_3DSS_MIN_GAIN;
+ if(actuator->m_handle)
+ AUD_setVolumeMinimum(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "referenceDistance3D")) {
+ } else if (!strcmp(prop, "distance_reference")) {
actuator->m_3d.reference_distance = prop_value;
- setting = AUD_3DSS_REFERENCE_DISTANCE;
+ if(actuator->m_handle)
+ AUD_setDistanceReference(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "maxDistance3D")) {
+ } else if (!strcmp(prop, "distance_maximum")) {
actuator->m_3d.max_distance = prop_value;
- setting = AUD_3DSS_MAX_DISTANCE;
+ if(actuator->m_handle)
+ AUD_setDistanceMaximum(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "rolloffFactor3D")) {
+ } else if (!strcmp(prop, "attenuation")) {
actuator->m_3d.rolloff_factor = prop_value;
- setting = AUD_3DSS_ROLLOFF_FACTOR;
+ if(actuator->m_handle)
+ AUD_setAttenuation(actuator->m_handle, prop_value);
- } else if (!!strcmp(prop, "coneInnerAngle3D")) {
+ } else if (!!strcmp(prop, "cone_angle_inner")) {
actuator->m_3d.cone_inner_angle = prop_value;
- setting = AUD_3DSS_CONE_INNER_ANGLE;
+ if(actuator->m_handle)
+ AUD_setConeAngleInner(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "coneOuterAngle3D")) {
+ } else if (!strcmp(prop, "cone_angle_outer")) {
actuator->m_3d.cone_outer_angle = prop_value;
- setting = AUD_3DSS_CONE_OUTER_ANGLE;
+ if(actuator->m_handle)
+ AUD_setConeAngleOuter(actuator->m_handle, prop_value);
- } else if (!strcmp(prop, "coneOuterGain3D")) {
+ } else if (!strcmp(prop, "cone_volume_outer")) {
actuator->m_3d.cone_outer_gain = prop_value;
- setting = AUD_3DSS_CONE_OUTER_GAIN;
+ if(actuator->m_handle)
+ AUD_setConeVolumeOuter(actuator->m_handle, prop_value);
} else {
return PY_SET_ATTR_FAIL;
- }
+ }
- // if sound is working and 3D, set the new setting
- if(actuator->m_handle && actuator->m_is3d && setting != AUD_3DSS_NONE)
- AUD_set3DSourceSetting(actuator->m_handle, setting, prop_value);
-
return PY_SET_ATTR_SUCCESS;
}
@@ -531,18 +496,4 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D
return PY_SET_ATTR_SUCCESS;
}
-int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
- float rollofffactor = 1.0;
- if (!PyArg_Parse(value, "f", &rollofffactor))
- return PY_SET_ATTR_FAIL;
-
- actuator->m_3d.rolloff_factor = rollofffactor;
- if(actuator->m_handle)
- AUD_set3DSourceSetting(actuator->m_handle, AUD_3DSS_ROLLOFF_FACTOR, rollofffactor);
-
- return PY_SET_ATTR_SUCCESS;
-}
-
#endif // DISABLE_PYTHON
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h
index 1eaea276191..c175a184a15 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.h
+++ b/source/gameengine/Ketsji/KX_SoundActuator.h
@@ -58,7 +58,7 @@ class KX_SoundActuator : public SCA_IActuator
float m_pitch;
bool m_is3d;
KX_3DSoundSettings m_3d;
- AUD_Handle* m_handle;
+ AUD_Channel* m_handle;
void play();
@@ -107,14 +107,12 @@ public:
static int pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static int pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static int pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
- static int pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static int pyattr_set_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
#endif // DISABLE_PYTHON
diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp
index f8fb643dd6a..33f21f49810 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.cpp
+++ b/source/gameengine/Ketsji/KX_StateActuator.cpp
@@ -31,10 +31,6 @@
#include "KX_StateActuator.h"
#include "KX_GameObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_StateActuator::KX_StateActuator(
SCA_IObject* gameobj,
int operation,
diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
index 4ba3b44d504..4f10c72b50b 100644
--- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
+++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
@@ -29,10 +29,6 @@
#include "KX_TimeCategoryLogger.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_TimeCategoryLogger::KX_TimeCategoryLogger(unsigned int maxNumMeasurements)
: m_maxNumMeasurements(maxNumMeasurements)
{
diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
index 7eda71c0798..b020683bfc6 100644
--- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
@@ -128,7 +128,7 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeCategoryLogger"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeCategoryLogger"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp
index 479d97f16a8..5ec09df2791 100644
--- a/source/gameengine/Ketsji/KX_TimeLogger.cpp
+++ b/source/gameengine/Ketsji/KX_TimeLogger.cpp
@@ -29,10 +29,6 @@
#include "KX_TimeLogger.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements) :
m_maxNumMeasurements(maxNumMeasurements),
m_logStart(0),
diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h
index b17000c98d0..058b1c2b6c7 100644
--- a/source/gameengine/Ketsji/KX_TimeLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeLogger.h
@@ -106,7 +106,7 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeLogger"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeLogger"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index 2b5a7c0f127..eb55d0272f6 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -33,10 +33,6 @@
#include "PHY_IPhysicsEnvironment.h"
#include "PHY_IPhysicsController.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr,
PHY_IPhysicsEnvironment* physEnv)
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h b/source/gameengine/Ketsji/KX_TouchEventManager.h
index 57d2894498a..388195367b9 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.h
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.h
@@ -79,7 +79,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TouchEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TouchEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 20c021480f9..9b44f487682 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -40,10 +40,6 @@
#include <iostream>
#include "PHY_IPhysicsEnvironment.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index baaa9a04f94..ae8d2f6459b 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -44,10 +44,6 @@
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index 4adeefe32b4..4ee80c64570 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -9,10 +9,6 @@
#include "KX_GameObject.h"
#include "KX_MotionState.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_VehicleWrapper::KX_VehicleWrapper(
PHY_IVehicle* vehicle,
PHY_IPhysicsEnvironment* physenv) :
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index e53c698c1c8..09630ad2851 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -28,10 +28,6 @@
#ifndef DISABLE_PYTHON
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "KX_VertexProxy.h"
#include "KX_MeshProxy.h"
#include "RAS_TexVert.h"
@@ -77,247 +73,359 @@ PyMethodDef KX_VertexProxy::Methods[] = {
};
PyAttributeDef KX_VertexProxy::Attributes[] = {
- //KX_PYATTRIBUTE_TODO("DummyProps"),
-
- KX_PYATTRIBUTE_DUMMY("x"),
- KX_PYATTRIBUTE_DUMMY("y"),
- KX_PYATTRIBUTE_DUMMY("z"),
-
- KX_PYATTRIBUTE_DUMMY("r"),
- KX_PYATTRIBUTE_DUMMY("g"),
- KX_PYATTRIBUTE_DUMMY("b"),
- KX_PYATTRIBUTE_DUMMY("a"),
+ KX_PYATTRIBUTE_RW_FUNCTION("x", KX_VertexProxy, pyattr_get_x, pyattr_set_x),
+ KX_PYATTRIBUTE_RW_FUNCTION("y", KX_VertexProxy, pyattr_get_y, pyattr_set_y),
+ KX_PYATTRIBUTE_RW_FUNCTION("z", KX_VertexProxy, pyattr_get_z, pyattr_set_z),
- KX_PYATTRIBUTE_DUMMY("u"),
- KX_PYATTRIBUTE_DUMMY("v"),
+ KX_PYATTRIBUTE_RW_FUNCTION("r", KX_VertexProxy, pyattr_get_r, pyattr_set_r),
+ KX_PYATTRIBUTE_RW_FUNCTION("g", KX_VertexProxy, pyattr_get_g, pyattr_set_g),
+ KX_PYATTRIBUTE_RW_FUNCTION("b", KX_VertexProxy, pyattr_get_b, pyattr_set_b),
+ KX_PYATTRIBUTE_RW_FUNCTION("a", KX_VertexProxy, pyattr_get_a, pyattr_set_a),
- KX_PYATTRIBUTE_DUMMY("u2"),
- KX_PYATTRIBUTE_DUMMY("v2"),
+ KX_PYATTRIBUTE_RW_FUNCTION("u", KX_VertexProxy, pyattr_get_u, pyattr_set_u),
+ KX_PYATTRIBUTE_RW_FUNCTION("v", KX_VertexProxy, pyattr_get_v, pyattr_set_v),
- KX_PYATTRIBUTE_DUMMY("XYZ"),
- KX_PYATTRIBUTE_DUMMY("UV"),
+ KX_PYATTRIBUTE_RW_FUNCTION("u2", KX_VertexProxy, pyattr_get_u2, pyattr_set_u2),
+ KX_PYATTRIBUTE_RW_FUNCTION("v2", KX_VertexProxy, pyattr_get_v2, pyattr_set_v2),
- KX_PYATTRIBUTE_DUMMY("color"),
- KX_PYATTRIBUTE_DUMMY("colour"),
+ KX_PYATTRIBUTE_RW_FUNCTION("XYZ", KX_VertexProxy, pyattr_get_XYZ, pyattr_set_XYZ),
+ KX_PYATTRIBUTE_RW_FUNCTION("UV", KX_VertexProxy, pyattr_get_UV, pyattr_set_UV),
- KX_PYATTRIBUTE_DUMMY("normal"),
+ KX_PYATTRIBUTE_RW_FUNCTION("color", KX_VertexProxy, pyattr_get_color, pyattr_set_color),
+ KX_PYATTRIBUTE_RW_FUNCTION("normal", KX_VertexProxy, pyattr_get_normal, pyattr_set_normal),
{ NULL } //Sentinel
};
-#if 0
-PyObject*
-KX_VertexProxy::py_getattro(PyObject *attr)
-{
- char *attr_str= _PyUnicode_AsString(attr);
- if (attr_str[1]=='\0') { // Group single letters
- // pos
- if (attr_str[0]=='x')
- return PyFloat_FromDouble(m_vertex->getXYZ()[0]);
- if (attr_str[0]=='y')
- return PyFloat_FromDouble(m_vertex->getXYZ()[1]);
- if (attr_str[0]=='z')
- return PyFloat_FromDouble(m_vertex->getXYZ()[2]);
-
- // Col
- if (attr_str[0]=='r')
- return PyFloat_FromDouble(m_vertex->getRGBA()[0]/255.0);
- if (attr_str[0]=='g')
- return PyFloat_FromDouble(m_vertex->getRGBA()[1]/255.0);
- if (attr_str[0]=='b')
- return PyFloat_FromDouble(m_vertex->getRGBA()[2]/255.0);
- if (attr_str[0]=='a')
- return PyFloat_FromDouble(m_vertex->getRGBA()[3]/255.0);
-
- // UV
- if (attr_str[0]=='u')
- return PyFloat_FromDouble(m_vertex->getUV1()[0]);
- if (attr_str[0]=='v')
- return PyFloat_FromDouble(m_vertex->getUV1()[1]);
- }
-
-
- if (!strcmp(attr_str, "XYZ"))
- return PyObjectFrom(MT_Vector3(m_vertex->getXYZ()));
-
- if (!strcmp(attr_str, "UV"))
- return PyObjectFrom(MT_Point2(m_vertex->getUV1()));
-
- if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour"))
- {
- const unsigned char *colp = m_vertex->getRGBA();
- MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
- color /= 255.0;
- return PyObjectFrom(color);
- }
+PyObject* KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]);
+}
- if (!strcmp(attr_str, "normal"))
- {
- return PyObjectFrom(MT_Vector3(m_vertex->getNormal()));
- }
+PyObject* KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]);
+}
- py_getattro_up(CValue);
+PyObject* KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]);
}
-#endif
+PyObject* KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0);
+}
-#if 0
-int KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue)
+PyObject* KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
- char *attr_str= _PyUnicode_AsString(attr);
- if (PySequence_Check(pyvalue))
- {
- if (!strcmp(attr_str, "XYZ"))
- {
- MT_Point3 vec;
- if (PyVecTo(pyvalue, vec))
- {
- m_vertex->SetXYZ(vec);
- m_mesh->SetMeshModified(true);
- return PY_SET_ATTR_SUCCESS;
- }
- return PY_SET_ATTR_FAIL;
- }
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
+}
- if (!strcmp(attr_str, "UV"))
- {
- MT_Point2 vec;
- if (PyVecTo(pyvalue, vec))
- {
- m_vertex->SetUV(vec);
- m_mesh->SetMeshModified(true);
- return PY_SET_ATTR_SUCCESS;
- }
- return PY_SET_ATTR_FAIL;
- }
+PyObject* KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0);
+}
- if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour"))
- {
- MT_Vector4 vec;
- if (PyVecTo(pyvalue, vec))
- {
- m_vertex->SetRGBA(vec);
- m_mesh->SetMeshModified(true);
- return PY_SET_ATTR_SUCCESS;
- }
- return PY_SET_ATTR_FAIL;
- }
+PyObject* KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0);
+}
- if (!strcmp(attr_str, "normal"))
- {
- MT_Vector3 vec;
- if (PyVecTo(pyvalue, vec))
- {
- m_vertex->SetNormal(vec);
- m_mesh->SetMeshModified(true);
- return PY_SET_ATTR_SUCCESS;
- }
- return PY_SET_ATTR_FAIL;
- }
- }
-
- if (PyFloat_Check(pyvalue))
- {
- float val = PyFloat_AsDouble(pyvalue);
- // pos
- MT_Point3 pos(m_vertex->getXYZ());
- if (!strcmp(attr_str, "x"))
+PyObject* KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getUV1()[0]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getUV1()[1]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getUV2()[0]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyFloat_FromDouble(self->m_vertex->getUV2()[1]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ()));
+}
+
+PyObject* KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
+}
+
+PyObject* KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ const unsigned char *colp = self->m_vertex->getRGBA();
+ MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
+ color /= 255.0;
+ return PyObjectFrom(color);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal()));
+}
+
+int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point3 pos(self->m_vertex->getXYZ());
pos.x() = val;
- m_vertex->SetXYZ(pos);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetXYZ(pos);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- if (!strcmp(attr_str, "y"))
+int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point3 pos(self->m_vertex->getXYZ());
pos.y() = val;
- m_vertex->SetXYZ(pos);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetXYZ(pos);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- if (!strcmp(attr_str, "z"))
+int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point3 pos(self->m_vertex->getXYZ());
pos.z() = val;
- m_vertex->SetXYZ(pos);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetXYZ(pos);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- // uv
- MT_Point2 uv = m_vertex->getUV1();
- if (!strcmp(attr_str, "u"))
+int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point2 uv = self->m_vertex->getUV1();
uv[0] = val;
- m_vertex->SetUV(uv);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetUV(uv);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- if (!strcmp(attr_str, "v"))
+int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point2 uv = self->m_vertex->getUV1();
uv[1] = val;
- m_vertex->SetUV(uv);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetUV(uv);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- // uv
- MT_Point2 uv2 = m_vertex->getUV2();
- if (!strcmp(attr_str, "u2"))
+int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point2 uv = self->m_vertex->getUV2();
uv[0] = val;
- m_vertex->SetUV2(uv);
- m_mesh->SetMeshModified(true);
- return 0;
+ self->m_vertex->SetUV2(uv);
+ self->m_mesh->SetMeshModified(true);
+ return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- if (!strcmp(attr_str, "v2"))
+int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ MT_Point2 uv = self->m_vertex->getUV2();
uv[1] = val;
- m_vertex->SetUV2(uv);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetUV2(uv);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
+ return PY_SET_ATTR_FAIL;
+}
- // col
- unsigned int icol = *((const unsigned int *)m_vertex->getRGBA());
- unsigned char *cp = (unsigned char*) &icol;
- val *= 255.0;
- if (!strcmp(attr_str, "r"))
+int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
cp[0] = (unsigned char) val;
- m_vertex->SetRGBA(icol);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetRGBA(icol);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- if (!strcmp(attr_str, "g"))
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
cp[1] = (unsigned char) val;
- m_vertex->SetRGBA(icol);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetRGBA(icol);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- if (!strcmp(attr_str, "b"))
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
cp[2] = (unsigned char) val;
- m_vertex->SetRGBA(icol);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetRGBA(icol);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- if (!strcmp(attr_str, "a"))
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PyFloat_Check(value))
{
+ float val = PyFloat_AsDouble(value);
+ unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
cp[3] = (unsigned char) val;
- m_vertex->SetRGBA(icol);
- m_mesh->SetMeshModified(true);
+ self->m_vertex->SetRGBA(icol);
+ self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- }
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PySequence_Check(value))
+ {
+ MT_Point3 vec;
+ if (PyVecTo(value, vec))
+ {
+ self->m_vertex->SetXYZ(vec);
+ self->m_mesh->SetMeshModified(true);
+ return PY_SET_ATTR_SUCCESS;
+ }
+ }
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PySequence_Check(value))
+ {
+ MT_Point2 vec;
+ if (PyVecTo(value, vec))
+ {
+ self->m_vertex->SetUV(vec);
+ self->m_mesh->SetMeshModified(true);
+ return PY_SET_ATTR_SUCCESS;
+ }
+ }
+ return PY_SET_ATTR_FAIL;
+}
- return CValue::py_setattro(attr, pyvalue);
+int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PySequence_Check(value))
+ {
+ MT_Vector4 vec;
+ if (PyVecTo(value, vec))
+ {
+ self->m_vertex->SetRGBA(vec);
+ self->m_mesh->SetMeshModified(true);
+ return PY_SET_ATTR_SUCCESS;
+ }
+ }
+ return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+ if (PySequence_Check(value))
+ {
+ MT_Vector3 vec;
+ if (PyVecTo(value, vec))
+ {
+ self->m_vertex->SetNormal(vec);
+ self->m_mesh->SetMeshModified(true);
+ return PY_SET_ATTR_SUCCESS;
+ }
+ }
+ return PY_SET_ATTR_FAIL;
}
-#endif
KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
: m_vertex(vertex),
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index 08fe0e7e2f8..b39d3ecb7d4 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -56,6 +56,37 @@ public:
// stuff for python integration
+ static PyObject* pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_x(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_y(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_z(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_u(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_v(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_u2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_v2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_r(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_g(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_b(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_a(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_XYZ(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_UV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_color(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static int pyattr_set_normal(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ);
KX_PYMETHOD_O(KX_VertexProxy,SetXYZ);
KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV);
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
index e5f520acfc5..e2f2badf051 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
@@ -31,10 +31,6 @@
#include "KX_VisibilityActuator.h"
#include "KX_GameObject.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_VisibilityActuator::KX_VisibilityActuator(
SCA_IObject* gameobj,
bool visible,
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.cpp b/source/gameengine/Ketsji/KX_WorldInfo.cpp
index e7b3761e268..bf059ca543c 100644
--- a/source/gameengine/Ketsji/KX_WorldInfo.cpp
+++ b/source/gameengine/Ketsji/KX_WorldInfo.cpp
@@ -28,10 +28,6 @@
#include "KX_WorldInfo.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
KX_WorldInfo::~KX_WorldInfo()
{
}
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h
index 21f8f521ef5..3b3d52f91f7 100644
--- a/source/gameengine/Ketsji/KX_WorldInfo.h
+++ b/source/gameengine/Ketsji/KX_WorldInfo.h
@@ -67,7 +67,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldInfo"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldInfo"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.cpp b/source/gameengine/Ketsji/KX_WorldIpoController.cpp
index f40c4b0253a..476b23a5cbf 100644
--- a/source/gameengine/Ketsji/KX_WorldIpoController.cpp
+++ b/source/gameengine/Ketsji/KX_WorldIpoController.cpp
@@ -30,10 +30,6 @@
#include "KX_ScalarInterpolator.h"
#include "KX_WorldInfo.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(_WIN64)
typedef unsigned __int64 uint_ptr;
#else
@@ -48,7 +44,8 @@ bool KX_WorldIpoController::Update(double currentTime)
for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) {
(*i)->Execute(m_ipotime);//currentTime);
}
-
+
+ /* TODO, this will crash! */
KX_WorldInfo *world = NULL;
if (m_modify_mist_start) {
diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.h b/source/gameengine/Ketsji/KX_WorldIpoController.h
index c89f893458f..f6c36198ae7 100644
--- a/source/gameengine/Ketsji/KX_WorldIpoController.h
+++ b/source/gameengine/Ketsji/KX_WorldIpoController.h
@@ -94,7 +94,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldIpoController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldIpoController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/Ketsji/Makefile b/source/gameengine/Ketsji/Makefile
index 4ecd23fc1a2..79c8626d295 100644
--- a/source/gameengine/Ketsji/Makefile
+++ b/source/gameengine/Ketsji/Makefile
@@ -15,7 +15,7 @@
#
# 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.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
@@ -65,6 +65,10 @@ CPPFLAGS += -I../../blender/imbuf
CPPFLAGS += -I../../blender/gpu
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+ifeq ($(WITH_FFMPEG), true)
+ CPPFLAGS += -DWITH_FFMPEG
+endif
+
###########################
SOURCEDIR = source/gameengine/Ketsji