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

Function RegisterComponentType

engine/gameobject/src/gameobject/gameobject.cpp:689–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687 };
688
689 Result RegisterComponentType(HRegister regist, const ComponentType& type)
690 {
691 if (regist->m_ComponentTypeCount == MAX_COMPONENT_TYPES)
692 return RESULT_OUT_OF_RESOURCES;
693
694 if (FindComponentType(regist, type.m_ResourceType, 0x0) != 0)
695 return RESULT_ALREADY_REGISTERED;
696
697 if ((type.m_UpdateFunction != 0x0
698 || type.m_FixedUpdateFunction != 0x0
699 || type.m_LateUpdateFunction != 0x0) && type.m_AddToUpdateFunction == 0x0) {
700 dmLogWarning("Registering an Update/FixedUpdate/LateUpdate function for '%s' requires the registration of an AddToUpdate function.", type.m_Name);
701 return RESULT_INVALID_OPERATION;
702 }
703
704 regist->m_ComponentTypes[regist->m_ComponentTypeCount] = type;
705 regist->m_ComponentTypes[regist->m_ComponentTypeCount].m_NameHash = dmHashString64(type.m_Name);
706 regist->m_ComponentTypesOrder[regist->m_ComponentTypeCount] = regist->m_ComponentTypeCount;
707 regist->m_ComponentTypeCount++;
708 return RESULT_OK;
709 }
710
711 Result SetUpdateOrderPrio(HRegister regist, HResourceType resource_type, uint16_t prio)
712 {

Callers 12

SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85

Calls 1

FindComponentTypeFunction · 0.85

Tested by 11

SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68