Editing grease objects with python?

So, I am trying to draw 3D lines for custom widgets in python using bgl module.
But that’s painful, I can’t get nothing about how that module or how opengl works.

I thought a easier way would be to draw grease pencil lines and controll them though python, would look almost natural.

But that effort will be useless if 2.8 dont have an api for grease pencil…

So, There are plans to have python-acessible grease pencil in 2.8?

Could you clarify exactly what you mean by 2.8 not having an API for Grease Pencil? All the RNA-based access that could be used in the past can still be used now (* with a few minor tweaks). If there are any methods in particular that worked before but are not working/insufficient now, let us know so that this can be rectified.

To get you started, here are some tips:

  • Use the “Data API” mode in the Outliner to poke around and get a feel for the structure of Blender’s internal data structures (as exposed via RNA). You can basically use whatever insights you gain here to put together the necessary access to Grease Pencil data
  • Remember that there’s now “Grease Pencil objects” and “Annotations”. The way you access the data for each of these depends heavily on what you’re trying to do
    • If you’re using “Grease Pencil Objects” - do something like
      ob = bpy.data.objects["3D Widget GP Object"]
      gp_data = ob.data
    • If you’re using “Annotations” - do something like
      gp_data = bpy.context.scene.grease_pencil
  • Once you have access to the Grease Pencil datablock, then you can access by the data by going through the layers -> frames -> strokes hierarchy. For example:
    for layer in gp_data.layers:
        for frame in gp_data.frames:
            for stroke in gp_data.strokes:
                ... do stuff with stroke ...

Hope that helps you get started with this.