Commit Graph

121875 Commits

Author SHA1 Message Date
Campbell Barton
eef9509ff1 UI: respect UI_BUT_NO_UTF8 for text buttons
This was already handled by most accessors.
2025-07-27 14:58:42 +10:00
Campbell Barton
e93e9db6b7 Cleanup: UTF8 string functions for color-space & imbuf strings
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 04:34:04 +00:00
Andrej730
0d2b44e309 Fix: Vector.to_tuple didn't accept precision of -1
The to_tuple method defaulted to -1 but didn't accept -1 as an argument
(as documented).

Ref !143278
2025-07-27 13:47:13 +10:00
Campbell Barton
01436bfbf3 Build: unbreak WITH_INTERNATIONAL=ON 2025-07-27 13:27:27 +10:00
Campbell Barton
9f056204e5 Cleanup: use UTF8 string functions in source/blender/python
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 12:49:02 +10:00
Campbell Barton
83a489d9ac Cleanup: remove commented code
These errors are handled by exceptions.
2025-07-27 12:49:02 +10:00
Campbell Barton
71a19e04ff Cleanup: back-tick quote literal strings in code comments
Prevent doxygen attempting to interpret symbols withing the text.
The `make check_spelling_*` target also skips this text.
2025-07-27 12:49:02 +10:00
Campbell Barton
8c8c8d5014 Cleanup: replace *_max_length with _maxncpy for null inclusive size
The term "length" is too easily confused with the `strlen(..)`
length without the null byte. Most string functions that take a static
buffer size use the suffix `maxncpy` to avoid off by one errors.
2025-07-27 12:49:02 +10:00
Campbell Barton
2528a41965 Fix: off by one error escaping node names
Also replace allocation with with the more commonly used
2x static-buffer size.
2025-07-27 12:49:02 +10:00
Harley Acheson
c022d5908f BLF: Increase FreeType Cache Values
When we first enabled FreeType font caching we purposely constrained it
so that we could see it was working, dropping and loading font faces
and sizes as needed. But that was years ago now and it is still running
with no more than 4 faces, 8 sizes, and only 400KB of cache. At minimum
we run with 3 simultaneous faces (main UI font and two copies of the
mono font), so allowing it 4 max seems pretty small. This PR changes
the max_faces to 8, sizes to 16, and the cache size to 1MB. Note that
these changes will give NO noticable user change, good or bad, under
normal circumstances. FreeType will churn a bit less, but the time
taken to do these things is very little.

Pull Request: https://projects.blender.org/blender/blender/pulls/143240
2025-07-27 01:40:12 +02:00
Campbell Barton
649b89781e Cleanup: ensure UTF8 string copy for DNA & screen data
Use `BLI_strncpy_utf8` & `BLI_snprintf_utf8` for fixed size buffers in
DNA and screen data structures such as panels, menus & operators.

This could be considered a fix as copying a UTF8 string into a smaller
buffer without proper truncation can create an invalid UTF8 sequence.
However identifying which of these users are likely to run into would
be time consuming and not especially useful.
2025-07-26 12:33:15 +00:00
Campbell Barton
e9ffd666d5 Cleanup: ensure the output of BLI_path_to_display_name is valid UTF8
While this didn't cause errors, the resulting text was often used in
situations where UTF8 is expected (data-block names & UI labels).
Ensure names are UTF8 to avoid encoding related errors in the future.
2025-07-26 12:08:45 +00:00
Campbell Barton
faed51f195 Cleanup: remove redundant calls to strlen 2025-07-26 12:08:15 +00:00
Campbell Barton
0531230a35 Fix: incorrect sizes of fixed size buffers, ensure valid UTF8
Correct code that was likely to truncate when copying strings and
correct the the size of fixed sized buffers.
2025-07-26 12:07:27 +00:00
Campbell Barton
24c965905e Fix: armature "Auto-Name by Axis" creating invalid UTF8 names
When auto-naming based on axis, the string concatenation didn't take
UTF8 encoding into account, adding the suffix could create names
which raised an exception when accessed from Python.

Resolve using UTF8 string truncation.

Also resolve a logical error reading past the buffer bounds if the name
passed in was longer than MAXBONENAME.
2025-07-26 11:58:39 +00:00
Hans Goudey
ed372380c5 Cleanup: Follow style guide & conventions in mesh_tangent.cc
- Order class variables before functions
- Use this-> to access non-private members
- Remove unnecessary BKE prefix
- Remove useless comments
- Use standard "uv_map" name for variable
- Use consistent order for mesh span variables
- Use C++ vector types instead of raw pointers
- Use Span instead of raw pointers
- Pass Span-like variables by value
2025-07-25 18:12:08 -04:00
Hans Goudey
855113ab06 Refactor: Mesh: Slightly simplify tangents API
The RNA `Mesh.calc_tangents()` function used a mesh tangents API wrapper
function that existed at a different abstraction level than the other
functions. That wrapper was only used in this single place, so just
inline its logic into the RNA code. Also give the base tangents API
function a name that makes its limitations clear.
2025-07-25 18:01:00 -04:00
Hans Goudey
44e6822191 Cleanup: Remove debug code accidentally included in previous commit 2025-07-25 17:26:22 -04:00
Hans Goudey
33b430892c Fix #143218: Uninitialized VBO data using multiple UV tangents
Caused by b19696c0b8.

I misunderstood the meaning of the vertex buffer allocation size.
Even though the attributes aren't interleaved, the fact that there
are multiple attributes is still included in the "element size" that's
multiplied with the size argument to `GPU_vertbuf_data_alloc`.

Also switch to spans and indices rather than incrementing raw pointers,
which would have made this much faster to debug.
2025-07-25 17:00:47 -04:00
John Kiril Swenson
b4815957ab Fix: VSE: Strip label jumping when resizing vertically
Make sure `mask_size` is calculated correctly in
`UI_view2d_view_to_region_rcti_clip` since the rcti is inclusive and the
size functions do not take this into consideration. This function is
only used from NLA and VSE drawing code.
2025-07-25 14:09:41 -05:00
Miguel Pozo
33d9e00f4a Fix #142738, #136688: Workbench: Inconsistent matcap rendering
Use `bool32_t` to work around C++/GLSL bool differences.

Pull Request: https://projects.blender.org/blender/blender/pulls/143233
2025-07-25 19:45:28 +02:00
Guillermo Venegas
52403b686f UI: Move block layout methods to namespace
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/143232
2025-07-25 19:33:15 +02:00
Sergey Sharybin
dcae48d1d3 Cycles: Add Portal Depth light pass information
It allows to implement tricks based on a knowledge whether the path
ever cam through a portal or not, and even something more advanced
based on the number of portals.

The main current objective is for strokes shading: stroke shader
uses Ray Portal BSDF to place ray to the center of the stroke and
point it in the direction of the surface it is generated for. This
gives stroke a single color which matches shading of the original
object. For this usecase to work the ray bounced from the original
surface should ignore the strokes, which is now possible by using
Portal Depth input and mixing with the Transparent BSDF. It also
helps to make shading look better when there are multiple stroke
layers.

A solution of using portal depth is chosen over a single flag due
to various factors:
- Last time we've looked into it it was a bit tricky to implement
	as a flag due to us running out of bits.
- It feels to be more flexible solution, even though it is a bit
	hard to come up with 100% compelling setup for it.
- It needs to be slightly different from the current "Is Foo"
	flags, and be more "Is Portal Descendant" or something.

An extra uint16 is added to the state to count the portal depth,
but it is only allocated for scenes that use Ray Portal BSDF.

Portal BSDF still increments Transparent bounce, as it is required
to have some "limiting" factor so that ray does not get infinitely
move to different place of the scene.

Ref #125213

Pull Request: https://projects.blender.org/blender/blender/pulls/143107
2025-07-25 18:09:38 +02:00
Harley Acheson
efe14ff166 UI: Fix VSE Channel Label Jiggling
In the video below you will see how VSE labels can jiggle vertically
while the area is resized. This is caused by the incorrect calculation
of rect height in UI_view2d_view_to_region_y. Our BLI_rcti_size_y does
not return the correct size, but max-min, which one unit too small for
our inclusive integer rects like v2d->mask or region->winrct. This PR
corrects the calculation in UI_view2d_region_to_view_y, and also in
UI_view2d_region_to_view_x because these are so similar.

Pull Request: https://projects.blender.org/blender/blender/pulls/143095
2025-07-25 18:09:02 +02:00
Omar Emara
2582630702 Refactor: Use Bounds for compositing region
This patch uses the new C++ Bounds structure for the composition region
returned by the compositor context.

Pull Request: https://projects.blender.org/blender/blender/pulls/143199
2025-07-25 15:40:45 +02:00
Hans Goudey
8b883a3922 Fix #143142: Displace modifier Custom Normal direction broken
Caused by cf6ee877a0
2025-07-25 09:27:57 -04:00
Brecht Van Lommel
ae5152866e Fix #142724: Mesh used by boolean modifier missing subdivision in edit mode
The code path for non-editmesh has ensure subdivision in it, the editmesh one
was missing it.

Pull Request: https://projects.blender.org/blender/blender/pulls/143135
2025-07-25 15:03:45 +02:00
Omar Emara
8cb7aafae2 Refactor: Use generic name for compositor context IO methods
This patch renames some IO methods in the compositor context to be more
generic. This is in preparation for more generic use of the compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/143193
2025-07-25 14:40:17 +02:00
Pratik Borhade
df75d3e664 Fix: Delete basis removes all shape key
Caused by 29b90af679
When deleting the first/basis shape key, all successive keys are
deleted. `shapenr` remains 1 during entire iteration and `BLI_findindex`
returns 1 for every keyblock as first element is deleted. This
eventually clears the entire list. To fix this, change `shapenr` value to 0
when deleting the first element.

Pull Request: https://projects.blender.org/blender/blender/pulls/142946
2025-07-25 12:49:05 +02:00
Pratik Borhade
832fc7af2a Fix #142982: Grease Pencil: Assert when overriding keyframes in dopesheet
Assert when overlapping keys are removed. This is due to drawing count
mismatch, more specifically when drawing is not removed/overwritten but
early check validation caused it. Remove `validate_drawing_user_counts`
from `remove_drawings_with_no_users`. If Drawing is actually removed
(`drawings_to_remove` non empty), validation function will be called at
the end.

Pull Request: https://projects.blender.org/blender/blender/pulls/143057
2025-07-25 12:47:19 +02:00
Sybren A. Stüvel
edc4136c79 Cleanup: fix compiler warning about memset on C++ type
Instead of zeroing out a C++ wrapper for a DNA struct, zero out just the
DNA struct itself.

The C++ wrapper adds no extra fields, and also no virtual functions, so
the old code was already safe. Now it's also semantically correct :)

No functional changes.

Reviewed by Omar, by locally applying my diff.

Pull Request: https://projects.blender.org/blender/blender/pulls/143184
2025-07-25 12:36:05 +02:00
W_Cloud
d15750a059 Geometry Nodes: add inline socket for missing nodes
Add missing inline socket for Set Spline Type,Join Strings,Pack UV Islands and Vector Rotate.

Pull Request: https://projects.blender.org/blender/blender/pulls/142299
2025-07-25 12:27:44 +02:00
Habib Gahbiche
c7421e197a Fix #143156: "RGB to BW" node not found in link drag search
The node is stil specific to the compositor and is not shared with its
Shader counterpart yet, so `ntype.gather_link_search_ops;` should not
be `nullptr`.

Pull Request: https://projects.blender.org/blender/blender/pulls/143174
2025-07-25 12:25:18 +02:00
Jacques Lucke
a5877c5704 Fix: Nodes: use correct structure types in switch nodes
Generally, switch nodes can work on any kind of data. Some additional restrictions
apply though because some types are only allowed to be single values.

Pull Request: https://projects.blender.org/blender/blender/pulls/143163
2025-07-25 12:22:04 +02:00
Pratik Borhade
b4a0cf398e Fix #139183: Stuck in Draw Mode after converting Grease Pencil to Mesh
`OBJECT_OT_convert` can be called outside of object mode from F3 search
menu. This fails/crashes for some conversions. To avoid running into
such situation, edit poll function so that operator is only available in
object mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/139261
2025-07-25 12:10:11 +02:00
Omar Emara
92d5c2078e Render: Add Media Type option
This patch adds a new Media Type option to image format settings, which
is used in the Render Output panel, File Output node, and Image Saving
operation. The option does not provide any new functionality, but
improves the UX of selecting file types by categorizing the existing file
type option into:

- Image.
- Multi-Layer EXR.
- Video.

Each option would then list only the file types that fit that media
type. For Multi-Layer and Video, the file type option is no longer drawn
for now since only one option exist for now, OpenEXR Multi-Layer and
FFMPEG respectively. This also improves the experience by not listing
technical terms like FFMPEG in the UI, but rather use "Video" instead.

The original motivation for introducing this option is the recent
redesign of the File Output node. The problem is that the distinction
between images and multi-layers images is not at all clear, while the
behavior of the node changes quite a bit when multi-layer is chosen.
While now with the new option, the distinction is quite clear.

Implementation-wise, the new option is mostly a UI layer that controls
the available enum items for the file format and callbacks to set a
default format if the existing format doesn't match the media type.
However, core code is unaffected and still transparently reads the image
format only.

Pull Request: https://projects.blender.org/blender/blender/pulls/142955
2025-07-25 11:15:28 +02:00
Mohamed Hassan
c1f52b8e91 Compositor: Improve Fog Glow glare realism
This patch improves the realism of the Fog Glow mode of the Glare node
based on the Photopic model described in:

  Physically-Based Glare Effects for Digital Images" by G. Spencer, P.
  Shirley, K. Zimmerman, and D. P. Greenberg.

This is a breaking change that can't be versioned, but it is worth it
for the superior realism of the new model.

Pull Request: https://projects.blender.org/blender/blender/pulls/140646
2025-07-25 10:09:32 +02:00
tariqsulley
f4b5cbd31b Fix #135908: Extrude Individual Faces "Offset Even" does nothing
Logically a NOP for individual faces, hide the property.

Ref !136275
2025-07-25 16:43:01 +10:00
tariqsulley
9dae336482 Fix #140548: Shift to extend fails in the "Hide Other Collection" menu
Use the invoke operator context so the event is passed to the operator.

Ref !141817
2025-07-25 16:32:49 +10:00
YimingWu
2def8c8b67 Fix #120885: Ensure EXR view_format selection in stereo
When stereoscopy is enabled, OpenEXR and OpenEXR Multilayer supports
different stereoscopy view format, ensure the view format selection
when selecting the output file format, so the value is always valid
when saving the image.

Pull Request: https://projects.blender.org/blender/blender/pulls/120904
2025-07-25 08:26:31 +02:00
Mohamed Hassan
2927388682 Compositor: Add Glare Sun Beams gizmos
Add gizmo for the Sun Beams mode in the Glare node.

Pull Request: https://projects.blender.org/blender/blender/pulls/142685
2025-07-25 08:05:08 +02:00
Campbell Barton
19b59ccaab Fix #143161: Armature select crashes with over 65k objects
Add null check to resolve crash when a "base" can't be retrieved
from the GPU selection index.
2025-07-25 15:58:32 +10:00
Omar Emara
b92b47f628 Refactor: Reduce compositor context pure virtual methods
The compositor context has a number of pure virtual methods that could
be optional or removed altogether, so this patch refactors that by
reducing unnecessary pure virtual methods.

Pull Request: https://projects.blender.org/blender/blender/pulls/143091
2025-07-25 07:50:52 +02:00
Aaron Carlisle
3e63312823 UI: Rename "HDRI Preview Size" to "Reference Spheres Size"
This is a follow up to 8404228aeb
2025-07-24 20:48:03 -04:00
John Kiril Swenson
8c744aa1d5 Fix: VSE: Cannot ignore connected strips' handles with alt if already selected
PR #139075 introduced a regression where holding alt to move strip
handles without other connected strips would not work if the handle was
already selected. Fix by only copying handles to selected strips if alt
is not held.

This also builds on #142916, using `find_neighboring_strip` to simplify
logic and consider other cases too. We now avoid copying handles if it
would interfere with *any* dual handle point, not just those present in
the selection.

Pull Request: https://projects.blender.org/blender/blender/pulls/143149
2025-07-25 02:36:57 +02:00
Harley Acheson
89e5129741 UI: Changes to the Platform Support Warning Message
Some small tweaks to the messagebox shown when users have graphics
hardware or driver that might not work.  The phrase "Your graphics card
or driver has limited support" changed to "Your graphics card or driver
version has limited support" to better indicate the driver has
versioning. "Newer graphics drivers may be available to improve Blender
support." changed to "Newer graphics drivers might be available with
better Blender compatibility." The message saying "Blender will now
close" only shown if Blender will close.

Pull Request: https://projects.blender.org/blender/blender/pulls/142999
2025-07-24 22:44:08 +02:00
Sean Kim
7bab7155ad Fix #142151: Scrape brush 'Plane Offset' not versioned correctly
The general Plane brush is a replacement for the Flatten, Fill, and
Scrape brushes that formerly existed. When the old brush types were
converted to the new type, the 'Plane Offset' usecase was missed due to
the field not being used for the bundled essential brushes.

To preserve brush behavior across 4.4 and 4.5, Scrape brushes with a
given 'Plane Offset' need to have this signed distance inverted.

Unfortunately, as this was discovered after 4.5 was officially released,
and the versioning having no clear indicators that can be used to fix
this with a subsequent version bump, this commit cannot address users
who have already started using 4.5. The best we can do in this case is
fix the incorrect versioning and make a note of the issue in the release
notes so that future users will not continue to experience this issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/143020
2025-07-24 21:59:38 +02:00
Sean Kim
ab09dec8fb Fix #142186: Mask Filter smoothing produces artifacts
When we perform the Smooth operation in the Mask filter, we have
historically only applied a raw average of the neighbor values. This can
lead to artifacts in the mesh due to the topology of the affected
vertices.

To ensure a smoother transition at the boundary of the mask, this commit
applies a linear blending between the old and new values.

Pull Request: https://projects.blender.org/blender/blender/pulls/142793
2025-07-24 21:56:25 +02:00
Aras Pranckevicius
bedf19f1ca Cleanup: No longer require VSE Strip struct memory layout to never change
Previously code that was reading Strip data assumed that seqbasep
and channels members would stay at fixed offsets within a struct,
forever into the future. Fix this by inferring their offsets from
the file SDNA data where needed.

Actual Strip DNA layout is not changed in this commit yet.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/142940
2025-07-24 20:37:16 +02:00
Harley Acheson
d6573097eb UI: ARM Win GL Qualcomm driver Error Message Change
When using GPU_DEVICE_QUALCOMM video drivers on Win32 with OpenGL (just
ARM) if the driver is too old a console message says that the driver is
not capable of running "Blender 4.0". This PR just adds "or later".

Pull Request: https://projects.blender.org/blender/blender/pulls/143108
2025-07-24 20:26:26 +02:00