Commit Graph

101116 Commits

Author SHA1 Message Date
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
Campbell Barton
1ec1e783cc Cleanup: consistent naming for wmTimer API
Word ordering for wmTimer API wasn't consistent.

- Use "WM_event_timer_" / "WM_event_timers_" prefix.
- Rename "wm_window_timer" to "wm_window_timers_process"
  because it wasn't clear what the function did from its name.
- Rename "wm_window_process_events" to "wm_window_events_process"
  for consistency with "wm_window_timers_process".
2023-07-11 13:16:04 +10:00
Campbell Barton
6be0c90eab Fix #109953: Timers without an associated window leak memory on exit
Thanks to @mod_moder & @Harley for their investigation, see !109603.
2023-07-11 12:52:34 +10:00
Campbell Barton
8a73c36643 Fix #109952: Unknown engine warning only shown when loading from a popup
Displaying the warning on file load depended on `wm->winactive`
being set, and didn't work when loading a file from the file-open
window or when loading files using a command-line argument.

Resolve using the first window as a fallback.
This happens to resolve #109770, although not freeing timers on exit
is likely to be an issue under other circumstances.
2023-07-11 12:21:04 +10:00
Campbell Barton
6239246c9c Cleanup: quiet class-memaccess warning 2023-07-11 12:21:02 +10:00
Germano Cavalcante
e9aba52f42 Fix wrong usage of 'accumulate_counts_to_offsets'
Error in 1457c0c533.
2023-07-10 21:59:00 -03:00
Germano Cavalcante
1457c0c533 Cleanup: Tweaks to the Mesh Merge by Distance code
- Improve comments
- Rename variables
- Reduce indentation
- Use `const` types
- Use `OffsetIndices` API

Pull Request: https://projects.blender.org/blender/blender/pulls/109919
2023-07-11 01:59:25 +02:00
Ray Molenkamp
3046b0a19e CMake: Fix shader_builder build error
Problem introduced in 57ad866d81
as I didn't build with this option on.
2023-07-10 17:08:13 -06:00
Hans Goudey
6d74a7173e Cleanup: Remove unused function 2023-07-10 16:23:04 -04:00
Hans Goudey
5ca29d293b Fix: BLI: Assert in generic array move constructor
When assigning a default constructed virtual array,
an assert checking for a non-null type was triggered.
2023-07-10 16:22:55 -04:00
Ray Molenkamp
04235d0e55 Cleanup: CMake: Modernize bf_blenlib dependencies
Pretty straightforward

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

Pull Request: https://projects.blender.org/blender/blender/pulls/109934
2023-07-10 22:04:18 +02:00
Germano Cavalcante
093a4d63f3 Cleanup: Move some space_view3d files to C++
See: #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/109936
2023-07-10 21:48:38 +02:00
Hans Goudey
3d383d383f Cleanup: Use C++ Array types for Edit Mesh SoA cache
This helps const correctness since the data can't be changed from a
const EditMeshData struct, and simplifies memory management.

Pull Request: https://projects.blender.org/blender/blender/pulls/109821
2023-07-10 19:49:54 +02:00
Iliya Katueshenock
94914d12f3 Fix #109341: Try to store single value fields as single in simulation
Sampling nodes produce fields, but can be used for
single values. If this used in simulation, this will not work
correctly, not similar as other singles. Just compute these
fields as single to store in Simulation Output node.

Pull Request: https://projects.blender.org/blender/blender/pulls/109879
2023-07-10 19:11:06 +02:00
Ray Molenkamp
57ad866d81 Cleanup: CMake: Modernize bf_guardedalloc dependencies
Pretty straightforward

- Removes any guardedalloc paths from INC
- Adds a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109925
2023-07-10 18:44:19 +02:00
Iliya Katueshenock
fc58d92acb Fix #99569: Socket type drawing of custom type in view template
Socket type drawing of custom type in view template.

Pull Request: https://projects.blender.org/blender/blender/pulls/109871
2023-07-10 18:22:01 +02:00
Iliya Katueshenock
a8186e1542 Fix #109885: Check if BVH tree is null in correct place
The `BKE_bvhtree_from_pointcloud_get` function have requirements for
input point cloud argument and initialization of `BVHTreeFromPointCloud`
can be skipped. Due to `BVHTreeFromPointCloud` is not initialized by
default constructor, it can contains garbage data. To check if tree is
initialized field of `BVHTreeFromPointCloud`, return argument shouldn't
be ignored. `[[nodiscard]]` attributes is added.

Pull Request: https://projects.blender.org/blender/blender/pulls/109892
2023-07-10 18:12:41 +02:00
Hans Goudey
5c4694759b Cleanup: Return corner normal space by value 2023-07-10 12:04:33 -04:00
Hans Goudey
3fc45d6151 Cleanup: Use C++ types, references for custom normals
Also remove unnecessary namespace specification.
2023-07-10 12:04:33 -04:00
Hoshinova
41335edf22 Fix #109254: Voronoi distance output is clamped at 8
The Voronoi distance output is clamped at 8, which is apparent for distance
metrics like Minkowski with low exponents.

This patch fixes that by setting the initial distance of the search loop to
FLT_MAX instead of 8. And for the Smooth variant of F1, the "h" parameter is set
to 1 for the first iteration using a signal value, effectively ignoring the
initial distance and using the computed distance at the first iteration instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/109286
2023-07-10 17:42:24 +02:00
Clément Foucault
b65dfb26f9 EEVEE-Next: Shadow Tag: Fix uv calculation 2023-07-10 17:04:06 +02:00
Joseph Eagar
fc10d04187 Cleanup: remove unused variables 2023-07-10 07:35:55 -07:00
Sergey Sharybin
d579ac2b3f Refactor: Use ImBuf to store passes in RenderResult
Doing so avoids having duplicated logic for working with pixel
data which is being passed throughout the render pipeline.

Notable changes:

- ImBug can now store GPU texture.
  This is not very finished part of the API, which will be
  worked further to support tiling for very-high-res images.

- Implicit sharing is removed from the image buffer, as it is
  no longer needed.

There should be no functional changes on user level with this
change.

Ref #108618

Pull Request: https://projects.blender.org/blender/blender/pulls/109788
2023-07-10 16:33:32 +02:00
Hans Goudey
baf1c79668 Geometry Nodes: Remove assets loading warning from 3D view header
This isn't really helpful at this point, and is ugly/distracting when
starting Blender. It's not that bad if more menus show up with a
bit of a delay anyway.
2023-07-10 10:09:46 -04:00
Hans Goudey
80f105e924 Fix #109462: Incorrect "No Cache" simulation cache invalidation
The "No Cache" simulation nodes option effectively changes the cache
to work in a "realtime mode" where there are only two states, the
current and previous frame. Whenever the current frame doesn't
increase, the previous state should reset. This didn't happen
properly, and it was hard to verify because the code was shared
with the regular "cache on" mode.

Instead, separate the caching more in the code, using a different
struct to store the two "realtime" states. Also clarify that we
don't support animation of the "No Cache" option by disabling
support for that in RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/109741
2023-07-10 16:02:31 +02:00
Bastien Montagne
fa29d28d73 Fix #109889: Trying to append/link from the current file does give proper error message.
Logic in FileBrowser and/or `BKE_blendfile_library_path_explode`
probably changed at some point, and the generic 'invalid filetype' error
message was reached before the path is compared to current blendfile path.
2023-07-10 15:58:36 +02:00
Ray Molenkamp
7cebb61486 Cleanup: CMake: Modernize bf_dna dependencies
There's quite a few libraries that depend on dna_type_offsets.h
but had gotten to it by just adding the folder that contains it to
their includes INC section without declaring a dependency to
bf_dna in the LIB section.

which occasionally lead to the lib building before bf_dna and the
header being missing, while this generally gets fixed in CMake by
adding bf_dna to the LIB section of the lib, however until last
week all libraries in the LIB section were linked as INTERFACE so
adding it in there did not resolve the build issue.

To make things still build, we sprinkled add_dependencies wherever
we needed it to force a build order.

This diff :

Declares public include folders for the bf_dna target so there's
no more fudging the INC section required to get to them.

Removes all dna related paths from the INC section for all
libraries.

Adds an alias target bf:dna to signify it has been updated to
modern cmake

Declares a dependency on bf::dna for all libraries that require it

Removes (almost) all calls to add_dependencies for bf_dna

Future work:

Because of the manual dependency management that was done, there is
now some "clutter" with libs depending on bf_dna that realistically
don't. Example bf_intern_opencolorio itself has no dependency on
bf_dna at all, doesn't need it, doesn't use it. However the
dna include folder had been added to it in the past since bf_blenlib
uses dna headers in some of its public headers and
bf_intern_opencolorio does use those blenlib headers.

Given bf_blenlib now correctly declares the dependency on bf_dna
as public bf_intern_opencolorio will get the dna header directory
automatically from CMake, hence some cleanup could be done for
bf_intern_opencolorio

Because 99% of the changes in this diff have been automated, this diff
does not seek to address these issues as there is no easy way to
determine why a certain dependency is in place. A developer will have
to make a pass a this at some later point in time. As I'd rather not
mix automated and manual labour.

There are a few libraries that could not be automatically processed
(ie bf_blendthumb) that also will need this manual look-over.

Pull Request: https://projects.blender.org/blender/blender/pulls/109835
2023-07-10 15:07:37 +02:00