- Made it so that when a source is added or removed from a scene it
will add a reference to sourceSceneRefs (std::unordered_map). Each
source adds a reference to that every time they are added to a scene,
and releases a reference from it when they are removed from a scene.
When the value reaches 0, the source is no longer in any scenes, and
is then marked for removal and destroyed.
Before, I was using the source internal reference counter, which is a
really bad thing to do because I don't know what might actually be
referencing it. So using a separate discrete reference counter for
the number of scenes it's in is better in this case.
- Added an extra comment regarding source removal
- Made is so that when a scene item is removed from the sources list
box, it removes the item based upon the GetClientData rather than by
its string name. This is done because there may be duplicate sources
in a particular scene, and it's important to remove the right one.
- When the remove source tool icon is clicked, it will now remove the
source from the scene.
- Fixed a bug where the scene item removal callback would add the scene
item to the list instead of removing it.
- Changed AddSourcePopup to AddSourcePopupMenu. Name actually confused
me once despite being the writer, so it was clearly a bad name.
Sources can now be added to scenes via user interface. It's a little
convoluted because everything has to work through OBS signals to ensure
that plugins/etc can modify the scenes/sources exernally.
Also, when switching scenes, it will properly list sources for the
scene you changed to.