4
$\begingroup$

I'd like to extract the user view orientation of the current 3DView. Since I didn't find a direct command to get it, my approach would be to take its matrix using bpy.context.region_data.view_matrix.transposed() and somehow convert it to a Euler rotation (ignoring its location), but I don't know how to do it.

Note that I'm not talking about a camera object but the user view.

$\endgroup$
  • 4
    $\begingroup$ Converting a matrix to euler is as simple as mat.to_euler(). Assuming your matrix is in the space you want, that should do the trick. $\endgroup$ – HENDRIX Jan 6 '18 at 15:04
  • $\begingroup$ Wow that was so much simpler than I expected. Tank you $\endgroup$ – ChameleonScales Jan 6 '18 at 16:16
1
$\begingroup$

bpy.context.region_data.view_matrix.transposed().to_euler()

Tanks HENDRIX, that was pretty simple

$\endgroup$
  • 2
    $\begingroup$ Just pasting a line, is not really helpful. $\endgroup$ – brockmann Jan 6 '18 at 17:15
  • 3
    $\begingroup$ @brockmann If more information is needed, then tell them what kind of additional information you expect. $\endgroup$ – Ray Mairlot Jan 6 '18 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.