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

Method removeObjectFromFile

Engine/source/console/persistenceManager.cpp:2069–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2067}
2068
2069void PersistenceManager::removeObjectFromFile(SimObject* object, const char* fileName)
2070{
2071 if (mCurrentFile)
2072 {
2073 Con::errorf("PersistenceManager::removeObjectFromFile(): Can't remove an object from a \
2074 file while another is currently opened");
2075
2076 return;
2077 }
2078
2079 const char* file = object->getFilename();
2080 if (fileName)
2081 {
2082 char buffer[1024];
2083 Con::expandScriptFilename( buffer, 1024, fileName );
2084
2085 file = StringTable->insert(buffer);
2086 }
2087
2088 bool success = false;
2089
2090 if ( file && file[ 0 ] )
2091 success = parseFile(file);
2092
2093 if (!success)
2094 {
2095 const char *name = object->getName();
2096
2097 String errorNameStr;
2098 if ( name )
2099 errorNameStr = String::ToString( "%s %s (%d)", object->getClassName(), name, object->getId() );
2100 else
2101 errorNameStr = String::ToString( "%s (%d)", object->getClassName(), object->getId() );
2102
2103 if ( !file )
2104 Con::errorf("PersistenceManager::removeObjectFromFile(): File was null trying to save %s", errorNameStr.c_str() );
2105 else
2106 Con::errorf("PersistenceManager::removeObjectFromFile(): Unable to open %s to save %s", file, errorNameStr.c_str() );
2107
2108 // Reset everything
2109 clearAll();
2110
2111 return;
2112 }
2113
2114 ParsedObject* parsedObject = findParsedObject(object);
2115
2116 if (!parsedObject)
2117 {
2118 const char *name = object->getName();
2119 if (name)
2120 {
2121 Con::errorf("PersistenceManager::removeObjectFromFile(): Unable to find %s %s (%d) in %s",
2122 object->getClassName(), name, object->getId(), file);
2123 }
2124 else
2125 {
2126 Con::errorf("PersistenceManager::removeObjectFromFile(): Unable to find %s (%d) in %s",

Callers 15

ForestEditorGuiFunction · 0.80
DecalEditorGuiFunction · 0.80
decalEditorGui.csFile · 0.80
ActionDeleteEmitterFunction · 0.80
ActionDeleteParticleFunction · 0.80
datablockEditor.csFile · 0.80
ActionChangeMaterialFunction · 0.80
ActionDeleteMaterialFunction · 0.80

Calls 10

errorfFunction · 0.85
expandScriptFilenameFunction · 0.85
getFilenameMethod · 0.45
insertMethod · 0.45
getNameMethod · 0.45
getClassNameMethod · 0.45
getIdMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected