mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Tweaks the Scene and SubScene save calls to handle simGroups to call onto their children
This commit is contained in:
parent
6ff92f61bb
commit
a931e9a308
2 changed files with 32 additions and 7 deletions
|
|
@ -296,11 +296,28 @@ bool Scene::saveScene(StringTableEntry fileName)
|
||||||
|
|
||||||
//Inform our objects we're saving, so if they do any special stuff
|
//Inform our objects we're saving, so if they do any special stuff
|
||||||
//they can do it before the actual write-out
|
//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<SimGroup*>(*itr);
|
||||||
|
if (sg)
|
||||||
|
{
|
||||||
|
ConsoleValue vars[3];
|
||||||
|
vars[2].setString(fileName);
|
||||||
|
sg->callOnChildren("onSaving", 3, vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneObject* sO = dynamic_cast<SceneObject*>(*itr);
|
||||||
|
if (sO)
|
||||||
|
{
|
||||||
|
sO->onSaving_callback(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (U32 i = 0; i < mPermanentObjects.size(); i++)
|
||||||
{
|
{
|
||||||
SceneObject* obj = mPermanentObjects[i];
|
SceneObject* obj = mPermanentObjects[i];
|
||||||
obj->onSaving_callback(fileName);
|
obj->onSaving_callback(fileName);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Inform our subscenes we're saving so they can do any
|
//Inform our subscenes we're saving so they can do any
|
||||||
//special work required as well
|
//special work required as well
|
||||||
|
|
|
||||||
|
|
@ -309,15 +309,23 @@ bool SubScene::save()
|
||||||
|
|
||||||
for (SimGroup::iterator itr = begin(); itr != end(); itr++)
|
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
|
//Inform our objects we're saving, so if they do any special stuff
|
||||||
SceneObject* gc = dynamic_cast<SceneObject*>(*itr);
|
//they can do it before the actual write-out
|
||||||
if (gc)
|
SimGroup* sg = dynamic_cast<SimGroup*>(*itr);
|
||||||
|
if (sg)
|
||||||
{
|
{
|
||||||
gc->onSaving_callback(mLevelAssetId);
|
ConsoleValue vars[3];
|
||||||
|
vars[2].setString(mLevelAssetId);
|
||||||
|
sg->callOnChildren("onSaving", 3, vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneObject* scO = dynamic_cast<SceneObject*>(*itr);
|
||||||
|
if (scO)
|
||||||
|
{
|
||||||
|
scO->onSaving_callback(mLevelAssetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimObject* sO = static_cast<SimObject*>(*itr);
|
SimObject* sO = static_cast<SimObject*>(*itr);
|
||||||
|
|
||||||
if (!sO->save(levelPath))
|
if (!sO->save(levelPath))
|
||||||
{
|
{
|
||||||
Con::errorf("SubScene::save() - error, failed to write object %s to file: %s", sO->getIdString(), levelPath);
|
Con::errorf("SubScene::save() - error, failed to write object %s to file: %s", sO->getIdString(), levelPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue