MCPcopy Create free account
hub / github.com/defold/defold / InitCollection

Function InitCollection

engine/gameobject/src/gameobject/gameobject.cpp:1855–1884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1853 }
1854
1855 static bool InitCollection(Collection* collection)
1856 {
1857 DM_PROFILE("Init");
1858 assert(collection->m_InUpdate == 0 && "Initializing instances during Update(.) is not permitted");
1859
1860 // Update transform cache
1861 UpdateTransforms(collection);
1862
1863 bool result = true;
1864 // Update scripts
1865 uint32_t count = collection->m_InstanceIndices.Size();
1866 for (uint32_t i = 0; i < count; ++i) {
1867 Instance* instance = collection->m_Instances[i];
1868 if (!InitInstance(collection, instance)) {
1869 result = false;
1870 }
1871 }
1872 for (uint32_t i = 0; i < count; ++i) {
1873 Instance* instance = collection->m_Instances[i];
1874 if (!DoAddToUpdate(collection, instance)) {
1875 result = false;
1876 }
1877 }
1878 dmMessage::HSocket sockets[] = {collection->m_ComponentSocket, collection->m_FrameSocket};
1879 if (!DispatchMessages(collection, sockets, 2))
1880 result = false;
1881
1882 collection->m_Initialized = 1;
1883 return result;
1884 }
1885
1886 bool Init(HCollection hcollection)
1887 {

Callers 1

InitFunction · 0.85

Calls 6

InitInstanceFunction · 0.85
DoAddToUpdateFunction · 0.85
DispatchMessagesFunction · 0.85
UpdateTransformsFunction · 0.70
assertFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected