Reset view?
All  1-4  5-10

Previous
Next
 From:  chippwalters
8025.5 
Here are a couple nifty keyboard shortcuts:

I've remapped my shift-A to
code:
/*!RESET VIEW*/script:moi.view.resetAll();


This will reset views if nothing is selected OR ZOOM all views to the selected objects. One of the nice things about resetting to the selection is it also resets the camera "looking at" point to the center of the selection, making editing easier as all right-button rotates are not pivoting about the selection.

Another two I like a lot is:

code:
/*!ZOOM OUT*/var z=1.2, vp=['3D','Left','Right','Top','Bottom','Front','Back']; for (var n in vp) moi.ui.mainWindow.viewpanel.getViewport(vp[n]).zoom(z);

and
code:
/*!ZOOM IN*/var z=.8, vp=['3D','Left','Right','Top','Bottom','Front','Back']; for (var n in vp) moi.ui.mainWindow.viewpanel.getViewport(vp[n]).zoom(z);


I map these to the ',' and '.' keys (< and>) and they will zoom all views OUT or IN by a small fraction, so you can tap them a few times in a row to get where you want.

With these keys, and the mouse scrollwheel I rarely need ANY other viewport zoom controls.
  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:  Flowgun
8025.6 In reply to 8025.4 
Hi Michael,

I want to ask if there's a way to always reset the view around all visible elements.
I use this script to isolate an object and then focus on it:

moi.geometryDatabase.isolate(); script:moi.view.resetAll();

I get a non-consistent results when I run the script again to get out of the isolation mode and focus on the whole scene because, even if other elements are now visible, the re-focusing will be around the selected object if I change the camera and I don't deselect it before pressing the script.

I want the script to be able to isolate and focus on a selected object to quickly inspect it for example, and pressing it again would get me out of the isolation mode and focuses on everything that is now visible so I can inspect another element.

Thank you,
- Flowgun
  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:  Flowgun
8025.7 In reply to 8025.6 
Not the most elegant solution since I'm not a programmer (yet), but I was able to achieve what I want by inverting the selection, focusing, and then inverting the selection back again. This is my new script to isolate selections:

script: /* Isolate selection */ moi.geometryDatabase.isolate(); script:moi.geometryDatabase.invertSelection(); script:moi.view.resetAll(); script:moi.geometryDatabase.invertSelection();

I hope I get a reply for a more elegant code though =D

Cheers.
  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
8025.8 In reply to 8025.6 
Hi Flowgun, by default the view reset will fit to selected objects and if you run it a second time it will fit to all objects regardless of selection.

But you can pass in an optional parameter to the resetAll() function to make it behave differently. The parameter can be one of:

'auto'  - Do automatic toggle between selected or all.
'selected'  - Only reset to selected objects.
'all'  - Only reset to all objects.
'default'  - Reset to default startup views, keeping reversed views (bottom/back/left).
'harddefault'  - Reset to startup views and get rid of reversed views (bottom view will become top).


So you can use it like this for example: moi.view.resetAll( 'selected' );

- 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

Message 8025.9 deleted 20 Mar 2022 by FLOWGUN

Message 8025.10 deleted 20 Mar 2022 by FLOWGUN
 

Reply to All Reply to All

 

 
 
Show messages: All  1-4  5-10