I stumbled across an issue with SuperController.GetAtomUIDs(). The implementation currently looks like this:
Since sortAtomUIDs seems to be always true, you might only get the visible atoms. However, this is called in cases where you would want ALL atoms. For example SuperController.RenameAtom() is calling this, which can result in sending the OLD list of atoms out to anyone listening to OnAtomUIDsChanged, because visibleAtomUIDs was not yet updated at that point.
Currently, in my plugin I came up with a workaround:
However, to allow us coders to keep our sanity, my suggestion would be to have GetAtomUIDs() just always return ALL atoms, either sortedAtomUIDs or atomUIDs. And then have a second method GetVisibleAtomUIDs() to make clear what you get.
@Acid Bubbles I think this is what is causing the issue with atom cloning in your Keybindings plugin
C#:
public List<string> GetAtomUIDs()
{
if (showHiddenAtoms)
{
return sortedAtomUIDs;
}
if (sortAtomUIDs)
{
return visibleAtomUIDs;
}
return atomUIDs;
}
Currently, in my plugin I came up with a workaround:
C#:
private List<string> GetAllAtomUIDs()
{
// working around VaM weirdness not returning hidden atoms
SuperController sc = SuperController.singleton;
bool wasSorted = sc.sortAtomUIDs;
sc.sortAtomUIDs = false;
List<string> atomUIDs = sc.GetAtomUIDs();
sc.sortAtomUIDs = wasSorted;
return atomUIDs;
}
However, to allow us coders to keep our sanity, my suggestion would be to have GetAtomUIDs() just always return ALL atoms, either sortedAtomUIDs or atomUIDs. And then have a second method GetVisibleAtomUIDs() to make clear what you get.
@Acid Bubbles I think this is what is causing the issue with atom cloning in your Keybindings plugin