MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / xnConfigureCreateNodes

Function xnConfigureCreateNodes

Source/OpenNI/XnXmlScriptNode.cpp:672–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672XnStatus xnConfigureCreateNodes(XnContext* pContext, const TiXmlElement* pRootElem, XnNodeInfoList* pCreatedNodes, XnEnumerationErrors* pErrors)
673{
674 XnStatus nRetVal = XN_STATUS_OK;
675
676 const TiXmlElement* pProudctionNodes = pRootElem->FirstChildElement("ProductionNodes");
677 if (pProudctionNodes == NULL)
678 {
679 return (XN_STATUS_OK);
680 }
681
682 // global mirror
683 const TiXmlElement* pGlobalMirror = pProudctionNodes->FirstChildElement("GlobalMirror");
684 if (pGlobalMirror != NULL)
685 {
686 XnBool bOn;
687 nRetVal = xnXmlReadBoolAttribute(pGlobalMirror, "on", &bOn);
688 XN_IS_STATUS_OK(nRetVal);
689
690 nRetVal = xnSetGlobalMirror(pContext, bOn);
691 XN_IS_STATUS_OK(nRetVal);
692 }
693
694 // file recordings
695 const TiXmlElement* pRecording = pProudctionNodes->FirstChildElement("Recording");
696 if (pRecording != NULL)
697 {
698 const XnChar* strFileName;
699 nRetVal = xnXmlReadStringAttribute(pRecording, "file", &strFileName);
700 XN_IS_STATUS_OK(nRetVal);
701
702 xnLogVerbose(XN_MASK_OPEN_NI, "Opening file recording '%s'...", strFileName);
703
704 XnNodeHandle hPlayer;
705 nRetVal = xnContextOpenFileRecordingEx(pContext, strFileName, &hPlayer);
706 XN_IS_STATUS_OK(nRetVal);
707
708 nRetVal = xnNodeInfoListAddNode(pCreatedNodes, hPlayer->pNodeInfo);
709 if (nRetVal != XN_STATUS_OK)
710 {
711 xnProductionNodeRelease(hPlayer);
712 return (nRetVal);
713 }
714
715 XnDouble dSpeed = 1.0;
716 if (NULL != pRecording->Attribute("playbackSpeed", &dSpeed))
717 {
718 nRetVal = xnSetPlaybackSpeed(hPlayer, dSpeed);
719 XN_IS_STATUS_OK(nRetVal);
720 }
721
722 const XnChar* REPEAT = "repeat";
723 if (NULL != pRecording->Attribute(REPEAT))
724 {
725 XnBool bRepeat;
726 nRetVal = xnXmlReadBoolAttribute(pRecording, REPEAT, &bRepeat);
727 XN_IS_STATUS_OK(nRetVal);
728
729 nRetVal = xnSetPlayerRepeat(hPlayer, bRepeat);

Callers 1

RunXmlScriptImplFunction · 0.85

Calls 15

xnXmlReadBoolAttributeFunction · 0.85
xnSetGlobalMirrorFunction · 0.85
xnXmlReadStringAttributeFunction · 0.85
xnNodeInfoListAddNodeFunction · 0.85
xnProductionNodeReleaseFunction · 0.85
xnSetPlaybackSpeedFunction · 0.85
xnSetPlayerRepeatFunction · 0.85
xnNodeQueryAllocateFunction · 0.85
xnXmlReadQueryFunction · 0.85

Tested by

no test coverage detected