Commit Graph

112059 Commits

Author SHA1 Message Date
Sergey Sharybin
baf9691959 BLI: Add easy and portable way of platform-specific checks
Covers OS detection, CPU architecture, bitness, and compiler family.

The goal of this change is to provide easier to use and remember checks
for these things. For example, with this change code like

```
  #ifdef _WIN32
  ...
  #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) ||     \
      defined(__OpenBSD__)
  ..
  #endif

```

becomes

```
  #if OS_WIN
  ...
  #elif OS_MAC || OS_BSD
  ...
  #endif
```

The code is originally based on build_config.h from Chromium, which was
first modified for Libmv, then to some other projects, and now is
adopted for Blender itself.

The checks are relying on the -Wundef to provide hint of cases when an
include is missing prior to the platform-specific checks.

This change only introduces possibility of cleaner checks and does not
start actual refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/118908
2024-08-06 14:33:53 +02:00
Pablo Vazquez
000d34c398 EEVEE: Add toggle for Fast GI Approximation
Add a toggle for Fast GI Approximation in the header of the panel,
following Cycles layout.

Move the `Max Roughness` setting inside the panel, and rename to
Threshold.

Since Fast GI Approximation only has any effect when Threshold/
Max Roughness is below the max (1.0), gray out the rest of the
panel when at that value.

Co-authored-by: Clément FOUCAULT <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/125452
2024-08-06 14:28:56 +02:00
Christoph Lendenfeld
af28dcfb7d Revert "Fix #124125: Depsgraph and scene time out of sync"
This reverts commit 780dc67f6d.
The patch caused a performance regression when inserting many
keys via python, as is done with the "Whole Character"
keying set.
Regression report: #125888
2024-08-06 13:25:22 +02:00
Campbell Barton
ca199ba13f Fix #125353: Select by active material fails to select the active slot
When (de)selecting the active material, use the active slot
falling back to the first-used slot (for non-active objects).

Resolve regression in [0].

Ref !125948

[0]: 296d05060d
2024-08-06 21:18:40 +10:00
Christoph Lendenfeld
07f88ddd67 Fix: Dope Sheet drawing doesn't draw connecting line outside of viewport
The issue was caused by blender/blender@f3b393a74a
Before that commit, the keylist would be built including 1 keyframe
outside the range on each side (if there was one).
After that those would be ignored, leading to the following issue

Fixes #125861

The fix is to ensure the keylist is built with 1 key outside the given range.

Pull Request: https://projects.blender.org/blender/blender/pulls/125807
2024-08-06 12:26:33 +02:00
Bastien Montagne
9e0b673467 Fix #125938: Transfer Mode (Alt+Q) doesn't work for pose mode switching to a liboverride armature.
Checks in this operator were simply not handling liboverrides properly.

Also refactored that code, grouping & refining checks and error
reports, add comment about why there is specific weird undo handling,
improve variable namings, remove non-sensical assumptions and code
regarding orig/eval objects, etc.
2024-08-06 11:21:52 +02:00
Clément Foucault
6d27aa709d Cleanup: Workbench Shadow Shader
- remove the geometry shader version of the shadow shaders.
- deduplicate vertex code.
- wrap code into graphic pipeline inspired functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/125855
2024-08-06 09:22:12 +02:00
Jesse Yurkovich
4035f2fe9c Fix #125826: Crash when using Render Engine Procedural with PointClouds
In 4.2, Alembic points are imported as PointCloud objects instead of as
mesh vertices.

The code inside Mesh Sequence Cache which converts geometry into a
bounding-box mesh when using Render Procedurals needed to be updated
to support PointCloud objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/125846
2024-08-06 06:09:57 +02:00
Hans Goudey
3549c9e2b7 Cleanup: Sculpt: Remove "no original coordinates" check for redo
The operator redo seems to behave the same before and after this
change. Conceptually there should always be data in the current
undo node since the operator pushes undo nodes when it starts.
That shouldn't be any different between redo and normal execution.
If this turns out to be necessary, it can be added back and the code
can be improved to show why it's actually necessary.
2024-08-05 21:48:15 -04:00
Jonas Holzman
a9f9062df2 Fix: Interactive Docking support on High-DPI/Retina Displays
When dragging an area from one window to another, the target location
was out by the monitor dot-pitch on macOS Retina displays. This commit
fixes this by converting the window position coordinates to the display
native pixel size via a new `WM_window_pixels_coords` API function.

Pull Request: https://projects.blender.org/blender/blender/pulls/125926
2024-08-06 02:25:22 +02:00
Harley Acheson
24e6b33942 UI: Adjustment to Status Bar Vertical Alignment
Slight adjustments so that Status Bar keymap items never touch the top
of the area no matter the UI scale. This is only noticeable on light
themes.

Pull Request: https://projects.blender.org/blender/blender/pulls/125927
2024-08-06 00:38:21 +02:00
Sean Kim
371011c9c4 Sculpt: Initial data-oriented refactor of boundary brush
Part of #118145.

At a high level, the process for a boundary brush works as follows:
* On the first step of a symmetry pass, initialize data in the
  `StrokeCache`
  * Initializes propagation steps and relative brush factors on each
    element of the mesh
  * Initializes specialized per-vertex data for certain brushes
* Grab original position data
* Apply mask & automask values to precalculated vertex-sized factor
  array
* Filter verts that are "uninitialized" by the initial pass
* Filter verts outside of the symmetry area
* Calculate the deformation-specific transform
* Apply this transform either to the mesh directly or to the cloth
  simulation

Of the deformation types, *Expand*, *Inflate*, *Grab*, and *Smooth*
behave similarly to one another (applying a displacement), and *Bend*
and *Twist* behave similarly (applying an angular displacement).

Unfortunately, as is, this PR introduces a lot of extra, duplicated
code. Most of the brushes are similar in their behavior, but differ
slightly enough to make abstractions difficult. One potential path
forward could be to create custom classes to hold or specify necessary
data and use virtual functions on a per-node level to avoid doing this
in a hot loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/125845
2024-08-06 00:09:15 +02:00
Leon Schittek
e68bdd44af Fix #125669: Add additional check to ui_but_equals_old
A button being wrongly matched during update caused a crash when it was
freed. The additional check prevents this false positive.

Pull Request: https://projects.blender.org/blender/blender/pulls/125821
2024-08-05 23:40:00 +02:00
Hans Goudey
6a656b885d Cleanup: Rename mesh loops to face corners 2024-08-05 16:17:50 -04:00
Sean Kim
15817b0cba Cleanup: Remove unused NearestVertexData struct
Pull Request: https://projects.blender.org/blender/blender/pulls/125912
2024-08-05 21:23:29 +02:00
Sean Kim
aa133b1a42 Cleanup: Extract and rename filter_positions_pivot_symmetry
Pull Request: https://projects.blender.org/blender/blender/pulls/125914
2024-08-05 21:22:33 +02:00
Harley Acheson
8e43a9a04e Fix #124162: Handle Properties' Null Runtime From Outliner Data View
Outliner Data API allows browsing most of Blender's data, including in
other areas and spaces. If an area being browsed is the non-active
data (previous space) belonging to Properties, its runtime can be
null and therefore its search_string. This PR just handles this
situation by checking for null runtime. Despite the bug report, I
don't think this should go into 4.2 - maybe back-ported to a later
point release.

Pull Request: https://projects.blender.org/blender/blender/pulls/124374
2024-08-05 21:11:21 +02:00
Hans Goudey
79ad6a3148 Sculpt: Refactor topology islands cache
Part of #118145.

- Specialize the algorithm for each geometry type.
- Store the cache in an array instead of an attribute. Attributes are
  meant to store user-edited data, not derived data like caches.
- Calculate the island IDs with a parallel disjoint set instead of a
  flood-fill algorithm.
- Avoid storing the island ID array if there is only one island, saving
  1 byte per vertex.

Pull Request: https://projects.blender.org/blender/blender/pulls/125907
2024-08-05 20:20:07 +02:00
Hans Goudey
85757cb98d BLI: Return number of roots in disjoint set reduction 2024-08-05 13:50:06 -04:00
Hans Goudey
d24b87f94d Refactor: Sculpt: Extract mesh filter operations to separate loops
Part of #118145.
This adds a bunch of duplication, but it significantly simplifies the
next step of specializing each filter operation per geometry type.
That will reduce some of the logic duplication too by extracting
it to separate shared functions.
2024-08-05 13:48:19 -04:00
Hans Goudey
6037ca73f5 Cleanup: Sculpt: Slightly simplify mesh filter initialization arguments 2024-08-05 13:48:18 -04:00
Omar Emara
69ae62a94e Refactor: Store reference to context in Result
This patch stores a reference to the entire context in the Result class,
as opposed to just the texture pool. This is in preparation for adding
CPU side texture to the result, such that allocations can automatically
allocate CPU or GPU textures based on context.
2024-08-05 18:38:32 +03:00
Laurynas Duburas
f340d7037c Overlay-Next: Light Probe
Overlay-Next version of light probe.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/125828
2024-08-05 17:20:12 +02:00
Clément Foucault
9c622d3b2b Fix: EEVEE: Invalid error in console from material preview
This was visible on apple hardware as it seems the data
from the SSBOs are not cleared.


Candidate for backporting to 4.2
2024-08-05 17:17:10 +02:00
Hans Goudey
77be435eee Fix #121107: Box Hide occasionally causes artifacts
There is more of a proper fix to do here still (#121152).
But for now, just use the recently added single-threaded
gather/scatter methods.
2024-08-05 11:11:21 -04:00
Philipp Oeser
f53b6b89f8 Fix: Editor related RNA paths incomplete/wrong
The RNA path that is generated for Editor properties were mostly
incomplete (e.g. the viewport overlay settings).
- in python tooltips
- from the `Copy (Full) Data Path` operator
- python methods `path_from_id`, `path_resolve` returned incomplete paths

Since a space (editor) is ultimately owned by the screen, we now add the
missing "areas[x].spaces[x]" subpath to any editor.
Nested structs (like the viewport overlay) also need to include this
subpath.

Some editor related structs are not tied to a single space though (and
these cases are therefor not resolved yet):
- Dopesheet is referenced from SpaceGraph, SpaceAction and SpaceNla
- View3DShading is referenced from SpaceView3D but render engines as
well
- FileSelectParams / FileAssetSelectParams / FileAssetSelectIDFilter
need more investigation

NOTE: in case of the VSE, to make this work this also changes the
overlays to be tied to SpaceSeq (the only editor using them)
NOTE: since the above is now in place, adding VSE overlay props to Quick
favourites is now made possible as well (was a leftover from !116604)

Fixes #124527, #113489

Pull Request: https://projects.blender.org/blender/blender/pulls/125365
2024-08-05 16:54:34 +02:00
Clément Foucault
f819e5eeb4 Fix: Overlay-Next: Crash in 2D view when dereferencing v3d
These cases should be safeguarded.
2024-08-05 16:44:01 +02:00
Falk David
656bbd4c7c Refactor: GPv3: Remove DrawingPlacement from GreasePencilStrokeParams
Instead of requiring `GreasePencilStrokeParams` to have a
`DrawingPlacement`, pass it to the `foreach_editable_drawing`
callback.

This makes it possible to have a variant of `foreach_editable_drawing`
that doesn't use a `DrawingPlacement`.
The `Smooth`, `Thickness`, and `Strength` sculpt
brushes don't need this for example.

Also in preparation of using `GreasePencilStrokeOperationCommon`
in more places like vertex painting and weight painting.

Pull Request: https://projects.blender.org/blender/blender/pulls/125903
2024-08-05 16:24:56 +02:00
Devashish Lal
f6e6f2b2d2 Geometry Nodes: PLY import node
This commit adds a PLY format import node, part of the current Google
Summer of Code Project [0]. The importer is refactored to output a mesh,
and a node is added to wrap around the importer. The node supports error
messages from the importer. The node is hidden behind an experimental
option for now, like the others.

0: https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482)

Pull Request: https://projects.blender.org/blender/blender/pulls/125587
2024-08-05 14:54:54 +02:00
Falk David
310c4cdc3c Fix: GPv3: DrawingPlacement copying and moving
The `DrawingPlacement` class did not define the copy
and move constructors/assignment operators even
though they were used in a couple of places.

Pull Request: https://projects.blender.org/blender/blender/pulls/125898
2024-08-05 14:44:23 +02:00
Clément Foucault
60d80c6bd5 Fix: DRW: Broken compilation on MacOS 2024-08-05 14:08:48 +02:00
nutti
1c3a2d1f5f Fix: temp_override doc not to take the positional arguments
Add positional argument to `temp_override` pyapi docs

Pull Request: https://projects.blender.org/blender/blender/pulls/125132
2024-08-05 13:28:25 +02:00
Falk David
5ae70519b2 GPv3: Python API: Add function to get current frame on a layer
This adds the `layer.current_frame()` function which will get the frame
at the current scene time on this layer.

In the lagacy API this was the property `layer.active_frame`. Since we don't cache the visible
frame anymore, we use the current context to get the current scene time.

Pull Request: https://projects.blender.org/blender/blender/pulls/125892
2024-08-05 13:28:06 +02:00
Clément Foucault
0e6d9c355c Fix: DRW: Vertex count explosion on pass resubmission
This was caused by the primitive expansion code path
modifying the `DrawGroup` source input. Upon resubmission
it would take the initial vertex count and expand it again.

The fix is to isalate the description of the draw
from the resolved vertex range.

Fix #125879
2024-08-05 13:00:46 +02:00
Lukas Tönne
43b68132c0 Fix #125866: Crash when converting empty grease pencil to instances
The specialized code for converting grease pencil layer attributes to
instance attributes was accessing the instance component without check.
This _should_ work because the component is explicitly created, but
still fails for empty grease pencil data, because the
`get_component_ptr` function checks if the component is "empty" as well
(zero instances).

Pull Request: https://projects.blender.org/blender/blender/pulls/125887
2024-08-05 12:14:56 +02:00
Clément Foucault
1e83d2f3ea Cleanup: GPU: Silence implicit narrowing warning 2024-08-05 10:36:36 +02:00
Omar Emara
aecea2e4bb Cleanup: Mixed type comparison warning 2024-08-05 10:45:14 +03:00
Harley Acheson
5fb140a36e UI: Status Bar Using SVG Icons
Refactor of how "event icons" are created, using custom SVG icons for
key outlines and some complex keys. Allows multiple key widths so that
"Ctrl", "Insert", etc can be readable. Strings are automatically sized
rather than hardcoded. Also allows these strings to be translated.
Supports the UI icon alpha preference.  Also supports local aspect in
case we ever want to allow 2D zooming there.

Pull Request: https://projects.blender.org/blender/blender/pulls/125591
2024-08-05 02:42:26 +02:00
Jesse Yurkovich
fe672bd479 Cleanup: USD: const correctness fixes
Apply `const` to variables, arguments, and methods. Also includes a few
variable shadowing changes that were noticed along the way.

All changes should have no user visible effects.

Pull Request: https://projects.blender.org/blender/blender/pulls/125873
2024-08-04 22:42:08 +02:00
Hans Goudey
c0d37d97de Cleanup: Sculpt: Move topology islands API to C++ namespace 2024-08-04 14:05:21 -04:00
Harley Acheson
a57c3be05e UI: Add SVG Icons for Status Bar Event Use
This adds 26 SVG icons (13 unfilled/filled pairs) for use on the Status
Bar for keymap indication. No other functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/125868
2024-08-04 19:19:54 +02:00
Sean Kim
dd905de795 Fix #125838: Elastic deform brush does not respect mask values
Factor calculation was not being used to scale the final translation.

Also removes a seemingly mistakenly added texture calculation for the
grids PBVH type.

Pull Request: https://projects.blender.org/blender/blender/pulls/125849
2024-08-04 18:28:30 +02:00
Campbell Barton
be4c7cae7c Cleanup: format 2024-08-04 23:33:55 +10:00
Campbell Barton
c071030ac3 Cleanup: spelling in comments 2024-08-04 13:45:06 +10:00
Hans Goudey
cdd72e689f Sculpt: Refactor displacement eraser filter initialization
Part of #118145.
Parallelize the creation of the initial limit positions for the filter,
also using the API function to evaluate more than one vertex at a time,
and removing the old sculpt API function as well.
2024-08-03 22:44:22 -04:00
Hans Goudey
f06d6185fc Cleanup: Sculpt: Use C++ vector type for symmetry flip function 2024-08-03 22:44:22 -04:00
Hans Goudey
08cd53b1d1 Cleanup: Sculpt: Remove unnecessary geodesic fallback code
It is the responsibility of the caller to make sure this is only called
for base mesh sculpting. The expand tool (the only caller of the
geodesic functions) already does this.
2024-08-03 22:44:22 -04:00
Hans Goudey
009366410f Cleanup: Sculpt: Avoid PBVHVertRef abstraction for trim tool
The tool is only supported for base mesh sculpting anyway.
2024-08-03 22:44:22 -04:00
Jesse Yurkovich
892bdf3134 USD: support color4f types in addition to color3f
Support the USD `color4f` (and related) types during import and use this
type when writing out Blender's color attributes.

This roundtrips Blender data correctly and will properly load data from
many more USD files as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/125839
2024-08-04 04:34:15 +02:00
Harley Acheson
21f2d91359 UI: Improve Icon Centering
Slightly improved sub-pixel centering of icons within their bounds. This
also adds a minimum (negative) for the offsets for the future case of
icons that require a design that overflows the design grid. Not just
that that have non-square proportions but that also need to be maximum
height or width of the design grid. These should not center themselves
but be anchored at the specified location.

Pull Request: https://projects.blender.org/blender/blender/pulls/125844
2024-08-04 03:52:06 +02:00