Commit Graph

109622 Commits

Author SHA1 Message Date
Hans Goudey
da1ea4cdd1 Revert "Draw: Avoid temporary copy for mesh triangulation index buffer"
This reverts commit 108ab1df2d.

This causes issues when duplicating objects that I don't have time
to investigate right now.
2024-05-23 23:43:34 -04:00
Sergey Sharybin
2a5892e013 Fix compilation error after recent cleanup 2024-05-23 22:17:36 +02:00
Clément Foucault
f46e3d1067 Fix: EEVEE-Next: No shading from lights for volume only scenes
The issue was that the shadow module was never setup by any
other pipeline before the volume lighting pass.

Fix #121971
2024-05-23 21:20:57 +02:00
Hans Goudey
427b356b87 Cleanup: Rename mesh render data orig index variables 2024-05-23 15:19:10 -04:00
Hans Goudey
e77c2d77e4 Cleanup: Remove unused function argument 2024-05-23 14:06:56 -04:00
Hans Goudey
3b93e8adca Cleanup: Mesh: Fix complicated index retrieval for loose points 2024-05-23 14:02:23 -04:00
Hans Goudey
108ab1df2d Draw: Avoid temporary copy for mesh triangulation index buffer
The mesh triangulation data is stored in CPU memory with the same format
as the triangles GPU index buffer. Because of that we can skip creating a
temporary copied owned by the GPU API. One way to do that is to just
upload the data directly and avoid keeping a reference to it. However, we
can only upload GPU data from the main thread with OpenGL, so instead
reference the data and keep track of whether to free it.

When drawing a mesh with a single material and 1.8 million faces, this
change gives a 12-15% improvement in framerate, from about 32 to 37 FPS.

Part of #116901.

Pull Request: https://projects.blender.org/blender/blender/pulls/122175
2024-05-23 19:59:36 +02:00
Jacques Lucke
ebb61ef30f Nodes: avoid removing link when inserting incompatible node
Previously, when dropping a node on a link with incompatible sockets, the link
would be removed. While sometimes useful in super simple setup, it is generally
useless for most work. Even worse, users might not notice that they accidentally
removed a link (this has been reported in the recent geometry nodes workshop).

This patch changes this behavior in two ways:
* A node can't be inserted onto an incompatible link anymore.
* A link will be dimmed while dragging a node over it, if it is incompatible or if
  alt is pressed.

Pull Request: https://projects.blender.org/blender/blender/pulls/121975
2024-05-23 19:52:37 +02:00
Clément Foucault
2e3ad7404a Fix: EEVEE: Broken bias for sunlights
The pixels size was not computed in the right space.

This is the easy fix as refactoring the directional
shadows is too risky/time consuming right now.

Fix #121641
2024-05-23 19:30:43 +02:00
Mangal Kushwah
d37342e185 Fix #108105: Fix operators affecting hidden geometry
These operators in sculpt mode affect hidden geometry which is undesirable.
- bpy.ops.sculpt.face_set_edit
- bpy.ops.sculpt.face_sets_init
- bpy.ops.sculpt.face_sets_create(mode='SELECTION')
- bpy.ops.mesh.paint_mask_extract()
- bpy.ops.mesh.paint_mask_slice()

This PR adds checks for hidden faces in these operators.

For operator `bpy.ops.sculpt.face_sets_init` it also modifies the way
face sets indices were generated so generated indices is unique. This
is needed so new initialized face sets do not get same indices as hidden
face sets.

For generating unique face set index I have created a set container
which stores hidden face sets indices. Before assigning indices to a
face set it checks if it is already in set container, if it is then
it'll keep increasing index by 1 until it is not in set container.

Modifying Operator `bpy.ops.mesh.paint_mask_slice()` is little complex,
it will not affect hidden geometry only when fill holes option is
unchecked, because currently filling hole code does not take hidden
geometry into account and because of this in some cases hidden part
of geometry can be trapped inside mesh.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119168
2024-05-23 19:24:12 +02:00
Harley Acheson
f5fdda776c UI: Outliner Ctrl-F To Start Filter
New operator OUTLINER_OT_start_filter bound to Ctrl-F to move keyboard
focus to the Outliner search filter box. And OUTLINER_OT_clear_filter
bound to Alt-F to clear the search box. Both similar to Properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/122126
2024-05-23 19:11:24 +02:00
Hans Goudey
b0eb48c4dc UI: Move Normal Edit and Weighted Normal modifiers to "Normals" menu
Though the whole modifier menu could use a reorganization, it probably doesn't
make sense to do that before we have a builtin library of node group assets.
We already have the "Normals" category though, so these two modifiers make
more sense there.

Pull Request: https://projects.blender.org/blender/blender/pulls/122168
2024-05-23 18:28:31 +02:00
Harley Acheson
5a643cfa74 UI: Edge Slide Comments
Comments explaining why some properties might be not set in some
circumstances.

Pull Request: https://projects.blender.org/blender/blender/pulls/122172
2024-05-23 17:51:16 +02:00
Brecht Van Lommel
b49165fc61 Fix: Asset shelf entries not properly ordered by library name
And add some comments for clarity
2024-05-23 17:49:46 +02:00
Brecht Van Lommel
28f60c725a Fix: Assert reusing asset datablocks 2024-05-23 17:49:40 +02:00
Philipp Oeser
f3c32a36bc Fix #103562: preserve custom normals in BM_mesh_triangulate
`BM_mesh_triangulate` is used in exporters (when the "Triangulate"
option is ON), the `Triangulate` modifier and currently also in the
`Triangulate` geometry node (even though there are plans to change this,
see !112264)

So in practice, exporters (Alembic/FBX/OBJ/Collada) were breaking
custom normals for game pipelines (unless everything was triangulated
beforehand).

This change builds upon 93c8955a72 (uses the use
`BM_custom_loop_normals_to_vector_layer` /
`BM_custom_loop_normals_from_vector_layer` pair of calls).

In the case of the `Triangulate` modifier, this had its own try at
preserving custom normals in 7d0fcaa69a  -- doing very similar
things but as an option -- this is now removed (so it is always done,
which fits into "interpolate custom data if it's there" design that we have
nowadays).

NOTE: the "Triangulate Faces" operator already did the same
Pull Request: https://projects.blender.org/blender/blender/pulls/121871
2024-05-23 17:33:40 +02:00
Clément Foucault
f968c99850 Fix: EEVEE: Shadow: Huge performance drop caused by local lights
Punctual shadow maps were never tagged as updated, constantly
refreshing themselves.
2024-05-23 17:17:42 +02:00
Clément Foucault
8b65908574 Fix: EEVEE-Next: Missing shadow near area light
This was caused by wrong assumption that `shadow_radius`
is also a radius for area light. To avoid the confusion,
use a new property for area light shadow scaling.
2024-05-23 17:17:42 +02:00
Falk David
7b3e529462 Cleanup: GPv3: Remove unused function 2024-05-23 16:23:02 +02:00
Clément Foucault
40b4447f0a Fix: EEVEE-Next: Broken Area light shadow
This removes the area light shadow clipping.
This had issues and we are now not using
any shifting behind the area light.

Fix 122108
2024-05-23 15:35:16 +02:00
Jacques Lucke
399f6a1c60 Nodes: add descriptions for why links are invalid
Blender shows invalid links in red in the node editor. However, it's not always
obvious why some links don't work, especially for beginners. This patch adds
additional information for every invalid link on the node that it links to.

The following error messages are added:
* Invalid link because of missing implicit conversions.
* Link cycle in node tree.
* A link from a field to a socket that does not support fields.
* Using the same menu on multiple Menu Switch nodes.

Currently, there are some per tree-type special cases in the link validation code.
In the future, this should be moved to tree type specific callbacks.

Pull Request: https://projects.blender.org/blender/blender/pulls/121976
2024-05-23 14:31:16 +02:00
Hans Goudey
c7c2a9c4c9 Fix #122154: Loose edges invisible, wireframe shading mode crashes
When there are no "extractors" the dependencies didn't work properly to
calculate the loose geometry. This is similar to 30ec31b550.
2024-05-23 08:30:16 -04:00
Iliya Katueshenock
7fac204909 Cleanup: unnecessary copy
This partially reverts 521cd53f29.

Pull Request: https://projects.blender.org/blender/blender/pulls/121783
2024-05-23 14:07:43 +02:00
Sietse Brouwer
180474aaee GPv3: Python API additions to layer, layers, layer_groups
This PR contains several additions to the GPv3 Python API for
`layer_groups`, `layers` and `layer[key]`.

**Layer groups**
`grease_pencil.layer_groups`
- `.new(name, parent_group=None)`
- `.remove(layer_group, keep_children=False)`
- `.move(layer_group, 'UP'/'DOWN')`
- `.move_top(layer_group)`
- `.move_bottom(layer_group)`
- `.move_to_layer_group(layer_group, parent_group)`

**Layers**
`grease_pencil.layers`
- `.new(name, set_active=True, layer_group=None)`
- `.remove(layer)`
- `.move(layer, 'UP'/'DOWN')`
- `.move_top(layer)`
- `.move_bottom(layer)`
- `.move_to_layer_group(layer, layer_group)`

**Layer**
`grease_pencil.layer[key]`
- `.select`
- `.lock`
- `.matrix_local`
- `.matrix_parent_inverse`
- `.parent_group`

Pull Request: https://projects.blender.org/blender/blender/pulls/121797
2024-05-23 13:51:13 +02:00
Jacques Lucke
0f32291d15 Nodes: make new frame node child of common parent of selected nodes
Previously, the new frame was always added as root frame and did not have a parent.
Now, the common root frame of all selected nodes is detected and the new frame is attached to it.

Pull Request: https://projects.blender.org/blender/blender/pulls/121972
2024-05-23 13:24:35 +02:00
Julian Eisel
46f5079f11 Fix: Various crashes and issues with popups
Fixes #121902, #121865, #121905 and some other reports that were closed
as duplicates.

Reverts a change done as part of 7d80fde033.

Reverting this change breaks the yet-to-be-used asset shelf popup a bit,
in that refreshing it won't work propery anymore. Think that's fair
given that 1) the popup isn't in use yet, 2) its refreshing implementation
causes a bunch of high priority bugs, and 3) #122068 is in review with a
better solution to handle refreshing. Namely, it converts the popup to a
popover, which handles refreshing differently, and thus makes the change
being reverted here unnecessary anyway.
2024-05-23 13:22:39 +02:00
Lukas Tönne
1ebc4a2328 Fix #122039: GPv3: Fix inverted fill tool invocation
The operator has a modal keymap with a toggle for inverted mode. This
key was only bound to `PRESS` events, preventing actual toggling during
modal operation.

It also needs to be invoked in inverted mode with ctrl, so a new
operator property was added to initialize the setting.

Pull Request: https://projects.blender.org/blender/blender/pulls/122146
2024-05-23 12:08:37 +02:00
Jeroen Bakker
6fbd287493 EEVEE-Next: Fix use after free when syncing curves/point clouds.
In `SyncModule::sync_curves/sync_point_cloud` the material variable
can be used after it has been freed. The cause is that cryptomatte
can request a new material, which might trigger a relocation of the
references material.

This PR fixes this by doing the shadow sync before the cryptomatte
sync.

Pull Request: https://projects.blender.org/blender/blender/pulls/121909
2024-05-23 12:04:47 +02:00
Jeroen Bakker
cc8dccb83b EEVEE-Next: Fix incorrect shift in shadowing
Grid offset of a tile can be negative. Shifting of negative numbers
is implementation dependent. This PR changes it to a multiplication.

Pull Request: https://projects.blender.org/blender/blender/pulls/121910
2024-05-23 12:04:20 +02:00
Jeroen Bakker
93c69e6b64 Vulkan: Render graph - swapchain handling
This PR implements swapchain handling when using the render graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/122144
2024-05-23 12:00:36 +02:00
Jeroen Bakker
d28474e404 Vulkan: Render graph - VKFramebuffer blitting
Implement framebuffer blitting using the render graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/122143
2024-05-23 11:37:58 +02:00
Jeroen Bakker
5ee46b0ef3 Vulkan: Use macros to reduce code replication
Use macros to reduce code replication.

- `VKRenderGraph::add_node`
- `VKRenderGraphNode::build_commands`
- `VKRenderGraphNode::free_data`

Pull Request: https://projects.blender.org/blender/blender/pulls/122141
2024-05-23 11:21:55 +02:00
Bastien Montagne
feb09cbe62 Cleanup: Update description of BKE_id_is_editable.
Getting the owner ID of an embedded liboverride is not that expansive
anymore.

Also explain difference between this function and the new similar
`ID_IS_EDITABLE` macro.
2024-05-23 10:31:41 +02:00
Jeroen Bakker
7fb1c4c573 Vulkan: Incorrect memory barrier when presenting
When synchonizing the image for presentation the incorrect access
mask was used. This PR changes the access mask from data transfer
write to memory write. The data transfer write is not allowed to
change the image layout.

Pull Request: https://projects.blender.org/blender/blender/pulls/122138
2024-05-23 10:04:32 +02:00
Jeroen Bakker
c3c4e948b1 Vulkan: Fixing issues in debugging groups
* Debugging groups were not being applied as that part of the code
  wasn't ported to the original patch
* Debugging groups didn't account for nodes that weren't owned by
  any debug group.

Pull Request: https://projects.blender.org/blender/blender/pulls/122136
2024-05-23 09:48:25 +02:00
Jeroen Bakker
eb20f30e15 Fix: Crash in interface layout when using custom nodes
`node_socket_add_tooltip_in_node_editor` doesn't set a free function.
but uiLayoutSetTooltipFunc didn't check on it. Documentation states
that the free_arg parameter is optional.

Pull Request: https://projects.blender.org/blender/blender/pulls/122115
2024-05-23 08:22:48 +02:00
Campbell Barton
d1516a44f2 Fix use of uninitialized memory in EEVVEE next 2024-05-23 15:30:58 +10:00
Campbell Barton
b25eefbf9a Fix #122132: Crash canceling nested popups
Moving the cursor away from the extensions "Add Repository" popup
could crash because the "Repositories" popover was closed while the
popup it created remains open.

Resolve by clearing wmEventHandler_UI::context.region_popup
which match the freed region, following similar logic already used by
WM_event_modal_handler_region_replace.

Note that this bug was exposed by [0].

[0]: 38d11482f5
2024-05-23 15:22:19 +10:00
Campbell Barton
57c023d580 Preference: add option allow internet access
Add a preference to "Work Offline" system preference as well as command
line options `--offline-mode` & `--online-mode`
(which overrides the preference).
This option is displayed in the initial setup screen too.

This is currently respected by:

- Check for updates on startup
- Disables running an update when enabling extensions.

When Blender is launched with `--offline-mode` the option cannot be
enabled in the preferences. This is intended for environments
where internet access is intentionally disallowed.

Background: with Blender supporting access to online-repositories
as well as 3rd party extensions themselves potentially accessing the
internet. This setting provides a way for users to disable online
functionality.

This prevents error messages when online access fails in environments
without internet access as well as the ability for users who prefer
Blender doesn't access the internet to have one place to turn this off.

While it does not enforce limitations on add-ons, 3rd party scripts
are expected to respect this setting using `bpy.app.internet_offline`.

The details for this will be handled along with other policies scripts
are expected to follow.

Ref !121994
2024-05-23 13:50:06 +10:00
Campbell Barton
3b21b0deb1 Fix invalid length passed to BLF_str_selection_boxes
Correct recent fix 643f23f4ed.
2024-05-23 13:08:09 +10:00
Lukas Stockner
7fbc93faa1 Fix: Studiolight: Use correct defaults for selected studio light
When selecting Scene World with Cycles, the world background will be missing-texture pink for one frame before showing the correct light.

The issue here appears to be that Cycles queries rna_View3DShading_selected_studio_light_get, which returns the placeholder "Default" value which doesn't have a file path, so the world ends up pink.

Immediately afterwards, the UI code calls rna_View3DShading_studio_light_get, which initializes shading->lookdev_light to the proper default.

The easiest workaround for this is to provide the proper flags when getting the selected studio light, which will not match the placeholder entry and therefore return the proper default.

Pull Request: https://projects.blender.org/blender/blender/pulls/121987
2024-05-23 02:59:56 +02:00
Harley Acheson
79847acd0c Cleanup: Make format
Just formatting changes resulting from Make Format.
2024-05-22 16:43:32 -07:00
Lalit Shankar Chowdhury
b561771f50 Fix #122110: Remove long text selection flickering
Fix flickering when selecting long (scrolled) text from the left.

Pull Request: https://projects.blender.org/blender/blender/pulls/122123
2024-05-23 01:41:56 +02:00
Hans Goudey
7be5802187 Cleanup: Remove outdated comment
Pull Request: https://projects.blender.org/blender/blender/pulls/122122
2024-05-22 23:27:22 +02:00
Hans Goudey
a778e3ddc1 Refactor: Avoid "extractors" abstraction for mesh normals GPU data
Part of #116901.
The only non-obvious part is changing from using the `MR_DATA_LOOP_NOR`
flag as a signal to calculate normals and store them in `MeshRenderData` to
a more explicit check that the normals buffer is requested. In the future hopefully
these dependencies will be refactored to be part of the task graph instead.
2024-05-22 15:40:58 -04:00
Hans Goudey
30ec31b550 Refactor: Tweak mesh render data normals update
Move the responsibility of deciding whether to calculate face corner
normals closer to the buffers and iteration, in preparation for replacing
the `data_flag` and `iter_flag` abstractions from the extractors system.
2024-05-22 15:40:58 -04:00
Hans Goudey
bce210578b Mesh: Replace extractor loop for BMesh normals extraction
Part of #116901. Main benefits to this change are reduced function call
overhead and a simpler hot loop when face corner normals are extracted.
Code duplication is also reduced through use of templates. The downside
is that the access patterns aren't clearly better for the BMesh case where
a lot of data is stored array-of-structs style.
2024-05-22 15:40:58 -04:00
Hans Goudey
99bda7670b Cleanup: Remove unused mesh extractor dependency flag
Mesh triangulation is retrieved with the typical `corner_tris()` lazy
calculation function rather than calculated in a special task now.
2024-05-22 15:40:58 -04:00
Hans Goudey
957c2f3df2 Mesh: Avoid calculating vertex normals for drawing flat-shaded meshes
Make better use of the lazy calculation by avoiding storing a reference
to the calculated normals in the mesh render data. This reduces memory
usage from 282 MB to 225 MB in a test file with about 2 million faces.
2024-05-22 15:40:58 -04:00
Hans Goudey
8d4da6063a Draw: Replace extractor abstraction for mesh positions extraction
Part of #116901. The remaining change was to change the BMesh iteration
to not use the extractor callbacks.
2024-05-22 15:40:57 -04:00