Commit Graph

120055 Commits

Author SHA1 Message Date
Aras Pranckevicius
82f0578ca3 Compositor: always use the new CPU compositor
Part of #125968: this makes the new CPU compositor always be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131783
2024-12-12 20:17:36 +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
Clément Foucault
afb0d41107 EEVEE: Make sampling.reset() and sampling.is_reset() viewport only
This commit ensures correct usage of these functions.
Usage of them was not guarded and caused issues in render.

Fix #131804
2024-12-12 18:49:58 +01:00
Jacques Lucke
8e1aec7664 Fix #108520: Store Named Attribute node does not propagate values if domain changes
Don't just initialize new values to zero but actually take the existing attribute into account.
Once supported, this can also automatically take defaults for built-in attributes into account
without further changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131794
2024-12-12 18:11:45 +01:00
Hans Goudey
4ca3f02601 Refactor: Nodes: Improve socket node lookup functions
- Use return values instead of return arguments
- Remove the socket index lookup which was only used once
- Always use the topology cache for node_find_node
- Improve the documentation
- Add a const version of node_find_node

Overall, I think always using the topology cache will give more
predictable performance. Though it may require more cache
rebuilds after the node tree is changed, in practice there are
plenty of other things that require that already. This way, code
that doesn't change the node tree will get better performance
without having to think about the caching.

Pull Request: https://projects.blender.org/blender/blender/pulls/131811
2024-12-12 18:04:36 +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
ba6b4d4553 Fix: mixed snap not working on geometry generated by curves
`snap_polygon` and `snap_edge_points` were, for no reason, limited to
Mesh type Objects.
2024-12-12 13:10:36 -03:00
YimingWu
bda221ef2e Fix #131711: Grease Pencil: Null check when getting material passes
The material returned by `BKE_object_material_get` could be nullptr when
the material is somehow not a grease pencil material and this situation
needs to be handled. This is likely caused by faulty file from previous
verisons.

Pull Request: https://projects.blender.org/blender/blender/pulls/131714
2024-12-12 17:04:21 +01:00
Omar Emara
e7dfc1c939 Compositor: Optimize Distance Dilate node
This patch optimizes the Distance Dilate code by limiting the search
window to areas within the image, avoiding fallback image sampling and
looping redundant pixels. Gives a 1.8x improvement.
2024-12-12 17:53:44 +02:00
Falk David
635c9c8303 Cleanup: Grease Pencil: Remove using namespace math
This was causing issues after updating tbb and compiling on msvc.
2024-12-12 16:49:11 +01:00
Bastien Montagne
0e0b7e3294 Fix #131748: Error with pasting pose on liboverride armature.
Either initial fix (9405bd25d6) was not fully correct (and properly
tested), or something else changed since then, but the handling of
liboverrides in copy/paste of poses would not be correct for local
overrides.

Instead of relying on generic `BKE_lib_id_make_local` to also work
for local liboverrides, add some more logic in `PartialWriteContext::make_local`
to properly handle local liboverrides when the override data needs to get
removed in the copy buffer blendfile.

NOTE: Not super-happy with how make local and removal of liboverrides
somewhat mix together currently. Will need to revisit once again that
whole process at some point.
2024-12-12 15:45:33 +01:00
Laurynas Duburas
3cbeb8ff2b Curves: Remove usage of IndexMask::operator[] in transform
Removes usage of `IndexMask::operator[]` in transform
function `curve_populate_trans_data_structs`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131784
2024-12-12 15:36:24 +01:00
Jacques Lucke
54f8ef12d8 Fix: crash when using subdiv modifier on curves
This only affected the drawing of the modifier UI, not the actual evaluation.

There was a missing check for the object type before retrieving the data from it.
2024-12-12 14:23:54 +01:00
Philipp Oeser
a01fd34f2d Fix #131785: EEVEE samples affected by (disabled motionblur) samples
This was reported for freestyle, but was also the case for regular
renders.

So even though MotionBlurModule::init and MotionBlurModule::step return
early when motionblur is disabled, Sampling::init would still up the
samples with motionblur samples (even if motionblur was disabled
alltogether).

To resolve, only do this when motionblur is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/131795
2024-12-12 14:03:49 +01:00
Hans Goudey
c3cc3c019d Fix #103785: Geometry Nodes attribute inputs aren't overridable
The "use attribute" and "attribute name" IDProperties were missing
the overrideable status and the static type status. This was an oversight
from when those tags were added.

This commit fixes the flag on new modifier properties as they're created
and applies versioning to old properties. It also fixes the poll of the toggle
input attribute operator so that it isn't possible on non-editable objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/131768
2024-12-12 13:48:52 +01:00
Jeroen Bakker
16a739dc8a GPU: Add unpack row length tests
This PR adds 2 test cases to test uploading sub texture with and
without unpack row length.

Ref #130977

Pull Request: https://projects.blender.org/blender/blender/pulls/131791
2024-12-12 12:58:16 +01:00
Jeroen Bakker
567595e850 Fix: GPU: OpenGL texture tests
Some texture roundtrip tests are not supported on OpenGL. This PR will
skip these tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/131792
2024-12-12 12:57:41 +01:00
Clément Foucault
f6ecd033de Cleanup: DRW: Remove unused functions and variables 2024-12-12 12:53:20 +01:00
Jeroen Bakker
d7c45e6e0c Fix #131754: Out of bounds when drawing active UDIM tile.
There is a case where the active image index could be placed on an
non-existing tile. This PR fixes this by keeping track of the active
tile when looping over all tiles.

Pull Request: https://projects.blender.org/blender/blender/pulls/131789
2024-12-12 12:29:06 +01:00
Jacques Lucke
c22ade6993 Fix #131175: corrupted data when unpacking bake on windows
The issue was that on windows any `\n` byte would be written as
`\r\n` which corrupts the data, unless `std::ios::binary` is provided.
2024-12-12 12:08:42 +01:00
Omar Emara
c8da04a150 Fix: Compositor returns zero for Speed pass
The GPU compositor and the new CPU compositor return zero for the Speed
pass, that's because the output identifier was used as the pass name
which is not guaranteed to work for existing files. To fix this, use the
socket data pass name instead.
2024-12-12 12:11:23 +02:00
Campbell Barton
3e9578485f Fix 3D text underline/rotation depending on the last characters style 2024-12-12 16:09:35 +11:00
Campbell Barton
396fbec4ed Fix 3D text alignment depending on the last characters style
As characters were evaluated, the VFontData was set.
This was then used to calculate text alignment.

Resolve by always using the "Regular" font metrics.
2024-12-12 16:09:35 +11:00
Campbell Barton
4e5a6846bf Refactor: use a struct to track font style in vfont_to_curve
No functional changes, prepare for fixes related to tracking style.
2024-12-12 16:09:35 +11:00
Campbell Barton
2c54da78d1 Cleanup: de-duplicate check in vfont_to_curve 2024-12-12 16:09:35 +11:00
Campbell Barton
e8316df911 Fix unlikely memory leak in vfont_to_curve
Memory would leak if allocating char32_t array failed.
2024-12-12 13:51:05 +11:00
Campbell Barton
d7bbb5f676 Cleanup: remove redundant/confusing break in vfont_to_curve
Remove a check for a case that never happens.
2024-12-12 13:44:37 +11:00
Campbell Barton
84e14b21fd Unbreak building WITH_USD 2024-12-12 13:40:26 +11:00
Jesse Yurkovich
a6d4e91db8 Cleanup: USD: various non-functional changes
Tidy up:
- Use blender::Map and blender::Vector for newly created `prim_map`
- Leave bread-crumb comment for moving map creation outside of loop
- Expand UI tooltip for newly added export option

Pull Request: https://projects.blender.org/blender/blender/pulls/131770
2024-12-12 00:57:29 +01:00
Harley Acheson
fe6609c4eb Fix #111379: Allow Win32 Volume Names to Contain Characters > U+FFFF
When processing volume names for the File Browser sidebar lists we are
properly handling Windows "wide" characters (UTF-16) as long as they
are single wide characters, so below U+FFFF. For characters above this
value we get a pair of UTF-16, and end up trying to convert each to
UTF-8 as separate UTF-32 values. The result is blank output and a
console error that "surrogates not allowed." This PR just does this
conversion correctly using utfconv.

Pull Request: https://projects.blender.org/blender/blender/pulls/131763
2024-12-12 00:49:33 +01:00
Hans Goudey
3bbf546d28 Fix #129388: Incorrect bounds for Geometry Nodes line primitive 2024-12-11 17:32:11 -05:00
Charles Flèche
0df5d8220b USD: Add new get_prim_map API callable from python on_import hooks
When importing an USD, the Blender object names do not necessarily match
Prim names:

```
#usda 1.0
def Xform "xform1"
{
  def Mesh "MyObject"  # Will be imported as "MyObject"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.001"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.002"
}
```

This makes it difficult in the [USD Import Hooks]
(https://docs.blender.org/api/current/bpy.types.USDHook.html) to link a
Blender object back to its source Prim for additional processing. A
typical use cases for games is to generate UVs, create and apply a
material on the fly when importing a collision shape that does not have
a visual representation (hence no materials) based on some Prim
attributes, but that the artist needs to differenciate in Blender's
viewport.

The Import context exposes a new method `get_prim_map()` that returns a
`dict` of `prim path` / `list of Blender ID`.

For example, given the following USD scene,
```
/
 |--XformThenCube [def Xform]
 |   `--Cube [def Cube]
 |--XformThenXformCube [def Xform]
 |   `--XformIntermediate [def Xform]
 |       `--Cube [def Mesh]
 |--Cube [def Cube]
 `--Material [def Material]
     `--Principled_BSDF [def Shader]
```

the `get_prim_map()` method will return a map as:

```python
@static_method
def on_import(import_context):
  pprint(import_context.get_prim_map())
```

```json
{
  "/Cube": [bpy.data.objects["Cube.002"], bpy.data.meshes["Cube.002"]],
  "/XformThenCube": [bpy.data.objects["XformThenCube"]],
  "/XformThenCube/Cube": [bpy.data.objects["Cube"], bpy.data.meshes["Cube"]],
  "/XformThenXformCube": [bpy.data.objects["XformThenXformCube"]],
  "/XformThenXformCube/XformIntermediate": [bpy.data.objects["XformIntermediate"]],
  "/XformThenXformCube/XformIntermediate/Cube": [bpy.data.objects["Cube.001"], bpy.data.meshes["Cube.001"]],
  "/Material": [bpy.data.materials["Material"]],
}
```

Co-authored-by: Odréanne Breton <odreanne.breton@ubisoft.com>
Co-authored-by: Sttevan Carnali Joga <sttevan.carnali-joga@ubisoft.com>
Co-authored-by: Charles Flèche <charles.fleche@ubisoft.com>
2024-12-11 21:36:09 +01:00
Gilberto.R
8ceaaafde8 UI: Use consistent naming for mode toggle on undo history
Change name of OBJECT_OT_editmode_toggle to "Edit Mode" and name of
PAINT_OT_texture_paint_toggle to "Texture Paint Mode" to display in a
more consistent manner in Undo History.

Pull Request: https://projects.blender.org/blender/blender/pulls/112703
2024-12-11 21:29:43 +01:00
Hans Goudey
4543177ca2 Fix: Missing versioning for embedded node trees in recent commit 2024-12-11 15:19:02 -05:00
Hans Goudey
4bf34d9591 Nodes: Simplify location storage, remove hidden offfsets
Currently each node's position is stored in the coordinate space of
its parent. To find the location of a node on the canvas, we have to
apply the translation of each of its parents. Also, nodes have hidden
"offset" values used while transforming frame nodes. Together,
those made the system much more complicated than necessary,
and they made the Python API ineffective.

This commit removes usage of the offset values and moves nodes
to be stored in the "global" space of the node canvas. It also resolves
some weird behavior when resizing frame nodes, and fixes a few bugs.

The change is forward compatible, so we still write files with nodes in
the old parent-space format. In 5.0 the conversion when writing can be
removed. The existing Python API also stays the same. A new
"location_absolute" property gives node locations in global space,
and changing the old property also moves the child nodes of frames.

Resolves #92458, #72904.

Pull Request: https://projects.blender.org/blender/blender/pulls/131335
2024-12-11 21:06:41 +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
Miguel Pozo
9584c9917a Fix #131040: EEVEE: First sample rendered with queued shaders
The first check for `materials.queued_shaders_count > 0` was done
before any synchronization, so it would always pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/131756
2024-12-11 19:43:23 +01:00
Clément Foucault
9a21d67a54 Fix #131652: DRW: Viewport/EEVEE retained ghost image of object
This was caused by a bad state where a texture (likely the viewport)
texture, could be bound as texture by the viewport blit function
and kept bound as texture input during the subsequent redraw.
This would provoke a feedback loop which is UB.

It is still unknown why this is not catched by our GL layer
and why it isn't an issue in Vulkan or Metal nor other GL
implementations.

Add back all missing calls from previous `DRW_state_reset` to
avoid more regressions.
2024-12-11 18:13:21 +01:00
Harley Acheson
f05fff0d97 Fix #93769: Improved File Browser Button Tooltips
In the File Browser the "Cancel" button always has a tooltip hint of
"Cancel loading of selected file", even when you are saving. This PR
changes that to a more generic "Cancel file operation". Similarly the
save/load button always shows "Execute selected file", even when
loading. This PR instead uses the description of the operator that is
called when that button is pressed. When opening a file it shows "Open
a Blender file", saving shows "Save the current file in the desired
location", etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/131703
2024-12-11 18:11:27 +01:00
Hans Goudey
de8f882817 Cleanup: Use "this" keyword to access class members 2024-12-11 11:47:20 -05:00
Guillermo Venegas
0576f22a67 BLI: allow extending a Vector with another Vector with move-semantics
This enables moving elements form one vector to another.

Usually this is being doing by extending a vector with the content
from the secondary vector and then clearing the secondary vector.
However sometimes this being performed to transfer ownership of managed elements,
if elements are copied from the secondary vector, but not cleared, this could
lead to 2 vectors to share ownership of objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/131560
2024-12-11 17:43:44 +01:00
Matthew-Kabin
661facbde0 Fix #131370: Curves: Sculpt selection overlay missing
Selecting curves in sculpt mode is once again visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/131550
2024-12-11 17:07:36 +01:00
Julian Eisel
2ce383b2f1 Fix: UI: Asset shelf popup not available
Mistake in f6a4d01703. This refactored the lookup for a named string context
member to avoid code duplication.

Intention was to construct a StringRef referencing the string stored in
context. But the refactored lookup returned an unintentional string copy, so
the reference would be constructed from a temporary string object that would
get destructed immediately.
2024-12-11 17:04:52 +01:00
Hans Goudey
cf6f6d515d Fix #112445: Possible to create invalid attribute with rename
Renaming attributes in the property editor didn't take into account
the required domains and types for builtin attributes. It might be
possible to trigger crashes by using a builtin name with the wrong
metadata. At the very least it would be confusing.

This commit extends the attribute provider check for builtin
attributes to give the required domain and type. We check that in
the attribute rename function to make sure the new name is valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/131702
2024-12-11 16:52:33 +01:00
Hans Goudey
20c3269ac9 Fix #100324: Curves sculpt slide brush always resets with pressure
When releasing the pen the pressure would always go back to zero,
undoing the effect of the brush. To fix this, don't take pressure into
account for the strength, and don't display it in the UI. The grab brush
in mesh sculpt mode works the same way.

Pull Request: https://projects.blender.org/blender/blender/pulls/131744
2024-12-11 16:43:15 +01:00
Hans Goudey
071fb86a07 Cleanup: Remove unused function 2024-12-11 10:23:45 -05:00
Hans Goudey
937f5022f4 Fix: Missing translation in parent set menu item 2024-12-11 10:08:43 -05:00
Hans Goudey
50585b8131 Fix #131749: Missing text for operator buttons
Missing change of nullptr to std::nullopt after a recent cleanup.
2024-12-11 10:07:59 -05:00