Page MenuHome

perspective_matrix not update in real time with bpy.ops.view3d.zoom
Closed, ResolvedPublic

Description

Hi,
the result of this script is not correct, the perspective_matrix isn't update, only after when it is finished.

import bpy

class SimpleOperator(bpy.types.Operator):
'''Tooltip'''
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"


def execute(self, context):
print(context.space_data.region_3d.perspective_matrix)
bpy.ops.view3d.zoom(delta = 1)
print(context.space_data.region_3d.perspective_matrix)

return {'FINISHED'}


def register():
bpy.utils.register_class(SimpleOperator)


def unregister():
bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
register()

Details

Type
Bug

Event Timeline

Sorry for the double post.
I think it is important because perspective_matrix is used in bpy_extras.view3d_utils.region_2d_to_location_3d and more

committed fix/workaround r44647

RegionView3D.update call, to address issue in report:
[#30454] perspective_matrix not update in real time with bpy.ops.view3d.zoom

This is so you can modifify the view settings and get the view matrix after without waiting for a redraw.