Set/Restore viewport
All  1-3  4-12

Previous
Next
 From:  Nick (BODINI)
2891.4 In reply to 2891.3 
Maybe this can help. I got this script off the forum here somewhere. Its resets the perspective view to a set angle. You can change the angle in the script. Set it up with a shortcut key.


script: /* 3d preset */ var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); v.leftRightAngle = 45; v.upDownAngle = -45; v.tiltAngle = 0;
  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 T. (MICTU_UTCIM)
2891.5 In reply to 2891.4 
Thanks Nick.

Still not quite what I'm looking for.

Thanks,

Michael T.

Michael Tuttle a.k.a. mictu

http://www.coroflot.com/fish317537

  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
2891.6 In reply to 2891.1 
Hi Michael T, it sounds like you're looking for something like the "named views" mechanism in Rhino.

MoI does not currently have anything set up for that, but it is on the todo / wishlist to add in the future though.

I can probably cook up some scripts that may help get something similar now though, I'll take a look.

- 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:  Michael Gibson
2891.7 In reply to 2891.1 
Hi Michael T, here are some scripts that may be useful - set these up on some shortcut keys.


Save view:

script: /* Save snapshot of current view into view stack */ var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); var data = new Object; data.camera = vp.cameraPt; data.target = vp.targetPt; var cm = moi.command; var views = new Array(); try { v = cm.getOption( 'views' ); if ( v ) views = v; } catch(e) {} views.push( data ); cm.setOption( 'views', views );


Restore view:

script: /* Restore the next view in the saved view stack */ var cm = moi.command; var views = null; try { views = cm.getOption( 'views' ); } catch(e) {} if ( views ) { var lastrestored = -1; try { lastrestored = cm.getOption( 'last_restored_view' ); } catch(e) {} var i = lastrestored + 1; if ( i >= views.length ) i = 0; var data = views[i]; var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); vp.setCameraAndTarget( data.camera, data.target ); cm.setOption( 'last_restored_view', i ); }


Clear saved views:

script: /* Clear the saved view stack */ moi.command.setOption( 'views', 0 );



Paste in each of those scripts for the command part of a new keyboard shortcut.

You might try setting up something like the saved view one on Shift+V, the restore view one on just plain V, and the clear saved views one on Alt+V (or whatever keys you wish).


So the way it works is that each time you press the "Save view" one, it will record a new saved view in an internal list so you can record one, then adjust the view a bit, record another one, etc... You can hit the "Restore view" key to cycle through those saved views one by one. If you want to start over again, hit the "Clear saved views" key and the saved stack will be removed.


The saved view stack in this case is only a runtime thing, it is not saved with your file and there isn't any method for fine tuning or replacing a view in the middle of the stack so it is fairly crude but it might give you at least the basic mechanism to set up several steps and "replay" them.

- Michael

EDIT: updated scripts to work with v3 as well now.

EDITED: 26 Jun 2013 by MICHAEL GIBSON

  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 T. (MICTU_UTCIM)
2891.8 In reply to 2891.7 
This is great Michael G! Just what I was looking for!

Thanks again,

Michael T.

Michael Tuttle a.k.a. mictu

http://www.coroflot.com/fish317537

  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:  Marc (TELLIER)
2891.9 In reply to 2891.7 
I've wished for something like this a couples of times, thanks Michael!

Marc
  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:  Mike K4ICY (MAJIKMIKE)
2891.10 
Michael... Just noticed:

Upon using the "Clear saved views:" (in Beta V3) I get the following Script error whenever any of the above scripts are used afterwords:

TypeError: Result of expression 'views' [undefined] is not an object.

MoI has to be restarted to continue using the above scripts.

Aside from that, very useful set of scripts!
  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
2891.11 In reply to 2891.10 
Hi Mike, I've updated the scripts above (all 3 of them) so that they should now work ok with v3. There is a slight difference with how 'null' in script is interpreted between v2 and v3.

The updated ones should now work in both v2 and v3, at least I think so. Please let me know if you still see any problems with them.

- 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
 From:  Mike K4ICY (MAJIKMIKE)
2891.12 
Works great now Michael!

This is really useful!
  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

 

 
 
Show messages: All  1-3  4-12