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; }
bool FPhATEdPreviewViewportClient::InputKey(FViewport* InViewport, int32 ControllerId, FKey Key, EInputEvent Event, float AmountDepressed, bool Gamepad) { int32 HitX = InViewport->GetMouseX(); int32 HitY = InViewport->GetMouseY(); bool bCtrlDown = InViewport->KeyState(EKeys::LeftControl) || InViewport->KeyState(EKeys::RightControl); bool bShiftDown = InViewport->KeyState(EKeys::LeftShift) || InViewport->KeyState(EKeys::RightShift); bool bHandled = false; if (SharedData->bRunningSimulation) { if (Key == EKeys::RightMouseButton || Key == EKeys::LeftMouseButton) { if (Event == IE_Pressed) { if (bShiftDown) { bHandled = true; SimMousePress(InViewport, false, Key); bAllowedToMoveCamera = false; } else if (bCtrlDown) { bHandled = true; SimMousePress(InViewport, true, Key); bAllowedToMoveCamera = false; } } else if (Event == IE_Released) { bHandled = true; SimMouseRelease(); bAllowedToMoveCamera = true; } UpdateAndApplyCursorVisibility(); } else if (Key == EKeys::MouseScrollUp) { bHandled = true; SimMouseWheelUp(); } else if (Key == EKeys::MouseScrollDown) { bHandled = true; SimMouseWheelDown(); } else if(IsFlightCameraActive()) { // If the flight camera is active (user is looking or moving around the scene) // consume the event so hotkeys don't fire. bHandled = true; } } if( !bHandled ) { bHandled = FEditorViewportClient::InputKey( InViewport, ControllerId, Key, Event, AmountDepressed, Gamepad ); } if( bHandled ) { Invalidate(); } return bHandled; }