Commit Graph

113721 Commits

Author SHA1 Message Date
Julian Eisel
2499299ff2 Fix: Empty grease pencil brush libraries linked on startup
Second part to fix #128420.

On startup, the Blender File Outliner mode would show empty libraries
linked, pointing to the brush essentials files. This was because some
grease pencil versioning code would call
`BKE_paint_ensure_from_paintmode()`, which would link in the default
brushes. Then a bit later, brush assets versioning code would remove
local brushes from the default starup file, so the library link became
empty.

Initializing paint data shouldn't necessarily include importing default
brushes. In an earlier version I made this optional with a boolean, but
it's easy enough to separate out entirely.

Now `BKE_paint_ensure()` just initializes paint data, and
`BKE_paint_brushes_ensure()` has to be called to ensure that active
brushes are available.

Pull Request: https://projects.blender.org/blender/blender/pulls/128801
2024-10-09 16:13:01 +02:00
Julian Eisel
eac897bb38 Fix: No default brush set for vertex paint mode
Name of the default brush to use was wrong, so it wouldn't be found.
2024-10-09 14:52:33 +02:00
nutti
1d07ec7bc9 PyAPI: add specific BMLayerCollection element type to doc-strings
Ref: !125851
2024-10-09 22:58:17 +11:00
Campbell Barton
233cf07866 Cleanup: remove unused functions 2024-10-09 22:29:16 +11:00
Philipp Oeser
738dc431eb Fix: Sequencecache modifier opening a file mem allocation mismatch
Oversight in 9506fed905

This would give: "Attempt to use C-style MEM_freeN on a pointer created
with CPP-style MEM_new" (and crash in my local builds)

(noticed while cecking on #128746)

Pull Request: https://projects.blender.org/blender/blender/pulls/128755
2024-10-09 13:01:42 +02:00
Lukas Tönne
12b4ac87ea Fix #128789: GPv3: Context property missing nullptr check
`grease_pencil` context property has to check for valid active object.
Added in 70c7fb6da2

Pull Request: https://projects.blender.org/blender/blender/pulls/128791
2024-10-09 12:22:51 +02:00
Lukas Tönne
5c57e24fea Cleanup: GPv3: Remove unused BKE functions from GPv2
Removes unused GPv2 functions in blenkernel.

Notes:
-  Functions for layer masks are still in use, but annotations never
  have layer masks in the first place. Would be good to remove the data
  structures so we can remove the functions too.
- Some multi-frame edit functions are also still nominally used, but
multi-frame editing is not an active feature for annotations. This
  should also be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/128709
2024-10-09 10:27:45 +02:00
nutti
933fb1978f PyAPI: correct types in doc-strings
Ref !116245
2024-10-09 15:45:23 +11:00
Germano Cavalcante
0ac66493c0 Fix: Error in previous commit: Snap to grid not updating size while navigating
`t->snap` varies per operator and does not update.
2024-10-08 23:29:57 -03:00
Germano Cavalcante
56c98046a5 Fix #122635: Precision mode not working with Snap to Grid
This introduces partial functionality of Precision mode to 'Snap to
Grid'.

However, it behaves differently from 'Absolute Grid Snap', as it lacks
smooth mouse movement.

Precision mode is now available specifically for Transform operations.
2024-10-08 22:17:36 -03:00
Germano Cavalcante
ae37656478 Fix #128764: Moving keys in the animation editors enables the 3D view's snap toggle
The issue occurred because the code block that read the snap flag was
out of sync with the code block that saved the flag.

The solution was to centralize snap flag handling in the
`transform_snap_flag_from_spacetype_ptr()` function. This function
retrieves the appropriate snap flag and property based on the editor
type, eliminating the need for repetitive conditional checks and
ensuring that the correct snap flag is set for each editor.
2024-10-08 19:17:51 -03:00
Weizhen Huang
52f2bb53b9 Fix #128654: EEVEE: improve precision of cubic solver in light LTC
by rescaling the polynomial coefficients and bringing them to the same
magnitude.

Pull Request: https://projects.blender.org/blender/blender/pulls/128753
2024-10-08 21:45:51 +02:00
Harley Acheson
dc6e021472 Fix #128616: Allow Docking to work from Menu shortcut
Allow Docking to work correctly if using a shortcut to the area header
context menu item. There is no longer a need to set the source or
target area locations.

Pull Request: https://projects.blender.org/blender/blender/pulls/128730
2024-10-08 21:37:54 +02:00
Harley Acheson
00dca5acec Fix #128112: Improve Display of Drag Overlays
Use zero offset for drag items to remove blurriness.

Pull Request: https://projects.blender.org/blender/blender/pulls/128623
2024-10-08 20:44:05 +02:00
Miguel Pozo
07bbe03ffa Fix: EEVEE: DoF slight focus
The ring distance was still computed wrong after #127880
2024-10-08 19:34:17 +02:00
Bastien Montagne
dbadc1c71c Fix part of #128420: invalid handling of full orphaned libraries in management code.
Reset the 'hierarchy index' runtime `temp_index` value for all library IDs.
This prevent the assert to be triggered when trying to rebuild libraries
hierarchy and there are some orphaned (i.e. not used by anything) library IDs
around.
2024-10-08 17:02:51 +02:00
Sybren A. Stüvel
0ae641c4ef Anim: fix null pointer access in 'Push-Down to NLA' operator
After pushing down the Action to the NLA, it needs to be tagged for
reevaluation. The code was using `adt->action->id` for this, but since
the nature of the operator is that it un-assigns the Action itself, that
would always be a null pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/128707
2024-10-08 15:19:34 +02:00
Falk David
92b4c853db Fix: Python: Incorrect default curve_type when calling drawing.add_strokes()
The API did not initialize the `curve_type` for the newly created strokes resulting in unwanted behavior.

Set the curve type to the expected default: `POLY`.
2024-10-08 12:37:10 +02:00
Falk David
35c2461130 Fix: Build warnings missing include
Caused by a57206dd59.
Missed to remove the line that included the legacy
folder.
2024-10-08 11:37:58 +02:00
Jeroen Bakker
27932162d8 Fix: Cache files location
Adds an additional precheck to identify if the app cache dir is correct.
Reduces placing cache files all over the place when the app dir isn't
correct.
2024-10-08 11:32:41 +02:00
Jeroen Bakker
3cd579208b Vulkan: SPIR-V Caching
Adds a SPIR-V cache that skips frontend compilation for shaders
that are already compiled in a previous run of Blender.

Initially this was postponed to 4.4 but it was observed that
the vulkan backend didn't perform well on Windows in debug
builds. The reason is that the compiler would also be a debug
build which makes compiling a shader really slow. Starting
Blender on a debug build could take minutes.

So the decision was made to give this task a higher priority so
the vulkan backend would become more usable to developers
as well.

The cache is stored in the application cache dir. The SPIR-V
binaries can be used by different Blender versions so there
is no version specific cache folder.

**Sidecar**: SPIR-V files are a stream of bytes. There is no
header information that allow us to validate the stream. To
add basic validations we could add our custom header or
a sidecar. It was chosen to use a sidecar as having the SPIR-V
files unmodified allows us to load them directly in
debug tools for analyzing.

**Retention**: Shaders that are not used are automatically
removed with a retention period of 30 days.

**Shader builder**: Shader builder cannot use the SPIR-V
cache as it uses stubs that returns invalid cache directories.
This would load/save the cache to the location where you
started the build.

Pull Request: https://projects.blender.org/blender/blender/pulls/128741
2024-10-08 10:55:10 +02:00
Philipp Oeser
3dd20a64f0 Fix #128633: Image gizmo missing update for the Properties Editor
Send appropriate notifier so the Properties Editor listener
(buttons_area_listener) will catch this and redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/128688
2024-10-08 08:19:45 +02:00
Iliya Katueshenock
6487fc96dd Fix #126024: Separate Geometry nodes does not propagate grease pencil materials
Pull Request: https://projects.blender.org/blender/blender/pulls/128664
2024-10-08 00:27:34 +02:00
Jacques Lucke
7777fca066 Fix #128178: missing update after attribute conversion
The same is done in `geometry_attribute_convert_exec`.
2024-10-08 00:21:03 +02:00
Campbell Barton
8c3ef77a35 Cleanup: spelling in comments 2024-10-08 09:03:49 +11:00
Sean Kim
03d5530788 Fix #128675: Layer brush creates bumps in mesh
Missed in 0161a19669

Unlike many other brushes, the Layer brush uses the original coordinates
of a given vertex only for the distance test when calculating the factor
and does not use it for other components such as textures.

Note that this commit looks larger than the change would imply, as it
required undoing a recent refactor that is no longer applicable with the
distance changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/128723
2024-10-07 23:04:04 +02:00
Sean Kim
197253c75c Fix #128508: Orbit around selected can shift view to negative infinity
We no longer keep the active_vert value in a valid state when the cursor
is not over the mesh. The helper method to access this position can
thus result in incorrect behavior when storing and retrieving this
value.

In this case, we simply avoid setting the `UnifiedPaintSettings` values
related to the last stroke, so that when it is used in
`view3d_navigate.cc` it falls back to the object origin.

Pull Request: https://projects.blender.org/blender/blender/pulls/128716
2024-10-07 22:42:43 +02:00
Sean Kim
061ea2c530 Fix #128635: Snake Hook brush cannot use texture
Missed in bf05ac13c8

Pull Request: https://projects.blender.org/blender/blender/pulls/128720
2024-10-07 22:41:07 +02:00
notrudyyy
bacbed14d0 Fix #128595: Mesh Filter Erase Displacement crashes without multires
Fixes a crash caused by a null pointer dereference when the Mesh Filter
tool with Erase Displacement option is used on a mesh that has no
Multiresolution modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/128632
2024-10-07 22:39:02 +02:00
Sean Kim
983ef262d8 Fix #128618: Crash when using cloth brush and automasking
Mistake in f4f732be95

Pull Request: https://projects.blender.org/blender/blender/pulls/128713
2024-10-07 22:34:23 +02:00
Jacques Lucke
99d73565d6 Geometry Nodes: optimize gathering attributes to fix regression
This fixes #127629. It's still a bit slower than it used to be when there are
lots of instances, but that fixes the main bottleneck that was introduced in
#116582. The issue was that we iterated over all attributes of all instances,
but it should only be necessary to iterate over the instances of each unique
geometry only once.

There is still quite some optimization potential in the Realize Instances code
for the case when realizing lots of instances. Especially the code to gather all
geometries that should be realized can still be made more efficient by reducing
redundant work and using multi-threading.

Pull Request: https://projects.blender.org/blender/blender/pulls/128699
2024-10-07 22:18:44 +02:00
Pablo Delgado Krämer
384f64f215 Fix Hydra crash with UsdPreviewSurface render delegates
When a render delegate does not use MaterialX (by setting
`bl_use_materialx = False` in engine.py), a crash can occur because the
worker_status is null.

Pull Request: https://projects.blender.org/blender/blender/pulls/128607
2024-10-07 21:29:48 +02:00
Germano Cavalcante
49ab0bb844 Fix: Edge Slide: Vertex destination not matching edges intersection
Before version 4.1, the vertex destination during edge sliding for two
independent edges was always the midpoint of the vertices closest to
those edges.

In version 4.1, this behavior was improved to calculate the destination
based on the intersection of the edges. However, when the faces were
coplanar, the behavior would revert to the previous midpoint
calculation instead of using the intersection.

This fix ensures that the vertex destination consistently aligns with
the intersection point, even when the faces are coplanar.
2024-10-07 14:32:33 -03:00
Germano Cavalcante
580e0af309 Fix #128702: Edge Slide can cause Blender to freeze
In non-manifold geometry, the original loop could fail to identify the
correct slide direction because it checked for loop equality
(`l_other != l_edge`), which might never be met.

The condition has been revised to check for face equality
(`l_other->f != l_edge->f`), ensuring the loop terminates correctly and
preventing infinite iterations in problematic geometry cases.
2024-10-07 14:04:52 -03:00
Falk David
9d09362c0c Fix #128698: GPv3: Layer adjustments are applied to original geometry
Mistake in b4881f6b0a.
The function `grease_pencil_do_layer_adjustments` needs
to be called *after* creating the geometry set for
evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/128706
2024-10-07 19:02:12 +02:00
Omar Emara
027d3acb4d Fix #128414: Compositor crashes using GPU compositor
Blender crashes when using the GPU compositor sometimes. This is because
compositor render data was accessed before it was updated in the
realtime compositor when detecting compositing device. So fix that by
first updating compositor data before calling any context methods.
2024-10-07 19:48:32 +03:00
Lukas Tönne
a57206dd59 GPv3: Remove unused legacy editor functions for GPv2
Removes all unused functions in ED_gpencil_legacy.hh

Pull Request: https://projects.blender.org/blender/blender/pulls/128597
2024-10-07 18:21:28 +02:00
Jesse Yurkovich
1676c06386 Fix #128504: check instancer purpose and visibility before processing
During stage load we first look for Prototype prims which are used for
instancing. However, if the instancer itself at the root of that
Prototype hierarchy would later be excluded because of either purpose or
visibility checks, the Prototypes would still be processed. These would
correctly be imported but would end up orphaned because nothing would
later add them to the view layer. Code expecting these objects to be
found within the scene would then fail.

In Animal Logic ALab this situation played out where there was a
`/root/instancer` prim with purpose "render" and we proceeded to load
the prims under the `/root/instancer/Prototypes/...` hierarchy. Since we
were attempting to load just the "proxy" purpose, the `/root/instancer`
was later excluded and the orphaning of those prototypes happened.

The change here moves `collect_point_instancer_proto_paths` to a method
of `USDStageReader` so it can now access `include_by_purpose` and
`include_by_visibility`. And these are now used to prevent unnecessary
Prototype loading.

Pull Request: https://projects.blender.org/blender/blender/pulls/128564
2024-10-07 18:08:22 +02:00
Omar Emara
0a70360eb6 Fix: Blender crashes opening a file with compositor
Blender crashes when opening a file that has an interactive compositor
active, while also having a script that invokes the compositor upon file
load.

This is caused by the same system GPU context being active in two
threads at the same time, which happens when the GPU context for the
compositor is created in the main thread, it is made current during
creation, but it is not reset to the main GPU context of the drawable
because it is null. So when the GPU compositor actually executes, it
makes the GPU context current again but in its own thread, causing a
BadAccess error in X11 and potentially other window systems.

The reason why the drawable is nullptr is because it is reset in the
existing window manager when opening a new file while Blender is open,
but it is never initialized for the new window manager. The drawable
info should be moved from the old window manager to the new window
manager in wm_file_read_setup_wm_use_new, but it is preemptively reset
by the wm_window_clear_drawable call before it it is moved. This is done
in wm_file_read_setup_wm_substitute_old_window.

So to fix this, we move wm_window_clear_drawable after the code block
where wm_file_read_setup_wm_substitute_old_window gets called.
2024-10-07 18:34:54 +03:00
Clément Foucault
301c853b9c DRW: Rename draw_debug_info.hh to avoid conflict with main branch
Between 0bfd5e3536
and b1cbd9c889
the main branch is incorrectly processing the file
`draw_debug_info.hh` as GLSL and does some string
preprocessing on it. But the output filename matches
the name of the header source file used for compiling
the gpu module. This file not having been updated
since a long time doesn't get copied from the source
folder when switching to other branch and make compilation
fail.

In order to avoid breaking the buildbot longer, we
rename the incriminating file to force recreate it
when building the release branch.
2024-10-07 16:11:09 +02:00
Jacques Lucke
9fc0d50846 Cleanup: encapsulate check for whether attribute is built-in 2024-10-07 14:10:38 +02:00
Pratik Borhade
772bb795d2 Fix #124753: Tag preferences dirty when editing operator property
When operator property is tweaked in preferences > keymap > "any operator",
preferences are not tagged dirty, which prevents writing the userpref
file at `WM_exit_ex` when auto-save is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/128516
2024-10-07 13:56:46 +02:00
Jacques Lucke
5fa8b5b601 Fix #127170: crash when openvdb throws exception in Volume to Mesh node
This catches the exception and shows the error message to the user.
We don't have much control over the error message here currently. Better just
report it for now. In the future we could try to detect what error it is exactly
and produce a more user friendly error.
2024-10-07 13:32:01 +02:00
Jacques Lucke
218af9b2cc Fix: missing anonymous attribute relations for foreach zone 2024-10-07 12:44:21 +02:00
Miguel Pozo
88289e8bac Fix #126562: Cycles/EEVEE versioning
Check all scenes to decide between versioning merged settings using
EEVEE or Cycles properties.

Still far from a great solution. :(

Pull Request: https://projects.blender.org/blender/blender/pulls/128554
2024-10-07 12:12:37 +02:00
Campbell Barton
6039cb17e6 Unix: use getpwuid() to access home when the variable/tilde expand fails
This was already done in GHOST, but not BKE_appdir_folder_home.

Also null check the return value from getpwuid() as it's not
guaranteed to be non-null.
2024-10-07 13:00:56 +11:00
Campbell Barton
1e9206238e Fix crash if expanding the fonts directory fails
Add missing null check for BLI_expand_tilde.
2024-10-07 13:00:53 +11:00
Campbell Barton
ff9d9711d7 Fix crash using "~" in the file selector when the "home" is null 2024-10-07 13:00:52 +11:00
Campbell Barton
e0f036f8f3 Fix inconsistency between *BKE_appdir_folder_{home/default} on macOS
Change from [0] introduced BLI_expand_tilde but missed the change
for BKE_appdir_folder_default.

[0]: 9df13fba69
2024-10-07 12:58:39 +11:00
Germano Cavalcante
e82ce39e17 Fix: Snap Toggle not updating snap status after a transform operation
Unlike Snap Invert, Snap Toggle (Shift + Tab) saves the snap status in
ToolSettings.

This is a regression from v3.6
2024-10-05 14:20:29 -03:00