Page 1 of 1

Wire circular connection lets instances grow but not shrink

Posted: Sat Dec 07, 2024 22:25
by DaCodaDragon
Hi peeps!

I have encountered an issue where I want many nodes to update their instance count using an "Int" attribute. However, I have a circular connection in my patch, but then it no longer allows me to lower the instance count. I was wondering whether this is by design or a bug.

Wire version: 7.22.0.42164
OS name: Microsoft Windows 10 Pro
OS version: 10.0.19045 Build 19045

phpBB [video]

Re: Wire circular connection lets instances grow but not shrink

Posted: Sun Dec 08, 2024 01:06
by tijnisfijn
Hi

This is not a bug, but a logical result from your loop. The simple explanation would be if you look in the picture that I included. See the top input as your initial instance count that goes through your Loop. The bottom input represents your new instance count. If you play with the bottom input, you will see that you can only add instances, but you cannot get a instance count that is lower than the top input. So because the loop already has the instance count of the first input you can only add instances. If your new instance count is lower, it will just repeat your inputs until it matches the original input count. And because it is a loop, if you add instances, then your first instance count gets raised, making it that you can only add instance this way. I hope this makes sense.

Re: Wire circular connection lets instances grow but not shrink

Posted: Sun Dec 08, 2024 14:02
by DaCodaDragon
Thanks! While it wasn't exactly the answer I was hoping for it does explain the behavior I'm seeing. I guess I need help with my setup since I'm trying to make "Write buffers". I'll move over to the Wire board for that.

Re: Wire circular connection lets instances grow but not shrink

Posted: Sun Dec 08, 2024 21:01
by tijnisfijn
What are you trying to do exactly maybe I can help you out?

Re: Wire circular connection lets instances grow but not shrink

Posted: Thu Dec 12, 2024 18:57
by DaCodaDragon
For context, I'm creating an OSC controlled score board for an event next year. Since we have 10 players, I need to have 10 titles, 10 scores, etc. To send them over using OSC I was designing a buffer that you can write into given a certain index. Sending data one by one, allows me to be flexible with the player count in case we want to re-use the patch. The instances correlate directly to the amount of players. It looked as follows:
Write buffer.png
With OSC, the request contains the index, and value, then the write trigger would write it in the correct location into the buffer. Once you were done with your write calls, you could use the "trigger send" to push the data for further processing. This works flawless, other than the fact that using a dummy buffer in the "Size in" would force the instance count to grow, but when we decrease the size, it wouldn't scale down.

To solve this, I've changed buffer into a normal wire buffer, which looks like this:
Wire buffer.png
Here we clear the buffer first, in case we have a previously failed attempt. Then we send all values, one by one, in order, until we filled the buffer up. And then send it out when we are certain we are done processing. The upside of this is that the buffer node has a exposed size inlet, the downside is that it requires a lot more back and forth between Wire and the control panel.

But eh, c'est la vie.