probiner Posted April 12, 2019 Share Posted April 12, 2019 What't the easiest way to present a user with a set of options when running a python script from the shelf? Is there by chance a way to use the Parameter Interface Editor, save that, call it from the script commit, and use the information from it? I've used hou.ui.readInput for simple string inputs, but I don't want to make that pop one after the other for several options. Thanks Quote Link to comment Share on other sites More sharing options...
garf Posted April 12, 2019 Share Posted April 12, 2019 (edited) " Is there by chance a way to use the Parameter Interface Editor, save that, call it from the script commit, and use the information from it? " that would be nice but i dont think its doable PyQt is the best way I know of creating custom UIs Edited April 12, 2019 by garf Quote Link to comment Share on other sites More sharing options...
kiryha Posted April 12, 2019 Share Posted April 12, 2019 If you decide to go with PyQt UI tutorial might be helpful for the beginning. Quote Link to comment Share on other sites More sharing options...
probiner Posted April 12, 2019 Author Share Posted April 12, 2019 (edited) Thanks to @Stalkerx777 for his library: https://bitbucket.org/alexxbb/huilib/overview Really fits my needs here of having some simple options for something that is just to run once. @garf Indeed I'll go down that path for heavy lifting stuff. But atm that would be a rabbit hole for me. @kiryha Thanks for producing that! Sounds like it will be verbose for evolved things (maybe even more than what is being executed) and probably a good opportunity to get in to code generators. Edited April 12, 2019 by probiner 1 Quote Link to comment Share on other sites More sharing options...
Atom Posted April 12, 2019 Share Posted April 12, 2019 (edited) So where do you place huilib.py so the include from the shelf tool can find it? Edited April 12, 2019 by Atom Quote Link to comment Share on other sites More sharing options...
flcc Posted April 12, 2019 Share Posted April 12, 2019 (edited) You can put it in app folder : Houdini 17.xx/python27/lib Probably not the best location, but at least Houdini finds it. On the other side, I can't get it to work. I included a small print test in the library to be sure. And I try with the two sample but nothing happen ! Edited April 12, 2019 by flcc Quote Link to comment Share on other sites More sharing options...
Atom Posted April 12, 2019 Share Posted April 12, 2019 (edited) Ah, got it. Get rid of that condition, at the bottom of the script and it does launch. ui = TestDialog(name = 'test', title = 'Test UI') ui.show() Edited April 12, 2019 by Atom Quote Link to comment Share on other sites More sharing options...
flcc Posted April 13, 2019 Share Posted April 13, 2019 (edited) Ah yes, thanks Trying in the source Windows and it's the same. Does this mean that this condition should not be used in houdini ? (sorry, pretty new with python in houdini) Edited April 13, 2019 by flcc Quote Link to comment Share on other sites More sharing options...
probiner Posted April 13, 2019 Author Share Posted April 13, 2019 (edited) @Atom I've been looking at Python in Houdini only recently, so I look forward to get more people's insight. Put it in any of the locations corresponding to $HOME, $HSITE, $HIP, $JOB inside a structure like {loocation}/{houdiniversion}/python2.7libs/ For example I have $HSITE at F:/HOUDINI/HSITE/ so I put the huilib.py in F:/HOUDINI/HSITE/houdini17.0/python2.7libs/ After this import huilib in the shelf tool Script field will be able to find it. As for running the examples, here I'm not so sure about the correct method, but what I've been doing is putting my scripts in a subfolder ../python2.7libs/PRB_HOM/ which contains an empty __init__.py and then call those scripts from the shelf with import. For example, I've put in said folder the example shipped with huilib, all_gadgets.py, while changing the script bottom part from: if __name__ == '__main__': ui = TestDialog(name = 'test', title = 'Test UI') ui.show() into def main(): ui = TestDialog(name = 'test', title = 'Test UI') ui.show() if __name__ == '__main__': main() And then in the shelf tool Script field I can do: from PRB_HOM import all_gadgets as tool reload(tool) tool.main() And this way it gets picked up. This is how I'm running my shelf tools in general, so I can store .py files in a repo and use an external editor and not have the scripts stored in the .shelf file. But I'm curious to know if this is "the proper" way to do it @Stalkerx777 or anyone! It would still be nice if we could work in the Parameter Editor and store that into a .ui file. Cheers PS: I failed to refresh the page and notice you guys already sorted it Edited April 13, 2019 by probiner 1 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.