diff --git a/Engine/source/T3D/Scene.cpp b/Engine/source/T3D/Scene.cpp index 95ff6da17..d8061f32b 100644 --- a/Engine/source/T3D/Scene.cpp +++ b/Engine/source/T3D/Scene.cpp @@ -296,11 +296,28 @@ bool Scene::saveScene(StringTableEntry fileName) //Inform our objects we're saving, so if they do any special stuff //they can do it before the actual write-out - for (U32 i = 0; i < mPermanentObjects.size(); i++) + for (SimGroup::iterator itr = begin(); itr != end(); itr++) + { + SimGroup* sg = dynamic_cast(*itr); + if (sg) + { + ConsoleValue vars[3]; + vars[2].setString(fileName); + sg->callOnChildren("onSaving", 3, vars); + } + + SceneObject* sO = dynamic_cast(*itr); + if (sO) + { + sO->onSaving_callback(fileName); + } + } + + /*for (U32 i = 0; i < mPermanentObjects.size(); i++) { SceneObject* obj = mPermanentObjects[i]; obj->onSaving_callback(fileName); - } + }*/ //Inform our subscenes we're saving so they can do any //special work required as well diff --git a/Engine/source/T3D/SubScene.cpp b/Engine/source/T3D/SubScene.cpp index 2cd64e9a6..5b93c473d 100644 --- a/Engine/source/T3D/SubScene.cpp +++ b/Engine/source/T3D/SubScene.cpp @@ -309,15 +309,23 @@ bool SubScene::save() for (SimGroup::iterator itr = begin(); itr != end(); itr++) { - //Just in case there's a valid callback the scene object would like to invoke for saving - SceneObject* gc = dynamic_cast(*itr); - if (gc) + //Inform our objects we're saving, so if they do any special stuff + //they can do it before the actual write-out + SimGroup* sg = dynamic_cast(*itr); + if (sg) { - gc->onSaving_callback(mLevelAssetId); + ConsoleValue vars[3]; + vars[2].setString(mLevelAssetId); + sg->callOnChildren("onSaving", 3, vars); + } + + SceneObject* scO = dynamic_cast(*itr); + if (scO) + { + scO->onSaving_callback(mLevelAssetId); } SimObject* sO = static_cast(*itr); - if (!sO->save(levelPath)) { Con::errorf("SubScene::save() - error, failed to write object %s to file: %s", sO->getIdString(), levelPath);