Thank you for these tutorials, am having trouble understanding
f@pscale = pscale;
What is the f for, If I type @pscale = pscale; , I get the same results in my Geo spreadsheet with no errors, is this correct?. I understand its setting the pscale in the geo att. Thanks you Ben
letters in front of the @ explicitly specify the attribute’s data type. In our case the “f” denotes a float. Most of the time Houdini automatically selects the correct data type for the attribute, especially if we’re working on built-in attributes such as pscale. However to be sure and have control over what’s happening, I prefer explicitly typing my attributes using the data type before the @. For a list of attribute data types see: https://www.sidefx.com/docs/houdini/vex/snippets.html#attributes
Hi Mo,
While working through this lesson I’ve found something interesting about the fit() functions that I suspect will apply to others as well: when operating a vector with uniform values, a float can be used instead of a complete vector. For example, fit01(randdir, -1.0, 1.0); has the same effect as expanding those values into 3-element vectors.
Thanks again for the excellent lessons!
On further experimentation, integers work as well and are automatically converted to floats. I appreciate what you said about explicitly typing attributes, but since these values are to be converted to vectors anyway (which are always made up of floats if I understand correctly), perhaps it’s not as important in this case.
Hi Moritz
Thank you for these tutorials, am having trouble understanding
f@pscale = pscale;
What is the f for, If I type @pscale = pscale; , I get the same results in my Geo spreadsheet with no errors, is this correct?. I understand its setting the pscale in the geo att. Thanks you Ben
Hi Ben,
letters in front of the @ explicitly specify the attribute’s data type. In our case the “f” denotes a float. Most of the time Houdini automatically selects the correct data type for the attribute, especially if we’re working on built-in attributes such as pscale. However to be sure and have control over what’s happening, I prefer explicitly typing my attributes using the data type before the @. For a list of attribute data types see: https://www.sidefx.com/docs/houdini/vex/snippets.html#attributes
Cheers, Mo
Hi Mo,
While working through this lesson I’ve found something interesting about the fit() functions that I suspect will apply to others as well: when operating a vector with uniform values, a float can be used instead of a complete vector. For example, fit01(randdir, -1.0, 1.0); has the same effect as expanding those values into 3-element vectors.
Thanks again for the excellent lessons!
On further experimentation, integers work as well and are automatically converted to floats. I appreciate what you said about explicitly typing attributes, but since these values are to be converted to vectors anyway (which are always made up of floats if I understand correctly), perhaps it’s not as important in this case.
Cheers!