float to integer conversion on hda parms

   6134   2   0
User Avatar
Member
412 posts
Joined: July 2005
Offline
hey,

came across something of interest when hacking apart an hda here.. if you have a parm of type int that is receiving a float value, it will round that number rather than truncate it.. i found this a little odd since the int() hscript function truncates and int parm type rounds.. me thinks they should be the same as it's caused somewhat of an inconsistency here (my preference would be to truncate both, but hey, who am i to decie.. )..

attached a simple otl as an example..

-dq

p.s. i had to zip up my otl because the extension wasn't allowed for upload.. can we allow otl's on the forum as attachments?

Attachments:
int_test.otl.gz (3.1 KB)

Dave Quirus
User Avatar
Member
4262 posts
Joined: July 2005
Offline
Well the HDA integer parameters behave like all the other integer parameters in Houdini. Its consistent in that aspect. From a programmer's POV they would probably expect a truncation, but from a artist's POV they would probably expect rounding.

Also, and I could be wrong, but I think all a numeric parms are internally stored as floats and the interface does the rounding when you input the values. (Hmm..after doing some tests I think they are stored as ints….so *shrug*)
if(coffees<2,round(float),float)
User Avatar
Member
412 posts
Joined: July 2005
Offline
well i'm an artist and i expect truncation…

oh well, you're prob right as it is consistent with other int parms in that respect.. and i'm wondering if you're also right about houdini storing them internally as floats because if you bring up the animation channel on an int parm that you typed a float into, the curve will respect that value.. so.. i dunno.. :roll:

thanks wolfwood.. good to be able to post something at least once in the past 6 months.. silly working with the not sleeping and what not..
Dave Quirus
  • Quick Links