I'm super new to Blender and working on a script for Blender. My question is how to rotate scene via python script, just like using middle mouse?

Thank you.

  • $\begingroup$ Would look at MMB more akin to orbiting our focus point in the scene. (see view matrix). Think of the scene as the basis of global coordinates. $\endgroup$ – batFINGER Aug 19 '18 at 13:11

Thanks to batFINGER I've found the answer

import bpy
from mathutils import Euler

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        area.spaces.active.region_3d.view_rotation.rotate(Euler((0, 0, 0.01)))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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