Commit Graph

144217 Commits

Author SHA1 Message Date
Pratik Borhade
da9f334e2b Fix #131374: Grease pencil subdivide icon is not consistent
Use correct icon in modifiers menu `ICON_MOD_SUBSURF`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131407
2024-12-05 10:37:04 +01:00
Philipp Oeser
8044f531c7 Fix #131107: Grease Pencil: Crash doing Grease Pencil Surface Reproject
Implemented in 4291ab855c
Fixed in c20399442d (even though that commit introduced the crash)

The crash happens because we are dealing with multiple
`DrawingPlacement` (using the constructor from c20399442d which allows
for passing in cached depths) in **threads**. The depth_cache gets freed
in the destructor of  `DrawingPlacement` though, thus ruining the data
for a `DrawingPlacement` in another thread.

To resolve, pass in a copy of the depths.

Pull Request: https://projects.blender.org/blender/blender/pulls/131356
2024-12-05 10:35:24 +01:00
Lukas Tönne
03f2f1b5b3 Fix #130271: Flip the color threshold interpretation to match Blender 4.2
The color threshold in Blender 4.2 is interpreted to mean that colors above the
threshold are "background" and colors below threshold are "foreground".
This is arbitrary but works well for black-on-white drawings.

Pull Request: https://projects.blender.org/blender/blender/pulls/131324
2024-12-05 10:32:46 +01:00
Aras Pranckevicius
1148df0f5c Fix #99026: VSE View menu wrongly displays Channels item for combined Sequencer & Preview type
Channels can not be shown in Sequencer & Preview type by design,
so do not show the view menu item for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/131368
2024-12-05 09:20:15 +01:00
Jesse Yurkovich
69c63311fa Fix #130907: Use Blender Action name as the UsdSkelAnimation name
Rather than using a default "Anim" name when exporting armature
animations, use the animation's Action name instead. Likewise use the
UsdSkelAnimation name for the Action's name during import.

Blendshapes/shapekeys still use the default "Anim" name as there's no
action for these situations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131021
2024-12-04 23:43:07 +01:00
Hans Goudey
cb94b62775 Fix #95139: Right click on sockets opens menu with "Edit Source"
We create invisible buttons for socket tooltips because sockets themselves
aren't buttons and because we don't have a special tooltip handler for the
node editor. Currently those buttons have an empty right click menu with
just the "Edit Source" operator. Changing to label buttons removes the
right click menu but keeps tooltips working.

This didn't work earlier because label buttons didn't have tooltips.
That has been implemented in the meantime.

Pull Request: https://projects.blender.org/blender/blender/pulls/131399
2024-12-04 21:56:38 +01:00
Jacques Lucke
5926654756 Fix: Geometry Nodes: crash when accessing runtime data while baking
Some editors are not redrawn while baking, but the properties editor currently
is and therefore needs this special check.

Eventually, we should rename or split the `is_rendering` flag to make it
more obvious that it also means baking.
2024-12-04 20:00:37 +01:00
Hans Goudey
2303f0cfee Fix #115104: Geometry nodes bake loses vertex groups
Vertex groups are written as generic attributes in bakes currently.
In order to restore them as vertex groups properly when reading bakes,
keep track of the vertex group names in the bake metadata.

Pull Request: https://projects.blender.org/blender/blender/pulls/131393
2024-12-04 20:00:00 +01:00
Harley Acheson
3f91350d4e Fix #78371: Allow Deleting Items When Measure On Gizmos Off
When using the "Measure" Tool with Gizmos turned off, trying to delete
anything will result in an error message instead.  When Gizmos are on
then view3d_ruler_remove_invoke will return OPERATOR_PASS_THROUGH if
no rulers are selected. This way you can delete other objects. But if
Gizmos are off then it returns OPERATOR_CANCELLED which stops in its
tracks. Return OPERATOR_PASS_THROUGH in this case instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/131340
2024-12-04 19:57:56 +01:00
Clément Foucault
fb84b21ec4 Cleanup: Selection: Assert legacy selection mode are not used 2024-12-04 19:18:14 +01:00
Clément Foucault
ddf3a59de5 Fix #131285: Selecting Empty Space With Select Box Tool Selects Objects
The clearing logic depended on an uninitialized value.
2024-12-04 19:18:14 +01:00
Clément Foucault
c255178cc5 Selection: Remove usage of Depth picking for viewport selection
The option is already disregarded by the new viewport
selection code.

This only remove the usage of the flag and assume it is
always off.

The UI and DNA clearing needs to be done in another commit.
2024-12-04 19:18:14 +01:00
Jacques Lucke
fba10a8212 Cleanup: Blenloader: extract function to write blend file header
This simplifies the code a bit.

Pull Request: https://projects.blender.org/blender/blender/pulls/131379
2024-12-04 18:53:09 +01:00
Jesse Yurkovich
b75b191f9f Build: USD: Small change to allow compiling against both 24.05 and 24.11
Starting with USD 24.11, the external boost dependency is being phased
out. It will instead use their own internal pxr_boost::python library.

This PR adapts the code inside `usd_hook.cc` to build and run in this
new environment.

Pull Request: https://projects.blender.org/blender/blender/pulls/131343
2024-12-04 18:45:43 +01:00
Hans Goudey
22c13cfd28 Cleanup: Avoid reformatting geometry nodes property names, use fmt 2024-12-04 12:38:00 -05:00
Hans Goudey
af79b4e7b5 Cleanup: Use constexpr for geometry nodes string, avoid .c_str() 2024-12-04 12:38:00 -05:00
Hans Goudey
19ab63e513 Cleanup: Remove unnecessary namespace specification 2024-12-04 12:38:00 -05:00
Jacques Lucke
95ef33059c Geometry Nodes: support text overlay when viewing matrix attributes
This implements a basic text overlay for matrix attributes. The matrix is split into location,
rotation and scale to make the values more useful. There are probably ways to present
this in a more beautiful way, but for now this is already much more useful compared to
showing nothing. Also, previously, this would hit an assert in a debug build.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/131301
2024-12-04 18:22:24 +01:00
Miguel Pozo
bd1f4ec23c Fix: GPU: CPP shader errors in VS2019
Continuation of #131332.

Including built-in headers in VS2019 ends up including `corecrt_math.h`
as a side effect, which has many functions that overlap in name with
our stubs.
This puts the conflicting functions inside its own namespace (`glsl`)
and declares macros for them.
(Note this has the side effect of not allowing us to use those as
variable names)

This also removes the `<cassert>` and `<cstdio>` includes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131386
2024-12-04 18:03:42 +01:00
Miguel Pozo
72aaaa0c24 Fix: GPU: Errors and warnings for CPP shaders in MSVC
Pull Request: https://projects.blender.org/blender/blender/pulls/131332
2024-12-04 17:33:12 +01:00
Hans Goudey
6836dca44d Cleanup: Remove unused parts of BLI_rand.h C-API 2024-12-04 11:29:28 -05:00
Hans Goudey
d260ba0cdb Cleanup: Use C++ random number generator 2024-12-04 11:29:28 -05:00
Bastien Montagne
3bfa46175c Fix #108067: Liboverride: miss tagging constraints as 'from linked data' on creation. 2024-12-04 17:13:08 +01:00
Julian Eisel
91069ea674 Refactor: UI: Simplify screen refresh logic
Avoid extra parameter to force refresh a screen, only use the screen refresh
tag. Having both leads to unnecessarily complicated logic.

Also document behavior in function comment and make function name more clear.
2024-12-04 17:05:18 +01:00
Clément Foucault
5e4bba76d1 Fix #131363: Curves ignore Surface Object Setting
Depth only drawing was not always enabling the overlay engine
(now responsible for depth prepass). And the depth prepass
was not populated if overlays were turned off.
2024-12-04 17:05:03 +01:00
Sebastian Parborg
f66319b594 Fix: Remove internal ffmpeg API usage (fix ffmpeg 7 compilation)
FFmpeg removed public access to read_seek, read_seek2 in ffmpeg 7
2024-12-04 16:46:33 +01:00
Hans Goudey
4ded260cf3 UI: Allow setting active modifier on linked object
The poll function doesn't apply here because it just checks for object
editability and edit mode, object types, and modifier types. We shouldn't
have a poll function at all because the hovered modifier might not be
part of the context.

Resolves #90008.

Pull Request: https://projects.blender.org/blender/blender/pulls/131384
2024-12-04 16:43:13 +01:00
Julian Eisel
63d759d6d4 Fix: UI: Failing assert when switching workspaces
172e9c5b83 attempted to move area type and region type initialization to
`ED_screens_init()` so it's done before region polls run (which depends on
region types). However this was only done for active workspaces, so when
changing workspaces region types may still be missing before region polling.

We could iterate all screens there instead, not just those from the active
workspace. But in the end I decided it's better to move this back to regular
screen refreshing, but before region polling. This way all this related logic
stays closer together. It still only runs on complete screen refreshes, so when
the screen layout changes generally.
2024-12-04 16:32:35 +01:00
Hans Goudey
f9b627d29c Mesh: Move custom normals to a generic attribute
Move `CD_CUSTOMLOOPNORMAL` to the newly added
`CD_PROP_INT16_2D` generic attribute type. This is similar to
previous commits moving specific custom data types.

The attribute name is `custom_normal`. When the attribute with
that name is on the face corner domain, the code will interpret it
as stored in the existing deformation-invariant spherical coordinate
space.

The API remains the same, with the additional opportunity to edit
custom normal data as an attribute directly (which admittedly is fairly
unintuitive currently).

See #130484.

Pull Request: https://projects.blender.org/blender/blender/pulls/130689
2024-12-04 16:06:36 +01:00
Clément Foucault
f7d271dd92 Fix #131378: Selectino: Bone select in posemode is broken
The modified condition was not changed properly.
There is no need for the condition at all if there is
no culling needed.
2024-12-04 16:00:48 +01:00
Hans Goudey
a31b6c1863 BLI: Inline math vector "is finite" checks
These functions showed up in a profile of a geometry nodes setup
using BVH sampling. They are so simple that function call overhead
is likely to be significant, and giving the compiler a view of what they
do is also likely to be helpful.
2024-12-04 09:04:43 -05:00
quackarooni
65b1ab43bf Geometry Nodes: Add "Collection" and "Object" input nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/131075
2024-12-04 15:01:44 +01:00
Sergey Sharybin
76d6d169ba Fix #124518: Crash modifying material and marking it as an asset in quick succession
The preview generation job is not safe from cases when the underlying data is
changed outside of the job.

Ideally we'd solve possible threading conflict by making the job somehow
smarter. Until then kill the preview job manually, following similar pattern
from other places (for example, lib_id_generate_preview_exec).

Pull Request: https://projects.blender.org/blender/blender/pulls/131372
2024-12-04 14:56:41 +01:00
Hans Goudey
e06acd302a Cleanup: Remove unused declarations in DRW_render.hh 2024-12-04 08:53:52 -05:00
Hans Goudey
504ac41ae7 Cleanup: Remove math include from two headers 2024-12-04 08:52:37 -05:00
Hans Goudey
0299ea5463 Cleanup: Remove unused functions from BLI math C-API 2024-12-04 08:48:38 -05:00
Laurynas Duburas
7cc5918ade Fix #131038: Bezier strokes affect pivot of other strokes
Makes sure to select in Bezier handle layers only for Bezier curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/131087
2024-12-04 14:02:17 +01:00
Hans Goudey
583ae8990c Sculpt: Optimize sculpt vertex neighbor storage
Currently we calculate neighbors for vertices in batches. The idea is
to access topology data all at once, storing the result in a local node-
sized vector that can fit in CPU caches. Currently we use
`Vector<Vector<int>>` for storing the neighbors, and that works well
enough when the number of neighbors fits into the inline buffer, but
whenever it doesn't it causes many vector reallocations and scatters
the neighbor storage in arbitrary memory locations.

This commit changes to using a `GroupedSpan` to store the neighbors, in
other words contiguous storage split into groups by an array of offset
integers. This reduces local per-vertex memory usage by 20 bytes and
makes memory access more predictable.

I observed a 1.39x performance improvement for the mesh smooth filter
on a large triangulated mesh, and a 1.14x improvement for a mesh of
mostly quads. In the brush benchmark on a quad mesh the difference I
observed is a small slowdown. I'm not sure why that happens but I trust
the results from the filter a bit more.

Resolves #130797.

Pull Request: https://projects.blender.org/blender/blender/pulls/130941
2024-12-04 14:00:37 +01:00
Aras Pranckevicius
aebd4a711c Fix: VSE cursor handling crash when there's no active tool
For me on Mac picking "Video Editing" template in startup dialog
now consistently crashes, due to bToolRef being null.
Looks like other code places check for tool being null before trying
to use it; `sequencer_main_cursor` however was not.

Pull Request: https://projects.blender.org/blender/blender/pulls/131358
2024-12-04 13:25:07 +01:00
Campbell Barton
de3eda3c8e Fix 3D text styling buttons in edit-mode
Resolve regression in 4.1 where the 3D text styling buttons
would only read the style from the first character.
2024-12-04 22:26:20 +11:00
Clément Foucault
ad4a306049 Fix #124013: EEVEE: Artifact when using larger pixel size
Rely on Overlay engine to output correct fullres depth
instead of trying to upsample EEVEE's one.

Pull Request: https://projects.blender.org/blender/blender/pulls/130228
2024-12-04 11:49:41 +01:00
Clément Foucault
a0078b79ff Cleanup: GPU: Remove include of removed directory 2024-12-04 10:06:15 +01:00
Omar Emara
462b81efca Fix: Border bicubic interpolation is wrong around edges
The BLI bicubic interpolation function with border boundary is wrong
around edges. It returns zero, where interpolated values should exist.
This is due to a wrong early exit condition, where only a 2x2 window is
assumed instead of the 4x4 window considered by bicubic interpolation.
To fix this, assume a 2 pixel region in the early exit condition for
both directions.

Pull Request: https://projects.blender.org/blender/blender/pulls/131320
2024-12-04 08:39:58 +01:00
Alaska
615ab676a7 Tests: Add Cycles test for a volume with a zero angle distant light
During Blender 4.2's development, a bug was introduced that lead to
volumes rendering incorrectly if:
- There was a distant light with a zero angle spread
- The light tree was enabled

This was reported to blender/blender#129420 and fixed in 4.3.

This commit adds a render test for this situation.

Ref: blender/blender#123012
Ref: blender/blender-test-data!26

Pull Request: https://projects.blender.org/blender/blender/pulls/131079
2024-12-04 02:09:35 +01:00
Alaska
42f8ffbb4c Tests: Add render test for Principled BSDF with a colored zero weight coat
Ref: blender/blender-test-data!20
Ref: blender/blender!124856
Ref: blender/blender#123012

Pull Request: https://projects.blender.org/blender/blender/pulls/130608
2024-12-04 02:00:21 +01:00
Hans Goudey
024d7d12e2 Mesh: Move BVH storage to shared cache system
Avoid rebuilding BVH trees when meshes are copied.
Similar to the other uses of the shared cache system,
this can arbitrarily improve performance when meshes
are copied but not deformed and BVH building is the
main bottleneck. In a simple test file I got a 6x speedup.

The amount of code is also reduced and the system is
much simpler overall-- built out of common threading
patterns like `SharedCache` with its double-checked lock.
RAII is used in a few places to simplify memory management
too.

The downside is storing more `SharedCache` items in the
mesh runtime struct. That has a slight cost when copying
a small mesh many times, but we have ideas to improve that
in the future anyway (#104327).

Pull Request: https://projects.blender.org/blender/blender/pulls/130865
2024-12-04 00:17:17 +01:00
Jacques Lucke
ee9ddbeea3 Fix: interpolating matrix attributes does not always work
The issue is that the conversion to quaternions seems to need normalized matrices
and even then is not always safe. It's simplest to use the existing `*_safe` method here for now.

Related to reports #129445 and #129485.
Related to PR #131296.

Pull Request: https://projects.blender.org/blender/blender/pulls/131297
2024-12-03 23:08:08 +01:00
Hans Goudey
e1e47b6d05 Cleanup: Adjust comment for attribute creation update tag
Avoid confusing initialization with default initialization.
2024-12-03 17:01:47 -05:00
Sean Kim
d8bec5faee Fix #131139: Small brush radius and alpha texture degrades performance
The call to `sculpt_apply_texture` is not thread safe and as such is a
major bottleneck in brush stroke processing. In previous versions, we
avoided calculating this if the vertex position was outside of the brush
radius.

To fix this, we add a check for the factor already being 0 and prevent
further texture calculations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131256
2024-12-03 21:52:50 +01:00
Sean Kim
c4d5145070 Fix: StringRefNull constructor not constexpr
`strlen` is not labeled as `constexpr` and cannot be used, this commit
switches it for `std::char_traits<char>::length` which is labeled as
such since C++17

See: https://en.cppreference.com/w/cpp/string/char_traits/length

Pull Request: https://projects.blender.org/blender/blender/pulls/131266
2024-12-03 21:37:13 +01:00