After countless failed attempts at trying to get a working template_curve_mapping, I have deemed it as inferior and broken, and decided to try my hand at a raw attempt with bgl, using an invisible operator button to capture the mouse events.

I've gotten the operator button positioned and sized how I want it, but now I need to draw the graph, and can't seem to figure out how to get the button's orientation and size (x,y,w,h).

Does anyone know how I could obtain those values from the Panel.draw context??
(the Operator.draw context is never invoked from the panel)

  • 3
    $\begingroup$ I understand there may be other reasons for you to ask this question (like if it's a limitation with what blender allows you to do), but wouldn't it simpler to ask about how to get template_curve_mapping working instead of asking about how to get your workaround to work? $\endgroup$ Oct 12, 2017 at 13:46
  • $\begingroup$ (+1) Not really, due to how I had to manage a dummy grease pencil brush where I was getting the CurveMapping I was initially using from (since there isn't a CurveMappingProperty type)... The problem I was having with it was the changes made in the template weren't being applied to the CurveMapping. With my workaround, there's no dummy data, only an array of points I initially had to work with anyways, which is added in the initial PropertyGroup I'm working with. So really, this work-around is actually easier. $\endgroup$
    – Tcll
    Oct 12, 2017 at 14:38
  • $\begingroup$ @RayMairlot not related: I'm not asking how to use a template_curve_mapping, I'm asking how to get coordinates so I can write my own with bgl. $\endgroup$
    – Tcll
    Oct 12, 2017 at 14:52


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.