Many times I have my viewport with a certain camera (lets call it Cam01). Then I need to change the viewport to top, left, etc, and I always wish I could go back to the camera I was before, without having to select it first.
Forum topic · Scripts Wanted
Script wanted: Set view to the last camera used
By lupaz · 2020-07-02
Description
Comments (5)
lupaz · 2020-07-23
I just wanted to thank you again. I'm using this every day and works really well.
lupaz · 2020-07-07
It works very nicely. Thanks!
.
jahman · 2020-07-03
try this:
callbacks.removeScripts #viewportChange id:#LastCameraUsed
global LastCameraUsed = undefined
fn OnViewportChange =
(
local cam = getActiveCamera()
if cam != undefined do LastCameraUsed = cam
)
callbacks.addScript #viewportChange "OnViewportChange()" id:#LastCameraUsed
-- Customize > Jahman > 'Switch To Last Used Camera'
macroScript SwitchToLastUsedCamera
category:"Jahman"
tooltip:"Switch To Last Used Camera"
(
try
(
viewport.SetCamera ::LastCameraUsed
)
catch()
)
if it works as expected, save this script in startup scripts folder
C:\Users\User\AppData\Local\Autodesk\3dsmax\<max_version>\ENU\scripts\startup
And bind it to any key combination you like.
Customize > Jahman > 'Switch To Last Used Camera'
lupaz · 2024-11-26
Hi Jahman,
I installed 3DS Max 2025.1 and now the script returns "An error occurred while switching to the last camera." even though it did change to the last camera.
Do you know what could be wrong?
Hope you are still around.
lupaz · 2024-11-26
Sorry. Nevermind. I installed it from scratch and now it works.
Hope you're doing well.