Commit Graph

100873 Commits

Author SHA1 Message Date
Jacques Lucke
db7b2ef386 Cleanup: remove unnecessary "struct" in declaration 2023-07-02 11:37:56 +02:00
Jacques Lucke
4658de2255 DNA: move makesdna to C++
Also see #103343.

The main complication here was that the `long` type was poisoned in GCC, but it's used by
some included C++ headers. I removed the compile-dependent poison and added a new
check for `long` and `ulong` so that they still can't be used in DNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/109617
2023-07-02 10:43:51 +02:00
Jacques Lucke
373e7aa995 Cleanup: remove pragma once from .cc file 2023-07-02 08:40:30 +02:00
Hans Goudey
95df909bcc Sculpt: Use a factor for mask extract factor property
Makes it easier to adjust the property visually.
2023-07-01 21:22:26 -04:00
Harley Acheson
c3eccf432c Cleanup: Make format
Just changes from running Make Format
2023-07-01 15:24:24 -07:00
Jacques Lucke
3ece6876af RNA: move most rna files to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/109585
2023-07-01 16:38:46 +02:00
Jacques Lucke
f33d7bb598 Nodes: add nested node ids and use them for simulation state
The simulation state used by simulation nodes is owned by the modifier. Since a
geometry nodes setup can contain an arbitrary number of simulations, the modifier
has a mapping from `SimulationZoneID` to `SimulationZoneState`. This patch changes
what is used as `SimulationZoneID`.

Previously, the `SimulationZoneID` contained a list of `bNode::identifier` that described
the path from the root node tree to the simulation output node. This works ok in many
cases, but also has a significant problem: The `SimulationZoneID` changes when moving
the simulation zone into or out of a node group. This implies that any of these operations
loses the mapping from zone to simulation state, invalidating the cache or even baked data.

The goal of this patch is to introduce a single-integer ID that identifies a (nested) simulation
zone and is stable even when grouping and un-grouping. The ID should be stable even if the
node group containing the (nested) simulation zone is in a separate linked .blend file and
that linked file is changed.

In the future, the same kind of ID can be used to store e.g. checkpoint/baked/frozen data
in the modifier.

To achieve the described goal, node trees can now store an arbitrary number of nested node
references (an array of `bNestedNodeRef`). Each nested node reference has an ID that is
unique within the current node tree. The node tree does not store the entire path to the
nested node. Instead it only know which group node the nested node is in, and what the
nested node ID of the node is within that group. Grouping and un-grouping operations
have to update the nested node references to keep the IDs stable. Importantly though,
these operations only have to care about the two node groups that are affected. IDs in
higher level node groups remain unchanged by design.

A consequence of this design is that every `bNodeTree` now has a `bNestedNodeRef`
for every (nested) simulation zone. Two instances of the same simulation zone (because
a node group is reused) are referenced by two separate `bNestedNodeRef`. This is
important to keep in mind, because it also means that this solution doesn't scale well if
we wanted to use it to keep stable references to *all* nested nodes. I can't think of a
solution that fulfills the described requirements but scales better with more nodes. For
that reason, this solution should only be used when we want to store data for each
referenced nested node at the top level (like we do for simulations).

This is not a replacement for `ViewerPath` which can store a path to data in a node tree
without changing the node tree. Also `ViewerPath` can contain information like the loop
iteration that should be viewed (#109164). `bNestedNodeRef` can't differentiate between
different iterations of a loop. This also means that simulations can't be used inside of a
loop (loops inside of a simulation work fine though).

When baking, the new stable ID is now written to disk, which means that baked data is
not invalidated by grouping/un-grouping operations. Backward compatibility for baked
data is provided, but only works as long as the simulation zone has not been moved to
a different node group yet. Forward compatibility for the baked data is not provided
(so older versions can't load the data baked with a newer version of Blender).

Pull Request: https://projects.blender.org/blender/blender/pulls/109444
2023-07-01 11:54:32 +02:00
Harley Acheson
e9e12015ea UI: Transparency Checkerboard behind File Browser Thumbnails
For thumbnails of image file types in the File Browser use the
checkerboard pattern as background to help indicate that the image
could contain transparency.

Pull Request: https://projects.blender.org/blender/blender/pulls/108554
2023-07-01 00:23:17 +02:00
Miguel Pozo
221f985129 EEVEE Next: Ambient Occlusion Node and RenderPass
Port Ambient Occlusion to EEVEE Next.

Add support for the AO Node and the AO RenderPass.
AO shading integration is still missing.

This also fixes the Shadow RenderPass.

Pull Request: https://projects.blender.org/blender/blender/pulls/108398
2023-06-30 19:37:30 +02:00
Germano Cavalcante
1c17db7489 Fix error in debug build caused by 568fe85b94
The member `treedata_editmesh` was removed.
2023-06-30 14:24:55 -03:00
Miguel Pozo
a639ec3afa Workbench Next: Hair and Curves support
Add Hair and Curves support to the new Draw Manager.
The `sub_pass_setup` functions bind the required data to an already
created sub-pass, and return the batches needed for drawing.

Add Hair and Curves rendering to Workbench Next:
-Refactor MeshPasses so it's possible to retrieve the pass instead of
 letting the class handle the drawing itself.
-Refactor object_sync so the emitter handle can be passed to the
 hair_sync function (needed to avoid outlines between hair and emitter)
-Refactor the ObjectState constructor so it's easier to add support for
 other object types.
-Update get_material so the slot index starts from 1, to match
 BKE_object_material_get_eval.

Pull Request: https://projects.blender.org/blender/blender/pulls/109456
2023-06-30 19:11:18 +02:00
Ray Molenkamp
7ad6b7cba4 Cmake: Fix WITH_GPU_BUILDTIME_SHADER_BUILDER on Windows 2023-06-30 18:32:03 +02:00
Hans Goudey
f6f3a6a928 Fix #109523: Crash applying modifier with shape keys
We can't take the ownership of the data of a CustomDataLayer by simply
swapping the pointers anymore, since the data is owned by the layer's
implicit sharing info. Since shape keys don't support implicit sharing
(yet?), just duplicate the layer data instead of taking ownership of it.
2023-06-30 11:55:18 -04:00
Germano Cavalcante
8cc418b6fc Fix Snap to Face Nearest not working properly if transformed
Local `init_co` and `curr_co` were being calculated incorrectly.
2023-06-30 12:44:35 -03:00
Germano Cavalcante
568fe85b94 BVH Utils: Remove member 'em' from 'BVHTreeFromEditMesh'
There is no need to pass `BVHTreeFromEditMesh` userdata if only
`BMEditMesh` is used in the callbacks.

And this code is only used in the snap system, with this change the
snap code is more simplified and organized.
2023-06-30 12:39:28 -03:00
Germano Cavalcante
efdbb57bb6 Cleanup: Hide the 'SnapCache_EditMesh' definition 2023-06-30 12:09:10 -03:00
Germano Cavalcante
6bf940d326 Cleanup: remove unnecessary callbacks
There is no need to create callback members for the snap system when
only one type of object is using them.

So remove the callbacks and inline the code.

This usually promotes optimization, but in this case, no change in
performance was observed.
2023-06-30 12:00:09 -03:00
Clément Foucault
49e6eb5d94 EEVEE-Next: Use clamped linear spherical harmonic eval
This can produce ringing but it is usually not noticeable
since it is only present in indirect lighting.
2023-06-30 13:58:11 +02:00
Clément Foucault
0929b98cd3 EEVEE-Next: Fix spherical_harmonics_evaluate_non_linear
Using `safe_normalize_and_get_length` add directional
component on otherwise fully ambient SH lighting.
2023-06-30 13:58:11 +02:00
Clément Foucault
6f7f105812 GPU: Fix safe_normalize_and_get_length implementation
Return the correct input length of the vector not the
length of the fallback vector.
2023-06-30 13:58:11 +02:00
Jeroen Bakker
91c3fd7a3b Eevee-next: World Irradiance Caching
This PR adds world lighting to the irradiance cache and allows diffuse materials
to be lit by the world. The scene in the reference image is only lit by an environment
texture.

The reflection probe lib has been split into sampling the world probe and evaluating
the world probe. As evaluating the world probe requires to include more libraries and
data structures that aren't really needed for the irradiance cache shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/109516
2023-06-30 13:54:34 +02:00
Jeroen Bakker
a655aa1fb2 Cleanup: Make format 2023-06-30 11:39:17 +02:00
Jeroen Bakker
c2de379081 GPU: Enable Cubemap Array Extension in Compute Shaders
This PR enables cubemap array extension in compute shaders when
supported by the platform. When used the shader must include
cubemap_lib as it contains a fallback implementation when
cubemap arrays aren't supported by the platform.

NOTE: This extension is available in Core Vulkan and doesn't need to be enabled.
Metal doesn't support cubemap arrays and would use the fallback.

Pull Request: https://projects.blender.org/blender/blender/pulls/109546
2023-06-30 11:16:39 +02:00
Bastien Montagne
f3c131adfe Fix #109422: Assertion triggered when opening a new file and "Load UI" is disabled in settings.
Small inconsistency leftover from ebb5643e59, 32bbfbb06e and 7ef8389dad
commits.

Weirdly enough that was not a problem on Linux X11, but did cause
issues at leaast on Windows and Linux Wayland.
2023-06-30 10:26:47 +02:00
Jacques Lucke
422e0c02e9 Cleanup: move more rna files to C++
Also see #103343.

There was one unusual complication due to `openvdb` here. The `BKE_volume.h`
header included `openvdb` but that would not link correctly in rna code. I'm not entirely
sure why any of the openvdb code is actually instantiated, may be an issue in the
`openvdb` headers. The solution is to create a new header that gives access to the
underlying `openvdb` data structure for a `Volume` geometry. This header can't be
included in rna for now, until the linking issues are resolved.

Pull Request: https://projects.blender.org/blender/blender/pulls/109508
2023-06-30 08:49:53 +02:00
Germano Cavalcante
e73a9a6a7d Fix #109519: Orbit Around Selection resets pivot if nothing is selected
Caused by 968ecf6f8b.

The value of the last pivot of the view should not be changed if there
is no selection.

The variable is static precisely because of this.
2023-06-29 21:04:51 -03:00
Chris Blackbourn
f47eed749e Cleanup: Fix warning from struct/class mismatch 2023-06-30 09:42:14 +12:00
Clément Foucault
ff62f402da EEVEE-Next: Fix overlap with nodetree UBO
Reserve the slot 0 for nodetree and bind
directly to it in Next engines.
2023-06-29 21:10:08 +02:00
Clément Foucault
57852a6688 DRW: Fix some overlapping UBO bindings
This shuffle around the UBO bindings of EEVEE-Next,
Workbench-Next and DRW internal.

This patch is based under the assumption that all
the target hardwares have at least 12 UBO slots,
which is already required by the GL 4.3 we aim.
2023-06-29 20:25:13 +02:00
Hans Goudey
267d449a50 Spreadsheet: Support selection filter for point cloud objects
Similar to curves, the ".selection" attribute is used to store selection.
Selection isn't visualized in the viewport yet, but this should be added
at some point anywya. See f89b32382a.
2023-06-29 12:57:24 -04:00
Miguel Pozo
e76fb44c58 Workbench Next: Remove references to object id name
Avoid unsafe references to potentially temporary objects.
2023-06-29 18:29:52 +02:00
Jeroen Bakker
13a6da7646 Fix compiler issue on windows platform
Introduced by eevee-next world reflective light.
2023-06-29 16:01:21 +02:00
Jeroen Bakker
fb38bb9806 Eevee-Next: World Reflective Light
This PR adds world probe baking to Eevee-next. The world is baked to a
cubemap and is used for reflective light in the deferred render pass.

The world probe is baked to a resolution of 2048x2048. In the future this
would become a user facing setting, but wasn't considered essential for
the first implementation.

When updating the world cubemap the world surface shader is reused.
Currently the world surface shader clears many render passes. It was
decided to replace the render passes with dummy textures as the effort
and potential slowdown didn't weigh against the benefit of doing this nicely.
Updating the world reflection probe isn't expected to happen often.

A big difference with Eevee(-legacy) is that the roughness GGX reflection
parameter isn't baked into the texture (as mipmap levels), but is calculated
during shading. This improves accuracy as we don't assume that every
object is an infinitive small sphere. The result has more noise and that
will be tackled after SSR will land.

![image](/attachments/12de6025-67ca-40d2-9540-bcc8a8a1605d)

Pull Request: https://projects.blender.org/blender/blender/pulls/108149
2023-06-29 15:24:57 +02:00
Jeroen Bakker
a1e9f9665e GPU: Remove unused GPU_TEXTURE_USAGE_MEMORYLESS
Flag was introduced for the metal backend, but isn't used anymore.
No backend has logic attached to it so it is fine to remove it.

Pull Request: https://projects.blender.org/blender/blender/pulls/109492
2023-06-29 15:13:12 +02:00
Jeroen Bakker
a9d501ade2 Fix: Unable to create Cubemap Arrays using GPU Wrapper
When using `Texture.ensure_cube_array` the resulting texture wasn't actually
layered (array) and when used resulted into incorrect behavior.

Until now this function isn't used, but will be in when Eevee-next
world reflective light PR lands #108149 .

Pull Request: https://projects.blender.org/blender/blender/pulls/109497
2023-06-29 15:12:36 +02:00
Jacques Lucke
e13dc04fb8 Cleanup: move rna_modifier to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/109502
2023-06-29 14:08:42 +02:00
Hans Goudey
e4cc91a611 Geometry Nodes: Node group operators initial phase
This PR adds a new operator to run a node group on object geometry.
Only curves sculpt mode is supported for now, to simplify the design.

A new geometry node editor context to edit operator groups is also
added. This allows changing any node group, rather than only node
groups that are part of the active modifier context.

3D viewport menus are added with any geometry node group
asset in a catalog that contains the `Operator` tag. Currently Blender
must be restarted to refresh the list of available operators.

This is only the first phase of the node group operator feature.
Many more features will be added in next steps.

See #101778

Pull Request: https://projects.blender.org/blender/blender/pulls/108947
2023-06-29 13:57:54 +02:00
Jacques Lucke
f3da3c7de4 Cleanup: improve debug printing for anonymous attribute inferencing 2023-06-29 12:32:22 +02:00
Jeroen Bakker
95a703242a Cleanup: Renamed WorldPipeline to BackgroundPipeline
Rename cause for #108149 we want to use WorldPipeline for rendering
the world cubemap.

Pull Request: https://projects.blender.org/blender/blender/pulls/109495
2023-06-29 11:33:20 +02:00
Chris Blackbourn
dee737d64b Cleanup: use c++ constructor and destructor for paramhandle in uv unwrap 2023-06-29 17:19:09 +12:00
Campbell Barton
35389e8b35 Cleanup: use const qualifier for arguments & variables 2023-06-29 10:56:33 +10:00
Campbell Barton
0dfeccfc6b Cleanup: pass strings as const references where appropriate 2023-06-29 10:55:58 +10:00
Campbell Barton
09c0c86d83 Fix property tags dummy enum value holding a reference to stack memory
Also update the doc-string to include a warning about this.
2023-06-29 10:31:23 +10:00
Almaz-Shinbay
65f40a4e5d Cleanup: use snake case for outliner class function names
Part of #96713. Follow the style conventions for naming: https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Naming

Pull Request: https://projects.blender.org/blender/blender/pulls/109402
2023-06-29 00:58:18 +02:00
Hans Goudey
ccfc67e4cd Cleanup: Simplify mask usage when evaluating attribute
Avoid the need for temporary `IndexMask` variables for "full"
selections which can jsut be specified to the field evaluator.
2023-06-28 16:43:22 -04:00
Germano Cavalcante
b6a534e41b Fix mouse offset of Set Snap Base returning original position
`Mouse Input::in val_unproj` was disregarded when resetting the initial
mouse position.

This caused the mouse to return to the previous position before the
`Set Snap Base` after navigating the 3D view.
2023-06-28 15:09:22 -03:00
Germano Cavalcante
ce7ee791b0 Fix Automatic Constraint using mouse position from before navigation
Axis "selection" gets messy if it doesn't use the same offset value
that is updated after navigating.
2023-06-28 14:14:58 -03:00
Ray molenkamp
2dac20e35f CMake/Cleanup: Use bf_intern_atomic target
Use the bf_intern_atomic target rather than adding a relative path
to it in the INC section.

Pull Request: https://projects.blender.org/blender/blender/pulls/109424
2023-06-28 19:12:55 +02:00
Bastien Montagne
a60c1e5bb8 Fix (studio-reported) crash when using 'Clear' on a liboverride hierarchy in the Outliner.
Usual issue of modifying the data hierarchy while iterating on it in its
outliner representation. And usual fix for this problem (only store data
to be processed during the iteration over Outliner data, and perform the
actual operation in a single call afterwards).

This commit also tries to improve a bit the 'Clear' process when applied
to a bunch of IDs, by iterating several times over the list of IDs to
clear, and only processing 'liboverrides leaves' first. That way, if
clearing a liboverride leaves turn other liboverrides into leaves, then
can also be processed that way, instead of just being reset.

Note that this is a naive and quite imperfect solution though
(dependency islands cannot be handled that way e.g.), this feature needs
a complete re-write at some point to be more complete and consistent.
Don't think this is high priority though, as it is not really that
useful in practice afaik.

Note: This should be backported to 3.6 LTS (and maybe 3.3 LTS if
applicable).
2023-06-28 19:00:11 +02:00
Hans Goudey
f89b32382a Point Cloud: Add initial edit mode support
Similar to 5f16e24cc9, this adds support for edit mode
to the point cloud object type, which is currently hidden behind an
experimental option. No interaction is possible yet, for now this
can be used as a testing for a node-group-operator-only mode.
2023-06-28 12:52:55 -04:00