Page MenuHome

view3d.viewnumpad operator should not animate
Closed, ResolvedPublic

Description

--- Operating System, Graphics card ---
Linux

--- Blender version with error, and version that worked ---
2.68a; never worked

--- Short description of error ---
The bpy.ops.view3d.viewnumpad() operator calls view3d_smooth_view, which appears
to do an animated change to the view using a timer. The change doesn't appear to have
any effect until a script calling this operator exits.
This is a problem if the view needs to be changed to affect later view-dependent
script operations (e.g., knifeproject).

--- Steps for others to reproduce the error (preferably based on attached .blend file) ---
Run script in attached .blend. The change to ortho and front view takes place after
the script exits (because the knife_project call works on the earlier view).

Perhaps the viewnumpad() python operator should call a non-animating view change?
If you don't want to do this, can you suggest a workaround? Being able to set the
view up for things like knife_project could help in writing some automated tests.
(A workaround is to manually set the view and save it in a .blend, I suppose.)


Event Timeline

Perhaps operator invoke should do the animation but exec should not?

We could support this, but for this to work for other operators it would mean adding invoke functions to all the view navigation functions that use smooth-view.

For scripts its normally better not to use viewport operators and just manipulate then durectly, accessing their view matrix for example.

OK, I can work around by setting the region_3d's view_matrix, as suggested. So you can close this either as a won't-fix or a won't-fix-todo, as you see fit.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Sep 16 2013, 6:05 AM