BGE: Fix T46338 replace mesh from an other scene.
authorPorteries Tristan <republicthunderbolt9@gmail.com>
Thu, 29 Oct 2015 11:05:06 +0000 (12:05 +0100)
committerPorteries Tristan <republicthunderbolt9@gmail.com>
Thu, 29 Oct 2015 11:14:40 +0000 (12:14 +0100)
To make consistent with KX_GameObject.replaceMesh, we don't allow this behavior but print an error message for the replace mesh actuator.
e.g : Warning: object "Cube" from ReplaceMesh actuator "Edit Object" uses a mesh not owned by an object in scene "scene1"

Reviewers: youle.

source/gameengine/Converter/KX_ConvertActuators.cpp

index 3347255f6f668fef2c10987b3fc53b4a653cb825..12bfb11032bb3dbdd9d1d3d39552df487cebbad0 100644 (file)
@@ -505,6 +505,13 @@ void BL_ConvertActuators(const char* maggiename,
                                        {
                                                RAS_MeshObject *tmpmesh = converter->FindGameMesh(editobact->me);
 
+                                               if (!tmpmesh) {
+                                                       std::cout << "Warning: object \"" << objectname <<
+                                                       "\" from ReplaceMesh actuator \"" << uniquename <<
+                                                       "\" uses a mesh not owned by an object in scene \"" <<
+                                                       scene->GetName() << "\"." << std::endl;
+                                               }
+
                                                KX_SCA_ReplaceMeshActuator* tmpreplaceact = new KX_SCA_ReplaceMeshActuator(
                                                            gameobj,
                                                            tmpmesh,