Commit Graph

101077 Commits

Author SHA1 Message Date
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
Germano Cavalcante
37d1d4cb07 Transform: Support navigation from NDOF devices
This commit implements the `VIEW3D_OT_ndof_orbit`,
`VIEW3D_OT_ndof_orbit_zoom`, `VIEW3D_OT_ndof_pan` and
`VIEW3D_OT_ndof_all` operators to the `ED_view3d_navigation_`
utility so that these operations can be used in the transform
operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/109792
2023-07-10 14:57:40 +02:00
Germano Cavalcante
113004687d Refactor: Mesh Merge By Distance
- Deduplicate code;
- Support no customdata interpolation for edges;
- Reduce number of required elements in context arrays.

With 74772c6920, the merge by distance code for meshes now supports
optional interpolation of custom data for vertices.

As this can be advantageous for performance and memory, it seems
convenient to support the same for edges (and in the future polygons
and corners).

So this commit reworks the code that finds the edge groups to match the
same used for vertices and thus deduplicating and simplifying the code.

Conveniently the `edge_ctx_map` array is no longer needed and can be
removed to save memory.

However it was necessary to create another array (which is usually
smaller) called `double_edges` (to match `double_verts`).

---

**Results:**

The profiling result depends on some factors such as:
- interpolate or not interpolate customdata;
- affect a large or small portion of the mesh;

The best case is when the customdata **is not** interpolated and the operation affects **large** portions of the mesh:

| Before:    | After:     | Factor: |
| ---------- | ---------- | ------- |
| 1256.61 ms | 1073.218 ms| -14.44% |

The worst case is when the customdata **is not** interpolated and the operation affects **small** portions of the mesh:

| Before:   | After:    | Factor: |
| --------- | --------- | ------- |
| 1077.50 ms| 1086.7 ms| +0.85%  |

Pull Request: https://projects.blender.org/blender/blender/pulls/109836
2023-07-10 14:55:38 +02:00
Bastien Montagne
739146bf33 UI Translations and messages fixes. 2023-07-10 14:34:41 +02:00
Joseph Eagar
351034891e Sculpt: Cleanup duplicate code in clay strips brush
Clay strips was using it's own brush local matrix,
which wasn't quite compatible with texture matrices.
This could lead to brush textures not lining up with
the stroke dabs.

There was also a bug where the stroke was starting
20 pixels into the stroke, which is much higher than
necassary to derive the initial rake angle.

Notes:
* The clay strips brush now uses SCULPT_cube_tip_init
  to calculate the local brush matrix.
* SCULPT_cube_tip_init now accepts custom brush location
  and radius arguments.
* The mouse sample preroll used to calculate initial brush
  rotation angle is now smaller than the update interval.
* Clay strips now supports tip_scale_x, which has also
  been added to DNA defaults.
2023-07-10 05:01:58 -07:00
Iliya Katueshenock
c78b6e9954 Geometry Nodes: Improve Blur node face domain performance
Slight speed up of face topology building for blur node.
Avoid using increment and replacing by adding size.
Multi-threading for accumulating offsets. Early returns
in one place places. In a test with a large grid, the node
became 36% faster, with 13 out of 40 ms saved from
the topology building.

Pull Request: https://projects.blender.org/blender/blender/pulls/109764
2023-07-10 13:47:29 +02:00
Jeroen Bakker
ba82b9c47e Fix: Eevee-next Looses Reflective World Light When Switching Shading Modes
When switching shading between material preview and solid modes, the
world reflective light could become uninitialized. The reason was that
the world was only updated when they actually changed. When switching
it might not be the case that the world changed and the world probe
wasn't uploaded to the texture.

This fix will reduce the locations where this information was stored
(removing the `do_world_update` attribute in `ReflectionProbeModule`).
It also doesn't reset the `do_render` flag during syncing, but post-
pone it to the actual drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/109901
2023-07-10 13:40:47 +02:00
Jacques Lucke
ff4eaeef48 Cleanup: move MOD_nodes.h to C++
All files that use it are in C++ now.
2023-07-10 13:14:36 +02:00
Julian Eisel
d94edda4fd UI: Improve region resize edge detection for transparent regions
For overlapping regions, we currently offset the edge for resizing
regions a bit towards the contents. This makes sense for example in the
sidebar, where the region background is fully transparent by default,
and users expect the edge to be where the visible contents begin. This
was an issue in #104831 for two reasons:
- Although the region overlaps, we decided to make it fully opaque by
  default. The offset is still applied, making the edge detection feel
  broken.
- The offset would also be applied to header-like regions, where there
  is not much padding between the edge and the content. So the edge to
  resize the region would overlap buttons.

2 changes to address this:
- Only apply the offset if the region background is transparent-ish,
  with a rather arbitrary alpha threshold.
- Do not apply the offset for header-like regions.

Pull Request: https://projects.blender.org/blender/blender/pulls/109753
2023-07-10 12:53:41 +02:00
Damien Picard
2f5245b434 I18n: extract single message from multiview stereo
The "Single file with all the views" message was not extracted because
it is an enum item that was not exposed to the RNA, but only
selectable in some cases depending on the
`RNA_def_property_enum_funcs()`.

This commit changes the `RNA_def_property_enum_items()` so that this
enum item is exposed to the RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/109876
2023-07-10 12:45:52 +02:00
Bastien Montagne
f07fee0188 UI Translations: Add bunch of nissing error messages from IO C++ code and modifiers.
Also fix some incorrect usages of `N_` macro instead of `TIP_` one
(these error messages typically need to get translated explicitely, not
only marked for extraction).
2023-07-10 12:45:28 +02:00
Brecht Van Lommel
f2705dd913 Fix #109683: Cycles and Eevee missing AOVs when no closure connected
No reason to skip these, and this will be useful for faster shader node
preview rendering based on AOVs.

Pull Request: https://projects.blender.org/blender/blender/pulls/109709
2023-07-10 12:41:44 +02:00
Almaz-Shinbay
bfae400ea5 Outliner: Port edit bone elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a new class for edit bone elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/109793
2023-07-10 12:37:15 +02:00
Jeroen Bakker
fa4def46c8 Cleanup: Remove Unused use_ambient_occusion Property
`use_ambient_occlusion` is a legacy property and not
connected to anything. The clip editor still write
to it for enabling the ambient occlusion renderpass.

This change will remove the legaccy option and
won't enable ambient occlusion pass anymore due
to visual and performance impact.

Pull Request: https://projects.blender.org/blender/blender/pulls/109783
2023-07-10 11:18:22 +02:00
Jeroen Bakker
080ab8b8b6 Fix: Usage of Incorrect Compile Directive
The WITH_VULKAN_BACKEND/WITH_METAL_BACKEND should be included per
library. However when doing this we used an none existing compile
directive for WITH_METAL_BACKEND. This wasn't detected as
WITH_METAL_BACKEND is also defined globally.

Pull Request: https://projects.blender.org/blender/blender/pulls/109896
2023-07-10 10:43:28 +02:00
Jeroen Bakker
8199cce0c5 Fix: Reflection Probe Negative Shifting
When using many reflection probes with different subdivisions
it can happen that the reflection probe uses texture space that
is already been allocated for another probe.

The cause for that is that negative shift operations result into
undefined behavior, this was fixed previously by clamping the
number of bit shifts to perform, but ignoring to shift into the
other direction

This change also includes `ProbeLocationFinder.print_debug`
for future debugging.

Pull Request: https://projects.blender.org/blender/blender/pulls/109823
2023-07-10 10:30:52 +02:00
Sergey Sharybin
9314f97afd Fix #109887: Adding driver from python might crash
Originally was noticed when adding drivers to a rigid body., but
it could potentially happen with any configuration.

The reason for the crash was that the ID which was modified was
not tagged as such.

Modifying drivers from the interface are likely tagging for updates
from the operator. This change makes it so the python function also
does tagging.

It is not really how one would design the system nowadays, but it
is how the Blender historically handles such cases. A bigger refactor
is possible to move tags to the places where modification actually
happens, but it seems to be a better idea to tackle it as a separate
project which will be considered no-functional-changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/109895
2023-07-10 10:11:43 +02:00
Jeroen Bakker
998e7f644f Fix: Eevee-next Compiler issue NVIDIA
This PR fixes a compiler issue when using NVIDIA. It was introduced
when adding the reflection probes. NVIDIA compiler doesn't like
to access elements in a bound resource and pass it directly
as a parameter. It should first be added as a local variable.

Pull Request: https://projects.blender.org/blender/blender/pulls/109891
2023-07-10 08:35:55 +02:00
Campbell Barton
7e24a0a2ec Fix invalid address-of operator (hidden by a cast)
While in practice this didn't cause problems,
it's misleading & unnecessary.
2023-07-10 12:37:44 +10:00
Campbell Barton
7271ceb057 Fix memory leak when there are unexpectedly more than MAXSEQ strips 2023-07-10 12:37:44 +10:00
Campbell Barton
116861dc2f Cleanup: break early out of rna_SeqTimelineChannel_owner_get
Once the channel was found the for-loop kept searching.
2023-07-10 12:37:44 +10:00
Campbell Barton
0b5eb86e2c Cleanup: check the result of BLI_findindex against -1 instead of < 0
There is only one error value, prefer a specific check.
2023-07-10 12:37:44 +10:00
Campbell Barton
98a2c2229d Fix error in 29bfd03009 2023-07-10 12:36:59 +10:00
Hans Goudey
29bfd03009 Cleanup: Reduce indentation in paint_vertex.cc
The file is easier to read and change when less context is needed at
each step. Also extract some complex-looking flag testing into a
separate function, and move some constant checks out of loops.
2023-07-09 22:25:41 -04:00
Hans Goudey
2a1ac6145a Cleanup: Use C++ attribute API to add attributes in a few places
This is a bit more flexible and future proof than CustomData.
2023-07-09 20:00:17 -04:00
Hans Goudey
475e8bcd97 Cleanup: Deduplicate color attribute domain and type RNA enums 2023-07-09 19:38:32 -04:00
Campbell Barton
09f1844d75 Cleanup: correct doxy-groups 2023-07-09 21:40:17 +10:00
Campbell Barton
85a10bc4d9 Cleanup: use doxy sections for mesh rip 2023-07-09 21:22:52 +10:00
Campbell Barton
6290451712 Cleanup: spelling in comments 2023-07-09 21:22:45 +10:00
Campbell Barton
043d23e9c6 Cleanup: spelling of variable name 2023-07-09 20:51:51 +10:00
Campbell Barton
7bc806ff25 Cleanup: use BKE_action prefix, return typed enum
Use eAction_TransformFlags typed return value.
2023-07-09 18:23:53 +10:00
Campbell Barton
2f2facef74 Cleanup: use BKE_action prefix, position return arguments last
- BKE_action_frame_range_get  (was BKE_action_get_frame_range)
- BKE_action_frame_range_calc (was calc_action_range)
- BKE_action_has_motion       (was action_has_motion)
2023-07-09 18:17:58 +10:00
Kévin Dietrich
b183e3ae89 Cleanup: Alembic, use a structure to hold interpolation settings
The Alembic importer can optionnaly interpolate vertex and matrix data.
To detect if two samples can be interpolated `get_weight_and_index`
needs to be called which output the interpolation weight and the indices
for the floor and ceil samples separately. Either the weight or the
indices could be used to determine if interpolation was needed.

This adds a `SampleInterpolationSettings` structure to hold the weight
and indices together so we don't need to manage multiple local
variables, and replaces `get_weight_and_index` with
`get_sample_interpolation_settings` which returns either a
`SampleInterpolationSettings` or nothing if no interpolation is
necessary.

This also modifies `AbcMeshData` to have an optional
`SampleInterpolationSettings` and removes members used for interpolation
from `CDStreamConfig`, which simplifies the latter structure as well as
the check in `read_mverts` to verify if interpolation is needed.

`get_config` also no longer needs a parameter for setting the now removed
`use_vertex_interpolation` member from `CDStreamConfig`. This was only
used for Mesh vertex interpolation despite also being set in the points
reader (which does not yet support any interpolation).

No functional changes.

Pull Request: #109155
2023-07-09 01:26:07 +02:00
Ray Molenkamp
c677f791f0 Cleanup: Make format 2023-07-07 20:41:57 -06:00
Joseph Eagar
0b01b7c1fa Sculpt: Fix #109555: More floating point error fixes
* Renamed BKE_pbvh_raycast_project_ray_root to
          BKE_pbvh_clip_ray_ortho for greater
	  clarity.
* BKE_pbvh_clip_ray_ortho no longer strictly clips
  within the input ray interval.  This is not necassary
  for orthographic views and was too prone to floating
  point error.  The function is only called to clip
  brush rays for orthographic views so this is acceptable.
2023-07-07 18:53:06 -07:00
Germano Cavalcante
3f90bb6a48 Fix transform updating during some navigation operations
Navigation operations, like those of the trackpad, are not modal and
therefore are confirmed on each call.

To prevent the transform operations from being updated in this case,
add a fake navigation flag.

The removal of this flag is postponed to the next call.
2023-07-07 21:27:12 -03:00
Clément Foucault
b894e90106 EEVEE-Next: Fix shader compilation on Mac 2023-07-07 23:22:13 +02:00
Ray Molenkamp
a0243dd8f9 Cleanup: make format 2023-07-07 14:10:55 -06:00
Weizhen Huang
8ad4a24287 EEVEE: Change sun light factor to match Cycles
Ref #108505

Pull Request: https://projects.blender.org/blender/blender/pulls/109831
2023-07-07 19:51:32 +02:00
Brecht Van Lommel
05c97df2de USD: improve light units conversion
* Use pi factor to convert between radiant flux and intensity
* Mark lights as normalized on export
* Add spot light export support
* Add treatAsPoint support for import and export
* Empirically match normalized distant light
* Fix wrong unnormalized point/sphere/disk light unit in Cycles

Overall it should be much closer now for all light types. Point and distant
light units are inconsistent between renderers, so not possible to match
everything there.

Ref #109404

Pull Request: https://projects.blender.org/blender/blender/pulls/109795
2023-07-07 18:20:39 +02:00