XnStatus xnConfigureProperty(XnNodeHandle hNode, const TiXmlElement* pOpcode) { XnStatus nRetVal = XN_STATUS_OK; const XnChar* strName; nRetVal = xnXmlReadStringAttribute(pOpcode, "name", &strName); XN_IS_STATUS_OK(nRetVal); const XnChar* strType; nRetVal = xnXmlReadStringAttribute(pOpcode, "type", &strType); XN_IS_STATUS_OK(nRetVal); if (strcmp(strType, "int") == 0) { XnInt nValue; nRetVal = xnXmlReadIntAttribute(pOpcode, "value", &nValue); XN_IS_STATUS_OK(nRetVal); nRetVal = xnSetIntProperty(hNode, strName, nValue); if (nRetVal != XN_STATUS_OK) { xnLogError(XN_MASK_OPEN_NI, "Failed to set property '%s' from xml: %s", strName, xnGetStatusString(nRetVal)); return nRetVal; } } else if (strcmp(strType, "real") == 0) { XnDouble dValue; nRetVal = xnXmlReadRealAttribute(pOpcode, "value", &dValue); XN_IS_STATUS_OK(nRetVal); nRetVal = xnSetRealProperty(hNode, strName, dValue); if (nRetVal != XN_STATUS_OK) { xnLogError(XN_MASK_OPEN_NI, "Failed to set property '%s' from xml: %s", strName, xnGetStatusString(nRetVal)); return nRetVal; } } else if (strcmp(strType, "string") == 0) { const XnChar* strValue; nRetVal = xnXmlReadStringAttribute(pOpcode, "value", &strValue); XN_IS_STATUS_OK(nRetVal); nRetVal = xnSetStringProperty(hNode, strName, strValue); if (nRetVal != XN_STATUS_OK) { xnLogError(XN_MASK_OPEN_NI, "Failed to set property '%s' from xml: %s", strName, xnGetStatusString(nRetVal)); return nRetVal; } } else { XN_LOG_ERROR_RETURN(XN_STATUS_CORRUPT_FILE, XN_MASK_OPEN_NI, "Invalid property type: %s", strType); } return (XN_STATUS_OK); }
XnStatus PlayerImpl::SetNodeRealProp(const XnChar* strNodeName, const XnChar* strPropName, XnDouble dValue) { XnStatus nRetVal = XN_STATUS_OK; PlayedNodeInfo playedNode; nRetVal = m_playedNodes.Get(strNodeName, playedNode); XN_IS_STATUS_OK(nRetVal); nRetVal = xnLockedNodeStartChanges(playedNode.hNode, playedNode.hLock); XN_IS_STATUS_OK(nRetVal); nRetVal = xnSetRealProperty(playedNode.hNode, strPropName, dValue); if (nRetVal != XN_STATUS_OK) { xnLockedNodeEndChanges(playedNode.hNode, playedNode.hLock); return (nRetVal); } nRetVal = xnLockedNodeEndChanges(playedNode.hNode, playedNode.hLock); XN_IS_STATUS_OK(nRetVal); return XN_STATUS_OK; }
XnStatus MockNotifier::OnNodeRealPropChangedImpl(void* pCookie, const XnChar* strNodeName, const XnChar* strPropName, XnDouble dValue) { return xnSetRealProperty((XnNodeHandle)pCookie, strPropName, dValue); }