Commit Graph

114649 Commits

Author SHA1 Message Date
Bastien Montagne
7bf17d83ab Cleanup: blenfont & blentranslation: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136126
2025-03-18 18:25:50 +01:00
Harley Acheson
4894c888ee BLF: Configurable Line Breaking Behavior
The PR allows specifying the method of line breaking. Current functions
gain an optional argument that defaults to "Minimal" which breaks as it
does now, only on space and line feed. "Typographical" breaks on
different types of spaces, backslashes, underscore, forward slash if
not following a number, dashes if not following a space, Chinese,
Japanese, and Korean Ideograms, and Tibetan intersyllabic marks. "Path"
breaks on space, underscore, and per-platform path separators. There is
also a "HardLimit" flag that forces breaking at character boundary at
the wrapping limit.

Pull Request: https://projects.blender.org/blender/blender/pulls/135203
2025-03-18 18:02:36 +01:00
Clément Foucault
2892b494bd Cleanup: DRW: Remove some global access to DRWContext
Rel #136090
2025-03-18 17:48:54 +01:00
Clément Foucault
8c7cb9d3c7 Cleanup: DRW: Flatten global access to DRWContext
Rel #136090
2025-03-18 17:28:00 +01:00
Harley Acheson
745509a0ab Fix #136119: Remove Warning Message With Save As
Regular "Save As" does not set "incremental" property, either true or
false, which results in a warning message. This PR just handles the
reading of this optional property properly by checking existence first.

Pull Request: https://projects.blender.org/blender/blender/pulls/136127
2025-03-18 17:23:35 +01:00
Bastien Montagne
9fcec54c93 Cleanup: blenloader: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136121
2025-03-18 16:14:26 +01:00
Omar Emara
781dea8442 Cleanup: Compositor: Use default case for blur types
Use a default case for blur type switch case, that's because adding all
types is not necessary, and I am trying to differentiate between switch
cases that need full type enumeration and those that do not.
2025-03-18 16:15:27 +02:00
Pratik Borhade
ba2e567efb Grease Pencil: Drawing API functions to assign/remove vertex group data
Currently there is no python api function to assign/remove vertices to specific
vertex group. Traditional `object.vertex_groups[0].add/rna_VertexGroup_vertex_add`
didn't work, because Grease Pencil stores deform verts and vertex group
on individual drawings. Now intorduced a new function
`vertex_group_assign` and `vertex_group_remove` on `Drawing`.

Resolves #135281.
Resolves #134678.

Example (just add GP Suzanne):
```
import bpy

C = bpy.context

drawing = C.active_object.data.layers['Lines'].current_frame().drawing
drawing.vertex_group_assign(vgroup_name="Group", indices_ptr=[2, 6, 10, 18, 19, 20], weight = 0.9)
drawing.vertex_group_remove(vgroup_name="Group", indices_ptr=[2, 6, 10])
```

Pull Request: https://projects.blender.org/blender/blender/pulls/135283
2025-03-18 15:11:09 +01:00
Omar Emara
0a57002469 Cleanup: Compositor: Remove redundant SMAA types
This patch removes code that handles types other than Float and Color,
that's because SMAA is practically only used for those types only.
2025-03-18 15:51:51 +02:00
Omar Emara
383a6ce654 Refactor: Compositor: Formalize single value data update
This patch formalizes the process of data updates of single values.
Previously, this was done internally in the set_single_value method, but
there was a hack in multi-function procedure code to do the same. This
patch adds a new method for single value data updates and uses it
internally in set_single_value.
2025-03-18 15:03:55 +02:00
Bastien Montagne
24e3010e50 Cleanup: freestyle: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136118
2025-03-18 13:57:00 +01:00
Germano Cavalcante
015b7483e7 Fix #136061: Shear and Edge Slide not displaying custom keys in statusbar
Since 40eadc75be, `ED_workspace_status_text` is now called at the
beginning of the modal function.

This clears any custom keymap and redraws the status bar.

The `Edge Slide` and `Shear` operations only update the status bar if a
modal key is pressed (not on mouse move).

The solution to avoid losing custom modal keys, and not having to
update the status bar more often is: call `ED_workspace_status_text`
only when an operation that requires redraw is performed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136101
2025-03-18 12:46:56 +01:00
Germano Cavalcante
94a8b5f607 Revert "Fix #136061: Modeling: Always update status bar on shear/edge slide."
This reverts commit b02c83386b.

The problem has not been fully resolved (there is a glitch in the
status bar when changing operations).

A newer, even more efficient solution is on the way.
2025-03-18 08:42:10 -03:00
Campbell Barton
3f9c08d960 Docs: add a doc-string for rotation_mode
Based on the report #135332, it's not obvious that rotation modes that
aren't selected aren't used, note this in the doc-string.

Ref !136103
2025-03-18 22:39:30 +11:00
Campbell Barton
5fc3303a35 Fix assert drawing the knife tool points with the Vulkan backend
Using the knife tool with Vulkan failed because using
GPU_PRIM_POINTS isn't supported with the GPU_SHADER_3D_UNIFORM_COLOR
shader.

Resolve using a shader intended for drawing points.

Ref !136109
2025-03-18 22:36:13 +11:00
Campbell Barton
c3320a1082 Fix crash starting with only the Vulkan backend enabled
When built with only the Vulkan back-end this wasn't being checked for
causing Blender to start with no GPU backend which crashed.

Ref !136110
2025-03-18 22:23:15 +11:00
Bastien Montagne
015f8150a2 Cleanup: geometry: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136116
2025-03-18 11:58:05 +01:00
Jeroen Bakker
4429cc7e84 Fix: Vulkan: Incorrect framebuffer selection
When swap chain is updated the logic could select an incorrect
framebuffer. This isn't actually the case during normal usage, but has
been detected during the development of OpenXR support. Here it did
matter.

Pull Request: https://projects.blender.org/blender/blender/pulls/136115
2025-03-18 11:49:52 +01:00
Omar Emara
ebaa12af6c Refactor: Compositor: Use data sharing for SMAA
Use data sharing instead of copying in the SMAA algorithm. This reduces
redundant copies and code duplication.
2025-03-18 12:38:48 +02:00
Bastien Montagne
9139005e82 Fix building on Clang19 on Linux.
Commit e9a21cf14c seems to have removed a bit too many includes, this
reverts one change, which seems to be enough to get it working again.

Will let @deadpin decide whether we keep this 'include all' header
include here, or go more refined in our includes.
2025-03-18 11:23:39 +01:00
Campbell Barton
b77d77af40 Refactor: add utility object & pchan setters, respecting protected flags
Add "set" functions for location, scale & rotation that leave
protected channels untouched.

Ref !136104
2025-03-18 20:36:57 +11:00
Omar Emara
a345c4597e Refactor: Compositor: Use GPU setter nodes for unlinked sockets
This patch refactors how values of unlinked sockets are provided to
nodes. Previously, the GPU node stack values were initialized at
construction time and linked by the node's compile methods. This meant
that we needed to handle implicit conversion if the socket is linked to
an unlinked node group input.

Alternatively, we now insert a GPU setter node for each unlinked socket
that carries the value and type of the origin socket, and let the GPU
code generator do implicit conversion at the shader level. This has
three advantages:

- It makes it easier to add new types since we no longer have to handle
  those types in shader node code and it reduces code duplication.
- It makes the code more inline with how we implement multi-function
  procedures. So refactoring is easier.
- It opens the door to implement things like implicit inputs, which will
  be needed later for things like texture nodes.
2025-03-18 11:23:43 +02:00
Bastien Montagne
1ff24efa02 Cleanup: ikplugin: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136095
2025-03-18 10:14:53 +01:00
Bastien Montagne
b87b58b07e OBJ Export: Update 'bitflag smoothgroup' to also consider boundary vertices.
Previous code would consider two different face groups sharing no common
edges as fully isolated from each other, and could assign them the same
bitflag facegroup value.

Following FBX recent option to export these bitflags smoothgroups (!135646),
also consider that two different face groups are connected if they only share
common vertices, and assign them different bitflags values.

NOTE: This seems to be the expected behavior in major DCCs actually
using smoothgroups, only considering boundary edges create groups that
generate broken shading when imported by these tools.

NOTE: The 'unique integer identifers' option is kept for OBJ exporter,
as such OBJ files are also found on internet, depending on which app
generated them.

Pull Request: https://projects.blender.org/blender/blender/pulls/135998
2025-03-18 10:04:38 +01:00
Jesse Yurkovich
e9a21cf14c Cleanup: USD: various non-functional changes
- Use const in more places
- Use more appropriate headers and forward decls elsewhere
- Remove one instance of variable shadowing
- Rename an internal rna enum list and the USD operator property object
  to follow surrounding code and naming guidelines

Pull Request: https://projects.blender.org/blender/blender/pulls/136112
2025-03-18 07:18:19 +01:00
Richard Antalik
d267ec3ec1 Fix #135968: Sound strip offset limit is hardcoded to 0
This seems to be remains of code from time when sound offsets were
clamped to non negative values and start/endstill offsets were used to
offset strip handles from sound content.

Since start/endstill offsets were merged with start/endofs, this limit
should have been removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136015
2025-03-18 07:12:50 +01:00
Philipp Oeser
e22ff684f3 Cleanup: Anim: convert cstyle-casts
Using clang-tidy "cppcoreguidelines-pro-type-cstyle-cast" to find them.

This PR touches `bf_animrig` & `bf_editor_animation` & `bf_editor_armature`

NOTE: Also some case where untouched (not straightforward) same as
expanded macros (e.g. `LISTBASE` or `GS`)
NOTE: a couple of cases of "inconsistent-declaration-parameter" as well

Pull Request: https://projects.blender.org/blender/blender/pulls/136044
2025-03-17 19:49:45 +01:00
Jesse Yurkovich
e93c6e5f74 USD: Eliminate some unintentional VtArray copies
The `pxr::VtArray<T>` type is based on a copy-on-write scheme that is
very easy to trigger unnecessarily because of how the C++ type system
works[1].

Here we bypass unneeded copies by ensuring we always call the `const`
version of various accessor functions. The offending call-sites were
found by using the `VT_LOG_STACK_ON_ARRAY_DETACH_COPY` env variable.

This yields a very small 2-3% performance benefit when loading in a
typical, mixed-use, asset like e.g. the "4004 Moore Lane" scene.

[1] https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/vt/array.h#L139

Pull Request: https://projects.blender.org/blender/blender/pulls/136014
2025-03-17 17:59:17 +01:00
Falk David
5d5782571e Fix #136036: Grease Pencil: SVG export not working for non-poly types
To fix this in the most non-intrusive way, we essentially do what
the modifiers do which is to convert everything to poly curves.
This is also what GPv2 used to do.

Ideally, we would export non-poly curves as bézier curves in the
supported SVG format.

Pull Request: https://projects.blender.org/blender/blender/pulls/136088
2025-03-17 17:29:52 +01:00
Clément Foucault
0105b33a5f Refactor: DRW: Move some functions to DRWContext
This reduces the API and make it more clear where there
is the global access.

This also removes some of these global access by merging
the `DRW_context_get()` calls.
2025-03-17 17:19:13 +01:00
Clément Foucault
686c571c09 Cleanup: Overlay: Remove DRWContext C-API calls 2025-03-17 16:24:23 +01:00
Clément Foucault
8d8b20f31f Cleanup: EEVEE: Remove workaround for state functions
Now the states are set accordingly inside the init function.
2025-03-17 16:24:23 +01:00
Clément Foucault
894c7fa4e2 EEVEE: Remove EEVEE Next mention inside the code
This only changes file and function names.
The EEVEE identifier is still `BLENDER_EEVEE_NEXT`.

No functional changes.
2025-03-17 15:37:04 +01:00
Jeroen Bakker
5a3fd4522c Fix #135929: Vulkan: Add support for line loops in immediate rendering
Currently only implemented for immediate mode. When used it copies the
first vertex to the last vertex to complete the loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/136083
2025-03-17 15:32:49 +01:00
Clément Foucault
e08c64d68e Cleanup: DRW: Remove DrawData
These have been replaced by better alternatives overtime.

Pull Request: https://projects.blender.org/blender/blender/pulls/136073
2025-03-17 15:16:07 +01:00
YimingWu
b02c83386b Fix #136061: Modeling: Always update status bar on shear/edge slide.
When a input event is handled but `status.opmodal` is not explicitly
requested, `WM_window_modal_keymap_status_draw` will override the status
bar message, then the tool hint would be incorrect. This applies to
shear and edge slide operators. Seemingly introduced by 6d5d3ce. The
fix is to not ignore mouse move event when updating status bar as they
also causes viewport redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/136063
2025-03-17 14:29:28 +01:00
Clément Foucault
959d82f2ab Merge branch 'blender-v4.4-release' 2025-03-17 14:25:43 +01:00
Clément Foucault
e31bfce08a Fix: Overlay: Broken Shading on Armature envelope
There was a copy paste mistake in the create info refactor
patch commited in b295df7345.
2025-03-17 14:24:31 +01:00
Hans Goudey
835696f152 Geometry Nodes: Move import nodes out of experimental
The import nodes are considered complete enough to expose without
the experimental option. This commit removes the option so they will
be exposed in 4.5. There are still some possible future improvements,
including automatic caching, possibly exposing more input sockets,
and possibly including imported paths in the "Internal Dependencies"
panel. Those are considered non blocking though.

Pull Request: https://projects.blender.org/blender/blender/pulls/135957
2025-03-17 13:54:48 +01:00
Pablo Vazquez
46bd1cedf8 UI: Add unit to label in Glare (Simple Star) node
Add the unit (degree) symbol to "Rotate 45" label
to the Glare node Simple Star mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/135887
2025-03-17 13:49:43 +01:00
Clément Foucault
5241133425 UI: Make area border width decoupled from scale factor
This is just the shader change.
It allows more freedom for the UI team to tweak the appearance.

The is not functional changes in this patch.

Rel #126334
2025-03-17 13:12:25 +01:00
Omar Emara
2e1dd5efee Fix: Crash when canceling compositor job
Blender crashes when canceling a compositor job if a transform node is
used. This is because freeing shared data didn't reset data members, so
it still thinks it has allocated data, which will be double freed
causing crashes. To fix this, we simply clear data members if data is
still shared.
2025-03-17 13:36:32 +02:00
Sybren A. Stüvel
7ca64d953c Fix #136041: NLA Strip Influence keyframes not appearing in tweak mode
Fix the `ANIMDATA_FILTER_CASES` macro, so that layered/slotted Actions
no longer take precedence over NLA control curves. Now they're handled
with the same priority as legacy Actions were.

Pull Request: https://projects.blender.org/blender/blender/pulls/136072
2025-03-17 11:47:20 +01:00
Campbell Barton
23de65afab Merge branch 'blender-v4.4-release' 2025-03-17 21:44:29 +11:00
Campbell Barton
5aec1308e6 Cleanup: quiet missing-declarations warnings 2025-03-17 21:44:08 +11:00
Sybren A. Stüvel
0f35ef9111 Fix #136041: NLA Strip Influence keyframes not appearing in tweak mode
Fix the `ANIMDATA_FILTER_CASES` macro, so that layered/slotted Actions
no longer take precedence over NLA control curves. Now they're handled
with the same priority as legacy Actions were.

Pull Request: https://projects.blender.org/blender/blender/pulls/136072
2025-03-17 11:42:42 +01:00
Campbell Barton
044b8ab6f0 Fix #136077: Crash transforming in background mode with an active region
Don't attempt to add region draw callbacks in background mode.
This caused by the regions runtime being null.

Even if the runtime was initialized, drawing callbacks aren't needed
in background mode.

Ref !136078
2025-03-17 21:41:34 +11:00
Sybren A. Stüvel
4e33abdafe Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-17 11:29:24 +01:00
Christoph Lendenfeld
103826d7ab Fix: Add missing reports when running Merge/Separate Action operators
Add reports after the merge- and separate animation operators are run.
This helps to clarify that these are limited in their use with the
NLA.

The motivation for this comes from a [comment][1] on a different
issue.

[1]: https://projects.blender.org/blender/blender/issues/135894#issuecomment-1520306

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/135920
2025-03-17 11:26:43 +01:00
Campbell Barton
3285da11a9 Fix #136067: Crash with dynamic paint output toggle in some contexts
Resolve the crash by using the active-object to match the operators
poll functions.

Ref !136068
2025-03-17 21:17:48 +11:00