garf Posted May 17, 2017 Share Posted May 17, 2017 Heya, I've written a little python expression to scale geo dependent on through which camera is being viewed. It works but does not recognise when the viewport has changed - is there an event trigger I can use to get it to recognise this change? import hou desktop = hou.ui.curDesktop() scene_viewer = desktop.paneTabOfType(hou.paneTabType.SceneViewer) viewport = scene_viewer.curViewport() camera = hou.GeometryViewport.camera(viewport) if 'preview' in str(camera): return 0.01 print 'preview cam' else: return 1 Quote Link to comment Share on other sites More sharing options...
Shalinar Posted May 18, 2017 Share Posted May 18, 2017 If you look at a recent post I made here, Alex Rusev gave me an excellent solution for getting an event trigger when a new node is selected. I strongly suspect you could use the same mechanism for finding out when the viewport changes. Essentially you just add a new eventLoopCallback() that compares the current viewport to a previously-stored viewport, and if they are different then do a thing (in my case, I needed to emit a Qt signal, in your case, scale geo). Not sure what your level of python is, but if you need help writing it I'll probably have some time to figure it out with you a little later today Quote Link to comment Share on other sites More sharing options...
garf Posted May 23, 2017 Author Share Posted May 23, 2017 thanks - it's way overkill for what I need but it's good to know it's do-able Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.