Commit Graph

118278 Commits

Author SHA1 Message Date
Clément Foucault
92968c23fe Refactor: DRW: Make DrawEngine a virtual class
This removes the old `DrawEngineType` and use the new `DrawEngine`
virtual class instead.

This removes a lot of boilerplate functions that were only there for
legacy reason.

To this end, some engines that were based on static functions have been
refactored into `Instance` classes. This was particularly cumbersome
for the Grease pencil engine which needed some more refactoring.

The `Engine` class that is in each namespace is a workaround to isolate
the internal implementation (i.e. the `Instance`) to the engine
modules. Without this, the whole engine is getting included in each
compile unit that includes the `Instance` class. Eventually, if we get
rid of these intricate dependencies, we could remove the `Engine` class.

Pull Request: https://projects.blender.org/blender/blender/pulls/136001
2025-03-17 10:31:22 +01:00
Campbell Barton
070a4cc9ee Merge branch 'blender-v4.4-release' 2025-03-17 20:14:50 +11:00
Campbell Barton
c8c276f56f Fix #136059: Crash clicking on the marker-region in the time line
When a marker exists always return the nearest instead of using an
arbitrary large threshold which caused region_position_is_over_marker to
crash when a non-empty marker list returned a null nearest marker.

Ref !136060
2025-03-17 20:13:08 +11:00
Jeroen Bakker
c4feddefd7 Refactor: Vulkan: Split VKWorkarounds
VKWorkarounds adds double negation. This PR splits
the struct into workarounds and extensions to reduce
confusing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/136064
2025-03-17 09:06:47 +01:00
Hans Goudey
23a88e0eec Fix #136039: Grease pencil edit mode crash with Bezier curves
Caused by 5f6e94ca58.
That commit mixed up `elb` and `epb`. Hopefully with clearer
names now that mistake will be harder to make.
2025-03-16 22:39:28 -04:00
Harley Acheson
39cb672d7c Tests: Remove Unnecessary Comparison
Remove a comparison in a test that was added
accidentally.
2025-03-16 09:27:59 -07:00
Pratik Borhade
72a38aee7e UI: Increase default rows of tree view
Tree view UI of bone collection, node interface and light linking is
quite small right now. Bump the minimum row count similar to
6d8e642367

Pull Request: https://projects.blender.org/blender/blender/pulls/135426
2025-03-16 06:44:36 +01:00
Harley Acheson
2ad702808c Tests: Add BLF tests
BLF tests for font file opening, display name, metrics, variable
weight changing, width, height, advances, etc. Also tests for current
minimal word wrapping.

Pull Request: https://projects.blender.org/blender/blender/pulls/135891
2025-03-16 01:30:53 +01:00
Philipp Oeser
1448b70625 Fix #135964: "Add Paint Slot" disabled "Alpha" still adds alpha
Since internally `BKE_image_add_generated` uses 4 channel colors (no
matter what depth/planes is specified), just set alpha to 1 if the
option is unchecked.

Same as what 35dd09a9ef did for `IMAGE_OT_new`

Pull Request: https://projects.blender.org/blender/blender/pulls/135972
2025-03-15 08:54:13 +01:00
Campbell Barton
2c6b23e513 Merge branch 'blender-v4.4-release' 2025-03-15 15:26:15 +11:00
Campbell Barton
8faf210e4e Fix: crash duplicating empty hair
Attempt to access `points_by_curve.data().last()` on an empty array
crashed on a null pointer dereference.

Ref !135956
2025-03-15 15:18:03 +11:00
Ramón Klauck
dde6c2bb10 Fix: VSE: Incorrect rotation with mirrored images
When images in the VSE use mirror and then get rotated, they rotate in
the wrong direction.

Multiply rotation by X and Y component of mirror value (-1). This is
the same approach as used by translation.

Co-authored-by: Aradgus <ramonklauck987@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/136004
2025-03-15 02:32:04 +01:00
Campbell Barton
c3e5a35ecd PyAPI: add blf.bind_imbuf(..) context manager
Add support for using BLF to draw into an ImBuf image buffer.
Once the imbuf context has been set, draw calls for that font_id will draw into the image.

This works by binding an imbuf to BLF which is then used as the target when drawing.
```
with blf.bind_imbuf(font_id, imbuf):
    blf.draw_buffer(font_id, text)
```
See the example in the Python API documentation for reference.

The following BLF API's have been added to support a Python context manager.

- `BLF_buffer_state_push`.
- `BLF_buffer_state_pop`
- `BLF_buffer_state_free`

Ref !135772
2025-03-15 11:00:51 +11:00
Harley Acheson
18d82c5164 Fix #135970: Allow Allow Movement After Tooltip Timer Starts
We can only allow some mouse and pen movement once the tooltip timer
has started. Doing so beforehand can keep some tooltips from starting.

Pull Request: https://projects.blender.org/blender/blender/pulls/135997
2025-03-14 19:16:43 +01:00
Sergey Sharybin
f243f13549 Merge branch 'blender-v4.4-release' 2025-03-14 18:36:53 +01:00
Hans Goudey
759923fdd7 Geometry Nodes: Use socket type for store named grid
This used custom data types before, which was misleading and didn't
scale well because the set of attribute types is different than the set
of grid types we can store. Now just use the grid data type, like how
the store named attribute node uses the attribute type.

This covers backward compatibility, but not forward compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/135814
2025-03-14 18:36:16 +01:00
Jacques Lucke
51904839ac Fix #135948: Geometry Nodes: support evaluating undefined custom group nodes
The main reason that didn't work before because undefined custom node groups
have the undefined `bNodeType` (and thus are ignored in various places) but are
actually still groups that can be evaluated. The fix is just to handle custom
node groups a bit more explicitly.

In the future, we may want to have a separate "undefined custom group"
`bNodetype`, but that might a be a bit bigger project.

Pull Request: https://projects.blender.org/blender/blender/pulls/135974
2025-03-14 18:31:29 +01:00
Sybren A. Stüvel
63c3db3e96 Fix #135923: Library Overrides break action constraints
Fix an issue with library overrides that was caused by Action
assignments getting versioned too late in the versioning process. Now
the versioning of Action assignments (which assigns the
created-by-versioning action slots) happens in the 'after linking'
stage, as well as in the 'after setup' stage. The latter is still
necessary for the conversion of pre-2.5x animation data.

It is likely that the versioning code can now be simplified, as the
tagging for "this needs upgrading" may no longer be necessary. We're now
too close to the 4.4 release to comfortably make such bigger refactors,
though, so I'd rather keep the overall code structure as-is.

Pull Request: https://projects.blender.org/blender/blender/pulls/135988
2025-03-14 18:26:17 +01:00
Sybren A. Stüvel
8b6e22f36e Fix: memory leak in unit test when freeing the WM
Use a cleaner approach to the WindowManager handling in the "blendfile
loading unit test" base class, to ensure it is freed properly.

The commit following this one changes the Action versioning code, which
writes to RNA properties, which in turn sends WindowManager
notifications, which in turn have to be freed properly whenever the test
exits.

Pull Request: https://projects.blender.org/blender/blender/pulls/135988
2025-03-14 18:26:17 +01:00
Bastien Montagne
dd98cede18 Merge branch 'blender-v4.4-release' 2025-03-14 18:20:26 +01:00
Bastien Montagne
8a61555a46 Fix: IMBuf: Potential buffer overflow in JPEG metadata writer.
Looks like a logic inversion mistake.

Not clear how bad this issue is, as other code related to image metadata
seems to expect 1024 char max size too (e.g. `MAX_METADATA_STR` define
in `ed_draw.cc`. But this is potentially a very bad issue, and the fix
seems safe enough for 4.4 still.

Should also be backported to active LTSs.

Pull Request: https://projects.blender.org/blender/blender/pulls/135983
2025-03-14 18:17:21 +01:00
Bastien Montagne
e85ebb24fe Cleanup: imbuf: 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/135994
2025-03-14 18:16:13 +01:00
Philipp Oeser
d79274ae53 Merge branch 'blender-v4.4-release' 2025-03-14 17:34:51 +01:00
Philipp Oeser
d83944f248 Merge branch 'blender-v4.4-release' 2025-03-14 17:32:43 +01:00
Philipp Oeser
6f02a485aa Fix #135927: Crash moving empty slots to new action
Check existence of layer and slot before handling Channelbags.
The existing asserts dont catch this (they are skipping the "empty
layers" case) and rightfully so, think there might be usecases for
moving **empty** slots as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135963
2025-03-14 17:19:06 +01:00
Hans Goudey
e5d9b7a43f Cleanup: GPU: Remove unused index buffer function
This information is set when creating the indices,
there should be no need to compute it later.

Pull Request: https://projects.blender.org/blender/blender/pulls/135986
2025-03-14 16:55:55 +01:00
Julian Eisel
d14c677da3 Versioning: Bump subversion after previous commit
Followup to 4499fad40e.

Although no really necessary (the added versioning would be fine to
always run), still bump the subversion to avoid confusion about the
unversioned block.
2025-03-14 16:50:14 +01:00
Julian Eisel
4499fad40e UI: Horizontal list view for asset browser
Part of #134755 / #134766.

The asset browser currently lacks a compact view that leaves names
readable. Especially when managing asset libraries (e.g. to prepare it
for sharing or set up a production library), this is quite a usability
issue. A column view like the file browser has can solve this, allowing
a quick overview and fast browsing of libraries, while keeping names
readable.

Adds a new "Horizontal List" display mode to the asset browser that
distributes assets over multiple columns, with horizontal scrolling.
Asset previews are shown in this mode, plus an asset type icon if
there's enough space. The size of previews and the columns can be
configured next to the display mode, for optimizing the display.

Pull Request: https://projects.blender.org/blender/blender/pulls/135306
2025-03-14 16:43:12 +01:00
Philipp Oeser
8a0d34393d Fix #135969: Crash exporting Grease Pencil with no materials as SVG/PDF
Having no material is not uncommon, e.g. this can happen in blender when
a Curve is coverted to Grease Pencil.

If there is no material, we can still regard that stroke as visible, and use the
default Grease Pencil material in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/135975
2025-03-14 15:42:54 +01:00
Jun Mizutani
200e26ed15 Cleanup: the comma operator was used to separate assignment statements
This was a typo.

Pull Request: https://projects.blender.org/blender/blender/pulls/135900
2025-03-14 15:34:14 +01:00
Julian Eisel
95c2daaac7 Cleanup: Move 3D View dropbox code into own file
There was quite a bit of drop-box code in `space_view3d.cc`. Moving it
to an own file makes files more focused & coherent, and keeps file sizes
more manageable.
2025-03-14 15:14:42 +01:00
Bastien Montagne
1e976ec37b Cleanup: io: 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/135976
2025-03-14 14:52:16 +01:00
Bastien Montagne
6ff1e227c8 Cleanup: makesdna: 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/135971
2025-03-14 12:48:52 +01:00
Jacques Lucke
e297e6dab3 Fix #135815: missing instance attribute propagation 2025-03-14 12:41:17 +01:00
Pratik Borhade
f5ceb3822a Grease Pencil: Stroke split operator
An operator to split selected points into a separate stroke.
Use `split_points()` function implemented in 2c42294557

Resolves #113643

Pull Request: https://projects.blender.org/blender/blender/pulls/135845
2025-03-14 12:37:25 +01:00
Jacques Lucke
1f223156ac Cleanup: add debug label 2025-03-14 12:21:34 +01:00
Habib Gahbiche
d8d09cdadb Geometry Nodes: shortcuts for viewer nodes
Implement shortcuts for viewer nodes. Viewer nodes are now activated using the operator `bpy.ops.node.activate_viewer()` instead of activating the viewer by setting the node to active.

This also unifies the behavior with viewer shortcuts in the compositor (see attachment in the original PR).

Pull Request: https://projects.blender.org/blender/blender/pulls/134555
2025-03-14 11:26:57 +01:00
Julian Eisel
18c4df0243 I18N: Make some property disabled hints translatable
This text will show in tooltips to explain why a property is not
editable, it needs to be tagged for translation.
2025-03-14 10:55:36 +01:00
Clément Foucault
626118984e Compositor: Use last_update for ID update
This replaces the deprecated DrawData mechanism by the
usage of the update timestamp `last_update`.

The compositor keeps the `last_update` value of the cached ID
and compares it with the value on the ID at the time of evaluation.

Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/134878
2025-03-14 10:25:32 +01:00
Jacques Lucke
c23cf12560 Cleanup: Nodes: simplify getting socket type from static type 2025-03-14 10:16:56 +01:00
Jacques Lucke
eb9d50d6a6 BLI: add implicit to-bool conversion for generic pointers
This way they behave more like regular pointers.
2025-03-14 10:16:55 +01:00
Omar Emara
b978f51051 Refactor: Compositor: Use BKE conversion for single values
This patch refactors the conversion code for single values to use BKE
conversion rules. This reduces boilerplate and makes it easier to add
new types.
2025-03-14 10:37:05 +02:00
Philipp Oeser
220e7481fb Merge branch 'blender-v4.4-release' 2025-03-14 09:18:49 +01:00
Philipp Oeser
fdd402c3d8 Fix #135863: Grease Pencil Tint Modifier ignores custom curve influence
Seems this was just forgotten in baeb4d7753

To resolve, do the same as done for the "Hue/Saturation" or "Opacity"
modifiers (calculate factor along curve and evaluate curmapping).

Pull Request: https://projects.blender.org/blender/blender/pulls/135871
2025-03-14 09:18:32 +01:00
Philipp Oeser
98ab9c26c1 Fix #135857: "Affect only origins" fail for non-poly grease pencil curve
If we tag positions to be changed we get a proper update (was probably
working for poly curves because the evaluated positions just reference
the original positions array when all curves are poly curves).

Pull Request: https://projects.blender.org/blender/blender/pulls/135874
2025-03-14 09:18:01 +01:00
Sean Kim
fed2364d18 Fix #135931: Paint brush with gravity factor can crash Blender
This commit prevents the "Gravity" value from having an effect on
brushes that are based on either the Paint or Smear brush in addition to
the ones that are already filtered. Prior versions of blender don't
crash, but still deformed the mesh, which is unexpected & undesired.

Pull Request: https://projects.blender.org/blender/blender/pulls/135944
2025-03-13 20:51:24 -07:00
Sean Kim
07e8b39330 Fix #135931: Paint brush with gravity factor can crash Blender
This commit prevents the "Gravity" value from having an effect on
brushes that are based on either the Paint or Smear brush in addition to
the ones that are already filtered. Prior versions of blender don't
crash, but still deformed the mesh, which is unexpected & undesired.

Pull Request: https://projects.blender.org/blender/blender/pulls/135944
2025-03-14 04:48:41 +01:00
Harley Acheson
edf2706f8c UI: Improve Usage of Tooltips for Pen Users
Hovering over UI items will pop up a tooltip hint if you are perfectly
still. This is easy when using a mouse since it is resting on a
surface. But with a tablet pen you are holding it off the surface so
absolute stillness is difficult. This PR allow a small amount of
movement. So unsteady or slow movement will still pop up the hint.

Pull Request: https://projects.blender.org/blender/blender/pulls/135602
2025-03-13 23:35:40 +01:00
Harley Acheson
8c5393d4c0 Fix #94324: Longer Drag Threshold for Pens on Tool Icons
Toolbar items with variations open a menu on long press. But they will
also open immediately on drag. The amount of distance it considers a
drag is about two pixels. Tablet pen users generally move more than
that while selecting items so the menu almost always pops out. This PR
uses the correct drag distance per pointer type, and uses the position
of the start of the drag instead of the last reported position.

Pull Request: https://projects.blender.org/blender/blender/pulls/135677
2025-03-13 23:10:47 +01:00
Clément Foucault
4ba3b1985c Overlay: Avoid engine recreation for clipping region toggle
This changes the shader module reference to a pointer and
set it during `init()`
2025-03-13 22:06:56 +01:00