Commit Graph

141959 Commits

Author SHA1 Message Date
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
Anthony Roberts
937b289137 Libs: Update OIIO+OSL+LibPNG+ShaderC
Pull Request: https://projects.blender.org/blender/blender/pulls/128690
2024-10-07 18:55:00 +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
Falk David
68c665ffa1 Fix #128646: Wrong selection results using the high-level python API
The issue was that the API assumed that the `.selection` attribute
was always on either the point domain for points or the stroke domain
for strokes.
Internally the attribute domain depends on the current selection mode.

To fix the issue, the API now checks for the domain of the attribute
and handles it accordingly.

If the selection attribute is on the `'POINT'` domain:
* Reading the `stroke.select` property will check if *any* of the points of
the stroke are selected and return `True` or `False`.
* Writing to the `stroke.select` property will write `True` or `False` to *all* the
points in the stroke.

Also resolves #128645.

Pull Request: https://projects.blender.org/blender/blender/pulls/128687
2024-10-07 18:17:45 +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
Bastien Montagne
af4d53ac2d I18N: Update UI translations from git/weblate repository (84027d1374f1ae). 2024-10-07 11:38:46 +02:00
Alaska
02973568d6 Cycles Build: Add OptiX 7.4 to FindOpitX.cmake
This helps users building Blender on their own machine get OptiX 7.4
setup for Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/128682
2024-10-07 11:22:57 +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
Campbell Barton
9517f69762 Fix BLI_path_is_abs_from_cwd with root/drive-letter paths
The paths `C:` (on WIN32) and `/` on other systems was detecting as
relative. This meant `BLI_path_abs_from_cwd` would make both paths
CWD relative. Also remove duplicate call to BLI_path_is_unc.
2024-10-05 17:58:41 +10:00
Campbell Barton
ea2d27cf84 Fix #128567: file selector automatically creates paths & warns
Regression in [0] which didn't account for entering paths in the
file selector which would create paths without confirming,
warning that the "confirm" property was missing.

Entering `*.*` would create `_._` for e.g in the users CWD for example.

Ref !128568

[0]: 6dd0f6627e.
2024-10-05 16:58:21 +10:00
Aaron Carlisle
522a21c58b Docs: Update RNA to user manual URL mapping 2024-10-05 00:51:36 -04:00
Miguel Pozo
40d20f023a Fix: gpu_shader_create_info_get_unfinalized_copy 2024-10-05 01:22:51 +02:00
Pratik Borhade
826ba8e27a Fix #128231: Wrong padding for gizmo and menu tooltips
This is due to wrong `is_pad` is passed as argument. It should be false
for gizmo tooltips. For menus when fields size is zero i.e. no
element is appended yet, the python message will be at the top of
tooltip region.

Pull Request: https://projects.blender.org/blender/blender/pulls/128243
2024-10-04 20:12:38 +02:00
Falk David
5f5b1b83d0 GPv3: Rename mode enum names and python identifiers
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.

For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`

For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`

Resolves #127374.

Pull Request: https://projects.blender.org/blender/blender/pulls/128604
2024-10-04 19:20:00 +02:00
Miguel Pozo
6e6e3da454 Workaround: Allow patching CreateInfos at runtime
Temporary workaround for Overlay Next.

Pull Request: https://projects.blender.org/blender/blender/pulls/128452
2024-10-04 19:16:30 +02:00
Miguel Pozo
3a39121a07 Fix: Finalize CreateInfos at startup
Prevents race conditions on ShaderCreateInfo::finalize.
Previoulsy fixed by #128281, but it doesn't work for the render thread.
2024-10-04 19:16:02 +02:00
Falk David
e7b2ec310f Fix: GPv3: Some selection keybinds not working in edit mode
This was due to a wrong mode check. GPv3 uses `OB_MODE_EDIT`.
2024-10-04 17:42:10 +02:00
Sergey Sharybin
4187644215 Build: Fix x64 libraries used by lib_update.cmd on WoA
Use the same logic as in check_libraries.cmd

Pull Request: https://projects.blender.org/blender/blender/pulls/128600
2024-10-04 17:06:15 +02:00
Lukas Tönne
9e70c6de4e Cleanup: Delete accidentally committed .orig file
This was a sloppy addition during #128521.

Pull Request: https://projects.blender.org/blender/blender/pulls/128596
2024-10-04 16:16:29 +02:00
Falk David
12eecb1504 Cleanup: GPv3: Don't show snap increment menu in topbar
In addc0ecb13, this also enabled
the `VIEW3D_PT_sculpt_snapping` menu which is not used
in Grease Pencil weight painting.
2024-10-04 16:03:59 +02:00
Philipp Oeser
addc0ecb13 GPv3: Add vertex group selector to topbar
Allows for switching the vertex group to be painted in weight paint mode
without having to have the Properties Editor open (same as for meshes).

Pull Request: https://projects.blender.org/blender/blender/pulls/128590
2024-10-04 15:55:07 +02:00
Falk David
e848bcdbbe Fix: GPv3: Flip primary and secondary toggle and shortcut missing
The `paint.brush_colors_flip` option was not exposed in the vertex color
panel.

This adds the toggle in the panel and also adds the keymap `X` to flip
the colors.
2024-10-04 14:48:09 +02:00
Falk David
9433ffe80a Fix: GPv3: Tint color property and panel
The tint color and panel was not used consistently.
In Vertex Paint mode we're using the unified paint settings,
but in Draw mode, we only use the brush color for tinting.

This fixes the issue by using the unified paint settings
for all the uses of the vertex color.
2024-10-04 14:41:45 +02:00
Omar Emara
99674e36f1 Fix #128551: Distorted cropped render in GPU compositor
Enabling render cropping while using the GPU compositor can cause the
render to be distorted in certain resolution and border configurations.

This is due to a difference in how the compositor and the render
pipeline compute the effective bordered size of the render. While
mathematically identical, difference in rounding can cause off by one
errors in the computed size. The render pipeline computes the integer
bounds of the border then computes the size from that, while the
compositor multiplies the float size of the border to the full size of
the render.

To fix this, we adjust the BKE_render_resolution function to compute the
border size using integer bounds like the render pipeline, which is the
function used by the compositor. The cropped version of that function is
used in two other places in the image editor for displaying render
results, so we should expect no difference in outputs with minimal but
more accurate difference in display.

Pull Request: https://projects.blender.org/blender/blender/pulls/128576
2024-10-04 14:27:27 +02:00
Jeroen Bakker
4334774a68 Fix: Vulkan: Incorrect image view layer size
When attaching a layered image with offset, the size of the attached
layers should be decreased. Otherwise an image view is created that can
access incorrect data.

Pull Request: https://projects.blender.org/blender/blender/pulls/128583
2024-10-04 14:26:22 +02:00
Omar Emara
6ae3232eda Fix #126565: Render region corrupt compositor output
Activating render region while using the CPU compositor produces corrupt
output for areas outside of the region when using the File Output node.
That's because the Full Frame compositor ignored nodes' render_border
flag, so the areas of interest of nodes that didn't consider render
border like the File Output were corrupt, producing uninitialized
outputs.

To fix this, we just consider the render_border flag when determining
output areas for output nodes in the Full Frame compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/128546
2024-10-04 14:25:31 +02:00
Omar Emara
ccab8005f6 Fix #126604: Legacy Cryptomatte doesn't work in GPU
The Legacy Cryptomatte node doesn't work in GPU execution mode if
Precision is set to Auto. That's because the colors picked from the Pick
layer might be in half precision and thus will not match the colors in
the Cryptomatte layers. This is due to the compositor using the
context's precision for Viewer outputs as opposed to the precision of
the image that actually needs to be viewed in the Viewer node.

To fix this, we set the Viewer node precision to be the precision of its
input, that way, the Cryptomatte pick layer will be output in full
precision as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/128495
2024-10-04 14:25:16 +02:00
Falk David
70c7fb6da2 Fix: GPv3: Context object has no attribute grease_pencil
When opeing the 2D Animation template, there was a UI error:
`AttributeError: 'Context' object has not attribute 'grease_pencil'`
This was because the context function `grease_pencil` was missing.
The fix adds this function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128580
2024-10-04 14:24:31 +02:00
Falk David
364d62e59b Fix: GPv3: Solid View: Show vertex colors in Draw and Vertex paint mode
There was a bug where vertex colors were not shown in solid view in
draw or vertex paint mode. The check to use `V3D_SHADING_VERTEX_COLOR`
was outdated and checked the wrong mode flags.

The fix makes sure that we use `V3D_SHADING_VERTEX_COLOR` in
draw and vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128581
2024-10-04 14:22:17 +02:00
Lukas Tönne
3d6a142162 GPv3: Remove unused GPv2 operators
Removes many of the operators, panels, and menus used exclusively by Grease Pencil v2 that are no longer needed in v3.
No functional changes are expected.

Some operators are still used by the annotations system and have to be kept around. These may be renamed in future.

Pull Request: https://projects.blender.org/blender/blender/pulls/128521
2024-10-04 13:05:09 +02:00
Jeroen Bakker
f1c0e258af Fix #128575: Vulkan: Fix armature drawing NVIDIA
The armature shape drawing was broken on NVIDIA. The reason is that not
all the elements in of the geometry shader out stages are written to. On
NVIDIA platforms this leads to not storing all the output data.

This could be that geometry shader on those plaforms write directly to
the final location in GPU memory. Other platforms might keep the data in
a local registry and copy it to the final location when emitting the
vertex.

Blender 4.4 might not have this issue as overlay next will remove the
need of the geometry shader.

From Khronos GLSL spec:
```
GS code writes all of the output values for a vertex, then calls EmitVertex().
This tells the system to write those output values to where ever it is that
output vertices get written. After calling this function, all output variables
contain undefined values. So you will need to write to them all again before
emitting the next vertex (if there is a next vertex).
```

Pull Request: https://projects.blender.org/blender/blender/pulls/128578
2024-10-04 12:47:42 +02:00
Alaska
0709743c0c Fix: Cycles: Rendering of the Principled BSDF when using adaptive kernel compilation
Fixes a issue where the Principled BSDF would render incorrectly if
`__SUBSURFACE__` is off. Which is common when using adaptive kernel
compilation (a unsupported Cycles feature).

Pull Request: https://projects.blender.org/blender/blender/pulls/128003
2024-10-04 12:39:03 +02:00
Falk David
c54d5d833b Fix: Compiler warning related to grease_pencil_context_poll
Declare this function in `ED_grease_pencil.hh`.
Move the implementation to `grease_pencil_ops.cc` with the other poll
functions.
2024-10-04 12:36:01 +02:00
Julian Eisel
7191608a98 Sculpt/Paint: Hide asset shelf by default in a few modes
Hides the brush asset shelf by default in weight paint, grease pencil
weight paint and grease pencil vertex paint mode. These only have one
bundled brush per tool available.

After bringing back some tools for brushes in certain modes
(3798852071), we want to hide the asset shelf in modes where there's
only one brush bundled per tool. While having these tools support
brushes can be useful, we don't expect to bundle more brushes soon. So
avoid a mostly empty asset shelf for a single brush by hiding it by
default and keeping it hidden until the user expands it (bf52f6f723 made
it possible to remember the visibility per mode).

Part of #128066 and #116337.
2024-10-04 12:27:04 +02:00