Add virtual keyword for timeToX and XtoTime

Hi, I was overriding the curve editor class and I’d like to ask you if it should be possible add “virtual” keyword to functions:

timeToX(double time)
xToTime(double /*(here not should be better float?) */ x)

I know they are already implemented, but for example the conversion from x to time and viceversa in my program is totally different and can be modified if the user changes the playhead speed (that can be variable or constant).

Let me know and thank you in advance.

Possibly… I’m a bit loathed to add that at the moment as I don’t know if there’s anything else in that class that assumes a linear mapping between time and distance.

Does changing those methods to virtual work for you?

If you’ve got an implementation that varies a lot from from our CurveEditor, does simply copying the class work for you?

1 Like

Yes, it works, I’ll send you an example (maybe a private video) to show it.
Anyway marking it virtual (not pure virtual) does not should raise problems, isn’t it?

There’s lots of threads on this forum about why simply making functions virtual is generally a bad idea. The TL;DR is that it blocks library implementers from changing implementation details which really makes things hard to maintain in the future.

1 Like