Control Rotation

Hi, I’m creating a movement system for a spaceship… the pawn yaw and pitch rotation is controlled by the mouse inputs and I add an axis input (Q and E keys) that allow the player to perform a roll. The roll amount is determined by how long the player hold down the keys… Doing it, the player could, for example, perform a roll of 45, 90 or 180 degrees… the problem is that I’d want invert the mouse controls when the ship is rotated then more than 90 degrees to control the pitch rotation with the Mouse X input and the yaw rotation with the Mouse Y input… Is important to say that the Spring Arm Rotation Type is set to “Absolute Rotation”. I attach some screenshot of my blueprint to better understand. There is a way to do this? Thanks!
233532-233533-233534-