Python, blender and weird rotate behaviour after restoring matrix I am trying to save user matrix and set it back later when needed
But after restoring the matrix the rotate function is behaving weird
As if it is 4D instead of 3D. And t seemt the wrong view.
What i did was open a default file and zoomed in. took these matrix values and placed them in VM. After restoring the view looks different.
I tried to search for similar posts but could not find any answer
Code i use is,
EDIT THE CODE ADDED
this is the code
import bpy
from mathutils import matrix

vm = ((0.9077774286270142, -0.4194521903991699, -6.8628960292471675e-09, 1.434309720993042),
        (0.3097465932369232, 0.6703528165817261, 0.6743027567863464, 0.9151758551597595),
        (-0.28283774852752686, -0.6121168732643127, 0.738455057144165, -0.902187168598175),
        (0.0, 0.0, 0.0, 1.0))


for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        v3d = area.spaces[0].region_3d   
        if v3d :
            v3d.view_matrix = vm
            v3d.view_perspective = 'ORTHO'

Before running script

After running script.

What am I missing here?
In order to use the Matrix class you can either use import mathutils and mathutils.Matrix() to initialize an instance or from mathutils import Matrix and then Matrix().

import bpy
import mathutils


view_matrix = mathutils.Matrix(([0.9077774286270142, -0.4194521903991699, -6.8628960292471675e-09, 1.434309720993042],
                                [0.3097465932369232, 0.6703528165817261, 0.6743027567863464, 0.9151758551597595],
                                [-0.28283774852752686, -0.6121168732643127, 0.738455057144165, -0.902187168598175],
                                [0.0, 0.0, 0.0, 1.0])) 


for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                v3d = space.region_3d   
                v3d.view_matrix = view_matrix
                v3d.view_perspective = 'ORTHO'
                break