It does add the item. But then I have to click back on the app window and I have it set to deselect when clicked anywhere else. Therefore it’s impossible to do anything with this.
Do I have to create SelectableClass or something? I’d rather do anything to make it work properly without assertions. At this point this is the biggest stopping point in development that I have.
What I’m getting at is that we should probably just remove that assertion if you don’t have any SelectableClasses registered. It’s really there to catch the cases where we add a new type of Selectable but don’t implement a SelectableClass for it.
If you just comment out that assertion locally for now it should ok?
Okay, I commented it out. I hope it won’t break anything internally.
I just not fully understand the purpose of SelectableClasses. What If I want to do the same action on all selected clips, is it possible without SelectableClass? E. g. change their position or fades?
You can write a function that does that to an Array<Clip*> if you need. Or you could write a SelectableClass subclass that has some kind of method to do that (in Waveform we have that).
That’s all very app specific though which is why it’s not in the Engine.
class SelectableClipClass : public te::SelectableClass
{
public:
;
And I click on myClipComponent (not the SelectableClipClass) to select its te::Clip* (not the component): editViewState.selectionManager.selectOnly(clip.get());
How do I use my SelectableClass here?
P.S. Sorry if I’m asking too much basic questions, I’m just struggling to figure out how it all works.
Does my ClipComponent or whatever I’m going to perform group actions on have to inherit from Selectable. How does SelectableClass::findClassFor() knows what to retrieve SelectableClipClass. Is this where Selectable comes in place?
Oh, you might need to be using the tracktion_engine namespace for that macro to work.
Can you try adding using namespace tracktion_engine above it?
If that does compile, you might want to create your own macro that has the namespace in it explicitly to avoid polluting your own.
This is all done with template magic. There was actually an error in the macro I mentioned earlier, if your naming scheme is different from WaveAudioClip -> WaveAudioClipClass you’ll need to use this macro:
Then once you select an object of type tracktion_engine::Clip it SelectableClass::findClassFor will return the SelectableClipClass instance you registered with it.
Compilers throws a bunch of errors like: error C2653: 'SelectableClass': is not a class or namespace name (compiling source file ..\..\Source\Main.cpp) error C2143: syntax error: missing ';' before '<' (compiling source file ..\..\Source\Main.cpp)
etc.