Commit Graph

113684 Commits

Author SHA1 Message Date
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
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
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
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
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
bf52f6f723 UI: Remember asset shelf visibility per mode
After feedback from the brush assets, we want to not only set the
default visibility, but also remember the visibility per mode. This way
we can keep the shelf hidden in modes where there's only one bundled
brush per available tool. While having these tools support brushes can
be useful, we don't expect to bundle more brushes soon. So to avoid a
mostly empy asset shelf for a single brush, allow keeping the shelf
hidden in these modes unless the user expands it. The following commit
will set the default visibility for these modes.

More strictly speaking this is entirely context sensitive, not just per
mode, but with current shelf types is practically per mode.
2024-10-04 12:19:18 +02:00
Jeroen Bakker
7596a08b2c Vulkan: Add back command reordering for buffer updates.
Related to #126974, which removed command reordering due to some
EEVEE/framebuffer requirements. However buffer can still be reordered
without any artifacts.

Update buffers are common operations and are often isolated; safe to
move them outside the rendering scope.

Pull Request: https://projects.blender.org/blender/blender/pulls/128538
2024-10-04 12:11:40 +02:00
Pratik Borhade
bd4f7acce5 GPv3: Display layers when properties tab is pinned
Layer panel (also mask/ transform etc.) and other operators are gone
when properties tab is pinned and gpv3 object is non-active.
To fix this, get grease pencil pointer from `button_context()`
(done in `grease_pencil_context()`).

Continuation of cd476226d8

Pull Request: https://projects.blender.org/blender/blender/pulls/128475
2024-10-04 11:58:12 +02:00
Falk David
9d9dc3fc8f GPv3: Apply modifier to all frames
This adds an option `all_keyframes` to the `object.modifier_apply` operator.
With the option enabled, the operator will iterate through all the keyframes,
then apply the modifier and merge the result back into the original
object. This is only done for Grease Pencil objects.

This is how the default `Apply` operation worked in GPv2. This adds the
functionality back but also keeps the current `Apply` behavior for consistency
with other object types.

The UI is also changed to show both options in the dropdown menu.
Again, this is only shown for Grease Pencil objects.

With Geometry Nodes it's possible to add new layers to the geometry.
When applying, this will create a single keyframe on the first frame of
evaluation.  Layers with duplicated names in evaluated geometry will
be deduplicated. It's also possible to have layers with empty names.
When applying these get renamed to `Layer` (and `Layer.001` etc.
when such a layer already exists in the original geometry).

Pull Request: https://projects.blender.org/blender/blender/pulls/128487
2024-10-04 11:51:30 +02:00
Lukas Tönne
6e9462e056 Fix #128533: GPv3: Crash on undo
The poll function of the Grease Pencil edit undo system was changed by accident to include other
object modes like sculpt mode as well. In the other modes, undo steps wouldn't be created correctly.
Instead, fix the poll function to only allow the Grease Pencil undo system to take over in edit mode.
In all other modes fall back to the global undo system.

Fixes #128566 as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/128573
2024-10-04 11:36:46 +02:00
Falk David
78e4dd14bc Fix: Make grease_pencil_selection_poll non-static 2024-10-04 10:58:04 +02:00
Jeroen Bakker
55c180acc4 Fix #128561: EEVEE: Lightlinking crashes on NVIDIA
On NVIDIA drivers it is not allowed to pass buffers directly from the
interface to a function as the qualifiers do not match. This is commonly
fixed by first storing it in a local variable to remove the qualifiers
and then pass it to the function that need the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/128571
2024-10-04 10:52:53 +02:00
Philipp Oeser
e9262f48aa Fix #121075: Outliner Ctrl-clicking to toggle selection has speed limit
There are a couple of keymap entries for `OUTLINER_OT_item_activate` in
our keymap. One of them has Ctrl+dblclick as a binding to trigger
recursion, but that one exits early when not dblclicking on the icon.
(introduced in 796577d76e)

It does not exit in a way that the non-dblclick variant can run, for
that we need to exit with OPERATOR_PASS_THROUGH, so that the "other"
operator can run as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/121130
2024-10-04 10:43:43 +02:00
Philipp Oeser
9664fb0e69 Fix #128482: Motion Tracking: Apply Scale misses update
Missing depsgraph tagging the clip.
(elsewhere this area of the code uses 0 as the flag, but I assume using
a proper flag is preferred? using `ID_RECALC_SYNC_TO_EVAL` in this
PR...)

Pull Request: https://projects.blender.org/blender/blender/pulls/128527
2024-10-04 10:42:46 +02:00
Falk David
effa8fbb7a GPv3: Material Isolate Operator
This ports the `gpencil.material_isolate` operator to GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/128549
2024-10-04 10:38:04 +02:00
Falk David
b353260b9a Fix: Missing declaration of grease_pencil_selection_poll 2024-10-04 10:31:55 +02:00
Campbell Barton
4b6ebc9579 Fix error with select non-manifold when a mesh is in face-mode
In multi-edit mode, the select non-manifold function would exit with
an error if any mesh was in face mode.

While in practice the mode is synced between meshes, it's possible for
them to get out of sync with multiple scenes.

Editing in the middle of a loop on all edit-objects would change their
selection based on the internal order, leaving some unhandled,
returning canceled even though changes where made.

Resolve by checking the selection mode in the operators poll function,
then ensure all edit-meshes selection modes match the active object.
2024-10-04 17:42:45 +10:00
Campbell Barton
e03214f424 Cleanup: use doxy code-command
Supports language & is ignored by spell checker.
2024-10-04 14:46:59 +10:00
Campbell Barton
318125c82b Fix #127692: Artifact in axis aligned portions of mask feather
BLI_scanfill could remove edges later needed for feathering,
although this would only occur in specific cases.

Resolve by storing edges before triangle filling.
2024-10-04 11:46:38 +10:00
Campbell Barton
a2617b0029 Fix mask duplicate failing to set the active point
Duplicate was setting the last-duplicated spline as active,
leaving the active vertex set to the original (non-duplicated) spline.

This caused the active spline/point to get out of sync,
while not an error - it is confusing and should be avoided.

Now the active spline & point are duplicated,
matching active behavior elsewhere (objects for e.g.).
2024-10-04 11:46:36 +10:00
Campbell Barton
18da036ecc Fix crash deleting mask vertices
The active vertex was only cleared when it was part of the active-spline
(which isn't guaranteed).

Duplicating & deleting left the active vertex pointing to freed memory.
2024-10-04 11:46:34 +10:00
Campbell Barton
44bb032590 Fix ARRAY_HAS_ITEM macro on 64bit systems
An unsigned int was used for pointer offset calculation which could wrap
around, for large values or when pointer being checked is from a
different allocation.
2024-10-04 11:46:33 +10:00
Campbell Barton
0b8ce96bc1 Cleanup: quiet warnings, spelling 2024-10-04 11:45:26 +10:00