Page MenuHome

Python API (parent task)
Open, Confirmed, MediumPublic

Description

Python API tasks for the 2.80 release.

Documentation

  • Gizmo and tool API
  • Object mode operator working on selected, visible, editable objects
  • Mesh edit mode operator working on multiple objects.

Missing APIs

Note: this won't be done for 2.80!

Details

Type
To Do

Event Timeline

Brecht Van Lommel (brecht) triaged this task as Normal priority.

About the Draw API:

  • I'll add more documentation for GPUVertBuf, GPUVertFormat and GPUIndexBuf. They are not needed in many cases though.
  • I have no idea what gpu.select is useful for. So I can't really help documenting it right now. Maybe we should just leave this module private for now.
  • Personally I find it a bit confusing to use the gpu.matrix module. It's unclear to me what I depend on when I use it. Unfortunately the module has to be used when you want to use the builtin shaders. I'd expect that Blender can derive the view/projection matrix from the context I just have to provide the model matrix. Not sure what's the best way to handle it.
  • Maybe gpu.shader could be merged with gpu.types.GPUShader? Ideally it would have something like this: gpu.types.GPUShader.FromBuiltin(...), shader.vertexcode, shader.fragcode and shader.geocode. This also means that we'd have to store the source code for user defined shaders, but that would not be too bad imo.
  • I'm waiting for one thing to get merged (namely D3918) and then I'll make a new, probably a bit shorter example for GPUOffScreen and put it on the main gpu module page. Personally I think large examples a the one currently provided are not useful because they 1) make it look way too hard and 2) force developers to strip away a lot of code to understand what is actually required to get it working.
  • I agree that it would be cool to have batch_for_shader in the gpu module directly but it feels like I'm not in a position to make that decision.
Brecht Van Lommel (brecht) raised the priority of this task from Normal to Confirmed, High.
Brecht Van Lommel (brecht) lowered the priority of this task from Confirmed, High to Confirmed, Medium.

It seems gpu.10.py is working fine, there was also a bugfix related to this recently.

It would be good if we could improve our Python API docs still, but I think everything that must be done for the release is ready now.