Simple lock- / unlock camera

Hi

I really miss two simple buttons, one that lock the current view and one that unlocks the view.

I have found this to do the job:
setTransformLockFlags $ #all
setTransformLockFlags $ #none
but I have to selecet the camera and target manuel to lock the view, before running the script.

I guess that the script should select the active camera and it's target and lock them.

I know how to add a script to a toolbar, but not how to write it properly :-/

Can anyone help?

Thanks

Comments

Comment viewing options

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

Thanks - works like a charm

Thanks - works like a charm :-)

miauu's picture

.

--	lock active camera and its target
(
	activeCam = getActiveCamera()
	setTransformLockFlags activeCam #all
	setTransformLockFlags activeCam.target #all
)
--	unlock active camera and its target
(
	activeCam = getActiveCamera()
	setTransformLockFlags activeCam #none
	setTransformLockFlags activeCam.target #none
)

The active viewport have to be the "camera" viewport.

Comment viewing options

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