Commit Graph

101142 Commits

Author SHA1 Message Date
Hans Goudey
f0b53777c8 Cleanup: Use spans and float3 to store sculpt and PBVH vert positions
Also store the allocated deformed positions in a separate array in PBVH,
so there isn't one pointer that _sometimes_ has ownership of its data.

Pull Request: https://projects.blender.org/blender/blender/pulls/109981
2023-07-11 21:01:53 +02:00
Hans Goudey
90ba798885 Cleanup: Remove file added mistakenly in previous commit 2023-07-11 14:54:54 -04:00
Hans Goudey
be09e94f05 Cleanup: Remove unused animation channel type
Unused after f3f05daf11
2023-07-11 14:50:29 -04:00
Hans Goudey
f5ffdafea2 Fix: Node operators crash when using depsgraph
The scene time node and volume nodes crashed, since the despgraph
needs to be retrieved from the operator data instead of modifier data.
2023-07-11 13:38:25 -04:00
Ray molenkamp
07fe6c5a57 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any blenkernel paths from INC
- Add a dependency though LIB

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109939
2023-07-11 19:28:01 +02:00
Hans Goudey
c8e0c69c73 Geometry Nodes: Hide node operators behind experimental option for now
Until the traits (#109526) and the redo panel (#109975) are added,
this is non-functional and confusing enough that it's worth hiding.
2023-07-11 11:43:40 -04:00
Bastien Montagne
8e780e9415 Cleanup: Unused parameters warning in release builds. 2023-07-11 17:10:04 +02:00
Hans Goudey
f3f05daf11 Cleanup: Remove unused "Simulation" data-block
This data-block was originally added in eb4e3bbe68.
However, that original plan wasn't fully implemented, with simulations
now integrated with geometry nodes and modifiers instead of a separate
data-block. We kept the data-block around anyway since we have the
loose plan of using a similar data-block to make global simulations
connected between multiple objects. But it may be a while before we
implement that, and in the meantime having this just causes confusion.
2023-07-11 10:53:15 -04:00
Hans Goudey
4d54e3b6e1 Cleanup: Move simulation nodes cache reset function to proper place
The simulation data-block file isn't used currently, and is unrelated to
the current simulation caches. It would also be reasonable to declare
the function in MOD_nodes.hh, but I went for keeping it together
with the other more public simulation cache code.

Pull Request: https://projects.blender.org/blender/blender/pulls/109967
2023-07-11 16:43:42 +02:00
Nathan Vegdahl
c814d9323e Fix #109920: f-curve ghosts are drawn with incorrect extrapolation
This simply disables extrapolation for all sampled ghost curves,
since their extrapolation doesn't match the f-curves they're ghosting
anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/109926
2023-07-11 16:43:23 +02:00
Philipp Oeser
300cfecc46 Fix #109802: Outliner "Blender File" view cant delete scene
`outliner_do_scene_operation` wasnt recursive, so it only acted on the
top-level `TreeElement` (which was fine for Scenes view, but failed in
`Blender File` view).

Now use an iterator that handles open subhierarchies as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109810
2023-07-11 16:31:01 +02:00
Hans Goudey
087612c042 Cleanup: Reduce use and scope of templates in vertex paint
Many high-level functions with unrelated code were templated based on
the color attribute domain and type. In the end, those were just a few
branches though, similar to other branches. So to reduce binary bloat
and clarify code, move tempates to the point where separate types are
actually needed. Also move constant code out of loops, and use generic
arrays and spans to store some caches. The binary ended up 53 KB
smaller for me, which isn't much but it's in the right direction.

Performance wise nothing really changes. The vast majority of time in
vertex paint is spent on unrelated things like calculating normals or
uploading GPU buffers anyway.

The one ugly part I didn't account for when I started is the casting
between the "ColorGeometry" and "ColorPaint" types. I'm not sure that
this is correct, but it's just a more explicit version of what was
there already.

Pull Request: https://projects.blender.org/blender/blender/pulls/109941
2023-07-11 15:52:28 +02:00
Julian Eisel
efbca8d660 Cleanup: Remove unnecessary tree view function override, add comment
`AbstractTreeViewItem::supports_collapsing()` returns true in the
default implementation, so no need to override that to do the same.
Notes the default behavior in a comment now.
2023-07-11 15:33:26 +02:00
Bastien Montagne
d2c87c3281 LibOverride: Add debug util to print out liboverride data.
No functional changes here.
2023-07-11 15:30:30 +02:00
Bastien Montagne
e11da03e7a LibOverride: Generate 'more unique' names for liboverrides.
Name collisions can become a big issue in liboverrides when production
files gets messy (weird overrides duplicates, bad resync with heavily
changing assets, etc.).

This commit tries to alleviate a bit the problem by generating 'more
unique' names for liboverrides, when an exact match with the reference
is not possible.

So by default, in most common case, the liboverride ID will still have
the exact same name as its linked reference.

If this is not possible, then the new liboverride ID will get a name
which is unique to within the whole current Main (for its ID type). In
particular, this ensure that new override IDs are either named exactly
as their references, or have a name which is not used by any other
reference (linked) IDs.

Note that this is not a perfect solution, since changes in library data
can lead to name collisions later on. However, it should greatly reduce
the frequency of such problems.
2023-07-11 15:30:30 +02:00
Bastien Montagne
b9becc47de Core: ID naming: Add 'global' namemap.
This new namemap allows to generate new ID names which are unique in
current Main (for a given ID type), regardless of the library they
belong to.

This new feature will be used by library override to try to reduce name
collisions with its linked reference IDs when more than one override
exists. It is not intended to be used for general ID naming.
2023-07-11 15:30:30 +02:00
Bastien Montagne
457b26aba3 LibOverride: Work around reset of system liboverrides on save.
Now that liboverride process on save (the diffing + pruning unused
override operations + reset of non-overridable changes) works better. it
leads to a bad side-effect: all system overrides data indirectly
modified through animation or drivers get reset.

Since in current system e.g. most objects of a rigged asset are system
overrides, but their transform is modified by bones animation, this
leads to entire overrides of assets being reset to their linked state
until next depsgraph evaluation.

While this is the expected and correct behavior in absolute, this is
very bad from a user experience PoV.

This commit address the issue by simply re-running a 'frame change'
despgraph update, to ensure all drivers, animations etc. are properly
re-applied after liboverride diffing cleanup & reset.
2023-07-11 15:30:30 +02:00
Bastien Montagne
a05419f18b LibOverride: RNA Apply code: Work around potential duplicates in names of RNA collections of IDs.
While in theory RNA collections of IDs will have unique names in common
use cases, it can happen that there are naming collisions (due to a same
RNA collection having ID pointers to data from different libraries,
having the same name).

This situation is deadly for liboverride applying code, since it rely on
finding which item of the collection to modify by using its name.

To alleviate the problem, this commit changes the way items are searched
for, by adding an extra first check to find an item which matches both
the requested name and index.

While not perfect, this should reduce the breaking cases when production
files get dirty and start having complex mangling of override and linked
data naming.
2023-07-11 15:30:30 +02:00
Bastien Montagne
6dd51353dd LibOverride: Fix potential minor issues in RNA liboverride handling code. 2023-07-11 15:30:30 +02:00
Bastien Montagne
2dfbd653a0 LibOverride: Fix 'resync enforce' not working on RNA collections of IDs.
Code was only considering RNA pointer properties to IDs, but not the
case of RNA collections of ID pointers (like e.g. the Collections' `objects`
property).

This would result in 'resync enforce' fixing tool not working properly
e.g. on liboverride collections' objects.
2023-07-11 15:30:30 +02:00
Bastien Montagne
784d09a87c LibOverride: Fix diffing code not always cleaning unused operations.
In RNA collections cases, the cleaning code was buggy and could end up
never cleaning actually unused liboverride operations, resulting in
sometimes tens of garbage operations on e.g. Collection's objects list.

This was a fairly severe bug, since it could lead to very broken
overrides of collections in some cases when things start to get broken
in the production file, amplifying greatly initially small issues.
2023-07-11 15:30:30 +02:00
Bastien Montagne
df0d6d0022 LibOverride: Expose 'match reference' status flag in RNA API. 2023-07-11 15:30:30 +02:00
Bastien Montagne
5b85248c71 LibOverride: Cleanup: Split log into dedicated output for resync code.
Helps filtering out walls of texts when debuging massive production
files.
2023-07-11 15:30:30 +02:00
Bastien Montagne
9889d0ef6f Fix (unreported) potential crash in 'make override' Outliner tool. 2023-07-11 15:30:30 +02:00
Bastien Montagne
4842424220 LibOverride: Reset object-parenting related properties in resync process.
When the parent ID pointer of an object is a 'system override' (i.e.
matches hierarchy-wise the parent of the linked reference object, or
actually use the same linked object), also clear potential liboverrides
for the other related parenting properties.

This is especially critical for the parent inverse matrix, otherwise if
it ever gets out of sync, in case of re-parenting in the lib data, the
offset would remain and move the liboverride child object into random
places.

NOTE: This may break some very specific workflows where users would rely
on actually overridden parent invert matrix. Not much to be done here,
there is currently no way to support both cases. This is not expected to
be a common use case.
2023-07-11 15:30:30 +02:00
Bastien Montagne
9ed5177055 LibOverride: Fix RNA handling of object parent-related properties.
While setting the parent object itself already had its dedicated
liboverride apply function to avoid resetting other related properties
like the invert parent matrix, other related properties also had custom
setter callbacks with similar effect.

This commit fixes the propblem for the `parent_bone` and `parent_type`
properties by adding a custom liboverride apply callback for them too.
2023-07-11 15:30:30 +02:00
Amelie
f2d3d321bb GPv3: Add access functions for opacity and radius attributes
We need setters and getters for these two very commonly accessed attributes of grease pencil.
The code is based on the implementation of `CurvesGeometry::positions()` and `CurvesGeometry::positions_for_write()`.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/109733
2023-07-11 15:11:14 +02:00
Julian Eisel
d31a0e8393 GPv3: Drag & drop reordering & inserting in the layer tree UI
Note: Change applies to Grease Pencil 3.0 only (experimental feature).

Enables use of drag & drop to reorder grease pencil layers through the layer
tree UI, as well as inserting layers into groups. This is an intuitive and
often requested method of managing such data-structures. Visual feedback should
be improved still, and the gap between items be removed, to reduce flickering
while dragging. These are general improvements for tree views however which
should be done separately.

There is no support yet for dragging layer groups, this requires further
changes in the internal grease pencil APIs.

#109825 introduced the necessary drag & drop support for tree views, #109824
prepared the internal grease pencil API for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/109826
2023-07-11 15:05:17 +02:00
Julian Eisel
3757ec7ee8 Silence unused variable warning in Outliner code
Also add type forward declarations to avoid breaking IDE features
(because type name is not known from the header only).
2023-07-11 14:44:50 +02:00
Julian Eisel
4525527852 UI: Basic tree-view drag & drop reordering and inserting support
No user visible changes expected, these are just the internal API preparations.

Modifies the Drop API for views so that tree-views can choose to insert items
before, after and into other items.

Note: While there is support for drag-tooltips that can explain how an item
will be inserted, there is no drawing yet like in the Outliner, that indicates
if an item is inserted before, after or into. There is some work on that but
that can be done separately.

Changes:
- Removes `AbstractViewDropTarget` that was shared between tree- and
  grid-views, and adds `AbstractTreeViewDropTarget` and
  `AbstractGridViewDropTarget`. The tree-view needs specialized handling now,
  and although they could share some code still, it's not worth having another
  level of inheritance.
- Modifies the drop-target API to use `DragInfo` which contains more info about
  the dragging operation than just the `wmDrag`.
- Adds `determine_drop_location()` to the `DropTargetInterface` which drop
  targets can use to determine when dropping means inserting before, after or
  into.
- Store the block and region in the view. This is needed unfortunately but
  shouldn't be an issue since the tree view is recreated on redraws, together
  with the block.
- Various smaller tweaks and additions to views as needed.

TODO (outside scope of this change): Increase row height so there is no gap
between tree view items, but keep things visually the same otherwise. This
reduces flickering while dragging.

Pull Request: https://projects.blender.org/blender/blender/pulls/109825
2023-07-11 14:30:26 +02:00
Hans Goudey
2549272f02 Fix: Adding node group asset doesn't respect import method
The asset import method option was added after the additions that use
assets in the node editor, so the node editor features still always used
append and reuse, no matter the import method.

This commit improves the asset import function to use the asset's
import method, with "Append & Reuse" as a default.

Pull Request: https://projects.blender.org/blender/blender/pulls/109706
2023-07-11 14:18:11 +02:00
Hans Goudey
6fbe0e27ca Fix: Potential crash with null simulation cache during playback
The cache is typically supposed to be non-null, but I did observe
that in testing, and the null check doesn't really hurt here.
2023-07-11 08:06:33 -04:00
Hans Goudey
424c6edc53 Geometry Nodes: Avoid geometry copies in "no cache" simulation
When we don't need to preserve a persistent cache, we can use
the geometry from the last frame directly rather than copying it.
Though implicit lets us avoid copying large data arrays when they
aren't changed, this can still give a large improvement for something
like particle simulation where the majority of the data was copied
every frame.

Pull Request: https://projects.blender.org/blender/blender/pulls/109742
2023-07-11 14:03:12 +02:00
Hans Goudey
791a06061c Fix: Build error in rigid body code with bullet turned off
Caused by 9c9664c823
2023-07-11 07:25:26 -04:00
Jacques Lucke
7ec335f995 Geometry Nodes: add run-time data to geometry nodes modifier
This adds a single run-time field and moves the existing run-time data into a new struct.
This approach makes it much easier to add new run-time data.

Pull Request: https://projects.blender.org/blender/blender/pulls/109905
2023-07-11 12:55:57 +02:00
Philipp Oeser
9c9664c823 Fix #109928: issues adding rigid bodies via just the world collection
Selecting a rigid body world collection is supposed to set up rigid
bodies for all of its mesh members (if they are not rigid bodies
already), expected result would be just the same as if `Object` > `Rigid
Body` > `Add ...` was used.

Doing it via just the world collection had the following issues though:
- calculating mass would crash on such a freshly created rigid body
objects (be1b32e4e4 falsely assumed `ob->rigidbody_object` is always
present on evaluated objects -- without tagging for depsgraph updates
this is not the case though)
- rigid body simulation would not work even on these freshly created
rigid body objects

Now tag bmain relations and object transforms for update to make both of
these work (following code in `BKE_rigidbody_add_object` that is used
when adding these through `Object` > `Rigid Body` > `Add ...`)

Pull Request: https://projects.blender.org/blender/blender/pulls/109961
2023-07-11 12:22:44 +02:00
Philipp Oeser
37e286be85 Cleanup: animation: remove redundant/wrong comments
These comments were copy-pasted around code and are either wrong
(because they have been copied from another function) or redundant
(since the function itself describes what is done here).

Pull Request: https://projects.blender.org/blender/blender/pulls/109360
2023-07-11 12:20:50 +02:00
bonj
d3315422ae Fix #109662: Overlay: Always use 0 for retopo min offset when disabled
Using 0.0015f as minimum value on Apple makes sense when the retopology
overlay is enabled.
When disabled however, this will cause the shader to think the overlay
is enabled when it's not, affecting the color of faces.
Therefore the offset when disabled should always be zero.
I've removed the unnecessary define and shortened the name of the other
one.

Pull Request: https://projects.blender.org/blender/blender/pulls/109658
2023-07-11 12:05:51 +02:00
Pratik Borhade
53e1bae929 Fix #109898: Incorrect behavior when moving objects to linked collection
Do not move objects to a collection which is linked from another file.

Pull Request: https://projects.blender.org/blender/blender/pulls/109957
2023-07-11 11:44:33 +02:00
bonj
70b05249cb Fix #109040: Don't calculate homogenous offset if viewspace offset is 0
Users were reporting offset issues when the retopology overlay
was disabled. The reason those issues were happening is because of
`vs_offset = min(vs_offset, vs_z * -0.5);`.
That line is necessary for proper functioning of the retopology
overlay, but causes issues at lower offset values (such as zero, when
the retopology overlay is disabled).

Fixes #109640

Pull Request: https://projects.blender.org/blender/blender/pulls/109657
2023-07-11 11:44:15 +02:00
Clément Foucault
b5749f8e8a GPU: Fix shader builder
Breakage caused by 1978b4fc92
2023-07-11 11:09:30 +02:00
Clément Foucault
11e2ca4b70 GPU: Fix compilation warnings
Warnings caused by 1978b4fc92
2023-07-11 11:08:06 +02:00
Clément Foucault
1978b4fc92 GHOST: Replace WITH_OPENGL build option
Replaces it by WITH_OPENGL_BACKEND and cleanup its usage.
Limits visibility of opengl enums and cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/109947
2023-07-11 09:17:31 +02:00
Jason Fielder
232d763af4 Fix #109389: Resolve Z-fighting artifacts in Metal
Resolves z-fighting artifact on Apple Silicon.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/109922
2023-07-11 09:07:21 +02:00
Jason Fielder
ac708cb33a Fix #106905: Increase OS version requirement for Metal on Intel
Certain feature requirements unsupported by older OS builds
caused failures when running Intel GPUs on older OS's.

This patch increases the minimum required OS version
to one which covers devices supporting all required features.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/109921
2023-07-11 09:03:47 +02:00
Campbell Barton
74c7615dba Cleanup: use function style casts for C++ 2023-07-11 15:15:09 +10:00
Campbell Barton
4333051f4d WM: pass the window manager & window to WM_report_banner_show
Avoid potential problems when the active window is known but not
assigned to `wm->winactive`, where the first window would be used
as a fallback. Instead, take a window argument, a fallback is still
used as a last resort (when NULL).
2023-07-11 14:42:24 +10:00
Campbell Barton
36b2291610 Cleanup: spelling in comments 2023-07-11 14:40:47 +10:00
Germano Cavalcante
7aa31c884d Mesh: Merge by Distance: Remove unnecessary array
The `groups_map` array (which indicates the group an element belongs
to) is only intended to reduce loops when creating groups, speeding up
that part of the code.

But on the downside, it requires more memory usage, and adds one more
step to access groups (`groups_offs[groups_map[i]]` instead of just
`groups_offs[i]`).

So removing that array decreases memory usage and speeds up access in
another part of the code.

The profile showed a +6% advantage when the Weld modifier affects large
portions of the mesh.

But it also showed a loss of around -0.6% in performance for cases
where the Weld modifier affects small parts of the mesh.

The biggest benefit is to save memory and speed up some cases.
2023-07-11 00:40:08 -03:00
Campbell Barton
bef652c432 Cleanup: prefer terms backup/restore over capture/restore
The term capture is associated with video/screen capture.
Prefer the term backup as it's clear that information is stored
to support restoring it later.
2023-07-11 13:23:36 +10:00