Not sure if this is a bug or intended behaviour.
If it’s intended behaviour could someone please explain to me why it’s happening?
Usecase
My usecase is a GUI where you select an object with the mouse, and then that connects a Channel with the object record data to an ImGUI UI where you can edit the attributes. The ImGUI is using the Select (ByPath) node to pass specific properties of the record as channels to individual ImGUI widgets.
Issue
When using the Select (ByPath) node and changing the input channel it seems to do something like subscribe to all channels that it has ever seen, and then copy the new object into the old channels before I’ve even triggered any SetValue behaviour.
I condensed the behaviour down to this patch.
ChannelTest4 SwitchingObjectPath.vl (27.5 KB)
I’m seeing this behaviour in
2021.4.12
2022.5.0-577
5.0-737
What’s going on here?
Workaround
Instead of using a single ImGUI instance and switching the input channel/model you can have each object have it’s own draw function with it’s own ImGUI instance. In that instance it’s attached to the internal channel of the object.
Or theoretically you could supply a single data model of all the objects as a channel, and to do selection update the path string at the select node to address the right object. I haven’t tried it though.