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

Function OutputJsonSceneGraph

engine/engine/src/engine_service.cpp:783–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781 }
782
783 static void OutputJsonSceneGraph(dmGameObject::SceneNode* node, dmWebServer::Request* request, int indent)
784 {
785 SendIndent(request, indent);
786 SendText(request, "{\n");
787
788 bool first_property = true;
789 dmGameObject::SceneNodePropertyIterator pit = TraverseIterateProperties(node);
790 while(dmGameObject::TraverseIteratePropertiesNext(&pit))
791 {
792 if (!first_property)
793 SendText(request, ",\n");
794 first_property = false;
795
796 OutputJsonProperty( &pit.m_Property, request, indent+1 );
797 }
798
799 if (!first_property)
800 SendText(request, ",\n");
801
802 SendIndent(request, indent+1);
803 SendText(request, "\"children\": [");
804
805 bool first_object = true;
806 dmGameObject::SceneNodeIterator it = dmGameObject::TraverseIterateChildren(node);
807 while(dmGameObject::TraverseIterateNext(&it))
808 {
809 if (!first_object)
810 SendText(request, ",\n");
811 else
812 SendText(request, "\n");
813 first_object = false;
814
815 OutputJsonSceneGraph( &it.m_Node, request, indent+1 );
816 }
817 SendText(request, "]\n");
818
819 SendIndent(request, indent);
820 SendText(request, "}");
821 }
822
823 static void HttpSceneGraphRequestCallback(void* context, dmWebServer::Request* request)
824 {

Callers 1

Calls 7

SendIndentFunction · 0.85
SendTextFunction · 0.85
OutputJsonPropertyFunction · 0.85
TraverseIterateChildrenFunction · 0.85
TraverseIterateNextFunction · 0.85

Tested by

no test coverage detected