Commit Graph

109782 Commits

Author SHA1 Message Date
Nathan Burnham
f0603d8fac PyAPI Doc: improve BMesh typing
- `BMLayerItem.copy_from(other)` had a typo in its docstring that prevented `other` being typed.
- `BMesh.from_object()` and `BMesh.from_mesh()` had untyped arguments.
- `BMVert.copy_from_vert_interp()`'s `fac` argument was untyped.
- `remove(item)` method of `BMVertSeq`, `BMEdgeSeq` and `BMFaceSeq` had no type for `item`.
- `get()` method of `BMEdgeSeq` and `BMFaceSeq` had "sequence" in the description of `verts` but not in the type.

Pull Request: https://projects.blender.org/blender/blender/pulls/122374
2024-05-29 03:00:03 +02:00
Harley Acheson
707503bf73 Fix #122403: Show correct Hex values for managed colors
Adjusted calculation of hex values so that what is shown matches what
is displayed for material colors as well as for theme colors.

Pull Request: https://projects.blender.org/blender/blender/pulls/122409
2024-05-29 01:13:50 +02:00
Hans Goudey
434b225bb8 Cleanup: Sculpt: Reduce usage of topology array references
Access topology arrays directly from the mesh as needed instead.
Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/122407
2024-05-28 23:48:39 +02:00
Hans Goudey
61fa2b7991 Paint: Reduce constant work for each node in weight paint
Move the loop over all affected nodes to each brush implementation,
making use of lambdas to avoid a bunch of boilerplate code. This makes
it clearer what logic actually depends on the vertices in each node, and
decreases future overhead if we decide to make PBVH nodes smaller.
2024-05-28 23:48:37 +02:00
Hans Goudey
aae77d5e60 Cleanup: Paint: Use const arguments 2024-05-28 23:48:37 +02:00
Hans Goudey
808c29d8db Cleanup: Paint: Remove more permanent storage of topology map
Access the vertex to face map directly from the mesh as necessary.
This helps to prevent unnecessary calculation (it isn't necessary in
weight paint mode besides the blur brush anymore), though it is
used for vertex normals calculation for smooth-shaded meshes.
2024-05-28 23:48:37 +02:00
Hans Goudey
f31d3b9e39 Paint: Remove use of vert to corner topology map
This saves 4 bytes per face corner and 4 bytes per vertex.
2024-05-28 23:48:37 +02:00
Hans Goudey
5cd06ffe60 Cleanup: Mesh: Modernize vert to corner topology map naming 2024-05-28 23:48:37 +02:00
Hans Goudey
bdb949bc76 Cleanup: Paint: Retrieve vert positions from consistent array
`ss.vert_positions` and `pbvh.vert_positions` are expected to point to the
same evaluated deformed position array here. It's preferrable to use the
span we already have locally. Though eventually we hope to remove the
vertex position array from PBVH.
2024-05-28 23:48:37 +02:00
Hans Goudey
144c995c06 Paint: Remove PBVH vertex iteration macro from weight & vertex paint
Part of #118145.
2024-05-28 23:48:37 +02:00
Hans Goudey
73a407061a Paint: Read selection before brush falloff
Reading the selection is much cheaper than calculating the brush radius
since it just requires reading from a boolean array. Better to do it earlier
so the radius calculation can be skipped for deselected points.
2024-05-28 23:48:37 +02:00
Hans Goudey
1c3d6fa4dd Paint: Avoid virtual array access overhead for weight and vertex paint
Use an optionally empty VArraySpan instead of a potentially-single VArray.
2024-05-28 23:48:37 +02:00
Hans Goudey
08ecad5471 Cleanup: Paint: Remove useless comments 2024-05-28 23:48:37 +02:00
Hans Goudey
8c7708acbc Cleanup: Paint: Remove multires code paths from vertex & weight paint
Multires isn't supported here anyway, and if it was it would look very different
because the weights and colors would probably be stored on the subdivided
grids somehow. For now this code is just confusing and gets in the way. It
also mixes up the purpose of the PBVH iteration macro abstraction.
2024-05-28 23:48:37 +02:00
Hans Goudey
c7e115a5ff Cleanup: Paint: Rename index variables 2024-05-28 23:48:37 +02:00
Clément Foucault
5bab443c63 Fix: EEVEE-Next: Fix broken Translucent Shadow bias
This was caused by #122255 which used the normal
to tag the translucent with thickness case. But
this normal is then overwritten during the first
call to `light_eval_single`.

This patch moves the tag to a special type of
`LightingType` which then gets flushed to
`LIGHT_DIFFUSE` when used.

Pull Request: https://projects.blender.org/blender/blender/pulls/122400
2024-05-28 21:23:46 +02:00
Vitaljok
14f9ae90c2 EEVEE: fixing vector displacement
Fix for #121890

The image shows testing results with "green" texture. It is expected that
all vectors are displaced along Y axis.
Cases are "no displacement", "tangent", "object" and "world" spaces.

Results are consistent with Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/122376
2024-05-28 21:20:54 +02:00
Sergey Sharybin
9faed28dcd Fix #122401: Missing animation rendering scene with "Render Single Layer"
Ensure that the re->r.scemode has R_SINGLE_LAYER when not rendering the
single layer.

Pull Request: https://projects.blender.org/blender/blender/pulls/122402
2024-05-28 21:19:43 +02:00
Clément Foucault
7d533175f2 EEVEE-Next: Shadow: Avoid transmission shadow to go behind light
This avoid missing tiles if light is inside the object radius.
2024-05-28 19:43:24 +02:00
Hans Goudey
2918602586 Fix #119980: BMesh copy functions can clear selection
A subtle error in 66da875488 mean that the existing selection
was overwritten instead of adding to the final flag on the result BMesh
element. Selection is often interpolated separately which is probably
why this mistake wasn't more observable earlier.
2024-05-28 13:34:50 -04:00
Hans Goudey
f38c4e0a39 Fix #119980: BMesh copying functions can clear selection
A subtle mistake in 66da875488 meant that existing selection
was overwritten instead of maintained in the BMesh utility functions for
copying element custom data and flags.
2024-05-28 13:34:50 -04:00
Hans Goudey
34af347bb5 Cleanup: Remove unused mesh extractor 2024-05-28 13:34:50 -04:00
Jacques Lucke
b210d56857 Nodes: support adding nodes in versioning without node callbacks
There is a fundamental issue when adding nodes from versioning code right now.
Generally speaking, versioning code should not change after it has been written.
If old versioning code suddenly changes its behavior, it can invalidate the versioning
code that comes after it.

The issue is that while the versioning code itself doesn't change, it is indirectly calling
code that is changing and evolving all the time. This makes the versioning unreliable
and makes it hard to do certain changes (e.g. changing which sockets a node has).
It's easy to overlook issues this creates because many of these cases don't have
regression tests.

The solution is to keep the versioning code more independent from the part of
Blender that is constantly evolving. More specifically, this means that when adding
a node, this should not take the current node initialization and declaration code into
account. Instead, the versioning code should just manually create the node with
the sockets that it expects based on the version that the versioning code has been
written for.

This patch adds new `version_node_add_empty`, `version_node_add_socket` and
`version_node_add_link` methods which allow creating nodes without calling ever
evolving code.

Pull Request: https://projects.blender.org/blender/blender/pulls/121664
2024-05-28 18:57:06 +02:00
Sean Kim
025df21a0f Sculpt: Add Polyline Mask, Face Set, and Trim
This PR adds the *Polyline Mask*, *Polyline Face Set*, and
*Polyline Trim* tools.

## Limitations
* *Polyline Face Set* is not added to either of the *Sculpt*
or *Face Sets* menu as none of the other face set gestures are in
either.

Pull Request: https://projects.blender.org/blender/blender/pulls/122248
2024-05-28 18:33:45 +02:00
Hans Goudey
48cc79f52d Mesh: Edit data draw extraction improvement
Part of #116901.

Avoid the "extractor" abstraction for creation of edit mode overlay data
vertex buffers. Use threading::parallel_for loops instead. Also prefer
code duplication over linking things that are unrelated. This is the
last "extractor" loop that runs by default in edit mode so there is a
small performance improvement there. Besides that, the changes is the
same as the other similar refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/122386
2024-05-28 18:06:08 +02:00
Sean Kim
9d3e2de76e Cleanup: make format 2024-05-28 08:47:58 -07:00
Hans Goudey
b642b516d9 Cleanup: Reorder edit data draw buffer extraction function
Just to make a future diff smaller.
2024-05-28 11:26:22 -04:00
Hans Goudey
ebbb72187a Cleanup: Use references, const, for mesh edit data flag extraction 2024-05-28 11:26:21 -04:00
Lukas Tönne
fd651da7e5 GPv3: Fix fill tool boundary construction on thin pixel lines
Finding the boundary uses a Moore neighborhood. The algorithm iterates
over filled pixels, following pixels with empty neighbors, in clockwise
direction. For a given pixel and input direction (where the boundary is
coming from), the next neighbor is found by checking neighbors clockwise
from the previous pixel.

The last direction in this inner loop would be opposite the input
direction, i.e. if the pixel has only one neighbor it can loop back
and iterate over pixels that are already in the boundary, from the
opposite direction. However, this last direction was excluded from the
search (an earlier implementation did not support it). Using this search
direction as well allows the boundary to go back and forth over the same
line of pixels until the boundary is closed.

Pull Request: https://projects.blender.org/blender/blender/pulls/122383
2024-05-28 17:25:35 +02:00
Sean Kim
7726e7f563 Sculpt: Add Line Face Set Tool
This PR adds the `Line Face Set` tool and adds it to the following
location:
* Sculpt Mode toolbar

## Limitations
None of the existing Face Set gesture operators exist in either the
Sculpt dropdown or the Face Set dropdown, this PR does not add the Line
Face set tool in either location as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122245
2024-05-28 17:17:10 +02:00
Lukas Tönne
f3054f03cd GPv3: Dilate and erode functions for the fill tool
This increases or decreases the initial filled area by an amount of
pixels.

Pull Request: https://projects.blender.org/blender/blender/pulls/122368
2024-05-28 17:14:28 +02:00
Clément Foucault
71e8e6520e EEVEE-Next: Fast GI: Improve Precision parameter
The parameter was not taking the number of samples into
account, making it impossible to acheive highest quality
at high sample count.
2024-05-28 17:14:06 +02:00
Sean Kim
1ab3fffc1d Sculpt: Add increase / decrease visibility operator
This PR adds a new operator: `PAINT_OT_visibility_edit` to support
iteratively expanding or shrinking the visibility of a mesh, similar to
the *Grow / Shrink Mask* actions and the *Grow / Shrink Face Set*
options. This operator is exposed via two new entries in the *Sculpt*
toolbar entry as *Show More* and *Show Less* and have also been
assigned to Page Up and Page Down in the default Blender keybinds for
Sculpt Mode.

### Technical Details
Each of the PBVH types is solved slightly differently, though the
general principle for each is as follows:

1. Make a copy of the current mesh visibility state
2. Iterate over elements (faces & corners if available, otherwise
   vertices) to look at adjacency information
3. Apply appropriate visibility change to vertices
4. Sync face visibility

### Limitations
* Currently, like all other operators in the `paint_hide.cc` file. This
  new operator is limited to Sculpt mode only.

Based off of [this](https://blender.community/c/rightclickselect/pz4y/)
RCS request.

Pull Request: https://projects.blender.org/blender/blender/pulls/120282
2024-05-28 17:12:45 +02:00
Philipp Oeser
fcc481a407 Render: include info string for "render_stats" handler
The "render_stats" handler now includes the message line that was
written to stdout as the first arg (using `BKE_callback_exec_string`
instead of just `BKE_callback_exec_null`).

This can be useful to track render progress (and people were relying on
parsing stdout in the past).

Was a request in chat.

This also corrects possible output from the callback being written in
between message parts in `do_write_image_or_movie` (which was probably a
mistake in 93d5e106aa).

Pull Request: https://projects.blender.org/blender/blender/pulls/119789
2024-05-28 17:07:27 +02:00
Hans Goudey
89c13dbb5c Fix: Mesh draw extraction missing wire batch missing normals input
The `overlay_wireframe` shaders uses a `nor` input but it wasn't added
to the GPU batch since the normals were split to a separate vertex buffer.
Adding that input gets closer to the appearance in 4.0. But it still looks a
bit different-- the outline is not as bright overall.

Fixes #120781.

Pull Request: https://projects.blender.org/blender/blender/pulls/120827
2024-05-28 16:58:08 +02:00
Nika Kutsniashvili
61178b22a2 Nodes: port "Connect to Output" operator from Node Wrangler
As Node Wrangler add-on is moving to extensions platform and maybe isn't shipped
with Blender from 4.2 onwards, some of it's more important functionalities which are
crucial for Blender UX can be ported inside core. Also see #121749.

This PR ports "Preview Node" operator from add-on inside `scripts/startup/bl_operators`.

When Shift-Ctrl (or Shift-Alt) clicked on the node operator connects output socket of the
node to active Output node in the tree (group, material, light, or world output). For Geometry
Nodes this is just handy operator, but in Shader Nodes, because Viewer Node isn't
implemented, this has always been the only way to quickly preview nodes by connecting
it to Material Output.

Changes made from Node Wrangler version:
- Renamed operator from "Preview Node" to "**Connect to Output**", because node previews
  already mean a different thing in context of compositor and shader editor, and viewer node
  is used for previewing in geometry nodes. Connect to Output is correct name because in every
  context it's called that's what it does.
- Assigned shortcut Shift-Alt-Click in shader editor as well. Even though Shift-Ctrl click already
  works, it's good to have consistency with geometry nodes, so that users can use same shortcut
  in both contexts.

Operator doesn't work in compositor. It's not clear if that's wanted (to connect to Composite node),
and if it is it'll be added in separate PR.

Original authors of the add-on: Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer

Pull Request: https://projects.blender.org/blender/blender/pulls/122016
2024-05-28 16:42:55 +02:00
Jacques Lucke
905aaf439c Geometry Nodes: new Set Instance Transform node
This node allows replacing the transformation of every instance by providing a matrix.

Before, this was only possible by using the Store Named Attribute node. It's more common
in Blender to have specialized built-in nodes for built-in attributes (e.g. Set Position, and Set ID).

Pull Request: https://projects.blender.org/blender/blender/pulls/121473
2024-05-28 16:34:37 +02:00
Clément Foucault
6e50aebd74 EEVEE-Next: UI: Remove mention of Horizon Scan in tooltip
We use fast GI for this feature now.
2024-05-28 16:16:53 +02:00
Clément Foucault
c9c95e7e64 EEVEE-Next: RNA: Rename horizon property to fast_gi
This avoid discrepancy between the UI and the API.
2024-05-28 16:09:00 +02:00
Clément Foucault
117bfc870d EEVEE-Next: Fast GI: Add angular thickness
While easier to understand, the conventionnal global
scene thickness parameter have some downside:
- It doesn't scale with larger scenes since the
  distant samples have small thickness
- It doesn't handle fine geometric variation in
  foreground.

The proposed angular thicknes makes all sample
have the same angular span. This makes it
distance independant and capture different occluder
thickness with less artifacts. The downside is
that the occluders have the same angular span
at any distance which makes the same occluder inflate
with distance.

A downside is that the geometry near the shading point is
under-represented. Leaving light leaking or lack of AO
at contact points. To fix this, we introduce back a
geometric thickness parameter.

Pull Request: https://projects.blender.org/blender/blender/pulls/122334
2024-05-28 16:00:38 +02:00
Campbell Barton
a55c3f503c Cleanup: quiet switch warning 2024-05-28 21:35:27 +10:00
Campbell Barton
a64f36a591 Unbreak building without OPENVDB 2024-05-28 21:35:01 +10:00
Dalai Felinto
651621da0d Extensions: Tooltips and disable poll message for Check for Updates
This includes checks for offline-mode.

Co-authored by Pablo Vazquez.
2024-05-28 13:01:07 +02:00
Dalai Felinto
bdde38eff1 UI: Preferences: Group the Themes tab with the Extensions
Co-authored by Pablo Vazquez.
2024-05-28 13:01:07 +02:00
Lukas Tönne
0fd81e4994 GPv3: Dot stroke materials for fill tool
This allows using strokes with a "Dot" material as boundaries for the
fill tool.

Note: "Square" materials are not currently supported, they get rendered
as dots too. This is the same in GPv2, there just isn't a simple shader
for rotated squares.

Pull Request: https://projects.blender.org/blender/blender/pulls/122324
2024-05-28 12:53:26 +02:00
Falk David
e7cf4676a1 Fix: GPv3: Build modifier conversion
There were some copy-paste mistakes in the
build modifier conversion.

Pull Request: https://projects.blender.org/blender/blender/pulls/122358
2024-05-28 12:52:38 +02:00
Falk David
d8c5f9a8ba Fix: GPv3: Build modifier maximum gap not working
The "Maximum Gap" setting for the "Natural Drawing Speed"
mode was not working.
This was because the code used `math::max` to try and clamp the value
to a maximum when it should have used `math::min`.
This fixes this issue.
2024-05-28 12:27:36 +02:00
Falk David
e4c0055591 Fix #122355: Opacity modifier hardness mode not working
This was introduced by 944be3d619.

In order to keep the behavior the same at the user level,
we can't invert the factor. We have to invert the values, then
apply the factor and convert back.

Pull Request: https://projects.blender.org/blender/blender/pulls/122360
2024-05-28 12:12:31 +02:00
Lukas Tönne
1080a94a3d Geometry Nodes: Value logging for Volume geometry and Grid sockets
Volumes and grids were not yet handled by the Geometry Nodes value
logging system. This patch adds basic information (number of grids)
to the value logger and node tooltips.

Pull Request: https://projects.blender.org/blender/blender/pulls/121622
2024-05-28 12:05:58 +02:00
Iliya Katueshenock
0507dc8c2a Geometry Nodes: skip unused output of multi-function when evaluating on single values
This is slight optimization. Number of nodes with additional outputs like `Valid`
flag of other math-related things will be more in future, its better to strict api
and do not evaluate even singles. This also can reduce number of logged values.

Pull Request: https://projects.blender.org/blender/blender/pulls/121799
2024-05-28 12:00:14 +02:00