Save & Restore Views

5 votes
Version: 
0.2
Date Updated: 
04/14/2014

A simple script that is pretty similar to max's own "Save active perspective view" and "Restore active perspective view" functionality just that there are 5 slots with preview images. Un-comment the first 2 lines to install it as a macroscript. Click the little lock symbol to save a view, click the image button to restore it. 

AttachmentSize
saveandrestoreviews_0.2.ms3.27 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
3dwannab's picture

Compact Version and Ortho

This works with Ortho views too. I think it worked with this anyway. If not download my EDIT1 in this thread or Martins Original. It's working here with top views etc on Max 2016. Maybe your Max version is incompatible. I can't test below 2016.

New EDIT:
-- Toolbar Size.
-- Drag the little blank grey bit on the right to move the UI. It saves position when you reopen.
-- RMB to save View
-- LMB to activate View

Also to change the size of the ICONS it can be done to suit. Just modify the width and height value of this line and the script will do the rest.

rollout perspStore "View Store" width:205 height:35

AttachmentSize
saveandrestoreviews_0.2_0_0_compact_version_3dwannab_edit.ms 5.08 KB
stevirt's picture

top view

Nice script. Thank you! Is it possible for me to change the script to use top view instead of perspective view? The script will save active top views (at least create a thumbnail of them) but not restore them.

Thanks again!

Kurai's picture

3dwannab Revamp

Thanks 3dwannab (and Deadclown)... I have adopted your revamp of this script cos you have made it smaller. I find this script crucial for final camera position and quickly moving from inside to outside of a building to make alterations since moving around gets sluggish with big models. It should be re-named: Teleport Tool :)

But... could it be smaller?

I would prefer it to be toolbar size so it can be docked easily.
For me the size of the picture is not important.
Really fed up of floating toolbars.

Thanks

3dwannab's picture

Changed the code

Hope you don't mind deadclown but I've found time to get the script like I descrided. Simple enough really but only works for max 2015 or more because it uses: NitrousGraphicsManager.GetActiveViewportSetting()

I modified and hidden all but two of the views (Felt 5 was too much for me :) ) in this script and changed the name to View Store (I hope you don't mind :P). Fixed saving the pos when dialog is moved and I've added a reset viewports button also to with the following settings:

		actionMan.executeAction 0 "40043" -- Selection: Select None
		viewport.ResetAllViews() --resets to Max Standard
		actionMan.executeAction 0 "311" --frames all viewports
		viewport.zoom .6 --fix to make perspective view appear closer
		completeredraw() --redraw the views
		viewport.setGridVisibility #all false --turns off all grids
		actionMan.executeAction 0 "40829" --show statistics

For anyone wanted basic shading saves in 2015 max or less you can look for the code and change:

		fn saveTM =(
			try(
				vpedgedfaces = viewport.GetShowEdgeFaces()
				VisualStyleMode = (impl = NitrousGraphicsManager.GetActiveViewportSetting() impl.VisualStyleMode) -- 2015 max version
				--vprenderlevel = viewport.GetRenderLevel() -- 2015 less max version
				vpType = viewport.getType()
				tmMatrix = getViewTM()			
			)catch()
		),
		fn getTM =(
			try(
				viewport.SetShowEdgeFaces vpedgedfaces
				impl = NitrousGraphicsManager.GetActiveViewportSetting() impl.VisualStyleMode = VisualStyleMode -- 2015 max version
				--viewport.SetRenderLevel vprenderlevel -- 2015 less max version
				viewport.setType vpType
				viewport.setTM tmMatrix
			)catch()
		),

And replace with:

		fn saveTM =(
			try(
				vpedgedfaces = viewport.GetShowEdgeFaces()
				--VisualStyleMode = (impl = NitrousGraphicsManager.GetActiveViewportSetting() impl.VisualStyleMode) -- 2015 max version
				vprenderlevel = viewport.GetRenderLevel() -- 2015 less max version
				vpType = viewport.getType()
				tmMatrix = getViewTM()			
			)catch()
		),
		fn getTM =(
			try(
				viewport.SetShowEdgeFaces vpedgedfaces
				--impl = NitrousGraphicsManager.GetActiveViewportSetting() impl.VisualStyleMode = VisualStyleMode -- 2015 max version
				viewport.SetRenderLevel vprenderlevel -- 2015 less max version
				viewport.setType vpType
				viewport.setTM tmMatrix
			)catch()
		),


AttachmentSize
saveandrestoreviews_0.2_0 3dwannab EDIT.ms 4.61 KB
3dwannab's picture

Thanks

Just that orbiting in max bugs out when you're in tight spaces so this was the perfect solution. Thanks once again.

DeadClown's picture

@3dwannab: Yes, that's a good

@3dwannab: Yes, that's a good idea. I will implement it when I time for it. I'm not using the script myself so I haven't even noticed ;)

@Ariel NM: It's possible that I'm using a maxscript function that does not exist in max 2011. I don't have 2011 to test it here, sorry.

Ariel NM's picture

Only gray squares

Hi DeadClown! Your script works fine in versions 2013 to 2015, but in 2011 it doesn’t show the thumbnails –only the original gray squares. Who is wrong, me or Autodesk? ;)

3dwannab's picture

Very useful.

Put it in my startup scripts folder. Thank you.

I think it would it be useful to save the type of shaded mode. So, lets say, if I'm in a view in wireframe mode I click the thumbnail and it brings me to the view with whatever mode was enabled. Would that e something you could implement?

robobear510's picture

wow great script - also I'm

wow great script - also I'm using octane 2.0 on max 2015, works fine at the first few test, I think I'm gonna use this one :)

Dom's picture

After some tests, I can say

After some tests, I can say it works, but if I move the point of view in octane viewport, the script no longer call back the saved perspective.
If you want, you can try octane, there is a demo version, it's similar to corona, but only GPU renderer, and its viewport is a kind of activeshade, like corona activeshade viewport.
I hope you can update it, it's a good script anyway, I can use it, even if it is not "octane friendly", thanks you for this release.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.