public override Vector2 Process(Vector2 value, InputControl control) { if (control == null) { throw new System.ArgumentNullException(nameof(control)); } // Don't convert to EditorWindowSpace if input is going to game view. if (InputEditorUserSettings.lockInputToGameView || (EditorApplication.isPlaying && Application.isFocused)) { return(value); } if (Mouse.s_PlatformMouseDevice != null) { var command = QueryEditorWindowCoordinatesCommand.Create(value); // Not all pointer devices implement the editor window position IOCTL, // so we try the global mouse device if available. if (Mouse.s_PlatformMouseDevice.ExecuteCommand(ref command) > 0) { return(command.inOutCoordinates); } } return(value); }
public override Vector2 Process(Vector2 value, InputControl control) { if (control == null) { throw new System.ArgumentNullException(nameof(control)); } // We go and fire trigger QueryEditorWindowCoordinatesCommand regardless // of whether we are currently in EditorWindow code or not. The expectation // here is that the underlying editor code is in a better position than us // to judge whether the conversion should be performed or not. In native code, // the IOCTL implementations will early out if they detect that the current // EditorWindow is in fact a game view. if (Mouse.s_PlatformMouseDevice != null) { var command = QueryEditorWindowCoordinatesCommand.Create(value); // Not all pointer devices implement the editor window position IOCTL, // so we try the global mouse device if available. if (Mouse.s_PlatformMouseDevice.ExecuteCommand(ref command) > 0) { return(command.inOutCoordinates); } } return(value); }
public Vector2 Process(Vector2 position, InputControl control) { // Don't convert to EditorWindowSpace if input is going to game view. if (InputEditorUserSettings.lockInputToGameView || (EditorApplication.isPlaying && Application.isFocused)) { return(position); } var command = QueryEditorWindowCoordinatesCommand.Create(position); if (control.device.ExecuteCommand(ref command) > 0) { return(command.inOutCoordinates); } return(position); }
public override Vector2 Process(Vector2 value, InputControl <Vector2> control) { if (control == null) { throw new System.ArgumentNullException(nameof(control)); } // Don't convert to EditorWindowSpace if input is going to game view. if (InputEditorUserSettings.lockInputToGameView || (EditorApplication.isPlaying && Application.isFocused)) { return(value); } var command = QueryEditorWindowCoordinatesCommand.Create(value); if (control.device.ExecuteCommand(ref command) > 0) { return(command.inOutCoordinates); } return(value); }
public override Vector2 Process(Vector2 value, InputControl <Vector2> control) { if (control == null) { throw new System.ArgumentNullException(nameof(control)); } // Don't convert to EditorWindowSpace if input is going to game view. if (InputEditorUserSettings.lockInputToGameView || (EditorApplication.isPlaying && Application.isFocused)) { return(value); } var command = QueryEditorWindowCoordinatesCommand.Create(value); ////TODO: don't issue this on the device itself but rather on the system mouse; this way //// it's not necessary for all pointer devices to implement the IOCTL separately if (control.device.ExecuteCommand(ref command) > 0) { return(command.inOutCoordinates); } return(value); }