Join the python modules gpu and _gpu into one.

Maybe it's still early to set the new drawing api for python.
But joining these two modules is an initial step.

```
>>> gpu.
        matrix
        select
        types
```
```
>>> gpu.types.GPU
                 Batch(
                 OffScreen(
                 VertBuf(
                 VertFormat(
```
The creation of a new offscreen object is now done by the `GPUOffscreen.__new__` method.

Reviewers: campbellbarton, dfelinto

Reviewed By: campbellbarton, dfelinto

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3667
This commit is contained in:
2018-09-05 21:10:42 -03:00
parent b060248324
commit 6d04e48539
22 changed files with 1726 additions and 1000 deletions

View File

@@ -42,7 +42,7 @@ class OffScreenDraw(bpy.types.Operator):
aspect_ratio = scene.render.resolution_x / scene.render.resolution_y
try:
offscreen = gpu.offscreen.new(512, int(512 / aspect_ratio))
offscreen = gpu.types.GPUOffScreen(512, int(512 / aspect_ratio))
except Exception as e:
print(e)
offscreen = None
@@ -52,7 +52,7 @@ class OffScreenDraw(bpy.types.Operator):
@staticmethod
def _update_offscreen(context, offscreen):
scene = context.scene
render_layer = context.render_layer
view_layer = context.view_layer
render = scene.render
camera = scene.camera

View File

@@ -1,20 +0,0 @@
*******************
GPU functions (gpu)
*******************
.. module:: gpu
Functions for GPU offscreen rendering, matrix stacks and selection.
Submodules:
.. toctree::
:maxdepth: 1
gpu.offscreen.rst
Intro
=====
Module to provide functions concerning the GPU implementation in Blender.

View File

@@ -235,7 +235,9 @@ else:
"bpy.utils.previews",
"bpy_extras",
"gpu",
"gpu.offscreen",
"gpu.types",
"gpu.matrix",
"gpu.select",
"idprop.types",
"mathutils",
"mathutils.bvhtree",
@@ -1822,7 +1824,10 @@ def write_rst_importable_modules(basepath):
# C_modules
"aud": "Audio System",
"blf": "Font Drawing",
"gpu.offscreen": "GPU Off-Screen Buffer",
"gpu": "GPU Shader Module",
"gpu.types": "GPU Types",
"gpu.matrix": "GPU Matrix",
"gpu.select": "GPU Select",
"bmesh": "BMesh Module",
"bmesh.types": "BMesh Types",
"bmesh.utils": "BMesh Utilities",
@@ -1865,7 +1870,6 @@ def copy_handwritten_rsts(basepath):
# TODO put this docs in Blender's code and use import as per modules above
handwritten_modules = [
"bgl", # "Blender OpenGl wrapper"
"gpu", # "GPU Shader Module"
"bmesh.ops", # generated by rst_from_bmesh_opdefines.py
# includes...