Commit Graph

5141 Commits

Author SHA1 Message Date
Campbell Barton
d592eb510e Cleanup: naming 2018-10-09 09:25:33 +11:00
Campbell Barton
d022794cad Cleanup: rename checks for Python struct strings
Using 'format' prefix made this read as if t was for string formatting.

Use 'PyC_StructFmt' prefix instead since these values are compatible
with formatting from Python's 'struct' module.
2018-10-08 08:37:32 +11:00
mano-wii
1fd1735df0 CPython: use format char utilities in idprop_py_api 2018-10-07 12:24:47 -03:00
mano-wii
af7967b010 CPython: py_capi_utils: format char utilities do not need to be inline. 2018-10-07 12:22:17 -03:00
mano-wii
91bfea5b05 CPython: py_capi_utils: use more descriptive names for format string utilities. 2018-10-07 12:21:09 -03:00
Campbell Barton
ee2e30683c Cleanup: style 2018-10-07 17:49:22 +11:00
mano-wii
495a7128cb Cleanup: use the naming convention in py_capi_utils
And use inline functions instead of preprocessor directives.
2018-10-06 01:15:15 -03:00
mano-wii
0f55334413 Cleanup: use new format string utility 2018-10-06 00:13:54 -03:00
mano-wii
98e62d459a py_capi_utils: add utilities for format string in struct module style syntax. 2018-10-06 00:13:40 -03:00
mano-wii
9bd65528e3 GPU Python: optionally init the vertexformat in the vertexbuffer itself. 2018-10-05 17:22:03 -03:00
mano-wii
550fee8eb6 GPU Python: use _PyArg_ParseTupleAndKeywordsFast. 2018-10-05 14:38:35 -03:00
mano-wii
eab00bf202 GPU Python: fix crash when calling batch.draw without passing a shader. 2018-10-05 11:55:17 -03:00
Jacques Lucke
564d37c4b6 Python API: new GPUVertFormat constructor and vbo.fill_attribute method
Reviewer: fclem

Differential Revision: https://developer.blender.org/D3760
2018-10-05 15:10:56 +02:00
mano-wii
c15439bcdc Cleanup: use PyModule_AddIntConstant 2018-10-04 23:53:57 -03:00
mano-wii
ee6c8be183 GPU Python: rename methods "shader_from_builtin" and "shader_code_from_builtin" to "from_builtin" and "code_from_builtin". 2018-10-04 13:51:21 -03:00
mano-wii
b183f57a9e GPU Python: Fix assert in PySequence_Fast_GET_SIZE 2018-10-04 13:49:06 -03:00
Campbell Barton
46eb050c9d Cleanup: remove single backtick quotes
This isn't valid RST.
2018-10-04 13:08:28 +10:00
mano-wii
ffa15f4b4a Python GPU: GPUBatch and GPUShader refactor.
The changes are:
- The shader now is passed as a parameter of the batch `draw` method (batch.draw(shader)). Since the batch always has to set a shader before drawing;
- The batch methods to specify a value to a uniform have been removed. Uniforms are parameters of the program (here called shader). If you change a uniform, it changes in all batchs that use the same program;
- New methods were added to set uniforms by the shader;
- The `batch.program_set_builtin` was removed. It is a duplicate of `program_set` but without a shader object. We need the shader object to configure the uniform;

Differential Revision: https://developer.blender.org/D3752
2018-10-03 23:34:27 -03:00
Campbell Barton
07d4580f64 Gizmo: support for gizmo-group properties
This allows gizmo groups to store properties in the tool.
This makes sense for gizmo options which only control gizmo display and
don't control operator execution.

Unlike similar kinds of properties,
this isn't accessible via the gizmo-group-type instance.

For now the it's only stored in the workspace tool as can be done for
operator properties, so each instance doesn't have different settings
which would be confusing from a user perspective and complicate access
from the top-bar.

Later we could add gizmo-group properties if needed.
2018-10-02 17:03:23 +10:00
mano-wii
3aed08377d GPY Python: program_use_begin and program_use_end.
The user has to be encouraged to use the `program_set` or `program_set_builtin` before drawing.
This avoids problem with gl_context.
2018-10-01 13:58:51 -03:00
Campbell Barton
8ee4fd0bdf Cleanup: style 2018-10-01 09:20:31 +10:00
Sebastian Parborg
a16e5b8efa Cleanup: remove unused DerivedMesh code.
Differential Revision: https://developer.blender.org/D3736
2018-09-27 20:19:28 +02:00
Campbell Barton
14e7fcfdde Cleanup: warnings 2018-09-27 21:15:55 +10:00
mano-wii
da96336e5f Python GPU module: Wrap GPUIndexBuf
Differential Revision D3714
2018-09-27 00:53:45 -03:00
mano-wii
1e647a570d Python GPU module: replace PyArg_ParseTupleAndKeywords by _PyArg_ParseTupleAndKeywordsFast
part of T47811 ("for faster argument parsing").
2018-09-27 00:22:57 -03:00
Campbell Barton
77b381bd35 Merge branch 'master' into blender2.8 2018-09-26 11:42:38 +10:00
Campbell Barton
63658ae76d Cleanup: redundant include 2018-09-26 10:55:22 +10:00
mano-wii
a6b125b06f Remove unused files 2018-09-24 14:50:20 -03:00
mano-wii
9682e43bf9 BGL: Wrap glBlitFramebuffer 2018-09-24 13:12:50 -03:00
mano-wii
4323ccfa6b GPU Python API: matrix.load_projection_matrix
If the `push_projection` and `pop_projection` functions already exist, there should naturally be a way to load a projection matrix.
2018-09-21 15:07:41 -03:00
Campbell Barton
08c7733c13 Cleanup: style 2018-09-21 08:11:50 +10:00
Dalai Felinto
fb88088203 Preserve the actively bound framebuffer after using gpu.offscreen
Otherwise we cannot draw anything after drawing in the offscreen buffer
2018-09-20 21:43:08 +00:00
Dalai Felinto
425cfdd5be GPU Python API: shader.uniform_float
The existing alternative is to use a buffer and call
uniform_vector_float which is overkill for such a simple operation.
2018-09-20 19:51:06 +00:00
Dalai Felinto
e316e41f84 Typo on pydoc for uniform_int 2018-09-20 19:49:08 +00:00
mano-wii
f0149bc070 gpu.batch module: keep shader reference in batch. 2018-09-20 16:38:43 -03:00
mano-wii
9fb9604c19 gpu.shader module: Do not free builtin shaders. 2018-09-20 15:21:59 -03:00
mano-wii
9c2dc808ce gpu.shader.builtin module: Add GPU_SHADER_2D_IMAGE. 2018-09-20 13:55:43 -03:00
Campbell Barton
e4c53d9163 Missing from last commit 2018-09-20 14:57:01 +10:00
Campbell Barton
e228574417 PyAPI: correct term for class property warning 2018-09-20 14:55:07 +10:00
Brecht Van Lommel
6b433f4eb3 Merge branch 'master' into blender2.8 2018-09-19 18:20:50 +02:00
Brecht Van Lommel
a4f2ebc78d Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3700
2018-09-19 18:18:05 +02:00
Campbell Barton
bb3ec3ebaf BLI_utildefines: rename pointer conversion macros
Terms get/set don't make much sense when casting values.

Name macros so the conversion is obvious,
use common prefix for easier completion.

- GET_INT_FROM_POINTER  -> POINTER_AS_INT
- SET_INT_IN_POINTER    -> POINTER_FROM_INT
- GET_UINT_FROM_POINTER -> POINTER_AS_UINT
- SET_UINT_IN_POINTER   -> POINTER_FROM_UINT
2018-09-19 12:12:21 +10:00
Campbell Barton
f35e9f047a Merge branch 'master' into blender2.8 2018-09-19 12:14:36 +10:00
Alexander Gavrilov
8c87e681a5 Fix driver expression bytecode validation crash if parsing fails.
Another NULL pointer access: nothing to validate if it already failed.
2018-09-16 10:46:28 +03:00
Alexander Gavrilov
9901679ce8 Fix a crash when a driver expression evaluates to NaN.
The debug logging statement was accessing a NULL pointer.
Also happens in 2.79.
2018-09-16 09:06:57 +03:00
Campbell Barton
83d4328ce7 PyDoc: add gpu.shader
Also some syntax corrections.
2018-09-15 10:35:03 +10:00
mano-wii
1287965089 GPU module: Initial implementation of the gpu.shader submodule.
Differential Revision: https://developer.blender.org/D3688
2018-09-14 09:46:19 -03:00
Campbell Barton
09aa446100 Merge branch 'master' into blender2.8 2018-09-13 20:15:18 +10:00
Campbell Barton
254067106e PyAPI: remove operator methods that leak memory 2018-09-13 20:10:56 +10:00
Campbell Barton
aacdd28edd PyDoc: add bpy.app.icons to docs 2018-09-13 19:21:08 +10:00