converting integer to real number with calculate node

i’m not sure if this is bug or not. maybe i’m completely missing something but converting from an integer to a real number doesn’t work with the calculate node. this seems like something trivial so i’m not sure why its not working for me. i’m using the standard calculate node with with expression A + B and trying to print from a published integer port. it should print 20 but something has gone wrong with the integer casting. it prints fine if I use a published input of type real but not of type integer even with the convert integer to real node.

IntegerCastingCalculate.vuo (3.33 KB)

seems like rounding a float to integer doesn’t work either when dealing with a port that wants integer. what am I missing it seems like this is something that I should be able to do. enclosed is a composition drawing a parametric circle. the amount of subdivisions when using input of real to input of integer does not cast. this should draw a circle of layers. see first comp for error then second comp that is working when using no casting or converting of floats and integers or vise versa. is this just something that is not possible ?

circleLayersInputsRounding.vuo (6.12 KB)

circleLayersInputs.vuo (5.92 KB)

It seems like you only have a fire on start node. This only triggers one event when the composition starts. You’ll need a fire periodically or fire on display refresh node connected on one of the ports receiving values to calculate it. Since events always flow from start to end, you’d only need one connected (shift-drag for time output ports) to a port of the calculate node in your first example.

I thought maybe I was doing something wrong with events. how am I supposed to connect fire on display refresh to an input published port ? I can connect the fire on refresh to the calculate expression port but that doesn’t do anything to help with casting an integer to float ? I tried with using shift to connect the display refresh time to all the nodes ports and nothing converts the integer to a float. I want to be able to use a list count integer with a real type calculation node ? i’m not understanding why these types of conversions are not working. am I doing what you suggested correctly in this first example ?

IntegerCastingCalculateRefresh.vuo (3.75 KB)

Not quite. As long as an input port doesn’t receive a signal (like for instance as a plugin in Resolume), it doesn’t generate an event. If you move the event cables over to the convert nodes it should work. Event cables should be added to the first node after an input port. You don’t need the rest of them as the events then flow through the rest of the nodes.

I assume the convert nodes popped up automatically, and inserted the event cables after, which I understand would be confusing. That would perhaps be something for Team Vuo to look into (@jmcc)? It’s a feature, not a bug though.

you got it… the convert nodes popped up automatically then I inserted the event cable with shift and it changed the convert node from a little one to a. big one but it seems the event stuck to the calculate node after the auto convert. like you said just adding a new event refresh to the beginning of the convert node made it execute as expected. thanks. i feel dumb that’s been driving me crazy all day. now you where saying early all I need to do is add the refresh event to any port on the node and it will refresh all ports on that node down the line.  

Don’t feel dumb! Learning new skills are rarely not frustrating!

You only need the event signal on the first nodes (the convert ones). The nodes attached downstream from those will get the event signal through the previous nodes.

thanks Magneson. learning something new does have its frustration levels for me. I just feel dumb because it’s something as trivial as casting an integer to float that was a causing problems for me. I guess I wasn’t paying attention when reading the manual. I somehow missed the part about using shift key when dragging display refresh time to add event.

at first when I was selecting nodes the shift select wasn’t working for me either but then I figured out its shift + command to selects nodes. i’m used to quartz composer so I keep hitting command e to bring up the node library. thankfully this highlights the library search field. it seems the library is always open for me in community version.

so thanks again. i’m sure I will have more dumb questions the more I investigate Vuo. i’m very happy with it so far. I wish the community version had dark mode though.

I assume the convert nodes popped up automatically, and inserted the event cables after, which I understand would be confusing. That would perhaps be something for Team Vuo to look into?

Since the Calculate node only accepts real numbers, Vuo inserted a type-converter node to convert the input from integer to real. By default, Vuo shows it in collapsed form. When you connect another cable to the same input port as the type-converter, Vuo expands it in order to visually clarify how the cable connections are happening.

thanks Jean Marie the automatic type converting is useful. I like how Vuo does this automatically. it was just a silly error I made, where there was no event coming from a published port, so the type converter wasn’t converting. In retro spect I think I started adding events from right to left instead left to right. I got it totally sorted out now, I don’t think there is any issue for Team Vuo to look into. I like how the converter node collapses and kind of tucks it out of the way.