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

Function FinalComponents

engine/gameobject/src/gameobject/gameobject.cpp:1891–1924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889 }
1890
1891 static bool FinalComponents(Collection* collection, HInstance instance)
1892 {
1893 uint32_t next_component_instance_data = 0;
1894 Prototype* prototype = instance->m_Prototype;
1895 for (uint32_t i = 0; i < prototype->m_ComponentCount; ++i)
1896 {
1897 Prototype::Component* component = &prototype->m_Components[i];
1898 ComponentType* component_type = component->m_Type;
1899 assert(component_type);
1900
1901 uintptr_t* component_instance_data = 0;
1902 if (component_type->m_InstanceHasUserData)
1903 {
1904 component_instance_data = &instance->m_ComponentInstanceUserData[next_component_instance_data++];
1905 }
1906 assert(next_component_instance_data <= instance->m_ComponentInstanceUserDataCount);
1907
1908 if (component_type->m_FinalFunction)
1909 {
1910 ComponentFinalParams params;
1911 params.m_Collection = collection->m_HCollection;
1912 params.m_Instance = instance;
1913 params.m_World = collection->m_ComponentWorlds[component->m_TypeIndex];
1914 params.m_Context = component_type->m_Context;
1915 params.m_UserData = component_instance_data;
1916 CreateResult result = component_type->m_FinalFunction(params);
1917 if (result != CREATE_RESULT_OK)
1918 {
1919 return false;
1920 }
1921 }
1922 }
1923 return true;
1924 }
1925
1926 static bool FinalInstance(Collection* collection, HInstance instance)
1927 {

Callers 2

FinalInstanceFunction · 0.85
RecreateInstanceFunction · 0.85

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected