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

Function OutputResourceSceneGraph

engine/engine/src/engine_service.cpp:639–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637 }
638
639 static void OutputResourceSceneGraph(dmGameObject::SceneNode* node, uint32_t parent, uint32_t* counter, dmWebServer::Request* request)
640 {
641 static const dmhash_t s_PropertyId = dmHashString64("id");
642 static const dmhash_t s_PropertyResource = dmHashString64("resource");
643 static const dmhash_t s_PropertyType = dmHashString64("type");
644
645 if (node->m_Type == dmGameObject::SCENE_NODE_TYPE_SUBCOMPONENT)
646 return;
647
648 dmhash_t id = 0;
649 dmhash_t resource_id = 0;
650 dmhash_t type = 0;
651 dmGameObject::SceneNodePropertyIterator pit = TraverseIterateProperties(node);
652 while(dmGameObject::TraverseIteratePropertiesNext(&pit))
653 {
654 if (pit.m_Property.m_NameHash == s_PropertyId)
655 id = pit.m_Property.m_Value.m_Hash;
656 else if (pit.m_Property.m_NameHash == s_PropertyResource)
657 resource_id = pit.m_Property.m_Value.m_Hash;
658 else if (pit.m_Property.m_NameHash == s_PropertyType)
659 type = pit.m_Property.m_Value.m_Hash;
660 }
661
662 uint32_t index = (*counter)++;
663
664 SendGameObjectData(request, id, resource_id, type, index, parent);
665
666 dmGameObject::SceneNodeIterator it = dmGameObject::TraverseIterateChildren(node);
667 while(dmGameObject::TraverseIterateNext(&it))
668 {
669 OutputResourceSceneGraph( &it.m_Node, index, counter, request );
670 }
671 }
672
673 static void HttpGameObjectRequestCallback(void* context, dmWebServer::Request* request)
674 {

Callers 1

Calls 5

SendGameObjectDataFunction · 0.85
TraverseIterateChildrenFunction · 0.85
TraverseIterateNextFunction · 0.85

Tested by

no test coverage detected