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

Method updateObject

Engine/source/console/persistenceManager.cpp:1331–1708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

getFormattedDataFunction · 0.85
dStricmpFunction · 0.85
collapseScriptFilenameFunction · 0.85
dSprintfFunction · 0.85
getCopySourceMethod · 0.80
getFieldDictionaryMethod · 0.80
getDataFieldMethod · 0.80
setOriginalNameMethod · 0.80
lastMethod · 0.80
dAtoiFunction · 0.70
dFreeFunction · 0.50
dStrcmpFunction · 0.50

Tested by

no test coverage detected