Wish: Ability to enter a numerical value for the Dolly zoom

While using the _DollyZoom command, Rhino will not accept entering a numerical value in the Command line. In my opinion, it should work that way in order to allow the user set an exact value in a convenient way. :slight_smile:

Hi Bobi - viewport properties allows this - will that work for you?

Also `_-ViewportProperties _Lens 20 _EnterEnd’

-Pascal

2 Likes

Hi Pascal, I’m aware that the Properties panel consists a setting for this, but the main issue is that it will reset the distance to the object right after entering a new value there. On the other hand, the Dolly zoom preserves the distance to the object and only changes the field of view in a cinematic fashion. :slight_smile: This is what I like a lot, because it will not destroy the other camera settings. This is especially important in architectural and automotive projects where the intent is to be able to see more of the objects inside the building or the car, while keeping the distance intact.

I agree. Also, UndoView should work on DollyZoom.

1 Like

i thought i could offer a nice workarround - but it does not function:
show the camera and edit the control points of the camera in a second viewport.
so my wish:

allow dollyzoom behaviour with camera-control point editing !

(gumball, select single cvs, scale, scaleNu, scale 1d… don t work)

or does anybody find out how to do this ?

Along with the request to allow a numerical value to be entered in the Command like to precisely control the Dolly zoom. What about an alternative way to control it, by snapping the Dolly zoom value by holding down the Shift key while dragging with the mouse? That way, the Dolly zoom could be set to snap to full numbers in increments of 1. For example: 56, 57, 58, 59, 60, 61, 62, 63 etc…

Currently if your cursor is close to the viewport edge then DollyZooming, the lens values snap to 5 increments (you can see the cursor change to magnifier with 5 in it). Perhaps it would not be too hard to make it Shift-sensitive and have “1” increment. The other problem is the Viewport Properties (Lens) don’t update “live” while zooming, only after it’s done, so with “1” it would be hard to tell precisely.

1 Like

DollyZoom does not preserve the distance to the object. It preserves the size (relative to the viewport size) of objects on the target plane while simultaneously changing the lens focal length and the camera position.

The DollyZoom command moves the camera location and changes the lens length at the same time, keeping the objects at the target plane about the same size.

DollyZoom is effective in Perspective viewports only.

DollyZoom requires the simultaneous changing of both the lens length and the camera to target distance, not only changing the lens length.

Wow, this is something new to me. I have never used to place the mouse cursor near the end of the viewport while dragging for “Dolly zoom”. However, those increments by 5 are way too big and will not allow a precise change of the focal length. They are nice to quickly change the focal length, though. Increments by 1 while holding the Shift key would do a great job where precise camera control is required.

By the way, there is a small bug with “Dolly zoom”. When I drag and change the focal length, the tiny icon next to the mouse pointer that shows the value remains visible even after the completion of the command. :slight_smile:

Agree, this is a well “hidden” view navigation feature. Maybe @mikko can chime in if a more precise whole number increment would be possible to implement and how (Shift, or some other mod key)
This could apply both to Zoom and DollyZoom that currently work with “5” increments.

1 Like

That would be great for both commands! :slight_smile:

There is this in rhinocommon but no idea how it work

Rhino.Display.RhinoViewport.KeyboardDolly(self: RhinoViewport, leftRight: bool, amount: float)

-runscript (
sub NumberDollyZoom

Dim strView, oldLength, newLength, k, arrPts, CamPt,TarPt
strView = Rhino.CurrentView
If Rhino.IsViewPerspective(strView) Then
oldLength = Rhino.ViewCameraLens(strView)
newLength = Rhino.GetInteger("Enter new camera lens", oldLength, 5)
If Not IsNull(newLength) Then
k = newLength / oldLength
arrPts = Rhino.ViewCameraTarget (strView)
CamPt = arrPts(0)
TarPt = arrPts(1)
CamPt=Rhino.PointSubtract(CamPt,TarPt)
CamPt=Rhino.PointScale(CamPt,k) 
CamPt=Rhino.PointAdd(CamPt,TarPt)
Rhino.EnableRedraw False
Rhino.ViewCameraTarget strView ,CamPt ,TarPt
Rhino.ViewCameraLens strView , newLength
Rhino.EnableRedraw True
End If
Else
Rhino.Print("Current viewport is not perspective")
End If

End sub
NumberDollyZoom
4 Likes

That script is great. Is there a way to make two alternatives to it to automatically switch to a specific number, such like 35 and 60? :slight_smile:

Not sure how difficult it would be to implement, but a GUI like this temporarily shown while the Dolly zoom is active would make sense. Dragging in the middle portion of the screen is a free Dolly zoom, while dragging inside the side segments separated by vertical lines uses increments by 1 and 5.

Also, the current implementation of the incremental steps by 5 is a bit difficult to use, because each increment changes after a very small number of pixels. That forces the user to be extra precise and use slow mouse movements. I would increase the required pixels at least twice, in order to allow a more relieved control.

Replace this line
newLength = Rhino.GetInteg…
with a static number like
newLength = 35

1 Like

Thanks again! It works as expected. I assigned it to a new icon with the LMB set to 60 and the RMB set to 35.

Dolly zoom 32x32

-runscript (
sub NumberDollyZoom

Dim strView, oldLength, newLength, k, arrPts, CamPt,TarPt
strView = Rhino.CurrentView
If Rhino.IsViewPerspective(strView) Then
oldLength = Rhino.ViewCameraLens(strView)
newLength = 60
If Not IsNull(newLength) Then
k = newLength / oldLength
arrPts = Rhino.ViewCameraTarget (strView)
CamPt = arrPts(0)
TarPt = arrPts(1)
CamPt=Rhino.PointSubtract(CamPt,TarPt)
CamPt=Rhino.PointScale(CamPt,k) 
CamPt=Rhino.PointAdd(CamPt,TarPt)
Rhino.EnableRedraw False
Rhino.ViewCameraTarget strView ,CamPt ,TarPt
Rhino.ViewCameraLens strView , newLength
Rhino.EnableRedraw True
End If
Else
Rhino.Print("Current viewport is not perspective")
End If

End sub
NumberDollyZoom

This is RHP file based on the script of @maje90

Command: DollyZoomSlider

UPDATE

image

DollyZoomSlider.rhp (11.5 KB)

6 Likes

For some reason it does not work with my Rhino 7 SR21 (7.21.22193.9001, 2022-07-12). :upside_down_face:

Try to compile it:
(If you don’t already know the steps )

  • Tools >> Script compiler
  • Open (O): dollyzoomslider.rhc
  • Build (B)

dollyzoomslider.zip (530 Bytes)