How to add a color highlight or marker in the timeline from a package?

I’d like to have a marker or visual hint in the timeline for the frames where annotations exist. What can I do from a package to implement such a feature?

I noticed there’s also a ‘mark frame’ command however that also doesn’t seem to show any visual clue in the UI:

import rv
rv.commands.markFrame(rv.commands.frame(), True)

The MU Command API Browser shows a Configuration.tlMarkedColor which seems to hint that something marked might be tinted a specific color - which it doesn’t seem to do?

Anyway, what approaches are there to implement custom markers for the timeline from a Python package? (or if required for it, from a Mu package)

1 Like

I’m not entirely sure what failed me earlier today, but I wanted to remark that the code snippet I posted does work to generate little markers in the timeline. Like this:

afbeelding

This is where the default Timeline.mu marked frame rendering logic is.

However, I’m wondering whether a separate package can be defined that can render over this. I’d still love to be able to draw an overlay with custom markers on top based on some other settings.

1 Like

So from a Python MinorMode instance I can implement the render method to do some custom OpenGL rendering that renders over the view (and that is also the timeline).

However, to find the right locations for the timeline I need access to the Timeline Widget’s renderLocations method.

I tried this:

from pymu import MuSymbol
fn = MuSymbol("timeline.Timeline.renderLocations")
locations = fn(event)

However, it seems it requires an extra argument which is likely the timeline instance as first argument. This should be available on the State as timeline but I’m not sure how to access that state correctly.

The behavior I’m looking for is similar to what motion_scope.py does by getting the timeline widget, e.g. from state and then using that instance to get the renderLocations for my render event drawing.

I can get the timeline widget in Mu through Python like this:

import rv.runtime

result = rv.runtime.eval("""{
State state = data();
state.timeline;
}""", ["commands", "rvtypes"])

print(result)
# rvtypes.Widget {true, "timeline", nil, nil, false, false, false, nil, 0.0, 0.0, 1024.0, 33.0, <0, 0>, false, false, false, nil, 3}

But runtime eval returns strings and not the required dictionary of the class to be able to pass it to renderLocations?

Any pointers on how to do this through Python?