Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 ยท 94 posts


EVargas posted Sun, 24 April 2022 at 11:53 AM

Update here, when translating to the "def" syntax I forgot the "Force Limits", fixed below. Another good tip is to set a keyboard shortcut for both, it makes life a lot easier!

# -- -- -- -- -- Lock_Current_Cam.py -- -- -- -- --

scene = poser.Scene()
cam = scene.CurrentCamera()

def lockCurrentCam():
    for parName in ('xtran','ytran','ztran','xrot','yrot','zrot'):
        camPar = cam.Parameter(parName)
        camPar.SetMinValue(camPar.MinValue() - 1 * camPar.MinValue() + camPar.Value())
        camPar.SetMaxValue(camPar.MaxValue() - 1 * camPar.MaxValue() + camPar.Value())
        camPar.SetForceLimits(1)

lockCurrentCam()

# -- -- -- -- -- Unlock_Current_Cam.py -- -- -- -- --

scene = poser.Scene()
cam = scene.CurrentCamera()
 
def unlockCurrentCam():    
    for parName in ('xtran','ytran','ztran','xrot','yrot','zrot'):
        camPar = cam.Parameter(parName)
        camPar.SetMinValue(-10000)
        camPar.SetMaxValue(10000)
        camPar.SetForceLimits(0)

unlockCurrentCam()



Store | Website

"Art exists so that reality does not destroy us" - Friedrich Nietzsche