dzigakaiser Posted June 10, 2020 Share Posted June 10, 2020 Hey guys! Once again, I have to seek out your precious help ^.^ I am currently creating my own asset browser and I am working on feeding assets from Houdini into the library. So far, everything was going pretty smoothly up until I got stuck with something that seems so simple: the frameSelected() function of the hou.GeometryViewport class. When I use the Python shell inside Houdini and do this, it is working correctly: import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() My section in the HDA is not. Broken down to the essential part (with hard coded selection of node as above for the sake of the example): import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() [...] cam = obj_level.createNode('cam', 'asset_cam') node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() view.saveViewToCamera(cam) view.setCamera(cam) All the other functions work as expected (lockCameraToView, saveViewToCamera, setCamera all work fine). I only have trouble with frameSelected(), even when adding the code from the shell to my script, basically hard coding selecting the correct node. After running my export process which does not frame the view, I can go to the shell and call frameSelected() and from there it works again :/ I also have sections where I first set the camera, lock the view, then try framing but it is the same result: all working, except the framing. I wonder what I am doing wrong in my code and hope you can help me out. Any pointers, comments are greatly appreciated! Quote Link to comment Share on other sites More sharing options...
dzigakaiser Posted June 10, 2020 Author Share Posted June 10, 2020 (edited) Okay, I got a little further now. When using setSelected(True,True) instead of setCurrent(True, True) I almost get it to work: When I click my HDA SOP and run the code, it does not frame the SOP. If I click next to it and then run the code from the parameter interface, it works. I added a print statement for hou.selectedNodes() before calling frameSelected() and the output is identical (1st line: clicking on the SOP/ 2nd line: clicking into an empty area in the node graph after having the SOP selected): (<hou.SopNode of type DZK_asset_export at /obj/geo1/DZK_Asset_Export>,) (<hou.SopNode of type DZK_asset_export at /obj/geo1/DZK_Asset_Export>,) Both methods result in also having the node return True for isCurrent(). I am not quite sure what to actually take from this and where to go next Edited June 10, 2020 by dzigakaiser 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.