Shift tracking of dynamicObjects from strict child objects for Scenes, to tracking the objects but keeping them in the Cleanup Group to fix prefab loading behavior

Shifted to utilizing SimGroupInterator and persistenceManager to fix saving issues with SubScenes
Shifted to utilizing SimGroupIterator for Scene saving to standardize and minimize object misses
Changed prefab load file logic to add loaded child simgroup to rootscene for consistent tracking and avoiding conflicts with subScene's hijacking the ImmediateGroup var
Reduced duplication of build<type>field callback for inspectors
Added more standard field type lookups to inspector group when creating a field to avoid misses for types like 'F32' or similar.
Folded the added-on MinSize/MaxSize/SimgroupSelect fields for SimGroup editing into a single compound field and fixed bugs with it's behavior so it works as expected now
This commit is contained in:
JeffR 2024-10-27 20:04:13 -05:00
parent 484ece3d28
commit 10d1aeca1f
9 changed files with 221 additions and 128 deletions

View file

@ -148,20 +148,32 @@ void Scene::removeObject(SimObject* object)
Parent::removeObject(object);
}
void Scene::addDynamicObject(SceneObject* object)
void Scene::addDynamicObject(SimObject* object)
{
mDynamicObjects.push_back(object);
SimGroup* cleanupGroup;
if(Sim::findObject("MissionCleanup", cleanupGroup))
{
cleanupGroup->addObject(object);
}
//Do it like regular, though we should probably bail if we're trying to add non-scene objects to the scene?
Parent::addObject(object);
//Parent::addObject(object);
}
void Scene::removeDynamicObject(SceneObject* object)
void Scene::removeDynamicObject(SimObject* object)
{
mDynamicObjects.remove(object);
SimGroup* cleanupGroup;
if (Sim::findObject("MissionCleanup", cleanupGroup))
{
cleanupGroup->removeObject(object);
}
//Do it like regular, though we should probably bail if we're trying to add non-scene objects to the scene?
Parent::removeObject(object);
//Parent::removeObject(object);
}
void Scene::interpolateTick(F32 delta)
@ -242,7 +254,7 @@ void Scene::dumpUtilizedAssets()
Con::printf("Dumping utilized assets in scene!");
Vector<StringTableEntry> utilizedAssetsList;
for (U32 i = 0; i < mPermanentObjects.size(); i++)
/*for (U32 i = 0; i < mPermanentObjects.size(); i++)
{
mPermanentObjects[i]->getUtilizedAssets(&utilizedAssetsList);
}
@ -250,7 +262,7 @@ void Scene::dumpUtilizedAssets()
for (U32 i = 0; i < mDynamicObjects.size(); i++)
{
mDynamicObjects[i]->getUtilizedAssets(&utilizedAssetsList);
}
}*/
for (U32 i = 0; i < utilizedAssetsList.size(); i++)
{
@ -294,31 +306,16 @@ bool Scene::saveScene(StringTableEntry fileName)
fileName = getOriginatingFile();
}
//Inform our objects we're saving, so if they do any special stuff
//they can do it before the actual write-out
for (SimGroup::iterator itr = begin(); itr != end(); itr++)
for (SimGroupIterator itr(this); *itr; ++itr)
{
SimGroup* sg = dynamic_cast<SimGroup*>(*itr);
if (sg)
if((*itr)->isMethod("onSaving"))
{
ConsoleValue vars[3];
vars[2].setString(fileName);
sg->callOnChildren("onSaving", 3, vars);
}
SceneObject* sO = dynamic_cast<SceneObject*>(*itr);
if (sO)
{
sO->onSaving_callback(fileName);
Con::execute((*itr), 3, vars);
}
}
/*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
for (U32 i = 0; i < mSubScenes.size(); i++)