sant0s81 Posted June 12, 2020 Share Posted June 12, 2020 (edited) Hey, I am trying to find out, what the most elegant way to write Python in Houdini would be. At the moment I always create an HDA and add a Python Modul. Than there is the option, to save the code as a .py file. And of course there is the Python SOP. And what I see often, a DIY Python SOP (like creating a string with multiple lines and Python as language on a geometry). But when does it make sense, to use what techniqe and what are the benefits? Sry if that sound stupid, but in every tutorial there is another way. Thanks, sant0s Edited June 12, 2020 by sant0s81 Quote Link to comment Share on other sites More sharing options...
anim Posted June 12, 2020 Share Posted June 12, 2020 (edited) 10 hours ago, sant0s81 said: But when does it make sense, to use what techniqe and what are the benefits? 10 hours ago, sant0s81 said: I always create an HDA and add a Python Modul. proper way if you need a node that needs some python, so you may want some internal module, of course you can always use external modules from python folder of your package or other scanned directories if you don't need node or HDA, just something that execures the script, then you can create a Tool and either add it to shelf or just let it be called from Tab menu, same deal, you can use your external modules 10 hours ago, sant0s81 said: And of course there is the Python SOP. only for runtime stuff when you want python to be executed every time sop is dirtied and cooked, usually to modify geometry, but should not be used for business outside of modifying the current geo (like creating nodes, setting ui parameter values, etc...) 10 hours ago, sant0s81 said: a DIY Python SOP (like creating a string with multiple lines and Python as language on a geometry). quick way to prototype some code for testing without needing to have HDA and code in HDA module and don't want to mess with tools, so quick and dirty self contained stuff, does not replace Python SOP though as it's not runtime, can modify geo stored in Data Parms though (as any method can) also hip file session module can be used for prototyping and testing, just note that that is executed every time the scene is open there is also Script SOP (and some specific DOP nodes), for executing certain stuff during cooking of that node Edited June 12, 2020 by anim 1 Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted June 13, 2020 Author Share Posted June 13, 2020 @anim thank you for the detailed explanation, helps alot! 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.