deleteSelected() issues

Hello,
Using the selectionManager, I noticed that the deleteSelected() method seems to be malfunctioning.

I have selected a track ( tracktion_engine::Track ) and then call the deleteSelected() method from the SelectionManager.
This method at the end it gets to the findClassFor(…) method :

SelectableClass* SelectableClass::findClassFor (const Selectable& s)
{
   #if ! JUCE_DEBUG
    for (auto cls : getAllSelectableClasses())
        if (auto c = cls->getClassForObject (&s))
            return c;
   #else
    SelectableClass* result = nullptr;

    for (auto cls : getAllSelectableClasses())
    {
        if (auto c = cls->getClassForObject (&s))
        {
            if (result == nullptr)
                result = c;
            else
                jassertfalse; // more than one SelectableClass thinks it applies to this object
        }
    }

    if (result != nullptr)
        return result;
   #endif

    return {};
}

But the getAllSelectableClasses() method always returns a null array and thus the deleteSelected()

void SelectionManager::deleteSelected()
{
    const juce::ScopedLock sl (lock);

    if (auto cls = getFirstSelectableClass())
        // use a local copy of the list, as it will change as things get deleted + deselected
        cls->deleteSelected (SelectableList (selected), false);
}

never enters the if condition.
Could anyone help me ?

I’ve created a class like this :

class SelectableTrackClass : public tracktion_engine::SelectableClass {
public:

    SelectableTrackClass() {}
    ~SelectableTrackClass() {}
    
    void deleteSelected(const SelectableList& list, bool partOfCutOperation) override {
        for (auto* elem : list) {
            if (auto* track = dynamic_cast<Track*>(elem)) {
                getEdit()->deleteTrack(track);
            }
        }
    }


};

and in the .cpp i’ve added static tracktion_engine::SelectableClass::ClassInstance<SelectableTrackClass, tracktion_engine::Track> selectableTrackClass;

In this way i’ve register my SelectableClass as well.

But i need to do this for each Selectable that Tracktion provides ? Such as clip,Track,Marker ecc… ?
It is not already done ? @dave96

Yes, that’s the correct way to do it. The reason this isn’t implemented in the Engine is that it’s very bespoke to your user interface. We have thousands of lines of code that do different logic depending on what is selected, modifier keys etc. This is all app logic that we didn’t want to hard code in to the Engine.