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

Method write

Engine/source/gui/core/guiControl.cpp:1822–1868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1820//-----------------------------------------------------------------------------
1821
1822void GuiControl::write(Stream &stream, U32 tabStop, U32 flags)
1823{
1824 //note: this will return false if either we, or any of our parents, are non-save controls
1825 bool bCanSave = ( flags & IgnoreCanSave ) || ( flags & NoCheckParentCanSave && getCanSave() ) || getCanSaveParent();
1826
1827 if (bCanSave && mAddGroup)
1828 {
1829 StringTableEntry steName = mAddGroup->getInternalName();
1830
1831 if ((steName != NULL) && (steName != StringTable->insert("null")) && getName())
1832 {
1833 MutexHandle handle;
1834 handle.lock(mMutex);
1835
1836 // export selected only?
1837 if ((flags & SelectedOnly) && !isSelected())
1838 {
1839 for (U32 i = 0; i < size(); i++)
1840 (*this)[i]->write(stream, tabStop, flags);
1841
1842 return;
1843
1844 }
1845
1846 stream.writeTabs(tabStop);
1847 char buffer[1024];
1848 dSprintf(buffer, sizeof(buffer), "new %s(%s,%s) {\r\n", getClassName(), getName() ? getName() : "", mAddGroup->getInternalName());
1849 stream.write(dStrlen(buffer), buffer);
1850 writeFields(stream, tabStop + 1);
1851
1852 if (size())
1853 {
1854 stream.write(2, "\r\n");
1855 for (U32 i = 0; i < size(); i++)
1856 (*this)[i]->write(stream, tabStop + 1, flags);
1857 }
1858
1859 stream.writeTabs(tabStop);
1860 stream.write(4, "};\r\n");
1861
1862 return;
1863 }
1864 }
1865
1866 if (bCanSave)
1867 Parent::write( stream, tabStop, flags );
1868}
1869
1870//=============================================================================
1871// Hierarchies.

Callers 1

saveSelectionMethod · 0.45

Calls 10

isSelectedFunction · 0.85
dSprintfFunction · 0.85
getInternalNameMethod · 0.80
writeTabsMethod · 0.80
getNameFunction · 0.50
sizeFunction · 0.50
dStrlenFunction · 0.50
writeFunction · 0.50
insertMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected