Store & Restore Views

2 votes
Version: 
1.5
Date Updated: 
07/29/2022
Author Name: 
Branko Živković

srv
Simple tool for storing and restoring different viewports.

Additional Info: 

This tool supports different viewports: orthographic and non-orthographic
Top, Bottom, Front, Back, Left, Right, Orthographic, Perspective, Camera and Light
All data are saved with the *.max file (no external files), so it's very important to save
max scene after you finish adding or deleting viewport presets.

How it works: the process is self-explanatory and there is some tooltips on the buttons.
To restore any view, just use double-click on the list item.

update 1.1 (request for fix by titane357)
- fixed some minor bugs (restoring views after you reopen maxfile)
- now script save last Rollout position on the screen
update 1.2 (request for fix by Juliano Salazar Rocha)
- changed some code: before MAX 2022.1 there was no support to converting string value to point2 value
update 1.3 - code optimizations
update 1.4
- fixed bug reported by rachka
update 1.5 (request for fix by rachka)
- now the list is sorted in ascending order

Version Requirement: 
2017.1 +
AttachmentSize
bga_store_restore_views_v1.5.ms7.34 KB

Comments

Comment viewing options

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

Script is updated to version 1.5

Thank you barigazy!

barigazy's picture

...

Script is updateted to version 1.5
@rachka
If you use 1,2,3 ... , the first double-digit number, like 10 for example, will be sorted after number 1
So, if you plan to use numbers as view names, for better sorting use 01,02,03 ...

bga

rachka's picture

working fine now but

Thanks barigazy! Seems to be working fine now. I made it a macro and it worked. I noticed one thing: if you name the view like 1, 2, 3, 4 etc. the script puts 1 and 2 properly, after that it puts 3, 4, 5 etc at the top of 1, 2 and if you continue with the naming it puts 10 between 6 and 7, then 11 between 7 and 8, 12 between 8 and 9, but after 13 it seems to put them in the right order although 1 and 2 continue to be at the bottom. Something with the order in the list is not right. Another thing is that if you remove all the views (right click) and start naming the views again with one digit like 1, 2.. etc. it does nothing but as soon as you type two digits like say 12 or 25 it returns all saved views. And if I'm not mistaken it does it more often than not i.e. sometimes this doesn't happen and everything works fine. Sometimes it even returns the views after typing 4 but next time if you type 4 it does nothing. There is a script from DeadClown here: https://www.scriptspot.com/3ds-max/scripts/save-restore-views which is very good-looking with its horizontal thumbnails (unnamed though) and handy especially the modification in the comments done by 3dwannab but unfortunately it seems like it does not remember the saved views after closing max and reopening the scene and it does not remember the saved zooming extents but only returns the saved view with the current zooming.
Cheers!

barigazy's picture

...

Mr @rachka,
sorry for delay, I was busy with work last two weeks.
I managed to find and remove issue, please let me know is it work for you now
Cheers!

bga

rachka's picture

-- MAXScript Rollout Handler

-- MAXScript Rollout Handler Exception:
-- Type error: Call needs function or class, got: undefined
-- MAXScript callstack:
-- thread data: threadID:5504
-- ------------------------------------------------------
-- [stack level: 0]
-- In k loop
-- Parameters:
-- k: 1
-- Locals:
-- node: undefined
-- vpd: undefined
-- vpdStruct: undefined
-- k: 1
-- FindNode: undefined
-- p3TOp2: undefined
-- Externals:
-- this: viewportDataAtt:viewportDataAtt
-- owner: undefined
-- ------------------------------------------------------
-- [stack level: 1]
-- called from getVPData()
-- member of:
-- Locals:
-- Externals:
-- this: viewportDataAtt:viewportDataAtt
-- owner: viewportDataAtt:viewportDataAtt
-- ------------------------------------------------------
-- [stack level: 2]
-- called from bga_srvRoll.open(); filename: C:\Users\Rachka\Downloads\bga_store_restore_views_v1.2.ms; position: 7228; line: 179
-- member of: Rollout:bga_srvRoll
-- Locals:
-- Externals:
-- cbx_views: RolloutControl:cbx_views in rollout:bga_srvRoll : ComboBoxControl:cbx_views
-- rootNode: SystemGlobal:rootNode : $
-- bga_srvRoll: Global:bga_srvRoll : Rollout:bga_srvRoll
-- owner: Rollout:bga_srvRoll
-- ------------------------------------------------------
-- [stack level: 3]
-- called from top-level

rachka's picture

MAXScript Listener Message

-- MAXScript Rollout Handler Exception:
-- Type error: Call needs function or class, got: undefined
-- MAXScript callstack:
-- thread data: threadID:5504
-- ------------------------------------------------------
-- [stack level: 0]
-- In k loop
-- Parameters:
-- k: 1
-- Locals:
-- node: undefined
-- vpd: undefined
-- vpdStruct: undefined
-- k: 1
-- FindNode: undefined
-- p3TOp2: undefined
-- Externals:
-- this: viewportDataAtt:viewportDataAtt
-- owner: undefined
-- ------------------------------------------------------
-- [stack level: 1]
-- called from getVPData()
-- member of:
-- Locals:
-- Externals:
-- this: viewportDataAtt:viewportDataAtt
-- owner: viewportDataAtt:viewportDataAtt
-- ------------------------------------------------------
-- [stack level: 2]
-- called from bga_srvRoll.open(); filename: C:\Users\Rachka\Downloads\bga_store_restore_views_v1.2.ms; position: 7228; line: 179
-- member of: Rollout:bga_srvRoll
-- Locals:
-- Externals:
-- cbx_views: RolloutControl:cbx_views in rollout:bga_srvRoll : ComboBoxControl:cbx_views
-- rootNode: SystemGlobal:rootNode : $
-- bga_srvRoll: Global:bga_srvRoll : Rollout:bga_srvRoll
-- owner: Rollout:bga_srvRoll
-- ------------------------------------------------------
-- [stack level: 3]
-- called from top-level

barigazy's picture

...

post me what MaxScript Listener shows

bga

rachka's picture

saved some views

I saved some views, saved the max file then I closed max and opened the saved file - this pops up:

MAXScript Rollout Handler Exception
Type error: Call needs function or class, got: undefined

(3ds Max 2020)

barigazy's picture

...

script is updated to version 1.2

bga

titane357's picture

Thanks, it works fine now !

Thanks, it works fine now ! :-)

Comment viewing options

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