mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
* Update levelAsset creation so it can be flagged to be creating a subScene preemptively, improving workflow when creating a SubScene level asset 'in place' via the inspector.
* Fixed issue of creating new SubScene using the full level template instead of a blank level file * Fixed subScene inspector field handling so clicking the create new will mark the 'in place' created level asset as a subscene appropriately * Changed up persistenceManager logic when parsing objects out - especially with specialty fields - to use Strings instead of const char* to simplify memory juggling and improve stability * Rolled back specialty array field outputs for decal roads and convex shapes to have the field names in the output again * Added sanity check for MeshRoad's when writing out via specialty array field to ensure there are profile nodes before trying to write any * Added sanity check to avoid pointlessly writing out meshroad and river position field into subScene file as it could cause a transform double-up and cause them to move when loading from a subscene
This commit is contained in:
parent
f71f4e051f
commit
0d338f2d51
10 changed files with 124 additions and 84 deletions
|
|
@ -3,6 +3,8 @@
|
|||
#include "gameMode.h"
|
||||
#include "console/persistenceManager.h"
|
||||
#include "console/script.h"
|
||||
#include "environment/meshRoad.h"
|
||||
#include "environment/river.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
#include "renderInstance/renderPassManager.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
|
|
@ -29,7 +31,8 @@ SubScene::SubScene() :
|
|||
mFreezeLoading(false),
|
||||
mTickPeriodMS(1000),
|
||||
mCurrTick(0),
|
||||
mGlobalLayer(false)
|
||||
mGlobalLayer(false),
|
||||
mSaving(false)
|
||||
{
|
||||
mNetFlags.set(Ghostable | ScopeAlways);
|
||||
|
||||
|
|
@ -65,6 +68,7 @@ void SubScene::initPersistFields()
|
|||
addGroup("SubScene");
|
||||
addField("isGlobalLayer", TypeBool, Offset(mGlobalLayer, SubScene), "");
|
||||
INITPERSISTFIELD_LEVELASSET(Level, SubScene, "The level asset to load.");
|
||||
addField("tickPeriodMS", TypeS32, Offset(mTickPeriodMS, SubScene), "evaluation rate (ms)");
|
||||
addField("gameModes", TypeGameModeList, Offset(mGameModesNames, SubScene), "The game modes that this subscene is associated with.");
|
||||
endGroup("SubScene");
|
||||
|
||||
|
|
@ -263,6 +267,9 @@ void SubScene::_onFileChanged(const Torque::Path& path)
|
|||
if(mLevelAsset.isNull() || Torque::Path(mLevelAsset->getLevelPath()) != path)
|
||||
return;
|
||||
|
||||
if (mSaving)
|
||||
return;
|
||||
|
||||
AssertFatal(path == mLevelAsset->getLevelPath(), "Prefab::_onFileChanged - path does not match filename.");
|
||||
|
||||
_closeFile(false);
|
||||
|
|
@ -336,6 +343,9 @@ void SubScene::load()
|
|||
if (mFreezeLoading)
|
||||
return;
|
||||
|
||||
if (mSaving)
|
||||
return;
|
||||
|
||||
_loadFile(true);
|
||||
mLoaded = true;
|
||||
|
||||
|
|
@ -362,6 +372,9 @@ void SubScene::unload()
|
|||
if (mFreezeLoading)
|
||||
return;
|
||||
|
||||
if (mSaving)
|
||||
return;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
mStartUnloadTimerMS = Sim::getCurrentTime();
|
||||
|
|
@ -421,10 +434,15 @@ bool SubScene::save()
|
|||
if (mLevelAsset.isNull())
|
||||
return false;
|
||||
|
||||
if (mSaving)
|
||||
return false;
|
||||
|
||||
//If we're flagged for unload, push back the unload timer so we can't accidentally trip be saving partway through an unload
|
||||
if (mStartUnloadTimerMS != -1)
|
||||
mStartUnloadTimerMS = Sim::getCurrentTime();
|
||||
|
||||
mSaving = true;
|
||||
|
||||
PersistenceManager prMger;
|
||||
|
||||
StringTableEntry levelPath = mLevelAsset->getLevelPath();
|
||||
|
|
@ -449,6 +467,11 @@ bool SubScene::save()
|
|||
prMger.setDirty((*itr), levelPath);
|
||||
}
|
||||
}
|
||||
|
||||
if(dynamic_cast<MeshRoad*>(childObj) || dynamic_cast<River*>(childObj))
|
||||
{
|
||||
prMger.addRemoveField(childObj, "position");
|
||||
}
|
||||
}
|
||||
|
||||
prMger.saveDirty();
|
||||
|
|
@ -466,6 +489,8 @@ bool SubScene::save()
|
|||
//Finally, save
|
||||
saveSuccess = mLevelAsset->saveAsset();
|
||||
|
||||
mSaving = false;
|
||||
|
||||
return saveSuccess;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue