Yorkst Posted October 24, 2015 Share Posted October 24, 2015 This works as a code for a python geometry operator: node = hou.pwd()print hou.hmath.rand(42.3); This fails: node = hou.pwd()print hou.hmath.rand(node); It prints TypeError: in hmath_rand argument 2 of type double Is there a python RNG, which accepts houdini objects like seed? Quote Link to comment Share on other sites More sharing options...
f1480187 Posted October 25, 2015 Share Posted October 25, 2015 Python built-ins id(object) and hash(object). All inconsistent between Python (and Houdini) sessions. There is also hashlib module. Maybe Python or hom have something even better. I'm not into scripting a lot. There is hou.Node.sessionId() for Node's instances, but it works in similar way as aforenamed functions. Quote Link to comment Share on other sites More sharing options...
Yorkst Posted October 25, 2015 Author Share Posted October 25, 2015 So, is Python limited in comparison to HScript? Quote Link to comment Share on other sites More sharing options...
f1480187 Posted October 25, 2015 Share Posted October 25, 2015 Is there any HScript/HScript Expression doing a better job? One I can find is similar to what hou.Node.sessionId() does. What's your situation, more precisely? Talking about limited-unlimited, there is bunch of this-still-not-implemented HScript equivalents I personally missed in HOM. Actually, found that they available, because I've never used "non-expression" HScript. You can invoke both from each other. hou.hscript() and bunch of other functions exists. Quote Link to comment Share on other sites More sharing options...
dedeks3000 Posted October 25, 2015 Share Posted October 25, 2015 (edited) May be you can use the uuid module to generate unique identifier and store the result on the node instance in a parameter or with userData ? Edited October 25, 2015 by dedeks3000 Quote Link to comment Share on other sites More sharing options...
Yorkst Posted October 26, 2015 Author Share Posted October 26, 2015 I was absolutely sure that HScript rand works with non float seed. It turns out, that it doesn't. Then it's just a matter of writing custom hash functions. Sorry for confusion. 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.