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

Method findParsedObject

Engine/source/console/persistenceManager.cpp:835–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833}
834
835PersistenceManager::ParsedObject* PersistenceManager::findParsedObject(SimObject* object, ParsedObject* parentObject)
836{
837 if (!object)
838 return NULL;
839
840 // See if our object belongs to a parent
841 if (!parentObject)
842 parentObject = findParentObject(object, parentObject);
843
844 // First let's compare the object to the SimObject's that
845 // we matched to our ParsedObject's when we loaded them
846 for (U32 i = 0; i < mObjectBuffer.size(); i++)
847 {
848 ParsedObject* testObj = mObjectBuffer[i];
849
850 if (testObj->simObject == object)
851 {
852 // Deal with children objects
853 if (testObj->parentObject != parentObject)
854 continue;
855
856 return testObj;
857 }
858 }
859
860 // Didn't find it in our ParsedObject's SimObject's
861 // so see if we can find one that corresponds to the
862 // same name and className
863 const char *originalName = object->getOriginalName();
864
865 // Find the corresponding ParsedObject
866 if (originalName && originalName[0])
867 {
868 for (U32 i = 0; i < mObjectBuffer.size(); i++)
869 {
870 ParsedObject* testObj = mObjectBuffer[i];
871
872 if (testObj->name == originalName)
873 {
874 // Deal with children objects
875 if (testObj->parentObject != parentObject)
876 continue;
877
878 return testObj;
879 }
880 }
881 }
882
883 //Check internal names
884 if (object->getInternalName())
885 {
886 for (U32 i = 0; i < mObjectBuffer.size(); i++)
887 {
888 ParsedObject* testObj = mObjectBuffer[i];
889 for (U32 j = 0; j < testObj->properties.size(); j++)
890 {
891 const ParsedProperty &prop = testObj->properties[j];
892

Callers

nothing calls this directly

Calls 4

compareFunction · 0.85
getOriginalNameMethod · 0.80
getInternalNameMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected