Commit Graph

108694 Commits

Author SHA1 Message Date
Campbell Barton
fd589fdca4 Cleanup: various non functional C++ changes 2024-04-20 13:46:14 +10:00
Campbell Barton
c6a9b11ef6 Cleanup: use const pointers 2024-04-20 12:41:23 +10:00
Sean Kim
285cbf9ee4 Cleanup: Fixup naming for sculpt_project.cc
This PR removes some unnecessary type and
function prefixes from `sculpt_gesture.cc`

Pull Request: https://projects.blender.org/blender/blender/pulls/120847
2024-04-20 04:04:29 +02:00
Harley Acheson
d8f6ae7919 UI: Outliner "File Mode" Manage User Count
In Outliner "Blender File Mode" view, show user counts, and allow
removing and adding fake user, requested in #118655.

Pull Request: https://projects.blender.org/blender/blender/pulls/118691
2024-04-20 02:50:12 +02:00
Hans Goudey
026f8e8bdf Fix: Missing include in previous commit
55c1abb8a0
2024-04-19 14:36:10 -04:00
Clément Foucault
9dd164e1ad EEVEE-Next: Rename screen trace max roughness
Remove "screen" from the name as it is not limited to
screen trace.
2024-04-19 20:27:24 +02:00
Pratik Borhade
d7cd25fc94 Fix #120731: sculpt trim tool crash
Caused by f7d5ec8661
`initialize_cursor_info` requires `gesture_data.operation` initialized.
So move allocation outside of `init_operation`

Pull Request: https://projects.blender.org/blender/blender/pulls/120733
2024-04-19 20:27:02 +02:00
Hans Goudey
55c1abb8a0 Cleanup: Unused variable warning 2024-04-19 14:25:09 -04:00
Bastien Montagne
2736446d65 Fix #119999: RNA copy failure due to improper handling of unset dynamic RNA properties.
A fully unset (i.e. null IDProperty storage pointer) dynamic RNA
property would not be properly handled by RNA copy code path. This led
to having a type mismatch (because dynamic RNA booleans are stored in
integer IDProperies) betwen source and destination RNA properties.
Since the fix in 6adf5adb7f, such type mismatch will abort the copying
process.

This is fixed by updating the `PropertyRNAOrID` internal struct to also
store whether the given property is actually a dynamic RNA one with
IDProperty storage.

NOTE: Potential side-effects: That kind of change is very difficult to
fully analyse, but no side-effects from this fix are expected. The only
code which behavior is changed is `rna_ensure_property_realdata`, which
is only used by `RNA_property_copy` currently.

This change to `PropertyRNAOrID`/`rna_property_rna_or_id_get` _may_ be
useful in the future though, e.g. in liboverride codepath...
2024-04-19 15:52:17 +02:00
Clément Foucault
c450200873 Fix: EEVEE-Next: Fix wrong space transformation for default thickness
The previous code was applying translation to a direction vector
making the thickness dependant on the object position.
2024-04-19 15:08:33 +02:00
Hans Goudey
7f5dd29abd Subdiv: Make OpenSubdiv_TopologyRefiner into a C++ class
Replace the C-class pattern function pointers with actual class methods.
Other than the obvious benefit of not requiring the "this" pointer to be
explicitly passed into every function call, this will make it much simpler
to remove the entire C-API class and replace it with its "impl" next.

For that next step we need to expose code to the implementation
of the topology refiner, so instead of defining stubs locally in the
opensubdiv intern class, we spread some WITH_OPENSUBDIV checks
in the blenkernel. As far as I know this is the only way to remove the
intermediate C-API and call opensubdiv functions directly from there.
2024-04-19 09:03:48 -04:00
Hans Goudey
52c0f4078a Cleanup: Remove redundant part of SubdivForeachTaskContext name
The "subdiv" part is implied by the namespace.
2024-04-19 09:03:39 -04:00
Hans Goudey
11f0d88d13 Subdiv: Move most blenkernel subdiv code to C++ namespace
Move most code to `blender::bke::subdiv`. That helps organization
and makes using C++ in subdiv code easier, which will be useful for
removing the unnecessary opensubdiv C-API wrapper.
2024-04-19 09:03:31 -04:00
Jeroen Bakker
be75f1ac2b Vulkan: Render graph textures
This PR implements render graph for VKTexture. During the
implementation some tweaks to the render graph was done
to support depth and stencil textures.

The render graph will record the image aspect being used
for each node. This will then be used to generate barriers
for the correct aspect.

Also fixes an issue that uploading of array textures didn't
allocate a large enough staging buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/120821
2024-04-19 14:55:39 +02:00
Germano Cavalcante
f5f05c99c9 Fix: Snap with 'Backface Culling' skipping edges and vertices of faces in edit mode
After 1c77779160, the snap logic in Edit Mode became the same as in
Object Mode, so Backface Culling started to ignore edges and vertices
of faces seen from behind.
2024-04-19 09:47:49 -03:00
Pratik Borhade
7c89efd787 Fix #120809: Skip saving use_selected_objects
Issue came with the new feature of adding modifiers to selected objects
by holding alt: 9a7f4a3b58. `use_selected_objects` state should not be
remembered. Otherwise, it's possible to add/edit modifier of multiple
object without holding alt

Pull Request: https://projects.blender.org/blender/blender/pulls/120810
2024-04-19 14:00:49 +02:00
Clément Foucault
7b38873732 EEVEE-Next: Volume: Add custom integration range
This is just adding a switch for enabling custom range.

Custom range is now optional as we compute a tight bound
to integrate around volume objects by default.

The custom range is only needed for scene with really
thick world volumes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120823
2024-04-19 13:51:27 +02:00
Omar Emara
dd321a47a6 Fix #120715: File Output node writes empty outputs
The File Output node writes single elements as full images in 4.1, while
such values were skipped in 4.0. This included invalid outputs, for
instance, when the Render Layers node does not have a result for the
selected view layer. Which would then just write an image with an
arbitrary color.

To fix this, we detect single element values and skip writing file
outputs for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/120749
2024-04-19 12:38:31 +02:00
Omar Emara
5e3932595f Compositor: Allow constant folding of set operations
This patch replaces the is_set_operation flag with the
is_constant_operation flag to allow input constants to propagate
through the node tree using the constant folder.
2024-04-19 12:34:43 +02:00
Clément Foucault
2c19be2682 EEVEE-Next: UI: Render Panel
- Reorder panels to match Cycles (and rendering pipeline order)
  `Sampling > Objects > Motion Blur / Dof > Film > Performance`
- General reordering of properties to avoid too many panels.
- Make sure panels a disabled if their checkbox is.
- Enabled Freestyle panel for EEVEE-Next.
- Merge some panels into sub-panels.
- Add `Clamping` panel.
- Split Lighprobe panel into `Performance` and `Scene`.
- Move shadow panel to Sampling.
- Generally improve consistency with Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/120691
2024-04-19 12:12:28 +02:00
Jeroen Bakker
ed9dea08b2 Vulkan: Render graph storage buffers
A developer can switch `vk_common.hh#use_render_graph` to enable render graph.
When enabled the buffers and images are tracked by the device resource state
tracker. The storage buffer commands are recorded to the context render graph.

The next unit tests will pass:
- GPUVulkanTest.storage_buffer_create_update_read
- GPUVulkanTest.storage_buffer_clear_zero
- GPUVulkanTest.storage_buffer_clear
- GPUVulkanTest.storage_buffer_copy_from_vertex_buffer

The pattern to migrate to render graph is:
- always construct CreateInfo for class.
- based on `use_render_graph` call `context.command_buffers.something`
  or `context.render_graph.add_node`.
- Hide calls to `context.flush` when `use_render_graph` is true.

Pull Request: https://projects.blender.org/blender/blender/pulls/120812
2024-04-19 12:08:57 +02:00
Bastien Montagne
8b1154a854 Fix #119999: Regression: Copy to selected on addons properties crash Blender.
Changes introduced in 6adf5adb7f did not take into account that this
code is also used by regular RNA copy code, in which case there is no
override data available.

NOTE: This commit fixes the crash. The root of the issue (that two
propoerties that should have identical types are detected as of
different types) remains under investigation.
2024-04-19 12:04:03 +02:00
Jeroen Bakker
c6fc125e3d Vulkan: Missing binding tracking
f2ae04db10 introduces missing binding
tracking for SSBO and UBOs. Vulkan relies on validation layers to
report on missing bindings, but the binding information should still
be cleared in the context state manager.

Pull Request: https://projects.blender.org/blender/blender/pulls/120814
2024-04-19 11:13:06 +02:00
Jeroen Bakker
d9d4f90142 GPU: Add test case for GPU_storagebuf_copy_sub_from_vertbuf
This API function wasn't covered in any test.

Pull Request: https://projects.blender.org/blender/blender/pulls/120817
2024-04-19 11:12:16 +02:00
Jeroen Bakker
adab06bc67 Vulkan: Render graph core
**Design Task**: blender/blender#118330

This PR adds the core of the render graph. The render graph isn't used.
Current implementation of the Vulkan Backend is slow by design. We
focused on stability, before performance. With the new introduced render
graph the focus will shift to performance and keep the stability at where
it is.

Some highlights:
- Every context will get its own render graph. (`VKRenderGraph`).
- Resources (and resource state tracking) is device specific (`VKResourceStateTracker`).
- No node reordering / sub graph execution has been implemented. Currently
  All nodes in the graph is executed in the order they were added. (`VKScheduler`).
- The links inside the graph describe the resources the nodes read from (input links)
  or writes to (output links)
- When resources are written to a resource stamp is incremented allowing keeping
  track of which nodes needs which stamp of a resource.
- At each link the access information (how does the node accesses the resource)
  and image layout (for image resources) are stored. This allows the render graph
  to find out how a resource was used in the past and will be used in the future.
  That is important to construct pipeline barriers that don't stall the whole GPU.

# Defined nodes

This implementation has nodes for:
- Blit image
- Clear color image
- Copy buffers to buffers
- Copy buffers to images
- Copy images to images
- Copy images to buffers
- Dispatch compute shader
- Fill buffers
- Synchronization

Each node has a node info, create info and data struct. The create info
contains all data to construct the node, including the links of the graph.
The data struct only contains the data stored inside the node. The node info
contains the node specific implementation.

> NOTE: Other nodes will be added after this PR lands to main.

# Resources

Before a render graph can be used, the resources should be registered
to `VKResourceStateTracker`. In the final implementation this will be owned by
the `VKDevice`. Registration of resources can be done by calling
`VKResources.add_buffer` or `VKResources.add_image`.

# Render graph

Nodes can be added to the render graph. When adding a node its read/
write dependencies are extracted and converted into links (`VKNodeInfo.
build_links`).
When the caller wants to have a resource up to date the functions
`VKRenderGraph.submit_for_read` or `VKRenderGraph.submit_for_present`
can be called.

These functions will select and order the nodes that are needed
and convert them to `vkCmd*` commands. These commands include pipeline
barrier and image layout transitions.

The `vkCmd` are recorded into a command buffer which is sent to the
device queue.

## Walking the graph

Walking the render graph isn't implemented yet. The idea is to have a
`Map<ResourceWithStamp, Vector<NodeHandle>> consumers` and
`Map<ResourceWithStamp, NodeHandle> producers`. These attributes can
be stored in the render graph and created when building the links, or
can be created inside the VKScheduler as a variable. The exact detail
which one would be better is unclear as there aren't any users yet. At
the moment the scheduler would need them we need to figure out the best
way to store and retrieve the consumers/producers.

# Unit tests

The render graph can be tested by enabling `WITH_GTEST` and use
`vk_render_graph` as a filter.

```
bin/tests/blender_test --gtest_filter="vk_render_graph*"
```

Pull Request: https://projects.blender.org/blender/blender/pulls/120427
2024-04-19 10:46:50 +02:00
Bastien Montagne
9c8dab6b18 Fix a couple of RNA/UI issues with EEVEE next raytrace options.
- DNA defaults were not properly registered, preventing the 'reset to
  default' to work correctly.
- The RNA sub-struct path was not properly generated.
- The RNA struct had no UI/API info.
2024-04-19 10:15:39 +02:00
Christoph Lendenfeld
6af54b4b1e Refactor: use IndexRange for loops in graph_draw.cc
No functional changes.

This modifies the function `get_bounding_bezt_indices` to return an `IndexRange` instead of an `int2`.
With that it is possible to use the C++ for loop syntax.
The function is renamed to `get_bounding_bezt_index_range` to represent its return type.

Pull Request: https://projects.blender.org/blender/blender/pulls/120786
2024-04-19 10:10:23 +02:00
Campbell Barton
4e8b24f1d1 Cleanup: spelling in comments & punctuation 2024-04-19 15:57:06 +10:00
Campbell Barton
0ceefd6358 Cleanup: cmake syntax 2024-04-19 15:50:26 +10:00
Campbell Barton
2d7dd9770a Cleanup: remove unnecessary ".svn" exclude for CMake 2024-04-19 15:50:25 +10:00
Clément Foucault
0791d7c349 EEVEE-Next: Light: Add ray visbility support
This is very straightforward.

We don't do any versionning as we assume that
if a scene was using these, it was not using eevee
as default renderer.
2024-04-18 22:10:54 +02:00
Clément Foucault
125fcc948e EEVEE-Next: Light: Add transmission factor
Now that lights are supported for refraction BSDFs,
there is no reason to not add support for it.

Versionning sets it to zero for compatibility with
legacy EEVEE.

This is also needed in order to support per object
ray visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/120796
2024-04-18 22:08:50 +02:00
Boltzmachine
740c9f220d VSE: Add RGB Parade Display Mode for sequencer
This PR implements #120479 by adding a new Waveform Display Mode
"RGB Parade" that will essentially be the Luma Waveform but with
"Separate Colors" turned on.

Pull Request: https://projects.blender.org/blender/blender/pulls/120615
2024-04-18 21:25:44 +02:00
Hans Goudey
40b7bf30c8 Cleanup: Remove unused variable 2024-04-18 15:17:28 -04:00
Jesse Yurkovich
3f8ec963e3 Fix: Use correct datatype in MSC modify_geometry_set for the frame time
The recently added `modify_geometry_set` code path [1] inside the Mesh
Sequence Cache was meant to follow what was done inside `modify_mesh`
but failed to use the correct data type for the time offset. Double is
used throughout Blender when dealing with the frame time and this was
simply missed.

This results in rounding errors and downstream consumers like USD would
re-read the wrong frames. e.g. it would read frame 4 twice because the
values provided when switching from frame 4 to frame 5 were
`4.000000119209290` and `4.999999880790710` instead of
`4.000000000000000` and `5.000000000000000` with this patch.

[1] ea256346a8

Pull Request: https://projects.blender.org/blender/blender/pulls/120790
2024-04-18 20:55:13 +02:00
Bastien Montagne
f3c677887d GPv3: Conversion: Significant refactor of animation hanlding.
While keeping the general process the same, this commit heavily
refactors the animation handling as part of the GPv2 to GPv3 conversion
process.

The whole animation handling is now embeded in new class, which covers
all current use cases (conversion of all fcurves matching a given root
RNA path, or a specific set of given full RNA paths, and transfer to
another ID's animation data if required).

The new system is also now able to perform custom additional conversion
on FCurves if necessary, through a new function callback.

This is used in this commit to fix two issues with the animation of the
'Stroke Thickness' GPv2 layers adjustment factor (the need to divide the
values by 2000, and to switch from an 'integer' FCurve to a regular
one).

Finally, this commit also adds suport for animation of the old GPv2
'Thickness Scale' parameter.

--------

NOTE: While this already improves a lot the animation handling code of
GPv3 conversion, this could still use more clean-up. Don't think it's
worth it within current usage scope though.

But if more use cases need to be covered, and/or we need such conversion
behavior in other places, it could be good to do another improvement
pass and move this as generic 'animation conversion' helper in a
dedicated BKE module.
2024-04-18 19:32:19 +02:00
Leon Schittek
9b21dffe45 Fix #94413: Hide added input sockets on group inputs with hidden sockets
Improve working with multiple group input nodes by automatically
hiding new node group input sockets on any group input node with
hidden extension socket.

Whenever the extension socket is hidden,  the user can now expect
the socket visibility of the group input node to stay fixed.
When the extension socket is shown on the other hand, the group input
node will update when sockets are added to the group interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/120067
2024-04-18 19:20:05 +02:00
Hans Goudey
9a7f4a3b58 Modifiers: Affect all selected objects when holding alt
Support holding alt while invoking modifier operations for add, apply,
remove, and move to index in the property editor. This affects all selected
editable objects instead of just the active object.

Though the alt key is not that visible, it's consistent with the
existing multi-object property editing shortcut. If/when multi-
object editing is every made the default, the alt key could
be reversed here too.

Changes as part of #120230.

Pull Request: https://projects.blender.org/blender/blender/pulls/120695
2024-04-18 17:40:50 +02:00
Clément Foucault
aea31a530d EEVEE-Next: UI: More tweak to lightprobes 2024-04-18 17:32:49 +02:00
Ray molenkamp
39c901407e MSVC: Add cmake option for external manifests
This PR adds a cmake option `WITH_WINDOWS_EXTERNAL_MANIFEST`
which is off by default which addresses the following 2 problems:

The CI env occasionally fails to link the manifest into blender.exe
with mt.exe getting file in use error. The solutions mentioned online
vary wildly between, just rebuild, turn off your AV, use this magic
switch. None of them actually point to a root cause we can address.

When building blender with clang and the visual studio generator
it also somehow doesn't embed the manifest.

If the bots stay problematic this option can be turned on for the CI
environment, and will be automatically turned on when it detects clang
and the visual studio generator being used.

Pull Request: https://projects.blender.org/blender/blender/pulls/111683
2024-04-18 16:57:04 +02:00
Clément Foucault
42c77b2107 EEVEE-Next: UI: Improve volume lightprobe props name and tooltips 2024-04-18 16:48:41 +02:00
Germano Cavalcante
3fc29d8080 Fix #120239: Snap in edit mode is ignoring some self elements
Fix snapping issues caused by commit 1c77779160, where a mesh
representing the edited mesh was introduced.

Mesh snap to vertex now works in the following order:
- Snap to vertices of visible triangles
- Snap to vertices of loose edges
- Snap to loose vertices

The problem arises because in editing mode, faces whose vertices are
being transformed are ignored, marked as hidden in the snap, resulting
in the loss of some vertices in triangles.

The solution involves considering the edges and vertices of hidden
faces as loose elements since, despite being connected to faces, they
are still visible to snap. Two new types of BVHTree were created for
this purpose:

- BVHTREE_FROM_LOOSEVERTS_NO_HIDDEN
- BVHTREE_FROM_LOOSEEDGES_NO_HIDDEN

This modification addresses two related issues:
- snapping in edit mode to vertices and edges of a face being
  transformed
- snapping to mesh with hidden loose elements

Optionally, the first issue could be tackled separately by generating
BVHTrees within the snap system itself and storing them in a
`SnapCache_EditMesh *em_cache`, then passing this cache as a parameter
to the `snap_object_mesh` function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120270
2024-04-18 16:48:19 +02:00
Hans Goudey
b5a82cd722 Cleanup: Unify UV sculpt radius variable naming
Also use const arguments
2024-04-18 10:28:34 -04:00
Jeroen Bakker
e84ab459c7 Vulkan: Use std::endl in vk_to_string
Trying to narrow down why some tests are failing on windows, but not on
linux/mac. These tests use a string compare. This PR adds two modifications
to the current vk_to_string.

- use `std::endl` although not required, it is important to portability
- print vulkan handles in a uniform way.

Pull Request: https://projects.blender.org/blender/blender/pulls/120780
2024-04-18 16:09:26 +02:00
Clément Foucault
f0b1eca9ee Cleanup: EEVEE-Next: Remove unused define 2024-04-18 14:39:10 +02:00
Pratik Borhade
f1955e1c57 Fix #120393: Outliner: Inconsistent dim on hidden items
non object tree elements are not faded in outliner when object or parent
collection is hidden. So in case of non ID_OB, call `element_should_draw_faded`
and pass parent tree element as argument to decide the fade status.
Also faded the icons and hierarchy lines.

Pull Request: https://projects.blender.org/blender/blender/pulls/120397
2024-04-18 14:05:19 +02:00
Hans Goudey
d95b1f120b Mesh: Store BMEditMesh in shared pointer
The main motivation for this is that it's part of a fix for #113377,
where I want to propagate the edit mesh pointers through copied
meshes in modifiers and geometry nodes, instead of just setting the
edit mesh pointer at the end of the modifier stack. That would have
two main benefits:
1. We avoid the need to write to the evaluated mesh, after evaluation
  which means it can be shared directly among evaluated objects.
2. When an object's mesh is completely replaced by the mesh from another
   object during evaluation (with the object info node), the final edit
   mesh pointer will not be "wrong", allowing us to skip index-mapped
   GPU data extraction.

Beyond that, using a shared pointer just makes things more automatic.
Handling of edit mesh data is already complicated enough, this way some
of the worry and complexity can be handled by RAII.

One thing to keep in mind is that the edit mesh's BMesh is still freed
manually with `EDBM_mesh_free_data` when leaving edit mode. I figured
that was a more conservative approach for now. Maybe eventually that
could be handled automatically with RAII too.

Pull Request: https://projects.blender.org/blender/blender/pulls/120276
2024-04-18 13:52:20 +02:00
Clément Foucault
998d0796e4 Fix: EEVEE-Next: Volume Probe: Missing binds in baking
Might fix a few issues related to baking.
2024-04-18 12:48:20 +02:00
Jeroen Bakker
189113c727 Cleanup: Move vulkan specific tests in tests folder
When reviewing the render graph core PR, we discussed where specific
backend tests should be located. The code style is clear that it
needs to be located in a tests folder next to the code it tests.

This PR moved the tests folder from next to the files they test to
a tests folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/120777
2024-04-18 12:47:23 +02:00
Clément Foucault
23348d4a5c GL: VertBuf/IndexBuf: Add missing SSBO bind tracking
Fix false positive errors with `--debug-gpu`.
2024-04-18 12:33:42 +02:00