Jump to content
gemini

Save a View Transform (Persp) and Restore Back Later

Recommended Posts

Posted (edited)

Hi,

Can a viewport (presp) transformation be stored and later restored back again. I was searching for the memory toolbars in python but I could not find.

Thanks

G

 

Edited by gemini

Share this post


Link to post
Share on other sites

I wrote a simple script which would toggle the actual persp camera with a camera in hip. So just to make it clear i have to save the persp camera translation ( here i save it to an other cam ) but when i would toggle back to persp view ( set the stored cam and i use useDefaultCamera ) it does not refresh the view to the new camera. It remain at the old camera settings. That's why i tried the updates.

Any Ideas ?

 

#run_after_save = 0
import toolutils
# Get the viewports from the sceneviewer
scene_viewer = toolutils.sceneViewer()
viewports = scene_viewer.viewports()
persp_viewport = viewports[-1]
look_trough_camera = persp_viewport.camera()

if look_trough_camera == None:
    persp_viewport.saveViewToCamera( hou.node('/obj/cam1'))
    persp_viewport.setCamera( hou.node('/obj/cam_XX'))
    print 1

else:
    persp_viewport.setCamera( hou.node('/obj/cam1'))
    persp_viewport.draw()
    hou.ui.triggerUpdate()
    persp_viewport.useDefaultCamera()
    
    print 2

    
    #hou.node('/obj/cam1').destroy()
    #import hdefereval
    #hdefereval.executeDeferred(hou.undos.performUndo)
    
 

Share this post


Link to post
Share on other sites

Any idea here ? Or other sollution ? Can a memory view cam (view not snapshot image) be used in python ?

THX!

Share this post


Link to post
Share on other sites

you mean this?

cam_view.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×