mikelafave Posted February 4, 2020 Share Posted February 4, 2020 https://www.sidefx.com/forum/topic/52186/ Oct. 19, 2017 4:14 P.M. Is it not possible to enable the lock view to camera button via python/hscript? experimenting w/python on this in Apprentice 16.5.634 (_old_ PC) and running into issue(s) https://www.sidefx.com/docs/houdini/hom/hou/GeometryViewport.html ... showed me several things which DO seem to work using the following syntax : import hou, toolutils myCam = hou.node('/obj/').createNode('cam', 'myCam') hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().setCamera(myCam) # hou.hscript('viewhome -s *.*.world.persp1') hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().homeAll() hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().saveViewToCamera(myCam) # ... HOWEVER, when I try something similar, I just get an Error on : >>> hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().lockCameraToView() Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'GeometryViewport' object has no attribute 'lockCameraToView' # ... and I have Not found any way to do this using hscript either. Anyone have advice on this? Quote Link to comment Share on other sites More sharing options...
ikoon Posted February 4, 2020 Share Posted February 4, 2020 Hi Michael, you need to add the argument, True or False into the lockCameraToView() hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().lockCameraToView(True) Quote Link to comment Share on other sites More sharing options...
mikelafave Posted February 4, 2020 Author Share Posted February 4, 2020 would that it were True in Apprentice 16.5.634 , pasting that (and any other argument variation I can think of) into the Python Shell just gets me that same dead-end Error message : >>> hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().lockCameraToView(True) Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'GeometryViewport' object has no attribute 'lockCameraToView' >>> hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().isCameraLockedToView() Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'GeometryViewport' object has no attribute 'isCameraLockedToView' ? Q : Does this work for You now ... and, if it Does work for you, what version of Houdini does it now work in ? Quote Link to comment Share on other sites More sharing options...
ikoon Posted February 4, 2020 Share Posted February 4, 2020 Hi, I am using Houdini 18. I had this conversation with SideFX in April 2018. I don`t know, in which version the Lock method was implemented. But Houdini 16.5 was released earlier, November 2017. Sent: Wednesday, April 25, 2018 6:05 PM Subject: Online Bug: python or hscript to toggle the lock [SESI #60637] I've added you to an existing RFE requesting this functionality. RFE #85473 You may try the following, in the Python Shell. The autocomplete will show you available methods in your version of Houdini, but lockCameraToView is probably not there: Quote Link to comment Share on other sites More sharing options...
mikelafave Posted February 6, 2020 Author Share Posted February 6, 2020 Yes, you are correct -- lockCameraToView is Not there in 16.5 And I could have noticed that myself, had I bothered to look at the _internal_ hou.GeometryViewport HELP (instead of just online) I will give it a try in 18 on my Son's (newly-built) PC when the opportunity presents itself in the meantime I will probably try to make-do with ".saveViewToCamera(myCam)" (which IS there in 16.5), After user adjustments (though I'm surprised there was never a way to do it using hscript) Thank You, Jiri, for your patience and help on this! -mike 1 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.