diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-23 12:41:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-23 12:41:53 +0400 |
commit | 4ced91da47ec1e95d71beef07b218fd0290ff68a (patch) | |
tree | 5f96c6268e194dd4cabcbe33efdc2fd226652cab /source/gameengine | |
parent | 87a34772003413bd402ea380ce5d8d7c3f3a6337 (diff) | |
parent | ac498a6b64ea2f034aa0177894fb25d0401e327b (diff) |
svn merge ^/trunk/blender -r42778:42839
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_IPO_SGController.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PyMath.h | 49 |
4 files changed, 51 insertions, 15 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 821cb746b65..30d7c153748 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -3032,4 +3032,4 @@ void BL_ConvertBlenderObjects(struct Main* maggie, SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code) { return gReverseKeyTranslateTable[key_code]; -}
\ No newline at end of file +} diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f9403c9725a..f249510ecc7 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -789,6 +789,10 @@ void GPG_Application::stopEngine() void GPG_Application::exitEngine() { + // We only want to kill the engine if it has been initialized + if (!m_engineInitialized) + return; + sound_exit(); if (m_ketsjiengine) { diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 70bb2dbb5a2..728d0fb8561 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -145,7 +145,8 @@ bool KX_IpoSGController::Update(double currentTime) } //modifies position? - if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] || m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z]) + if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] || + m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z]) { if (m_ipo_as_force == true) { @@ -198,7 +199,9 @@ bool KX_IpoSGController::Update(double currentTime) } } //modifies orientation? - if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] || m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z]) { + if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] || + m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z]) + { if (m_ipo_as_force) { if (m_game_object && ob) { @@ -293,7 +296,9 @@ bool KX_IpoSGController::Update(double currentTime) } } //modifies scale? - if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] || m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z]) { + if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] || + m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z]) + { //default is no scale change MT_Vector3 newScale(1.0,1.0,1.0); if (!m_ipo_add) diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index b9ff3759452..392a6633067 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -65,32 +65,59 @@ bool PyMatTo(PyObject* pymat, T& mat) { bool noerror = true; mat.setIdentity(); + + +#ifdef USE_MATHUTILS + + if (MatrixObject_Check(pymat)) + { + MatrixObject *pymatrix = (MatrixObject *)pymat; + + if (BaseMath_ReadCallback(pymatrix) == -1) + return false; + + if (pymatrix->num_col != Size(mat) || pymatrix->num_row != Size(mat)) + return false; + + for (unsigned int row = 0; row < Size(mat); row++) + { + for (unsigned int col = 0; col < Size(mat); col++) + { + mat[row][col] = *(pymatrix->matrix + col * pymatrix->num_row + row); + } + } + } + else + +#endif /* USE_MATHUTILS */ + + if (PySequence_Check(pymat)) { - unsigned int cols = PySequence_Size(pymat); - if (cols != Size(mat)) + unsigned int rows = PySequence_Size(pymat); + if (rows != Size(mat)) return false; - for (unsigned int x = 0; noerror && x < cols; x++) + for (unsigned int row = 0; noerror && row < rows; row++) { - PyObject *pycol = PySequence_GetItem(pymat, x); /* new ref */ - if (!PyErr_Occurred() && PySequence_Check(pycol)) + PyObject *pyrow = PySequence_GetItem(pymat, row); /* new ref */ + if (!PyErr_Occurred() && PySequence_Check(pyrow)) { - unsigned int rows = PySequence_Size(pycol); - if (rows != Size(mat)) + unsigned int cols = PySequence_Size(pyrow); + if (cols != Size(mat)) noerror = false; else { - for( unsigned int y = 0; y < rows; y++) + for( unsigned int col = 0; col < cols; col++) { - PyObject *item = PySequence_GetItem(pycol, y); /* new ref */ - mat[y][x] = PyFloat_AsDouble(item); + PyObject *item = PySequence_GetItem(pyrow, col); /* new ref */ + mat[row][col] = PyFloat_AsDouble(item); Py_DECREF(item); } } } else noerror = false; - Py_DECREF(pycol); + Py_DECREF(pyrow); } } else noerror = false; |