Commit Graph

6890 Commits

Author SHA1 Message Date
Jeroen Bakker
588087f88e Fix #131943: GPU: Vertex formats for polyline shaders
PR #129315 refactored polylines. The shaders now attaches the vertex
attributes as SSBOs. Adding a workaround for polyline shaders to
extract the correct vertex formats when called via Python.

Pull Request: https://projects.blender.org/blender/blender/pulls/132689
2025-01-06 16:05:50 +01:00
Jeroen Bakker
c2b8186b07 Fix #132590: Python/GPU: Builtin clipped shaders messages
Confusing error messages are printed when requesting a clipped builtin
shader via Python that does not exist.

This PR will remove the confusion of the messaging:
- Replaced BLI_assert_unreachable with an assert as it is reachable
  code.
- Adding clipped configuration for POLYLINE_UNIFORM_COLOR

Pull Request: https://projects.blender.org/blender/blender/pulls/132686
2025-01-06 15:42:07 +01:00
nutti
313f3ecf98 PyDoc: correct CollectionProperty & PointerProperty type in Python docs
Ref: !132420
2025-01-06 20:29:29 +11:00
nutti
10e3e3b4a0 PyDoc: add bpy_prop_collection_idprop class document
Ref: !132587
2025-01-06 20:29:29 +11:00
Campbell Barton
5f640457d8 Cleanup: suppress various pylint warnings 2025-01-04 21:17:29 +11:00
Campbell Barton
4c852d5566 Fix #131195: Crash with PyDrivers after canceling extensions update
Rendering a scene with py-drivers would crash after dropping an
extension onto Blender's window then canceling before the update
completed.

This was caused by context.temp_override pushing arguments into the
context but failing to pop them in the case of an error - which would
happen when the popup was closed while the update ran.
2025-01-04 19:09:54 +11:00
Campbell Barton
9363ad59b0 Fix #132615: Memory leak calling context.temp_override()
ContextTempOverride objects were not freeing the reference to their
arguments when the context managers __exit__ didn't run.

This would happen if __enter__ failed with an unsupported configuration
or if object was created and not used.

Resolve by making ContextTempOverride a container type with GC support.

This also allows the ContextTempOverride to be reused since it's
arguments are now cleared when it's deallocated instead of __exit__.
2025-01-04 19:09:53 +11:00
Campbell Barton
535b26d436 Cleanup: remove "__tp" from function names in bpy_rna_context
This convention seems strange and doesn't help with readability/clarity.
2025-01-04 16:32:04 +11:00
Campbell Barton
d2d754be3f Cleanup: spelling in comments (make check_spelling*)
- Back-tick quote math expressions so differentiate them
  from English.
- Use doxygen code blocks for TEX expressions.
2025-01-04 16:26:39 +11:00
Ray Molenkamp
5783950ac5 Revert: 0dc484f9cc bf_rna modernisation
This caused build errors on the docs builder, I can't seem to reproduce
locally, so revert for now and have another look at some point in the
future.

Sadly as these changes usually go, this took 5c515e26bb and
2f0fc7fc9f with it as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/132559
2025-01-02 19:56:24 +01:00
Campbell Barton
5c515e26bb Cleanup: remove trailing space, ensure a newline at EOF 2025-01-02 15:11:18 +11:00
Ray Molenkamp
0dc484f9cc Cleanup: CMake: Modernize bf_rna dependencies
Pretty straightforward

- Remove any bf_rna paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132413
2024-12-31 18:23:25 +01:00
Ray Molenkamp
a0d9826b3c Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132336
2024-12-25 23:32:15 +01:00
Ray Molenkamp
a23aab3ddc Cleanup: CMake: Modernize bf_blenloader dependencies
Pretty straightforward

- Remove any bf_blenloader paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132334
2024-12-25 18:40:41 +01:00
Ray Molenkamp
c331c6b50e Cleanup: CMake: Modernize bf_blentranslation dependencies
Pretty straightforward

- Remove any bf_blentranslation paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132311
2024-12-25 17:40:25 +01:00
Ray Molenkamp
54604efdfd Cleanup: CMake: Modernize bf_windowmanager dependencies
Pretty straightforward

- Remove any bf_windowmanager paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132310
2024-12-24 22:40:38 +01:00
Ray Molenkamp
b7407aabb5 Cleanup: CMake: Modernize bf_gpu dependencies
Pretty straightforward

- Remove any bf_gpu paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132286
2024-12-23 21:38:19 +01:00
Ray Molenkamp
a7c39896c6 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any bf_blenkernel paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132282
2024-12-23 20:08:37 +01:00
Ray Molenkamp
2992c63bc3 Cleanup: CMake: Modernize bf_bmesh dependencies
Pretty straightforward

- Remove any bf_bmesh paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132203
2024-12-23 17:47:25 +01:00
Andrej730
406fe689fd PyDocs: Fix Vector.angle_signed signature
From the current signature it appears as `fallback` argument is not
optional. Changed it to have a default `None` value, similar to
`angle(other, fallback=None)`.

Noticed this issue working with fake-bpy-module that generates typing
based on Blender docs - https://github.com/nutti/fake-bpy-module/issues/326.

Pull Request: https://projects.blender.org/blender/blender/pulls/132052
2024-12-23 02:57:06 +01:00
Sean Kim
d05a359946 Cleanup: make format
Missed in 5d0dfd6f5a.
2024-12-22 15:02:02 -05:00
Andrej730
5d0dfd6f5a Doc: Add info about IDProperty Pointers not supporting Embedded IDs.
This was lacking in API documentation so far, and was source of confusion, see e.g. #129393.

Pull Request: https://projects.blender.org/blender/blender/pulls/132218
2024-12-22 18:17:12 +01:00
Hans Goudey
bcfe4c34da Cleanup: Move BVH utils to C++ namespace 2024-12-19 18:22:29 +01:00
Andrej730
149ab6a7c4 PyDoc: bpy.props typing fixes and clarification note to PointerProperty.poll
1) Typing fixes for vector properties (similar to !131855)
2) More specific type for PointerProperty.poll since it's only called if type is ID.
3) Added a note to PointerProperty.poll that it's only checked when property is assigned from the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/131925
2024-12-18 10:38:29 +01:00
Hans Goudey
31964ef5ca Cleanup: Move BLI_kdopbvh to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/132031
2024-12-17 21:04:55 +01:00
Andrej730
6d555ac2a7 PyDoc: typing fix for Vector.to_tuple
Ref: !131855
2024-12-14 15:36:29 +11:00
Sybren A. Stüvel
efd2e762f7 Refactor: Core, give the IDWALK_CB_… enum an explicit name
Give the `IDWALK_CB_…` enum an explicit name:
`LibraryForeachIDCallbackFlag`. This way the flags are type-safe, and
it's known where values come from. This is much preferred (at least by
me) to just having `int flags`.

Uses of `0` have been replaced with `IDWALK_CB_NOP` as that has the same
value and is of the right type.

One invalid use of `IDWALK_NOP` was detected by this change, and is
replaced by `IDWALK_CB_NOP`.

This change might be incomplete; I gave the enum a name, fixed the
compiler errors, and then also updated assignments like `int cb_flag =
cb_data->cb_flag`. I might have missed some assignments to `int` though.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131865
2024-12-13 17:32:24 +01:00
Sybren A. Stüvel
8dd1eb4e8f Refactor: Core, give the IDWALK_… enum an explicit name
Give the `IDWALK_…` enum an explicit name: `LibraryForeachIDFlag`. This way
the flags are type-safe, and it's known where values come from. This is
much preferred (at least by me) to just having `int flags`.

Uses of `0` have been replaced with `IDWALK_NOP` as that has the same value
and is of the right type.

One invalid use of `IDWALK_CB_NOP` was detected by this change, and is
replaced by `IDWALK_NOP`.

This change might be incomplete; I gave the enum a name, and then fixed
the compiler errors.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131865
2024-12-13 17:32:24 +01:00
Aras Pranckevicius
7e7f4f0cee Cleanup: Remove WITH_COMPOSITOR_CPU option (compositor is always in)
Compositor is a required feature and parts of it have been always
included anyway. Remove WITH_COMPOSITOR_CPU build option.

Pull Request: https://projects.blender.org/blender/blender/pulls/131838
2024-12-13 14:54:19 +01:00
Sybren A. Stüvel
7d5143e94c Revert "Refactor: Core, give the IDWALK_… enums an explicit name"
This reverts commit 3ef748789d. It was
landed too hastily, my apologies.

Pull Request: https://projects.blender.org/blender/blender/pulls/131813
2024-12-12 20:03:27 +01:00
Sybren A. Stüvel
3ef748789d Refactor: Core, give the IDWALK_… enums an explicit name
Two commits that basically do the same thing for two `enum`s: give
them a name.

- the `IDWALK_…` enum → `LibraryForeachIDFlag`.
- the `IDWALK_CB_…` enum → `LibraryForeachIDCallbackFlag`.

This way the flags are type-safe, and it's known where values come
from. This is much preferred (at least by me) to just having `int
flags`.

Uses of `0` have been replaced with `IDWALK_NOP` and `IDWALK_CB_NOP`,
as those have the same value and are of the right type.

One invalid use of `IDWALK_NOP` was detected by this change, and is
replaced by `IDWALK_CB_NOP`. And another one in the opposite
direction.

This change might be incomplete; I gave the enum a name, fixed the
compiler errors, and then also updated assignments like `int cb_flag =
cb_data->cb_flag`. I might have missed some assignments to `int`
though.

No functional changes.

----------

I intend to land this PR as its two separate commits. I just put them in the same PR so the buildbot can handle them in one go, and we don't have a stack of highly relatled PRs.

In the future this could also apply to the `IDWALK_RET_…` enum. This one I left out, though, because a proper cleanup there would also have to include their ambiguity on whether they are bitflags (like the enums in this PR) or not. Their values and the code in `BKE_lib_query_foreachid_process()` implies they are bitflags, but in practice they are never or'ed together and just used as discrete values.

Pull Request: https://projects.blender.org/blender/blender/pulls/131803
2024-12-12 17:28:28 +01:00
Germano Cavalcante
179f2a3cb1 PyGPU: Show error for unsupported POLYLINE shader configurations
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.

In C++, workarounds allow these shaders to function as before, albeit
with some limitations.

To address these known limitations, error messages are now raised when
a polyline shader is used with unsupported configurations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131055
2024-12-11 20:39:25 +01:00
Germano Cavalcante
19fee82b72 Fix #131236: 'batch_for_shader' not working with POLYLINE shaders
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.

In C++, workarounds allow these shaders to function as before, albeit
with some limitations.

However, this change broke the `batch_for_shader` function in Python,
as `GPUShader.attrs_info_get()` only reads attributes and does not
support SSBOs.

To address this, the method now treats polyline shaders differently,
accessing SSBO inputs instead of attributes.

fix
2024-12-11 20:39:24 +01:00
Germano Cavalcante
93e3da136f PyGPU: Rename 'program' to 'shader' in documentation for 'GPUBatch.draw'
Renaming 'program' to 'shader' makes the documentation clearer.
2024-12-11 20:39:24 +01:00
Julian Eisel
f6a4d01703 UI: Allow passing named integers via context
Similar to 2fbf206491, but for integers (not strings). Essentially this
allows passing named integer values through UI abstractions in a clean
way.

I used 64 bit integers here, since space isn't an issue here, and it
fits common integer types (so we don't have to add APIs for multiple
integer types).

Planned to be used to fix #111463 (following commit).
2024-12-11 13:39:24 +01:00
Iliya Katueshenock
7348e670b3 Cleanup: BKE: Use StringRefNull instead of char *
Use StringRefNull for all function arguments and return types.
Not a StringRef but StringRefNull since there is still large
interaction with C api so null-termination usually necessary.

If string is expected to be not only empty but also a null then
optional is used. This change depends on #130935.

Pull Request: https://projects.blender.org/blender/blender/pulls/131204
2024-12-02 19:24:07 +01:00
Campbell Barton
8fba37cea7 Fix #129657: Broken pipe from a Python script closes Blender
Since [0] PyConfig_InitIsolatedConfig was used which disables
Python's signal handlers, re-enable them as they're needed for
Python's own error handling to work properly.

[0]: cd5dd6e454
2024-11-27 20:32:50 +11:00
Bastien Montagne
4bf5a2f5cb Cleanup: PointerRNA: Remove 'C-style' zero-initializations.
These are useless now that PointerRNA has explicit default values, and
become a problem when real constructors are added to this struct. Simply
use the default empty value initialization instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/130927
2024-11-25 19:09:56 +01:00
Campbell Barton
0de8ae8046 Cleanup: spelling in comments 2024-11-25 13:24:46 +11:00
Campbell Barton
8b29a50625 Cleanup: use doxy sections following our style guide 2024-11-25 13:20:14 +11:00
Germano Cavalcante
9b3fb99bc9 Fix #116551: gpu.types.Buffer always returning 'FLOAT' type on MacOS
The issue involves using const on a variable that is later modified.
2024-11-18 23:24:48 -03:00
Bastien Montagne
992c52ff1e Fix #130310: Improve Enum props API doc regarding separators.
Doc only mentioned 'None' separators, but 'tuple' items with an empty
identifier string are also valid separators, and allow to get 'named'
separators in the UI.
2024-11-15 17:36:22 +01:00
Bastien Montagne
b325142d17 Merge branch 'blender-v4.3-release' 2024-11-12 16:55:40 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Sybren A. Stüvel
c06c96b2b8 RNA: quote callback function name in error message
When reporting "could not create instance of {class} to call callback
function {function}", put single quotes around the name of the function.
This will make it easier to understand that that word is actually a
function name, and not some verb in the sentence.

Before:

> RuntimeError: could not create instance of
> AMP_TIMELINE_TOOLS_OT_anim_lattice to call callback function execute

After:

> RuntimeError: could not create instance of
> AMP_TIMELINE_TOOLS_OT_anim_lattice to call callback function 'execute'

Pull Request: https://projects.blender.org/blender/blender/pulls/129780
2024-11-07 12:13:50 +01:00
Richard Antalik
4af90dcaff Merge branch 'blender-v4.3-release' 2024-11-04 03:17:14 +01:00
Campbell Barton
02571da35f PyDoc: correct GPUIndexBuf doc-string & exception 2024-11-04 11:55:41 +11:00
Campbell Barton
3bab869c0d Fix BMeshElemSeq.sort(key=None) argument
Allow passing key=None to BMesh element sorting callback,
matching the doc-string & Python's list sort.
2024-11-04 11:55:37 +11:00
Bastien Montagne
397286e985 Cleanup: Silence unused var warning in NDBEUG builds. 2024-11-03 16:53:25 +01:00
Campbell Barton
d40a0fc5c3 Merge branch 'blender-v4.3-release' 2024-11-03 22:04:51 +11:00