Commit Graph

104254 Commits

Author SHA1 Message Date
Thomas Dinges 26caa18173 Release: Bump to 4.1 release 2024-03-25 18:08:02 +01:00
Pratik Borhade 436b9a5aae Fix #119862: poly build crash when adding first vertex in empty geometry
object_index is not found (-1) when all mesh data is deleted hence it
crashes when accessing base from the vector at index -1.
So skip the further execution to prevent crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/119865
2024-03-25 13:55:57 +01:00
Brecht Van Lommel 64bfe49164 Fix: RNA warning regarding description ending in period
Ref #109157
2024-03-22 20:59:15 +01:00
Harley Acheson 986e4a8b7f Fix #119384: Outliner Edit Mode Toggle When Data is Shared
This report includes a file that demonstrates a crash when ctrl-
clicking the "dot" icon to add to the objects in edit mode. This is
because the object has a mesh shared with another object that is
already in edit mode. This PR allows editing only one object at a
time between objects that share data.

Pull Request: https://projects.blender.org/blender/blender/pulls/119704
2024-03-22 18:26:29 +01:00
Hans Goudey 7f4a4fa605 Fix #119787: Curves viewport attribute drawing crash
Caused by 1cca960677.

That commit stated that creating the final subdivided attribute didn't
free the "proc" attribute buffer that contains the data from the Curves
control points. However that wasn't the case, given the call to
`GPU_VERTBUF_DISCARD_SAFE` in that function. That caused a crash when
the overlay engine and EEVEE both wanted to access the VBO and it was
discarded the second time. To fix that, only regenerate the
`proc_attributes_buf` when it doesn't already exist.

This matches the "ensure" behavior that already exists for the
`cache.final[subdiv].attributes_buf` buffer, so conceptually it
seems fine.

Pull Request: https://projects.blender.org/blender/blender/pulls/119795
2024-03-22 17:19:50 +01:00
Julian Eisel 303014bfac Fix #108078: Crash when inverting results in pose library sidebar
a958ae36e8 introduced support for UI lists to reference items that would
never be shown, regardless of filter settings. This was to skip assets
in the asset view template that were not of the requested type. UI list
sorting code wasn't updated to account for such items that should be
entirely ignored.

Pull Request: https://projects.blender.org/blender/blender/pulls/109157
2024-03-22 12:25:39 +01:00
Hans Goudey b9ef66693a Fix #119754: Edit mode modifier deform data copy crash
Caused by ddcfc46ee6.

That commit assumed that the cage mesh always had the deformed
position and normal data. But that isn't true, as shown in the example
in the report. To fix the bug, simplify things, and make the goal clearer,
just copy the struct directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/119755
2024-03-21 21:22:51 +01:00
Hans Goudey 040ff38fcd Fix: ID namemap assert in auto smooth versioning code
When "moving" the new node group to the same library as the object, its
original name has to be cleared from the name-map as well. That's
because there is a separate name-map for each library. I had this in
the original PR, but incorrectly removed this because I thought it was
unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/119747
2024-03-21 17:26:45 +01:00
Philipp Oeser 5fa1915d47 Fix #119715: Curve sculpt puff brush causes hairs to move erratically
Caused by 98bf7a8d7a / ff7b8f3412

Since the `curve_weights` array was created uninitialized, and the above
commits were doing `math::max_inplace` on the uninitialized data, this
could end up with garbage values.

Now initialize the array properly to prevent this.

Pull Request: https://projects.blender.org/blender/blender/pulls/119730
2024-03-21 11:52:31 +01:00
Hans Goudey ddcfc46ee6 Fix #119544: Cage modifier deformation ignored in next modifier
When the edit mesh modifier stack first deforms the original edit mesh,
it creates deformed positions in a separate array. That array is copied
to the mesh's vertex positions if a subsequent modifier requires an
actual mesh rather than a mesh wrapper.

However, if that last deform modifier is the last "on cage" modifier
and the next modifier requires a real Mesh, we hit a code path that
didn't copy the temporary position array, since it was contained in the
separate `EditMeshData` struct that must be handled manually.

This was a regression in 91b27ab637. In the future I hope to
make this simpler by expanding the use of implicit sharing and making
the conversion from original BMesh to a Mesh more lazy / const correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/119718
2024-03-20 23:16:02 +01:00
Harley Acheson afbd733047 Fix #119635: File Browser Horizontal Display Never Compact
File Browser listings can clip content, remove columns, etc as the
available space narrows. This PR just makes this never happen for
the horizontal display mode, where files are shown in multiple columns,
as this is not applicable.

Pull Request: https://projects.blender.org/blender/blender/pulls/119673
2024-03-20 17:06:38 +01:00
Sergey Sharybin 4eab8fae5a Fix #119697: Incorrect update after disabling light linking
The issue was caused by 29aaa2922d.

With the change from the offended commit there was nothing that
would have informed objects previously linked to a light that they
need to re-calculate their light linking collections.

This change makes it so scene's hierarchy is tagged for update,
which propagates to all dependencies which do depend on hierarchy
of objects and collections in the scene.

This brings behavior closer to what it used to be, without causing
slowdown with full re-evaluation (which was fixed by the offending
commit).

Pull Request: https://projects.blender.org/blender/blender/pulls/119698
2024-03-20 16:06:06 +01:00
Jason Fielder c584597165 Fix #109363: Resolve GPencil fill in Metal
Resolves an issue with stroke rendering in
Metal using the geometry shader fallback
path. Stroke rendering now matches OpenGL
which should enable the GPencil fill tool to
function correctly at all zoom levels.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119660
2024-03-20 15:38:44 +01:00
Hans Goudey 87de8109b7 Fix: Build error from misplaced const in recent commit 2024-03-20 10:09:06 -04:00
Hans Goudey cb3975c045 Fix #119642: Orbit around selection ignores geometry bounds
The code tried to retrieve the bounds from the data
synced back to the original object at the end of depsgraph
evaluation. That data is only set on original objects.

Instead just retrieve the bounds directly from the evaluated
object. Also make two variables const now that it's possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/119674
2024-03-20 14:47:27 +01:00
Sergey Sharybin 03c7191286 Fix #119560: Wanderer Demo Crash in 4.1 and 4.2
Add a null pointer check around CPU processor, matching the rest of the
processor access.

This solves crash in cases when the OCIO configuration exists but is
invalid: i.e. by removing a lookup table. It could lead to an invalid
render result, but is better than a crash.

The original issue with running Blender from within .zip archive might
still need investigation, as there might be a way to make it work.

Pull Request: https://projects.blender.org/blender/blender/pulls/119693
2024-03-20 14:38:23 +01:00
Michael Kowalski 99b845b1fb Fix: USD import: point instancer invalid modifier uid
Initializing the uid of the geom nodes modifier created
by the point instancer reader to prevent an assertion failure
(in a call to to BKE_modifiers_persistent_uids_are_valid())
when reading any USD point instancers in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/119683
2024-03-20 13:59:00 +01:00
Pratik Borhade f99939e2ff Cleanup: Remove redo panel drawing code of graph select handle
Since there is no special case for drawing redo panel, this callback is
not required. Panel will be generated automatically because `undo` and `register`
flags are added to operator.
This improves alignment in redo panel.

Pull Request: https://projects.blender.org/blender/blender/pulls/119494
2024-03-20 12:55:13 +01:00
Jacques Lucke 067daec270 Nodes: don't use combined input/output sockets in node tree interface
Those shouldn't really exist at all currently, since we forbid them in 354915cf3c.
Unfortunately, not all cases were removed, and many node trees with such sockets
have been created during the development of 4.1 due to the auto-smooth changes.

I'm not entirely sure if it's still possible to properly remove them now. The commit
above mentions that we might lose links due to changed identifiers. Maybe we're
better off just supporting these inlined sockets while also allowing the "align with
previous socket" functionality.

Either way, not creating more of such node trees for now is reasonable, since we
explicitly disabled that functionality for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/119654
2024-03-20 11:26:07 +01:00
Jason Fielder 3c25b079ce Fix #109739: Resolve greyed out UI on MacOS
UI would sometimes disappear with the Metal backend.
This occured in situations where there was only a single
GPUContext within a single GHOST window, meaning
the activation routine for the context was never run.

Context activation is required to ensure the backbuffer
was up to date upon resize. Otherwise, re-sizing the
window would cause the screen to turn grey as the
new drawables would not be rendered to.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/119299
2024-03-20 08:33:29 +01:00
Hans Goudey 3641b4b884 Fix #119586: Vertex paint mode crash after converting color attribute
Converting a color attribute to a non-color domain or type causes vertex
paint mode to try to change the attribute even though it's unsupported.
That leads to a crash here and unpredictable behavior elsewhere.

This PR modifies some poll functions to check for the proper domain and
data type before continuing. Even if converting an attribute properly
updates the active color attribute, we can still run into situations where
the active name references an attribute with incorrect metadata.

Pull Request: https://projects.blender.org/blender/blender/pulls/119657
2024-03-19 19:49:00 +01:00
Brecht Van Lommel f771a8563b Fix #110751: Crash baking grease pencil line art
Ensure depsgraph tag happens when strokes are cleared, otherwise the
next depsgraph evaluation tries to use freed stroke data.

Pull Request: https://projects.blender.org/blender/blender/pulls/119662
2024-03-19 17:59:19 +01:00
Hans Goudey cc0e015a35 Fix #119177: False positive dyntopo attribute detection warning
".sculpt_mask" is handled as a special case for dynamic topology
but wasn't detected that way in the warning.

Pull Request: https://projects.blender.org/blender/blender/pulls/119665
2024-03-19 16:55:21 +01:00
Sybren A. Stüvel cd476226d8 Fix #119402: Bone collections layers fail with pinned object or armature #119434
Don't assume armature of active object is what is displayed in the properties editor, both in C++ and Python code.

Object pointer was left out from some notifiers, as this means only that object was changed. But an armature datablock can be shared by multiple objects.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119663
2024-03-19 16:27:06 +01:00
Jeroen Bakker b5168ee771 Fix #119527: Aliased Wireframe In XRay
This change reverts 14500953ed. This commit improved the performance
but introduced the regression. The wireframe shader checks the normal
buffer to detect if attributes are being rendered. The VBO contains both
positions and normals.

In Blender 4.2 this VBO was separated (#116902)and this solved the rendering. It is
to late and risky to add this separation to 4.1 in the last minute so we
decided to revert the performance improvement as it was already an issue
for several years.

The performance improvement will still be in Blender 4.2 where it doesn't
have these artifacts.

Pull Request: https://projects.blender.org/blender/blender/pulls/119656
2024-03-19 14:23:43 +01:00
Philipp Oeser 4a7c5d3d3d Fix #119534: Action Editor empty channels region without active action
Caused by a96f1208cc

For `SPACE_ACTION` (`SACTCONT_ACTION`), `actedit_get_context` will
return true, but `ANIM_animdata_context_getdata` also checks the
`bAnimContext` data [which in this case is the action], so will **not**
return true.

As a result we are skipping drawing the background and the search, which
is now done again.

Pull Request: https://projects.blender.org/blender/blender/pulls/119621
2024-03-19 14:05:42 +01:00
Sybren A. Stüvel c0c7e34bab Fix #119615: Anim, Crash with NLA tweak mode and linked Armatures
Fix a crash when inserting a key with tweak mode enabled, but where
`AnimData::actstrip` was NULL.

The root cause of this is that two pointers in the `AnimData` struct
(`act_track` and `actstrip`) are expected to be set when NLA tweak mode
is enabled, BUT these are not exposed to RNA and thus invisible to the
library overrides system. As such, they are NULL when loading from disk,
while the `ADT_NLA_EDIT_ON` flag still indicates they are to be used.

Rather than adding a NULL pointer check (and having to add that in many
more places), I used this two-pronged approach:

- Extend the 'NLA tweakmode' override apply code, to set the `act_track`
  and `actstrip` pointers when they are incorrectly NULL. This is done
  by lookup of the track and strip by name.
- Add versioning code to exit out of tweak mode whenever the
  `ADT_NLA_EDIT_ON` flag is set, but those two pointers are still NULL.

The last step was necessary with the example file attached to the bug
report, as that was saved with a buggy blender version. New saves work
just fine.

Pull Request: https://projects.blender.org/blender/blender/pulls/119632
2024-03-19 10:45:32 +01:00
Pratik Borhade 43e968dc78 Fix #119612: Markers bar in NLA blocks view of final track in list
Mistake in a96f1208cc.
When markers are present, offset should be added to the height.
Earlier it was subtracted like so `v2d->tot.ymin -= MarkerMargin` and that worked
because ymin is assigned like so `v2d->tot.ymin = -height`.
Now that the marker margin is added to the height it needs to be additive.

Pull Request: https://projects.blender.org/blender/blender/pulls/119647
2024-03-19 10:26:29 +01:00
Sybren A. Stüvel 30711d1398 Fix #119623: Anim: unintended API change in keyframe_insert() function
Bring back the `INSERTKEY_XYZ_TO_RGB` enum item for the
`keyframe_insert()` function (it was removed in 30b0c5b225). This way
any Python code that targets Blender 4.x can safely pass this flag,
without having to check specific Blender versions.

Note that the flag is implemented as a no-op, as the behaviour change
introduced in 30b0c5b225 (just looking at the user preference) is still
retained. The purpose of this commit is simply to avoid the `ValueError`
exception that would otherwise be raised.

This should also fix Rigify report blender/blender-addons#105241.

Pull Request: https://projects.blender.org/blender/blender/pulls/119625
2024-03-19 10:05:22 +01:00
Hans Goudey 51cdf665ab Fix #119520: Auto smooth modifier added unnecessarily with bevel
If the bevel "Harden Normals" option is on, custom normals will be
generated. In that case, the automatic sharp edge tagging based on the
angle shouldn't run. This PR extends the earlier fix to #116395 to
handle this case and also extends the check to not just check the last
modifier, which doesn't work in this test file which has a collision
modifier at the end. That makes sense anyway, since what we really care
about is whether the evaluated mesh has custom normals or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/119638
2024-03-18 21:43:22 +01:00
Hans Goudey 5bfe6ad8f8 Fix: Various issues with auto smooth versioning
This PR fixes several issues with the versioning that replaces the old
auto smooth flag with a modifier.

One issue is that the flag wasn't cleared in the initial versioning
code. That means some objects have the replacement modifier but their
meshes still have the flag set. The fix for that is to make the
versioning idempotent by trying to find an existing node group before
adding a new one. The versioning is now re-run on all objects to clear
the flags. Flags on all meshes are cleared too, even unused meshes.
That could cause loss of the auto-smooth when the mesh is linked from
a different blend-file, but that situation should be very rare.

Another issue was that the versioning wasn't run when linking objects.
That was simple to solve by adding the versioning where the proxy
versioning already existed for that case.

Finally, arguably the largest issue was that the the newly added node
groups were always added as local data-blocks. When linking, having
library data-blocks point to local data-blocks not in that library is
quite bad and breaks assumptions around Blender. This is solved by
having an auto smooth node group per library.

Resolves #119516, #119455, #119447

Pull Request: https://projects.blender.org/blender/blender/pulls/119539
2024-03-18 20:15:36 +01:00
Julian Eisel 745fd2a2cb Fix: Tree-view items always collapsed by default
Since 660867fa00, having tree-view items uncollapsed by default using
the `set_collapsed()` functions wouldn't work anymore. An attempt to do
this would assert even, so eb71d9f7bc disabled the assert.

I think a function designed to handle exactly this is the best solution,
it makes the intent & behavior more clear than before, and highlights
that this is a special case.

Mitigates #117957, in that it solves the regression, but tree-views still
don't remember their state on screen-layout changes. This is a known
limitation and not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/119166
2024-03-18 19:32:53 +01:00
Brecht Van Lommel 7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00
Jacques Lucke 67bd678887 Fix #119578: crash when node tool does not have geometry as first output socket
This was simply missing a check and error message. The same error message
is shown when the node group is used as modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/119604
2024-03-18 14:36:43 +01:00
Jason Fielder 661d12aef7 Fix #119195: Ensure Metal uses correct attribute conversion mode
Resolves custom attribute types for ints and booleans by ensuring
conversion mode is correct. Previously, the attribute declarations
were assumed to be linear. However, patch ensures the correct
attribute index is now fetched, ensuring the conversion mode
is correctly specified for non-linear attribute ID's.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119569
2024-03-18 13:38:09 +01:00
Philipp Oeser 5ba581bd0a Fix #119523: Missing driver bone target doesn't mark driver as invalid
If a bone was specified (but now missing), the driver would fallback to
using the object as a target (which can lead to unintended behavior).

So now check if a bone is specified, if it is missing, mark the driver
invalid. If no bone is specified at all, then use the armature object as
the target.

NOTE: `DTAR_FLAG_INVALID` is not granular enough to distinguish the
object and bone targets, so both will be marked in red in the UI (there
is already comments about it in code). If necessary, we could introduce
an additional DTAR_FLAG_BONE_INVALID and use that in a couple of places.

Pull Request: https://projects.blender.org/blender/blender/pulls/119533
2024-03-18 12:48:43 +01:00
Falk David a3243172bf GPv3: Switch back to the current grease pencil render engine
This makes it so GPv3 objects are rendered using the current grease pencil render engine.

A new `gpencil_next` engine was added at the beginning of the project, but it couldn't
be finished in time. This commit removes the `gpencil_next` engine as it is no longer
used. The current status of the new engine been pushed to the `gpencil-next` branch on
the `blender` repository.

Note: Onion skinning is not supported yet. This work will be done in a separate PR.

Fixes #115467 and #116347.

Pull Request: https://projects.blender.org/blender/blender/pulls/118664
2024-03-18 12:01:15 +01:00
Pratik Borhade b3095d9c2e Merge branch 'blender-v4.1-release' 2024-03-18 14:43:15 +05:30
Kamil Galik d739d27a2d Fix #119203: Change default NDOF Deadzone value
There is a Deadband built in the sensor of SpaceMouse,
therefore the default value of Deadzone field can be equal to 0.0
instead of 0.100.

Pull Request: https://projects.blender.org/blender/blender/pulls/119522
2024-03-18 10:10:21 +01:00
Jacques Lucke e4e4b51c83 Fix: add missing socket type in forward declaration list
Not quite sure how I missed this before. It's quite unfortunate that this
causes issues like #119179 in Blender 4.0.
2024-03-17 19:08:40 +01:00
Jacques Lucke ee1fa8e1ca BLI: support set operations on index masks
The `IndexMask` data structure was designed to allow us to implement set
operations like `union`, `intersection` and `difference` efficiently
(2cfcb8b0b8). This patch adds an evaluator for
arbitrary expressions involving the mentioned operations. The evaluator makes
use of the design of the `IndexMask` data structure to be quite efficient.

In some common cases, the evaluator runs in constant time. So it's very fast
even if the mask contains many millions of indices. If possible the evaluator
works on entire segments at once instead of looking at the individual indices.
This results in a very low constant factor even if the evaluation time is
linear. If the evaluator has to look at the individual indices to be able to
perform the operation, it can make use of multi-threading.

The evaluation consists of the following steps:
1. A coarse evaluation that looks at entire segments at once.
2. All segments that couldn't be fully evaluated by the coarse evaluation are
   evaluated exactly by looking at the actual indices. There are two evaluators
   for this case. One that is based on `std::set_union` etc. The other one first
   converts the index masks to bit spans, then does bit operations to evaluate
   the expression, and then converts the bits back into indices. Depending on
   the expression, one or the other can be more efficient.
3. Construct an index mask from the evaluated segments.

Showing the performance of the evaluator is kind of difficult because it highly
depends on the input data. Comparing the performance to something that does not
short-circuit when there are full ranges is meaningless, because one can
construct an example where the new evaluator is arbitrarily faster. I'm still
working on a case where performance can be compared to e.g. using
`std::set_union`. This comparison is only fair when the input data when
constructing a case where the new evaluator can't short-circuit.

One of the main remaining bottlenecks are the calls to `slice_content` on large
index masks. I think the impact of those can still be reduced.

We are not using this evaluator much yet, except through `IndexMask::complement`
calls. I intend to use it when I get to refactoring the field evaluator for
geometry nodes to optimize the evaluation of selections.

Pull Request: https://projects.blender.org/blender/blender/pulls/117805
2024-03-17 09:52:32 +01:00
Jason Fielder 6768ded895 Fix #118868: Metal render pass output for EEVEE Next
Resolves render pass export for EEVEE Next on Metal.
Reads from texture views was previously utilising the
root texture rather than the view variant, resulting
in views into texture arrays being incorrectly sampled.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119563
2024-03-16 20:16:37 +01:00
Harley Acheson bec9b4bc4b UI: Update Polls on Single Repository Sync and Upgrade
The buttons to sync and update individual repositories only work for
remote repositories. This PR just updates their poll functions to
disable them for local repos.

Pull Request: https://projects.blender.org/blender/blender/pulls/119568
2024-03-16 20:00:49 +01:00
Brecht Van Lommel b8ea467475 Merge branch 'blender-v4.1-release' 2024-03-16 19:45:51 +01:00
Guillermo Venegas 1058006e03 Fix #119549: Avoid resetting properties tagged as `SKIP_PRESET`
Excludes properties tagged as `SKIP_PRESET` from being reset.

Pull Request: https://projects.blender.org/blender/blender/pulls/119550
2024-03-16 19:34:49 +01:00
Harley Acheson 8770299406 UI: Option for Separate Extension Dev Tools
Experimental flag for "Extensions Development Utilities" that can be
enabled separately from "Extensions". Note this PR does not enable the
use of this flag (coming later) as uses are in addons-contrib. This
flag is requested in #119521

Pull Request: https://projects.blender.org/blender/blender/pulls/119562
2024-03-16 17:24:34 +01:00
Clément Foucault 38b180f236 EEVEE-Next: Shadow: Hide banding artifact at projection edges
This affect all local lights (non-sun light).

We hide the artifact caused by different tracing results from
two adjacent projection. This is visible as the shading point
switches projections.

We fix this by randomizing which shadow map projection (face)
to trace. We do that by using the point at half the ray instead
of the shading point to choose the projection. This gives
a soft enough look proportional to the light shape.
This also has the benefit of being stupidly simple.

Pull Request: https://projects.blender.org/blender/blender/pulls/119555
2024-03-16 15:20:46 +01:00
Iliya Katueshenock 62bd0ea5fd Fix: Geometry Nodes: GPv3 component is always in Separate Component node
Makes sure the GPv3 component doesn't show up unless the experimental
flag is set.

Pull Request: https://projects.blender.org/blender/blender/pulls/118915
2024-03-16 14:03:13 +01:00
Harley Acheson 66a40c0e04 UI: Use Internet Icon for Repo Add menu
In Preferences / Extensions / Repositories / Add, show the correct
"Internet" icon on the menu item for remote repository.

Pull Request: https://projects.blender.org/blender/blender/pulls/119541
2024-03-15 21:44:33 +01:00
Brecht Van Lommel 971e82b93a Merge branch 'blender-v4.1-release' 2024-03-15 21:13:19 +01:00