I’ve noticed that if one performs a boolean operation in a MathMix between a float and an int attribute, the result is not a boolean, nor an integer, but a float, even when using the quantizing option in the post tab. I’m not sure if that’s by necessity, but seems like a bug to me. See an attached example.
If it is for some reason necessary, I suggest having a type casting option in the post tab, that would allow us to cast to the desired type, avoiding confusion when programming further. I know there’s an int cast option also in the combine tab… but conceptually might make sense to also offer it as an “end of chain” operation as a convenience?
Logic.tox (8.3 KB)
Hello @Darien.Brito
If I’m not mistaken, at some point while developing the MathMix, by necessity, we decided to cast the attributes to float.
I’m noting your suggestion about the casting option. Thanks
1 Like
Hi Darien,
So the current logic right now is for the automatically created attribute to be the type of scope A.
So if you have 2 ints or swap the comparison you’ll get an int.
Alternatively if you’d like more control you can create a New result attribute that’s an Int on the new page (that’s what the new page was for in my mind) and assign the result to that attribute.
That being said it’s on our list to make casting between types easier so we may streamline that a bit, maybe a “cast to : Auto/Float/Int” dropdown menu available in each block makes the most sense
2 Likes
Hey @Guillaume.L and @vincentDev,
Thanks for the info and the note on intended workflows.
I can imagine why the choice of making type acquisition based on scope A. However, that doesn’t feel too intuitive imo.
Creating a new result attribute is something I didn’t consider, but then it becomes one more field to keep track of in an already pretty complex node.
I certainly think having a dropdown menu with casting options for blocks would be really nice, as suggested last by Vincent

Cool, noted.
Can’t remember but it’s probably in the examples, where things can get hairy is the math mix let you direct the result to multiple attributes, so if your result has 3 components you can have
output scope: P(0) myAttrib(0) myOtherAttrib(2)
so I guess in that case all 3 attributes would get casted to what is selected with the menu described above
1 Like
Oh I see! That can get hairy indeed. What you mention though seems like the most sensible approach, regarding the menu.
Hi Darien, this was improved in alpha 5, 2023.31974
Math, ReRange, Limit now have a cast to menu to streamline outputting to float or int without having to expand the >> parameters
The cast to menu was added on the post page blocks for math combine (formerly Math Mix) as well
There’s also a quantize POP now
Please note internally they now all operates on floats internally so operations on very large ints (bigger than 16,777,217 I believe) will give incorrect results - we might consider a special Integer Math POP in the future with a limited set of operations - for now GLSL POP is the only way
Thank you for the heads up @vincentDev!
I’ve played with the new Math combine and Quantize POPs. All working great!
Wishing you a happy new year btw, as I’m writing you on the 31st of December 
Great thanks for the feedback! And thank you, happy new year as well!
1 Like