Commit Graph

111340 Commits

Author SHA1 Message Date
Hans Goudey
59442dda91 Refactor: Sculpt: Tweak restore from undo step functions, expose publicly
- Put them in the undo namespace, since they're quite tied to the undo system.
- Retrieve the nodes inside the functions, since they always need to act on
  all leaf nodes conceptually anyway.
- Expose the position restore function publicly for use in the transform tool.
2024-07-10 12:30:00 -04:00
Hans Goudey
9d6599db25 Refactor: Sculpt: Separate functions for retrieving area sampling radii
Makes future optimizations to this area simpler.
2024-07-10 12:30:00 -04:00
Hans Goudey
410f7cab78 Cleanup: Mesh: Corner naming in mesh normals code 2024-07-10 12:30:00 -04:00
Jacques Lucke
8fbdc39ff2 Fix: show correct number of grease pencil layers in socket tooltip 2024-07-10 18:25:25 +02:00
Jacques Lucke
259af59e17 Merge branch 'blender-v4.2-release' 2024-07-10 18:01:26 +02:00
Jacques Lucke
6390f2e4c6 Fix #124391: crash in complex node setup with multi-threading
The lazy-function for a logical-or made the wrong assumption that
`try_get_input_data_ptr_or_request` returns null when `try_get_input_data_ptr`
returns null for the same input right before that. That's not true, because the
input might have been computed by another thread in the mean-time.

This wrong assumption lead to a bug because lazy-functions are always assumed to
either request more unavailable inputs, or compute all requested outputs. Here,
the lazy-function did neither. It wanted to request a new input, but it was
available already.

The solution is to handle the return value of
`try_get_input_data_ptr_or_request` properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/124465
2024-07-10 18:00:48 +02:00
Julian Eisel
1ed408fdd9 Cleanup: Remove wrong/unnecessary type cast in UI function 2024-07-10 17:53:44 +02:00
Jacques Lucke
9816dba416 Fix: compilation with clang on linux 2024-07-10 17:47:26 +02:00
Sean Kim
d0ebd8e1a7 Cleanup: SubdivCCG: Prevent copying of SubdivCCG
We generally do not want this struct to be copied due to its size. To
assist in finding development errors earlier, disable the copy
constructor entirely, as the destructor puts its resources into an
invalid state.

Pull Request: https://projects.blender.org/blender/blender/pulls/124439
2024-07-10 17:06:55 +02:00
Jacques Lucke
24dc9a21b1 Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.

We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.

The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.

The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.

If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.

Backpropagation does not work for all nodes, although more nodes can be
supported over time.

This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
  a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
  rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.

In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.

All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.

The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.

Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.

The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
  clicking the gizmo icon next to the value.

Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
Thomas Dinges
e02c6fd130 Release: Bump 4.2 to rc 2024-07-10 16:13:17 +02:00
Bastien Montagne
131d61b534 Fix crash after uiLayout refactor.
Fact that `vector.last()` is undefined when the container is empty is a
bit annoying, forces to check for emptyness everywhere :|
2024-07-10 16:03:48 +02:00
Bastien Montagne
a3f0d81a5e Refactor: UI: Make uiItem layout hierarchy use C++ inheritance.
This commit turns the base struct `uiItem` and all of its descendants
(including `uiButtonItem`, uiLayout`, etc.) into a C++ polymorphic
hierarchy of types.

This allows to use C++ type of memory management, and use non-trivial
types (which will be required to make `PointerRNA` non-trivial).

It also moves the storage of these `uiItems` from `BLI_listbase` to
`blender::Vector`, as our C-based listbase implementation is
incompatible with C++ polymorphism.

This also lead to making `uiItem` parameters of a few utils functions
`const`, to allow passing around `blender::Span` instead of vectors to
some internal helpers.

Pull Request: https://projects.blender.org/blender/blender/pulls/124405
2024-07-10 14:46:06 +02:00
YimingWu
96cc9109fd Fix #124431: Division by zero in Resample Curves
`get_count_input_from_length()` did not check whether length is zero,
this would cause division by zero exception. Now will return a segment
count of 1 when a zero length is given.

Pull Request: https://projects.blender.org/blender/blender/pulls/124440
2024-07-10 14:23:35 +02:00
Campbell Barton
41fe7b0d27 Merge branch 'blender-v4.2-release' 2024-07-10 17:42:42 +10:00
Campbell Barton
f7382a2de1 Merge branch 'blender-v4.2-release' 2024-07-10 17:42:37 +10:00
Campbell Barton
7ee6451a51 Extensions: support adding system repositories via the command line 2024-07-10 17:39:06 +10:00
Campbell Barton
b3fbc439fe readfile: add missing define check 2024-07-10 17:02:57 +10:00
Hans Goudey
28c3332e32 Cleanup: Sculpt: Remove now-unused proxy system
Part of #118145.

The proxy system was used to store the accumulated translation from
the deformation of multiple symmetry passes. After a brush/tool update
step, all PBVH nodes with proxies were gathered, the proxies from
each symmetry passes were accumulated, and the deformation was applied
to the evaluated mesh, then the base mesh and shape keys.

In the recently refactored brushes, the translations are immediately
applied to the base mesh and shape keys instead. That avoids the need
for storing a float vector for every affected vertex during the
deformation. Reducing memory usage and affecting the memory that is
already hot in the cache has significant performance benefits too.
Also, brushes are now more conceptually independent-- they don't
rely on a separate pass to actually apply deformations.

Finally removing the proxy system reduces the size of PBVH nodes from
728 to 416 bytes. That's helpful as part of the effort to reduce per-
node overhead in order to make nodes smaller, and helps to reduce the
responsibilities of the PBVH, to focus it on being a BVH tree instead
of "bag for storing arbitrary user-interaction data."
2024-07-09 23:56:07 -04:00
Hans Goudey
d0a5599da3 Cleanup: Sculpt: Remove no-op addition of proxy
Adding the proxy doesn't do anything because the translations
are zeroed by default.
2024-07-09 23:56:07 -04:00
Hans Goudey
830f9cb95b Sculpt: Data oriented refactor for elastic transform
Part of #118145.
2024-07-09 23:56:07 -04:00
Hans Goudey
9a44887b23 Cleanup: Sculpt: Use C++ math types for elastic transform 2024-07-09 23:56:07 -04:00
Hans Goudey
11a4510e9a Sculpt: Avoid normals calculating when starting filter/transform
Move the node update tagging and normal recalculation outside of the
generic filter initialization to the callers. This avoids unnecessarily
recalculating all normals when the filter/transform starts. That's
especially unnecessary for the color filter which doesn't affect positions.
2024-07-09 23:56:01 -04:00
Hans Goudey
9eac6b6786 Sculpt: Use faster undo push function before transform tools
Use the function introduced in fd205d9bb9. In a test this made
the initialization of the transform operator 1.5x faster for a large mesh.
2024-07-09 22:31:49 -04:00
Hans Goudey
d65f6a9d62 Cleanup: Sculpt: Remove redundant undo pushing in transform code 2024-07-09 22:26:36 -04:00
Hans Goudey
c3c68cfc88 Cleanup: Sculpt: Remove unused variables
The original position wasn't actually used in the elastic transform mode.
2024-07-09 22:21:26 -04:00
Hans Goudey
fc385ca746 Cleanup: Sculpt: Remove unnecessary deformation flushing
Unnecessary after a9e29bea94.
2024-07-09 21:45:15 -04:00
Hans Goudey
bf05ac13c8 Sculpt: Data oriented refactor for snake hook brush
Part of #118145.
There is more cleanup possible here, particularly doing some loop
fission and making the brush use our common utilities will help
remove some code and make better use of auto-vectorization.
But with this commit the code we want to remove is no longer
used, so we can stop here for now.
2024-07-09 21:45:15 -04:00
Harley Acheson
e3036cc3d5 Fix #124390: Slightly Improved Icon Rendering at Non-Integral Interface Sizes
Size icons to subpixel precision to give slightly better results when used
with fractional resolution scales.

---

This change is very subtle. So you might have to trust me or get your reading glasses on...

Our icons are designed for small sizes.  When the Blender resolution scale is set to exactly 1.0 then the icons are aligned perfectly to a 14x14 grid and features like lines are exactly one pixel wide.  So these one-pixel wide lines are perfectly aligned to the pixel grid.  Change the scale to 2.0x and they also align perfectly, just with lines that are two pixels wide.

But what happens at 1.25x scale?  Now the icon is 17.5 pixels and lines in it are a pixel and a quarter wide .  The best that can be is a solid pixel and one next to it that is quarter-opacity. But it can get worse than that as it could potentially touch three adjacent pixels.

Our old icon code took an icon bitmap that was rendered larger and scaled it into the desired size.  Because this was done by the opengl shader, this scaling was done to subpixel size. So at 1.25 scale you got an icon that was 17.5 pixels.

The new icon code is truncating the sizes to integer before rendering. I thought this was best, but I was wrong.

The following image has three rows.  The top is the old icon code, with UI scale from 1.0, 1.25, 1.5, 1.75, and 2.0. The second row is current code. The third is with this PR:

![image](/attachments/f809b30f-df6f-48b1-8745-40d9e897ebc7)

The first and last columns are identical, obviously because the design perfectly fits the pixel grid.

The left green area, at 1.25 scale, current code is forcing the design into an integer size, while (bottom) gives a more pleasing result as it is properly spread over 17.5 pixels.

The right green area is more interesting.  With both the old code and new code, the 1.75 pixel wide line is spread over three pixels. The PR nicely spreads it over two pixels.

Hard to tell;  Just squint.  This is just very slightly more pleasing rendering of icons.

Pull Request: https://projects.blender.org/blender/blender/pulls/124436
2024-07-10 03:08:58 +02:00
Richard Antalik
20eb70ee18 Merge branch 'blender-v4.2-release' 2024-07-10 02:22:22 +02:00
il4n
e13b2f3774 Fix: VSE: Overlap after moving a retiming key was not handled
Moving a strip retiming key at the end of a strip, so that a strip
overlaps another one would leave them overlapped. The expected
behavior is that it acts according to the Overlap Mode, like it does
when moving a strip.

Co-authored-by: Richard Antalik <richardantalik@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/124424
2024-07-10 02:21:14 +02:00
il4n
b2e3b6c393 Fix: VSE: Selected strips don't get tinted while transforming
If the "Overwrite" Overlap Mode was used, the non-active strips would
not get tinted while moving them.

Pull Request: https://projects.blender.org/blender/blender/pulls/124411
2024-07-10 01:21:13 +02:00
il4n
a23cb6b1d6 Fix: VSE Set Speed operator not handling overlap
Lowering the speed of a strip that doesn't have user-created retiming
keys using the "Set Speed" operator would cause the strip to overlap
neighboring strips. The fix shuffles the retimed strip to avoid
overlap. This now matches the behavior of the same operator, when
using it on a user created retiming key.

Pull Request: https://projects.blender.org/blender/blender/pulls/124414
2024-07-10 01:19:50 +02:00
Jonas Holzman
3b23dc4b4d Fix: Window title not properly updating on editor change
Update the window title on change of area even if the spacetype remains
the same. This way it catches subtype changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/124304
2024-07-10 01:04:20 +02:00
Hans Goudey
0ccb126a14 Fix: Build error in Windows after allocator change, part 2
Similar to 248910be1f
2024-07-09 17:21:01 -04:00
Hans Goudey
879eca663a Fix #124419: Smooth brush broken for larger meshes
Simple mistake in 68d6bf56e5.
2024-07-09 17:19:00 -04:00
Hans Goudey
248910be1f Fix: Build error on Windows after recent fix
`PreviewImage` is a non-trivial type on MSVC and can't
be allocated with `MEM_cnew`.
2024-07-09 16:16:56 -04:00
Hans Goudey
1d5bf4ca56 Refactor: Sculpt: Change parts of snake hook brush to new structure
- Access positions from a thread-local array
- Replace use of the proxy system with immediately applied translations
- Access data from stroke cache directly
2024-07-09 15:26:30 -04:00
Hans Goudey
426ffa6000 Refactor: Sculpt: Specialize snake hook brush per PBVH type
Part of #118145.
2024-07-09 15:26:30 -04:00
Jesse Yurkovich
3c65b154eb Merge branch 'blender-v4.2-release' 2024-07-09 12:07:15 -07:00
Pablo Delgado Krämer
7cc0e48882 Fix #124016: Translate Image Texture node color spaces to MaterialX
This addresses #124016. The report provides a scene to test the changes.

Currently, the Blender and MaterialX color spaces are not fully aligned,
but the linear/srgb heuristic should cover most cases however.

Pull Request: https://projects.blender.org/blender/blender/pulls/124315
2024-07-09 21:06:08 +02:00
Hans Goudey
5665243bef Cleanup: Use C++ types for snake hook brush 2024-07-09 14:10:05 -04:00
Hans Goudey
3009d4f28c Cleanup: Sculpt: Move snake hook brush to separate file 2024-07-09 13:31:45 -04:00
Julian Eisel
46c0d3e644 Fix: Broken active highlighting of assets in the asset shelf
Suspecting a mismatch when asset weak references stored using Unix style
paths with ones generated at runtime with Windows sytle paths.

Pull Request: https://projects.blender.org/blender/blender/pulls/124415
2024-07-09 19:07:18 +02:00
Jacques Lucke
57f1d959d4 Cleanup: use StringRefNull instead of std::string for instance reference name 2024-07-09 18:56:09 +02:00
Jacques Lucke
39d509f91f Fix: incorrect preview image shallow copy 2024-07-09 18:53:50 +02:00
Jacques Lucke
d0c6bce884 Fix: new/free mismatch
Also see 06be295946.
2024-07-09 18:31:13 +02:00
Jacques Lucke
a57d1ae35e Cleanup: fix compilation
For some reason, `MTex` is trivial on some platforms and not on others.
2024-07-09 18:20:11 +02:00
Sybren A. Stüvel
c26dc45bd9 Merge remote-tracking branch 'origin/blender-v4.2-release' 2024-07-09 18:11:21 +02:00
Pratik Borhade
63cb33139f Fix #124288: Channels overlap the Dope Sheet search
Channels are drawn after/on top of the search box. To fix this, move
`ED_time_scrub_channel_search_draw` below the channel drawing function.

Pull Request: https://projects.blender.org/blender/blender/pulls/124331
2024-07-09 17:57:07 +02:00