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?