bool FCascadeEdPreviewViewportClient::InputKey(FViewport* Viewport, int32 ControllerId, FKey Key, EInputEvent Event, float AmountDepressed, bool Gamepad) { //Update cursor UpdateAndApplyCursorVisibility(); bool bHandled = false; const int32 HitX = Viewport->GetMouseX(); const int32 HitY = Viewport->GetMouseY(); if(Key == EKeys::LeftMouseButton) { if (Event == IE_Pressed) { Viewport->InvalidateHitProxy(); HHitProxy* HitResult = Viewport->GetHitProxy(HitX,HitY); if (HitResult && HitResult->IsA(HWidgetUtilProxy::StaticGetType())) { HWidgetUtilProxy* WidgetProxy = (HWidgetUtilProxy*)HitResult; if (WidgetProxy->Info1 == VectorFieldHitproxyInfo) { bManipulatingVectorField = true; } WidgetAxis = WidgetProxy->Axis; // Calculate the scree-space directions for this drag. FSceneViewFamilyContext ViewFamily( FSceneViewFamily::ConstructionValues( Viewport, GetScene(), EngineShowFlags )); FSceneView* View = CalcSceneView(&ViewFamily); WidgetProxy->CalcVectors(View, FViewportClick(View, this, Key, Event, HitX, HitY), LocalManipulateDir, WorldManipulateDir, DragX, DragY); bHandled = true; } } else if (Event == IE_Released) { if (bManipulatingVectorField) { WidgetAxis = EAxisList::None; bManipulatingVectorField = false; bHandled = true; } } } else if (Key == EKeys::SpaceBar && Event == IE_Pressed) { if (CascadePtr.Pin()->GetSelectedModule() && CascadePtr.Pin()->GetSelectedModule()->IsA(UParticleModuleVectorFieldLocal::StaticClass())) { bHandled = true; WidgetMM = (EWidgetMovementMode)((WidgetMM+1) % WMM_MAX); } } if( !bHandled ) { bHandled = FEditorViewportClient::InputKey(Viewport,ControllerId,Key,Event,AmountDepressed,Gamepad); } return bHandled; }
void FPhATEdPreviewViewportClient::TrackingStarted( const struct FInputEventState& InInputState, bool bIsDraggingWidget, bool bNudge ) { // If releasing the mouse button, check we are done manipulating if ( bIsDraggingWidget ) { FSceneViewFamilyContext ViewFamily( FSceneViewFamily::ConstructionValues( Viewport, GetScene(), EngineShowFlags )); FSceneView* View = CalcSceneView(&ViewFamily); const int32 HitX = InInputState.GetViewport()->GetMouseX(); const int32 HitY = InInputState.GetViewport()->GetMouseY(); StartManipulating(Widget->GetCurrentAxis(), FViewportClick(View, this, InInputState.GetKey(), InInputState.GetInputEvent(), HitX, HitY), View->ViewMatrices.ViewMatrix); // If we are manipulating, don't move the camera as we drag now. if (SharedData->bManipulating) { bAllowedToMoveCamera = false; } } }