Commit Graph

120055 Commits

Author SHA1 Message Date
Richard Antalik
af1a6d048d VSE: Simplify outline parameters definition and usage
Function `strip_data_outline_params_set()` was simplified, so setting
color and outline parameters are not mixed and overwriting as code flows
and so the function is better readable.

Shader code is changed, so that when strip overlaps other strip, it gets
2 px red outline regardless of whether it is active or selected. This
makes it more consistent when strip is not active or selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/124442
2024-07-11 07:38:02 +02:00
Richard Antalik
d0cf4a4a8b Fix: Retiming keys do not respect strip drawing order
Retiming was drawn for all strips in one draw call. During strip
transformation, if strips overlap, one strip should cover the other.
But all keys were drawn on top.

Retiming drawing API was changed to draw 1 strip, so overlapped strips
can be drawn first, followed by overlapping strips.
Since retiming drawing is also layered, single draw call was split into
drawing continuity line, keys and speed text.
2024-07-11 06:08:21 +02:00
Hans Goudey
b8a1e41dc2 Cleanup: Sculpt: Use utility function to restore positions from undo step 2024-07-10 22:28:25 -04:00
Harley Acheson
cfe77fbafd UI: Use Official Blender Logo As Blender Icon
Our icon sources currently include two versions of the Blender logo,
the official one and one that is modified to align better to our
smallest pixel grid. But with our recent change to SVG icons, and
alignment tweaks to the official version this can be used in all
cases. This PR does so, removes BLENDER_LARGE, and also slightly
tweaks FILE_BACKUP and FILE_BLEND to use the official form.

Pull Request: https://projects.blender.org/blender/blender/pulls/124179
2024-07-11 01:15:07 +02:00
Jesse Yurkovich
e4bf3015a1 Fix #124470: MEM_new/MEM_freeN mismatch for uiEditSourceStore
Pull Request: https://projects.blender.org/blender/blender/pulls/124487
2024-07-11 00:03:51 +02:00
Jesse Yurkovich
57544887d0 CMake: Add WITH_TBB definition to prevent ODR violation for BLI_spin API
The BLI_spin APIs use a `SpinLock` typedef whose underlying type is
contingent on the precense of `WITH_TBB`. Since our projects did not
consistently define the `WITH_TBB` definition, multiple `SpinLock` types
would end up in our final binary creating ODR violations.

Pull Request: https://projects.blender.org/blender/blender/pulls/124285
2024-07-10 23:02:17 +02:00
Jesse Yurkovich
05241f47f5 CMake: Add WITH_TBB definition for the projects that require it
The `WITH_TBB` define needs to be set in order for code using the
various parallel threading helpers [1][2] to actually be multi-threaded.

The affected projects did not have `WITH_TBB` defined and were using the
single-thread variant of all affected APIs.

Additionally, in the case of `EnumerableThreadSpecific`, this results in
an ODR violation where there are 2 versions of the same class linked
into our final binary. One with TBB members and one without.

--------
[1] Namely code using the `BLI_task.hh`, `BLI_sort.hh`, and `BLI_enumerable_thread_specific.hh` headers
[2] `EnumerableThreadSpecific`, `parallel_for_each`, `parallel_reduce`, `parallel_invoke`, `isolate_task`, `parallel_sort`

Pull Request: https://projects.blender.org/blender/blender/pulls/124283
2024-07-10 23:01:38 +02:00
Jeroen Bakker
615f4a7d4e Cleanup: Vulkan: Remove unused variable
Detected when compiled with clang.

Pull Request: https://projects.blender.org/blender/blender/pulls/124480
2024-07-10 21:44:19 +02:00
Sean Kim
0ee46f1208 Refactor: Sculpt: Expose per-pbvh type unique face set methods
Part of #118145

Pull Request: https://projects.blender.org/blender/blender/pulls/124478
2024-07-10 20:36:43 +02:00
Richard Antalik
41430ed4bd Cleanup: Split strip foreground drawing function
Pull Request: https://projects.blender.org/blender/blender/pulls/124441
2024-07-10 20:13:40 +02:00
Sean Kim
7a6a2519c5 Refactor: SubdivCCG: Extract utility method for boundary calculation
Pull Request: https://projects.blender.org/blender/blender/pulls/124476
2024-07-10 19:48:00 +02:00
Hans Goudey
7fea77992c Fix: Sculpt: Restore transform symmetry clipping lost in refactor
Restore fix 5a8003091c which was lost in e9318360f1.
2024-07-10 13:07:16 -04:00
Hans Goudey
39c334582b Sculpt: Data oriented refactor for nearest vertex search
Part of #118145.
2024-07-10 12:30:00 -04:00
Hans Goudey
e9318360f1 Sculpt: Data oriented refactor for transform tool
Part of #118145.
2024-07-10 12:30:00 -04:00
Hans Goudey
9b43b9feec Cleanup: Sculpt: Use utility function for building translations 2024-07-10 12:30:00 -04:00
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