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$
2
  • 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
    Commented Jan 6, 2018 at 15:04
  • $\begingroup$ Wow that was so much simpler than I expected. Tank you $\endgroup$ Commented Jan 6, 2018 at 16:16

1 Answer 1

1
$\begingroup$

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

Tanks HENDRIX, that was pretty simple

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .