Toggle Zoom/FoV

Next
 From:  Moi3dFan
11306.1 
Greetings!

Sometimes it is necessary to precisely aim at an object, but when all snapping is enabled and there are many objects on the scene it is difficult to do it.

For myself I solved this problem with the help of points, I set them in advance and then with a combination of keys enable binding only to the points. After I've placed everything on the points, I press the same keyboard shortcut again, and my past snapping is enabled again.

I know about 100 other ways to move an object or draw a curve accurately, but I've come up with 101 ways:
At any given moment, when I press a button (Let's say X) the camera in my viewport instantly halves the FOV (from 27.5 => 13.75). Thus allowing me to position the object more accurately. And after all the necessary actions, I release the key and the FOV is back to what it was before. It's basically like aiming in games, press -> aim/shoot -> release.

Question, is it possible to implement in MoI3d script execution on holding hotkey and script execution on releasing hotkey? It would be very convenient!

And if not, is it possible to implement script execution on repeated pressing of the same key?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11306.2 In reply to 11306.1 
Hi Moi3dFan,

re:
> Question, is it possible to implement in MoI3d script execution on holding hotkey and script
> execution on releasing hotkey? It would be very convenient!

Not as a regular shortcut key, but when a dialog has focus it is possible for script on the dialog box to get keydown and keyup events when the dialog has keyboard focus.

There's an example of that in ShortcutKeyDialog.htm,


> And if not, is it possible to implement script execution on repeated pressing of the same key?

I'm not entirely sure if I've understood this question properly but yes if you hold down a key and there is a shortcut key assigned to it, the key will repeat while you have it held down.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Moi3dFan
11306.3 In reply to 11306.2 
The active window solution doesn't work for me. You need an interactive solution to do it quickly.
I have attached a GD video where I clearly show how I want the script to do it. That is, without any windows you can quickly reduce the FOV and then quickly return it back.

https://drive.google.com/file/d/1r1UDO2dwU1083vV03Z1zPNPq9_MoEQWE/view?usp=sharing
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11306.4 In reply to 11306.3 
Hi Moi3d fan, something like this on a shortcut key maybe? :

script: var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); if ( Math.abs(vp.fieldOfViewAngle - 27.5) < 0.01 ) { vp.fieldOfViewAngle = 7; } else { vp.fieldOfViewAngle = 27.5; }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Moi3dFan
11306.5 In reply to 11306.4 
Yes! That's what it's all about. Thank you!

And can the camera focus on the cursor position?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
11306.6 In reply to 11306.5 
Hi Moi3dFan,

re:
> And can the camera focus on the cursor position?

Sorry no there isn't any way set up for field of view changes to focus on the cursor position.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All