Commit Graph

121912 Commits

Author SHA1 Message Date
Campbell Barton
c737c30b38 Cleanup: spelling in comments (make check_spelling_*) 2025-07-29 10:39:50 +10:00
Hans Goudey
1557d5c388 Fix: Potential null pointer dereference in attribute accessors
`AttributeIter::get()` could potentially use the `accessor` field
which wasn't set for curves or mesh vertex groups. "is_builtin"
can also be explicitly set for this case.
2025-07-28 17:59:01 -04:00
Hans Goudey
a358e1c53d Fix: Some enum item buttons don't function after recent cleanup
Caused by ecd8de4bea
2025-07-28 15:32:31 -04:00
Clément Foucault
55a0e427c5 GPU: Remove mip render workaround and recursive downsample
Recursive downsample was only used by workbench DoF
which can be expressed using mip view instead.

The mip render workaround was creating GL error on startup
and is not needed anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/143246
2025-07-28 19:05:36 +02:00
Jacques Lucke
5f132d3f07 Nodes: support storing internal data in Bundle
Currently, bundles can only store socket values of Geometry Nodes. However, it
can make sense to store other kinds of data too. Specifically, this patch adds
support for storing arbitrary internal data in a bundle. This is useful when
storing e.g. the physics world when implementing a proper physics solver for
Geometry Nodes (like in #143171).

One can still see that the data exists in Geometry Nodes in the tooltip, but one
can't extract it. Built-in nodes can still read that data.

Storing built-in data in bundles can also be done as an alternative to having a
new "internal data socket" as we talked in a workshop in the past:
https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/#internal-data-sockets

A bundle still has to be copyable. Internal data is expected to use implicit
sharing. That way copying it just requires increasing the user count of the
data.

Pull Request: https://projects.blender.org/blender/blender/pulls/143472
2025-07-28 19:05:18 +02:00
Aras Pranckevicius
04cb3c1bbd VSE: Faster Histogram scope calculation
Histogram was calculated by copying the rendered image, transforming it
into display space, and calculating the histogram on that. On large
resolutions, this copy+transform+free of the temporary image was taking
up majority of the time. Especially for default use case when the
display transform is a no-op.

Change the code so that display transform, if needed, is done directly
inside histogram calculation, without needing a full-size temporary image.

Performance of histogram calculation, on Ryzen 5950X (Windows), on
a 4K resolution image, with default color management settings:
- PNG (SDR): 3.9 -> 0.9ms
- EXR (HDR): 41.3 -> 6.3ms

With display colorspace (P3) that is different than the sequencer
colorspace (sRGB):
- PNG (SDR): 25.3 -> 11.3ms
- EXR (HDR): 64.9 -> 10.6ms

It also fixes calculation of histogram on float (HDR) images that have
alpha channel; the histogram was wrongly calculated on premultiplied
color values, which was not consistent with how it was calculated
on the byte images.

Pull Request: https://projects.blender.org/blender/blender/pulls/143175
2025-07-28 18:39:01 +02:00
Habib Gahbiche
794f33b8d6 Cleanup: use version_node_add_empty to add nodes in versioning
Pull Request: https://projects.blender.org/blender/blender/pulls/143476
2025-07-28 18:31:25 +02:00
Hans Goudey
32c9bd8b81 Cleanup: UI: Remove unused min/max arguments to uiDefIconTextBut
These min and max arguments are unused, 0 is passed everywhere.
2025-07-28 11:27:52 -04:00
Hans Goudey
ecd8de4bea Cleanup: UI: Remove unnecessary button arguments
Passing the current enum value as a float to the "min" argument
doesn't seem to do anything. It's also the only place that the min
and max arguments to `uiDefIconTextBut` are used.
2025-07-28 11:27:52 -04:00
Hans Goudey
3936d7a93e Fix #142485: Shading artifacts with free custom normals and scale transform
When transforming a geometry, we often apply the transposed inverse
to normals / custom normal data. However, that matrix can still contain
scale from the original matrix. That scale has to be removed so we can
avoid also scaling the normals.

I used the opportunity to remove the duplication between mesh and curves
processing of the custom normals, and to formalize an optimization to
skip the final normalization of each vector if the transform is such
that it isn't necessary. The new functions don't fit beautifully into
their public headers, but I don't know of a better place for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/142896
2025-07-28 17:25:34 +02:00
Sergey Sharybin
07bf1bd87b OpenSubdiv: Switch away from GLSL on Apple
Use MTLPatchShaderSource to provide the patch basis shader source on
all Apple platforms. The immediate advantage of this change is ability
to use GPU subdivision on iOS. Another advantage is that it moves us
further away from frameworks which got deprecated by Apple and it might
save us some headache in the future.

Also tweak backend-specific defines to match definitions from OpenSubdiv.
The annoying difference is that OSD_PATCH_BASIS_METAL is defined by the
OpenSubdiv as 1 in the very beginning of the base code, which is not done
for the OSD_PATCH_BASIS_GLSL is not defined by the OpenSubdiv at all.

Ref #143445

---

TODO:
- [X] Check it works correctly on macOS
- [x] Check it works correctly on Linux

Pull Request: https://projects.blender.org/blender/blender/pulls/143462
2025-07-28 16:54:10 +02:00
Jacques Lucke
63954843c2 Nodes: add utility to get virtual array for list
Pull Request: https://projects.blender.org/blender/blender/pulls/143469
2025-07-28 16:43:48 +02:00
Jacques Lucke
cf9939d3f2 Fix: Nodes: support choosing list socket shape for supported types 2025-07-28 16:28:05 +02:00
Jacques Lucke
5168ee1036 Nodes: use better color for closures
Change colors according to #143056.

Pull Request: https://projects.blender.org/blender/blender/pulls/143465
2025-07-28 16:11:36 +02:00
Sybren A. Stüvel
301a86d700 Modeling: new shape key operator Make Basis
Add a new operator "Make Shape Key the Basis Key", shown in the Shape
Key menu as "Make Basis". Effectively this does the same thing as moving
the active shape key to the top of the list of shape keys: applying it
to the mesh.

This operator is added now, because !141930 will prevent moving shape
keys to the top of the list. This hopefully prevents accidentally making
other keys the basis key, which can cause issues that are hard to
recover from.

Pull Request: https://projects.blender.org/blender/blender/pulls/143200
2025-07-28 15:28:21 +02:00
Sergey Sharybin
38f867814f Fix #143191: 10/12 bit videos import much too dark
Originally reported for ProRes codec, but it affects multiple
other codecs: any format which is read as >= 10bit had the issue.

A regression since 93be12fde0.

The cause of the issue is that movie clip and image data-blocks
did linearization on their side, which was quite hidden to find.
Now the color management is done on the movie reader level.

Additionally, added regression test to catch such issues early
on in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/143435
2025-07-28 15:14:23 +02:00
W_Cloud
3cd40bae9f Geometry Nodes: Change socket name based on node category and support component type.
The socket name should clearly indicate the type of component being processed.
The socket names for most nodes with geometry tag are clear, with the exception of these few nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/142358
2025-07-28 15:07:00 +02:00
Bartosz Kosiorek
fe96b2a613 Fix #107679: Smoke simulation adaptive domain shrinks too much
* Take into account heat grid in addition to density and fuel, as this is used for
  displaying smoke in Blender.
* Lower adaptive domain threshold from 0.02 to 0.002, to fix visual issues with
  small smoke density that can still be visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/139940
2025-07-28 14:15:07 +02:00
Habib Gahbiche
445eceb02a Nodes: Remove "Use Nodes" in Shader Editor for World
Part of https://projects.blender.org/blender/blender/pulls/141278

Blend files compatibility:
If a World exists and "Use Nodes" is disabled, we add new nodes to the
existing node tree (or create one if it doesn't) that emulates the
behavior of a world without a node tree. This ensures backward and
forward compatibility.

Python API compatibility:
- `world.use_nodes` was removed from Python API => **Breaking change**
- `world.color` is still being used by Workbench, so it stays there,
although it has no effect anymore when using Cycles or EEVEE.

Python API changes:
Creating a World using `bpy.data.worlds.new()` now creates a World with
 an empty (embedded) node tree. This was necessary to enable Python
scripts to add nodes without having to create a node tree (which is
currently not possible, because World node trees are embedded).

Pull Request: https://projects.blender.org/blender/blender/pulls/142342
2025-07-28 14:06:08 +02:00
YimingWu
272178d001 Fix #143420: Grease Pencil: Handle empty result in dash modifier
The dash modifier creates final result by combining filtered/processed
and unfiltered strokes, but this result could be empty. The code assumes
valid joined geometry when it's sometimes not the case. This patch did
a null check and it worked as it should.

Pull Request: https://projects.blender.org/blender/blender/pulls/143424
2025-07-28 13:38:08 +02:00
Brecht Van Lommel
fa007002b1 Refactor: Logging: Move G.quiet to CLOG, replace some printfs
* Replace G.quiet by CLG_quiet_set/get
* CLOG_INFO_NOCHECK prints are now suppressed when quiet, these were
  typically inside a if (!G.quiet) conditional already.
* Change some prints for blend files, color management and rendering to
  use CLOG, that were previously using if (!G.quiet) printf().

Pull Request: https://projects.blender.org/blender/blender/pulls/143138
2025-07-28 13:36:13 +02:00
Bartosz Kosiorek
b1d5c35f3a Physics: Change default shape for Bubble and Foam particles, to increase visibility
Change default shape of Bubble and Foam, to be able to notice potential
artifacts in the Viewport. The shape for bubble was changed to circle, and
the shape for Foam was changed to cross.

It allows users to notice and fix artifacts in early stages for reports like:
#79995 #81011 #85533 #97063

Pull Request: https://projects.blender.org/blender/blender/pulls/138681
2025-07-28 13:33:04 +02:00
Bartosz Kosiorek
127d891f31 Fix #86512: Fire simulation without smoke not affected by force field
It was incorrectly skipping effectors in this case.

Fix #86512
Fix #129427

Pull Request: https://projects.blender.org/blender/blender/pulls/137679
2025-07-28 13:16:17 +02:00
Benjamin Beilharz
fa2062ee96 Refactor: Renames the zero extension mode to clip
This commit renames the `ExtensionMode`'s `Zero` case to `Clip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/143354
2025-07-28 10:45:12 +02:00
Habib Gahbiche
cf5be88e7f Fix #143291: USD: World uses wrong output node
The problem was that the first output node was chosen instead of the
active one.

Pull Request: https://projects.blender.org/blender/blender/pulls/143292
2025-07-28 10:27:44 +02:00
Omar Emara
6f426f498a Refactor: Move pass name aliasing to context implementation
This patch moves the rules that alias Image to Combined for pass names
to the context implementations. This is because this only makes sense
for contexts that deal with passes, while it wouldn't make much sense
for other possible contexts like VSE modifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/143419
2025-07-28 10:00:20 +02:00
Benjamin Beilharz
4bffd43adc Cleanup: Adds missing static casts
This commit adds missing static casts for the interpolation and
extension mode lookups.

Pull Request: https://projects.blender.org/blender/blender/pulls/143418
2025-07-28 09:11:21 +02:00
Omar Emara
ed8c072933 Refactor: Add default implementation for render_data
This patch adds a default implementation for the render_data method of
the compositor context. It defaults to the scene render_data.

Pull Request: https://projects.blender.org/blender/blender/pulls/143205
2025-07-28 07:55:46 +02:00
Jesse Yurkovich
26c939849c Cleanup: USD: Various C++ cleanups for point instancing export support
- Use Blender C++ containers
- Use const in more places
- Remove unnecessary headers
- Style/guideline cleanups

Pull Request: https://projects.blender.org/blender/blender/pulls/143397
2025-07-28 07:16:26 +02:00
Jesse Yurkovich
f7210eabd8 USD: Enable the allow_unicode export operator property by default
All supported versions of Blender are capable of handling the Unicode
prim and property names now.

It's difficult to determine how much of the USD ecosystem is using
version 24.03 or greater so there is some risk of our files (when they
make use of Unicode names) not loading correctly for other DCC
applications.

Pull Request: https://projects.blender.org/blender/blender/pulls/142747
2025-07-28 07:15:50 +02:00
Campbell Barton
ca0e6e77ec UI: improve percentage display for wm.progress API
wm.progress displayed a percentage in a cryptic
2x2 grid of numbers, so:

```
75
23
```

Represents `75.23%`. This is now shown as `75.23%`
on systems that support RGBA cursors.
2025-07-27 21:26:26 +10:00
Campbell Barton
320975c842 Cleanup: don't pass an Array by value in mesh_intersect.cc 2025-07-27 20:32:55 +10:00
Andrej730
ddeddaecd6 PyDoc: improve mathutils python signatures and doc-strings
- Adding `/` to signatures to indicate that arguments are accepted only
  as positional.
- Document default values and optional arguments in consistent way with
  other docs.
- Use `Literal` for strings to indicate set of allowed string values
  (later it can also be used in typing stubs).
- Document some undocumented arguments.

Ref !143278
2025-07-27 20:23:44 +10:00
Campbell Barton
37a2effab7 Cleanup: avoid casting away 'const'
Copy into a non-const variable before assignment to avoid casts that
remove `const`.
2025-07-27 17:06:06 +10:00
Campbell Barton
b8897d3f6e Cleanup: remove unnecessary name prefix in DrawCache::text_id 2025-07-27 16:59:11 +10:00
Campbell Barton
e8f9e2d1d1 Cleanup: use UTF8 string functions in editors & related logic
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 16:41:19 +10:00
Campbell Barton
f6af0aae7c Cleanup: use UTF8 string functions for tracking members
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 16:39:57 +10:00
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