Stefano Nicolis
SteN
About Me
専門知識
Hobbyist
業界:
Film/TV
Connect
LOCATION
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
Why are values inaccurate in Houdini? 2017年4月18日9:47
benCNever, never do that, never try to compare two float to see if they are equal: it will never work.
I was just using an “if” statement to check if the value was exactly equals to “0.7382” but it returns nothing.
I had the same problem (see here [sidefx.com]) and what you have to do instead is compare a value (the value you are looking for) to a range, with your example you can write the following code:
if(value > 0.73 && value < 0.74) { //Do stuff }
Or also:
float _tolerance = 0.01; if( (value - 0.7834) <= _tolerance) { //Do stuff }
So basically to get that to work you dont check if the two values are equal, but if the two values are more or less close
String comparison in Hscript 2017年4月16日13:12
tamteThanks!
you have to use strcmp(){ if(strcmp(chs("../random_node/geotype"), "poly")==0) { return 1; } }
and not sure but the values you are refering here (“none”) or in your file (“primitive”) are not valid for group geotype parm, so it would never switch to one anyway
the valid values are:
'all', ‘bezierc’, ‘bezier’, ‘mesh’, ‘circle’, ‘MetaSQuad’, ‘meta’, ‘nurbc’, ‘nurb’, ‘PackedAgent’, ‘AlembicRef’, ‘PackedDisk’, ‘PackedFragment’, ‘PackedGeometry’, ‘part’, ‘PasteSurf’, ‘poly’, ‘polysoup’, ‘sphere’, ‘tetrahedron’, ‘trifan’, ‘tristrip’, ‘tribez’, ‘tube’, ‘vdb’, ‘volume’
I didnt know the strcmp() function, now it works.
That chs(“../random_node/geotype”) I just used it as an example, the real channel is referring to an ordered menu wich contains a “none” option in it
String comparison in Hscript 2017年4月15日17:02
edward
Theexpression returns a float, not a string. For strings, you needch()(note the s after ch).chs()
Yea I forgot to mention: it doesnt work even with the chs() function.
Here's an example file.
(Im still working in H15.5)