The `vert_dest_map` array, which contains a map indicating the index of
destination vertices, was being copied to another array (`WeldVert`)
unnecessarily.
By directly using the `vert_dest_map` array, we achieved a performance
improvement.
The average execution time of different operations was reduced from
267.4ms to 261.3ms, resulting in a 2.3% improvement in overall
performance.
Fix of assert for debug build. Offsets have one last extra
element, used to contain offset for last real element. When
copying values to offsets, the last element has to be ignored.
Pull Request: https://projects.blender.org/blender/blender/pulls/109476
`BKE_mesh_nomain_to_mesh` already copies the "parameters" to the
result mesh, and the result mesh here wasn't an "evaluated" mesh like
the removed function expected.
Fairly recently `OPTYPE_DEPENDS_ON_CURSOR` was added, which makes
the modal callback used to allow clicking on a face set unnecessary.
There is no more instructional text in the status bar, but the changed
mouse cursor should make that clear anyway. Removing the modal
callback makes the behavior more standard, and avoids hardcoding
the operator's keymap.
Pull Request: https://projects.blender.org/blender/blender/pulls/109608
Image buffer display in the animation player was difficult to reason
about because it could potentially access the entire play-state on load
(frame-step, modifier keys... etc) even though these are are only
intended to be used interactively.
Add playanim_toscreen_ex which is called by both
playanim_toscreen & playanim_toscreen_on_load which doesn't use the
PlayState struct.
Replace `typedef struct X {} X;` with `struct X {};`
In some cases the first and last name didn't match although this
is rarely useful, even a typo in some cases, e.g. TrachPathPoint.
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
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
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
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
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
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.
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.
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.
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
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
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.
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
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.
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.
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.
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.

Pull Request: https://projects.blender.org/blender/blender/pulls/108149