3f47df577d
Cleanup: use new BLI_assert_unreachable macro
2021-03-24 12:38:08 +11:00
b71b1ae384
Python GPU: Improve the Python GPU API documentation
...
This fixes some errors of continuity and consistency of formatting on
https://docs.blender.org/api/current/gpu.html
This also details the description of some parameters.
Differential Revision: https://developer.blender.org/D10531
2021-03-16 12:48:39 -03:00
242a278b56
Cleanup: rename offs to offscreen
2021-03-08 14:40:57 +11:00
39b86a989d
Cleanup: use const arrays
2021-03-04 16:58:03 +11:00
a40ccde405
Fix logic for calling PyObject_GC_UnTrack
...
All tracked objects need a matching un-track,
also remove redundant Py_XDECREF call.
2021-03-04 15:18:10 +11:00
Germano Cavalcante
6c6b1c015c
GPU Python: Implement gpu.texture.from_image
...
It can be useful to replace `image.bindcode` and `image.gl_load`.
Used for example in https://docs.blender.org/api/current/gpu.html#d-image
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D10458
2021-03-01 17:38:57 -03:00
5be72125bf
Cleanup: Move some utilities to 'gpu_py.h'
2021-02-24 10:58:15 -03:00
Germano Cavalcante
086d70e910
GPU Python: Use 'PyC_ParseStringEnum' to parse items
...
Currently the GPU module for python has different ways to handle enums.
- Organizing items in `PyC_StringEnumItems` arrays and parsing them with `PyC_ParseStringEnum`.
- Using dedicated functions for each type of enum (`bpygpu_ParsePrimType`, `pygpu_ParseVertCompType` and `pygpu_ParseVertFetchMode`).
Although apparently more efficient (especially `pygpu_ParseVertCompType`
which transforms strings into integers for simple comparison), these
dedicated functions duplicate functionality, increase the complexity of
the code and consequently make it less readable.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D10456
2021-02-22 08:35:52 -03:00
73f4dfa3c5
Cleanup: Clang tidy else after return
2021-02-18 13:58:27 -06:00
7e11595364
Cleanup: clang-format
2021-02-19 02:19:53 +11:00
e79916eb47
Cleanup: order shape_len after shape argument
...
This matches nearly all other argument ordering in Blender,
including Python mathutils API.
2021-02-19 02:19:53 +11:00
10a54bbd06
Cleanup: spelling, correct doc-string arguments
2021-02-19 02:19:53 +11:00
a7750f95b9
GPU Python: Rename 'uniform_buffer' to 'uniform_block'
...
From the the opengl wiki:
> Buffer objects are associated with a program's uniform block similarly to the way that texture objects are associated with sampler uniforms.
2021-02-17 13:23:35 -03:00
89c79c3ed8
Cleanup: Abbreviate enums with 'UNSIGNED_' in the name
2021-02-17 12:38:21 -03:00
4430e8a008
Python: gpu module: add new submodules and types
...
This commit extends the gpu python API with:
```
gpu.types.Buffer #"__init__", "to_list"
gpu.types.GPUTexture #"__init__", "clear", "read", "format"
gpu.types.GPUFrameBuffer #"__init__", "bind", "clear", "is_bound", "viewport", ("__enter__", "__exit__" with "GPUFrameBufferStackContext")
gpu.types.GPUUniformBuf #"__init__", "update"
gpu.state #"blend_set", "blend_get", "depth_test_set", "depth_test_get", "depth_mask_set", "depth_mask_get", "viewport_set", "viewport_get", "line_width_set", "line_width_get", "point_size_set", "color_mask_set", "face_culling_set", "front_facing_set", "program_point_size_set"
```
Add these methods to existing objects:
```
gpu.types.GPUShader #"uniform_sample", "uniform_buffer"
```
Maniphest Tasks: T80481
Differential Revision: https://developer.blender.org/D8826
2021-02-17 12:27:19 -03:00
b7e1660d40
Cleanup: Use 'pygpu_' prefix in the cpython GPU module
...
`py_` prefix can be confused with the Python's own API's.
2021-02-17 10:38:59 -03:00
dae445d94a
Fix T85573: Building with Python 3.10a5 fails
...
Replace deprecated _PyUnicode_AsString{AndSize} usage.
T83626 still needs to be resolved before 3.10 is usable.
2021-02-13 23:09:55 +11:00
aa43e2ec29
PyAPI: use PyModule_AddType utility function
2021-02-12 08:08:16 +11:00
ed817d62bd
Cleanup: Python GPU: Use consistent prefixes for local API
...
It was not following the own documentation at the top code that mentions
that for local API the prefix is "bpygpu_".
2021-02-11 16:13:02 -03:00
d9eeb7840f
Merge branch 'blender-v2.92-release'
2021-02-10 13:30:07 +01:00
97cc130f47
Fix T85395: Texture paint external edit wrong projection on reapply
...
Caused by rB5b34d11b55e0.
Above commit restored the view matrices in ED_view3d_draw_offscreen
_before_ they can be stored in the ImBuff (see ED_view3d_draw_offscreen
/ texture_paint_image_from_view_exec).
Now make restoring the view matrices optional and dont do this in case
of reprojection, so the used matrices can still be saved in the ImBuff
later.
Reviewed By: campbellbarton
Maniphest Tasks: T85395
Differential Revision: https://developer.blender.org/D10331
2021-02-10 13:25:31 +01:00
4895d1f9ce
Cleanup: replace '_imp' function suffix with '_impl'
...
Use the more common abbreviation for `implementation`.
2021-02-04 13:10:29 +11:00
b10fac0432
Docs: Remove wrong debug flag info
...
Removed the `--debug-gpu-shaders` argument in bc94036a76
but forgot to amend
these changes.
2021-01-31 15:53:09 +01:00
ea01c8c5f6
Fix T84402: Off-screen rendering works only once from Python
...
Off-screen drawing doesn't work once the 'bgl' workaround is enabled.
Disable this for off-screen drawing.
2021-01-27 20:23:00 +11:00
af88d23ffa
Revert "Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask"
...
This reverts commit 9db3d1951d
.
This was an accidental commit of the patch D8826
2021-01-10 21:07:04 -03:00
9db3d1951d
Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask
2021-01-10 19:01:53 -03:00
ba83ad226d
Fix error in recent commit
...
Introduced in rBcada56b1f72f537f9ab007cfafd430ac10c292fb
2020-12-11 17:54:27 -03:00
bbd7f94d8a
Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions
2020-12-11 16:06:22 -03:00
cada56b1f7
Cleanup: GPU Python: Use 'PyC_ParseStringEnum' for string enum
2020-12-11 16:06:22 -03:00
5b34d11b55
Fix add-object tools cursor distorted drawing on save
...
Generating the thumbnail left the view matrices set to values
that couldn't be used for cursor drawing.
Backup/restore the matrices for off-screen drawing.
2020-11-20 12:15:04 +11:00
219c3aa653
Cleanup: remove unused perspective argument to off-screen drawing
...
Some callers were passing in dummy values, this can be accessed from
`RegionView3D.is_persp` can be used to check this.
2020-11-20 12:14:50 +11:00
YimingWu
b35b8c8849
Adding 3D_POLYLINE_UNIFORM_COLOR to PyGPU shader API
...
This would allow python script to access `lineWidth` uniform when drawing lines
without using `glLineWidth`.
Reviewed By: Jeroen Bakker
Differential Revision: https://developer.blender.org/D9518
2020-11-13 08:23:04 +01:00
72335d5e89
Pydoc: Move builtin GPU shader information to code
...
This fixes a compile warning for sphinx.
This commit includes some reformating of the information.
2020-10-11 18:21:28 -04:00
1b575cbb75
Cleanup: Pydoc strings
2020-10-11 18:19:42 -04:00
05710171cb
PyDoc: resolve duplicate module warnings
...
Remove submodule listings from the module docstring,
as this information already exists in the generator.
2020-10-09 12:11:00 +11:00
nutti
db346ac2cd
API Docs: Fix corrupted document of gpu.select.load_id
...
The Python API document of gpu.select.load_id does not follow rst format.
c.f. https://docs.blender.org/api/current/gpu.select.html
This patch fixes it.
Reviewed By: Blendify
Differential Revision: https://developer.blender.org/D8547
2020-09-29 15:50:49 -04:00
fe5efccd8f
GPUOffscreen: Push the GL state before and after binding
...
This avoids wrong viewport and scissor bounds with BGL commands.
2020-09-12 17:34:51 +02:00
d023c4104c
Cleanup: spelling, correct comments
2020-09-11 14:57:27 +10:00
7ffff04e49
GPUVertBuf: Make GPUVertBuf private to the GPU module
...
This is just a cleanup to isolate the internals of the vertbuf.
This adds some getters to avoid refactor of existing code.
2020-09-06 22:13:06 +02:00
84d67bd0a9
Cleanup: GPU: Rename GPU_element to GPU_index_buffer
...
Makes it follow the functions names.
2020-09-06 22:13:06 +02:00
2115232a16
Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fix
...
No functional changes
2020-09-04 21:04:16 +02:00
3bc09c1c1e
Cleanup: split BKE_scene_get_depsgraph()
into two functions
...
Split the depsgraph allocation into a separate function
`BKE_scene_ensure_depsgraph()`. Parameters are only passed to those
functions that actually need them. This removes the the "if that boolean
is `false` this pointer is allowed to be `NULL`" logic and more cleanly
decouples code.
No functional changes.
2020-08-21 12:23:13 +02:00
efa7aaa97f
Cleanup: use const variables where possible in the Python API
2020-08-20 16:10:13 +10:00
216d78687d
GPUShader: GL backend isolation
2020-08-18 21:30:09 +02:00
854c999d82
GPUShader: Change shader state tracking to be part of the GPUContext
...
This remove the use of batch->program and replace it with batch->shader.
This will allow GL abstraction latter.
2020-08-13 14:20:23 +02:00
3d48d99647
Cleanup: Python, Clang-Tidy else-after-return fixes
...
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/python` module.
No functional changes.
2020-08-07 13:38:07 +02:00
7283e6fb73
Merge branch 'blender-v2.90-release' into master
2020-08-07 10:04:57 +02:00
91694b9b58
Code Style: use "#pragma once" in source directory
...
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.
This patch has been generated by P1561 followed by `make format`.
Differential Revision: https://developer.blender.org/D8466
2020-08-07 09:50:34 +02:00
901ee66ea1
Cleanup: use term init instead of initialize/initialise
...
The abbreviation 'init' is brief, unambiguous and already used
in thousands of places, also initialize is often accidentally
written with British spelling.
2020-08-01 13:51:05 +10:00
19175f4757
GPUBatch & GPUImmediate: Use GPUShader instead of using raw OGL handle
2020-07-30 13:28:50 +02:00