MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateObject

Method updateObject

Engine/source/console/persistenceManager.cpp:1321–1714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319}
1320
1321void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObject)
1322{
1323 // Create a default object of the same type
1324 ConsoleObject *defaultConObject = ConsoleObject::create(object->getClassName());
1325 SimObject* defaultObject = dynamic_cast<SimObject*>(defaultConObject);
1326
1327 // ***Really*** shouldn't happen
1328 if (!defaultObject)
1329 return;
1330
1331 Vector<const char*> newLines;
1332
1333 ParsedObject* parsedObject = findParsedObject(object, parentObject);
1334
1335 // If we don't already have an association between the ParsedObject
1336 // and the SimObject then go ahead and create it
1337 if (parsedObject && parsedObject->simObject.isNull())
1338 parsedObject->simObject = object;
1339
1340 // Kill all fields on the remove list.
1341
1342 for( U32 i = 0; i < mRemoveFields.size(); ++ i )
1343 {
1344 RemoveField& field = mRemoveFields[ i ];
1345 if( field.object != object )
1346 continue;
1347
1348 S32 propertyIndex = getPropertyIndex( parsedObject, field.fieldName, field.arrayPos );
1349 if( propertyIndex != -1 )
1350 removeField( parsedObject->properties[ propertyIndex ] );
1351 }
1352
1353 // Get our field list
1354 const AbstractClassRep::FieldList &list = object->getFieldList();
1355
1356 for(U32 i = 0; i < list.size(); i++)
1357 {
1358 const AbstractClassRep::Field* f = &list[i];
1359
1360 // Skip the special field types.
1361 if ( f->type >= AbstractClassRep::ARCFirstCustomField )
1362 continue;
1363
1364 for(U32 j = 0; S32(j) < f->elementCount; j++)
1365 {
1366 const char* value = getFieldValue(object, f->pFieldname, j);
1367
1368 // Make sure we got a value
1369 if (!value)
1370 continue;
1371
1372 // Let's see if this field is already in the file
1373 S32 propertyIndex = getPropertyIndex(parsedObject, f->pFieldname, j);
1374
1375 if (propertyIndex > -1)
1376 {
1377 ParsedProperty& prop = parsedObject->properties[propertyIndex];
1378

Callers

nothing calls this directly

Calls 15

getFormattedDataFunction · 0.85
dStricmpFunction · 0.85
collapseScriptFilenameFunction · 0.85
expandEscapeFunction · 0.85
compareFunction · 0.85
dAtoiFunction · 0.85
dSprintfFunction · 0.85
getCopySourceMethod · 0.80
getFieldDictionaryMethod · 0.80
getDataFieldMethod · 0.80
setOriginalNameMethod · 0.80
dFreeFunction · 0.50

Tested by

no test coverage detected