Why fail?

Hi everyone. Copy and paste this code in blender text editor. Run the script…

Can anyone explain to me why this fails with

“AttributeError: ‘RegionView3D’ object has no attribute ‘view_rotation’” ? :mad:

This stopped working in one of the recent builds, but I’ve been unable to find a solution

import bpy

for s in bpy.context.window.screen.areas:
                if s.type=="VIEW_3D":
                    print('VIEW_3D was found')
                    break

#arbitrary values for rotation
viewRot = tuple((0.8001033067703247, -0.46193987131118774, -0.19134169816970825, -0.3314135670661926))

spaceIndex = -1    

for sr in s.spaces:    
    spaceIndex += 1
    if sr.type == 'VIEW_3D':                
        break
        
s.spaces[spaceIndex].region_3d.view_rotation = viewRot

I would really appreciate help on this…

Best regards

view_rotation was renamed view_rotate_method.
Not sure why, view_rotation seems better to me…

@ Ecrivian. Thanks that worked great. I must say, I also prefer the old name. The new one doesn’t sound … …well

I’ve updated the script to work with the renamed method. It can be found here

http://tinyurl.com/35zfzzh