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

Function CompModelOnMessage

engine/gamesys/src/gamesys/components/comp_model.cpp:2821–2851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2819 }
2820
2821 dmGameObject::UpdateResult CompModelOnMessage(const dmGameObject::ComponentOnMessageParams& params)
2822 {
2823 ModelWorld* world = (ModelWorld*)params.m_World;
2824 ModelComponent* component = world->m_Components.Get(*params.m_UserData);
2825 if (params.m_Message->m_Id == dmGameObjectDDF::Enable::m_DDFDescriptor->m_NameHash)
2826 {
2827 component->m_Enabled = 1;
2828 dmRig::SetEnabled(component->m_RigInstance, true);
2829 }
2830 else if (params.m_Message->m_Id == dmGameObjectDDF::Disable::m_DDFDescriptor->m_NameHash)
2831 {
2832 component->m_Enabled = 0;
2833 dmRig::SetEnabled(component->m_RigInstance, false);
2834 }
2835 else if (params.m_Message->m_Descriptor != 0x0)
2836 {
2837 if (params.m_Message->m_Id == dmModelDDF::ModelCancelAnimation::m_DDFDescriptor->m_NameHash)
2838 {
2839 dmRig::CancelAnimation(component->m_RigInstance);
2840 }
2841 else if (params.m_Message->m_Id == dmGameSystemDDF::ResetConstant::m_DDFDescriptor->m_NameHash)
2842 {
2843 dmGameSystemDDF::ResetConstant* ddf = (dmGameSystemDDF::ResetConstant*)params.m_Message->m_Data;
2844 if (component->m_RenderConstants && dmGameSystem::ClearRenderConstant(component->m_RenderConstants, ddf->m_NameHash))
2845 {
2846 component->m_ReHash = 1;
2847 }
2848 }
2849 }
2850 return dmGameObject::UPDATE_RESULT_OK;
2851 }
2852
2853 static bool OnResourceReloaded(ModelWorld* world, ModelComponent* component, int index)
2854 {

Callers

nothing calls this directly

Calls 4

ClearRenderConstantFunction · 0.85
SetEnabledFunction · 0.50
CancelAnimationFunction · 0.50
GetMethod · 0.45

Tested by

no test coverage detected