Zoom Window Tool [REQUEST]
-
Is there a way to replace SU's native Zoom Window Tool with a new graphic which is a crosshair so that the starting corner of the tool can be accurately placed?
OR
Could a script create a tool identical to the functioning of the native SU Zoom Window Tool which uses a cross hair graphic?
-
Entirely possible - I have the code already to make the selection with cross-hairs. Just need help calculating where to move the camera. Ideas, anyone?
-
Make a class
Rect
inside your tool class (which is instantiated with the picked rectangle.)
Have instance methods return it's height and center (in screen pixels.)Save a ref to the current camera eye:
cam = view.camera eye = cam.eye
Calculate a new target as the center of the pick rectangle:
target = view.inputpoint(*rect.center).position
Calulate the new up vector from the directional vector
dir_vec = eye.vector_to(target) up = ? # use trig ?
Set the camera:
view.camera.set( eye, target, up )
Set the zoom factor, by:
dividing theview.vpheight
by the pickrect's height to get the zoom factor to pass as the argument toview.zoom( view.vpheight / rect.height )
-
Here is the non-working tool which needs the
do_zoom()
method filled in.
Advertisement