void URealSenseTask::EnableGestureDetection(bool enableAll, bool enable, FString singleGesture) { if (!collector->IsValid()){ UE_LOG(RealSensePluginLog, Warning, TEXT("RealSense unavailable.")); return; } PXCHandConfiguration* config = collector->handConfig; //Null check, hand has to be enabled before we can enable gestures if (config == NULL) return; //enable gestures config->LoadGesturePack(L"navigation"); //single gesture enabling example if (!singleGesture.IsEmpty()){ if (enable) { config->EnableGesture(*singleGesture); GesturesEnabled = true; } else { config->DisableGesture(*singleGesture); } } else{ //enable all gestures if (enableAll) { config->EnableAllGestures(); UE_LOG(RealSensePluginLog, Log, TEXT("Gestures enabled")); } else { config->DisableAllGestures(); UE_LOG(RealSensePluginLog, Log, TEXT("Gestures disabled")); } GesturesEnabled = enableAll; } config->ApplyChanges(); config->Update(); }
void GesturePipeline::enableGestureDetectedRule(bool enabled, bool continuousTracking) { // Hand Module Configuration PXCHandConfiguration* config = _pxcHandModule->CreateActiveConfiguration(); if (enabled) config->EnableAllGestures(true); else config->DisableAllGestures(); config->ApplyChanges(); config->Update(); config->Release(); _gestureDetectedRule->enabled = enabled; _gestureDetectedRule->_continuousTracking = continuousTracking; }