From 47c2271d673173ee93b9d91926de9ea41415d411 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Aug 2008 08:58:25 +0000 Subject: Python API get/setObject update for Actuators. (SetParent, AddObject, Camera and TrackTo) * bugfix for BGE python api - SetParent actuator getObject would segfault if the object was not set. * Added utility function ConvertPythonToGameObject() that can take a GameObject, string or None and set the game object from this since it was being done in a number of places. * allow setObject(None), since no object is valid for actuators, Python should be able to set this. * added optional argument for getObject() so it returns the KX_GameObject rather then its name, would prefer this be default but it could break existing games. --- source/gameengine/Converter/KX_ConvertActuators.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/gameengine/Converter/KX_ConvertActuators.cpp') diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 53ac730d203..cb2521de9a4 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -540,9 +540,16 @@ void BL_ConvertActuators(char* maggiename, // does the 'original' for replication exists, and // is it in a non-active layer ? SCA_IObject* originalval = NULL; - if (editobact->ob && !(editobact->ob->lay & activeLayerBitInfo)) - originalval = converter->FindGameObject(editobact->ob); - + if (editobact->ob) + { + if (editobact->ob->lay & activeLayerBitInfo) + { + fprintf(stderr, "Warning, object \"%s\" from AddObject actuator \"%s\" is not in a hidden layer.\n", objectname.Ptr(), uniquename.Ptr()); + } + else { + originalval = converter->FindGameObject(editobact->ob); + } + } MT_Vector3 linvelvec ( KX_BLENDERTRUNC(editobact->linVelocity[0]), KX_BLENDERTRUNC(editobact->linVelocity[1]), KX_BLENDERTRUNC(editobact->linVelocity[2])); -- cgit v1.2.3