public void Update(WSceneView view) { m_View = view; UpdateSelectionGizmo(view); // Add our gizmo to the renderer this frame. if (TransformGizmo != null) { ((IRenderable)TransformGizmo).AddToRenderer(view); } // If we have a gizmo and we're transforming it, don't check for selection change. if (TransformGizmo != null && TransformGizmo.IsTransforming) { return; } if (WInput.GetMouseButtonDown(0) && !WInput.GetMouseButton(1) && !m_bOverrideSceneCamera) { FRay mouseRay = view.ProjectScreenToWorld(WInput.MousePosition); BindingVector3 addedVec = Raycast(mouseRay, view.ViewCamera); // Check the behaviour of this click to determine appropriate selection modification behaviour. // Click w/o Modifiers = Clear Selection, add result to selection // Click /w Ctrl = Toggle Selection State // Click /w Shift = Add to Selection bool ctrlPressed = WInput.GetKey(Key.LeftCtrl) || WInput.GetKey(Key.RightCtrl); bool shiftPressed = WInput.GetKey(Key.LeftShift) || WInput.GetKey(Key.RightShift); // Replace the previous selection with the current selection, if it's valid. if (!ctrlPressed & !shiftPressed) { EditorSelection.ClearSelection(); if (addedVec != null) { EditorSelection.AddToSelection(addedVec); } } else if (addedVec != null && (ctrlPressed && !shiftPressed)) { if (EditorSelection.SelectedObjects.Contains(addedVec)) { EditorSelection.RemoveFromSelection(addedVec); } else { EditorSelection.AddToSelection(addedVec); } } else if (addedVec != null && shiftPressed) { if (!EditorSelection.SelectedObjects.Contains(addedVec)) { EditorSelection.AddToSelection(addedVec); } } } if (m_CopyCameraRequest != null) { m_CopyCameraRequest.RequestingCut.CopySettingsFromCamera(view.ViewCamera, m_CopyCameraRequest.IsStart); m_CopyCameraRequest = null; } if (WInput.GetMouseButton(1) && m_bOverrideSceneCamera) { RestoreSceneCamera(view); } UpdateGizmoTransform(); }
private void OnRequestCopyCameraFromViewport(object sender, CopyCameraFromViewportEventArgs e) { m_CopyCameraRequest = e; }