Germano Cavalcante
d7f124f06f
Fix T102845: GPU python crash in background mode
...
`BPYGPU_IS_INIT_OR_ERROR_OBJ` is not implemented in all pygpu functions.
Instead of copying and pasting that call across the API when it has no
gpu context, override the methods with one that always reports error.
2022-11-29 13:55:46 -03:00
Campbell Barton
4eb9322eda
Cleanup: PyMethodDef formatting
...
Missed these changes in [0].
Also replace designated initializers in some C code, as it's not used
often and would need to be removed when converting to C++.
[0] e555ede626
2022-11-08 11:13:58 +11:00
Campbell Barton
4baa6e57bd
Cleanup: prefer 'arg' over 'params' for sphinx documentation
...
While both are supported, 'arg' is in more common use so prefer it.
2022-09-19 14:24:31 +10:00
Campbell Barton
57e4b6aefb
PyDoc: correct parameter doc-strings & exception message
2022-09-18 00:39:13 +10:00
Campbell Barton
982aea88e0
Cleanup: separate format-units for Python argument parsing
...
With the increased use of multi-character format units and keyword-only
arguments these are increasingly difficult to make sense of.
Split the string onto multiple lines, one per argument.
While verbose it's easier to understand and add new arguments.
2022-04-08 11:49:50 +10:00
Iyad Ahmed
fc259d4c30
Fix gpu.types.GPUTexture not passing data buffer to 3D textures
...
Missed in rB4430e8a00810ca8df2fa20029c4cb8078e8cdbe6
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D14333
2022-03-14 16:06:32 -03:00
Brecht Van Lommel
beaf2baeff
Cleanup: fix wrong spelling of texture and indentation
...
Contributed by luzpaz.
Ref D14271, D14270
2022-03-09 15:07:38 +01:00
Campbell Barton
c434782e3a
File headers: SPDX License migration
...
Use a shorter/simpler license convention, stops the header taking so
much space.
Follow the SPDX license specification: https://spdx.org/licenses
- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile
While most of the source tree has been included
- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
use different header conventions.
doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.
See P2788 for the script that automated these edits.
Reviewed By: brecht, mont29, sergey
Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton
c097c7b855
Cleanup: correct unbalanced doxygen groups
...
Also add groups in some files.
2021-12-14 16:17:10 +11:00
Xavier Cho
62d64bec2a
Docs: Fixes and improvements in API documentation
...
Fixes several notable mistakes and missing information
regarding the API documentation (*.rst).
This will allow API stub generators like bpystubgen or
fake-bpy-module to produce more accurate result.
Differential Revision: https://developer.blender.org/D12639
2021-10-22 18:27:16 -04:00
Campbell Barton
3c50687073
Fix gpu.types.GPUTexture crash when the size argument was too big
...
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-29 14:11:37 +10:00
Campbell Barton
58eacb8e7c
Cleanup: pass sizeof array element to PyC_AsArray
...
Replace the is_double argument which was only used for single/double
precision floats.
This allows supporting different sized int types more easily.
2021-07-27 22:36:01 +10:00
Campbell Barton
c3a400b73f
Cleanup: use single back-tick quoting in comments
...
While doxygen supports both, conform to our style guide.
Note that single back-tick's are already used in a majority of comments.
2021-07-20 22:58:14 +10:00
Germano Cavalcante
2b660e825b
Fix T88365: GPUTexture.read returning a buffer with wrong size
...
The pixel components were not being considered.
2021-05-18 10:01:29 -03:00
Campbell Barton
75536b5a61
Cleanup: compiler warnings
2021-05-01 00:49:55 +10:00
Germano Cavalcante
2bd9a28ff8
Cleanup: Rename #if GPU_USE_PY_REFERENCES to #ifndef GPU_NO_USE_PY_REFERENCES
...
This is safer for incremental build.
And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.
2021-04-30 11:20:39 -03:00
Germano Cavalcante
04b6296e81
Python GPU: Add reference of PyObject GPU object to the GPU object itself
...
Instead of creating different python wrappers for the same GPU object,
return the same `PyObject` created earlier.
This also allows for more secure access to existing GPU objects.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D11044
2021-04-30 10:42:13 -03:00
Germano Cavalcante
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
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
Germano Cavalcante
5be72125bf
Cleanup: Move some utilities to 'gpu_py.h'
2021-02-24 10:58:15 -03:00
Campbell Barton
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
Germano Cavalcante
89c79c3ed8
Cleanup: Abbreviate enums with 'UNSIGNED_' in the name
2021-02-17 12:38:21 -03:00
Germano Cavalcante
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
Germano Cavalcantemano-wii
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
Germano Cavalcantemano-wii
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