Commit Graph

101024 Commits

Author SHA1 Message Date
Christoph Lendenfeld
c7cca085c6 Fix: assign char instead of string
Using " instead of ' caused a compiler warning
2023-07-07 16:07:04 +02:00
Hans Goudey
ec29d96d11 Cleanup: Simplify replacing component data in geometry set 2023-07-07 09:59:55 -04:00
Jeroen Bakker
f37fa6d0b1 Cleanup: make format 2023-07-07 15:43:04 +02:00
Jeroen Bakker
17a58f7db0 Eevee-next: Reflection Probe Packing
All probes (including the world background probe) are stored in a single texture. Each probe
can be of any resolution as long as it is a power of 2 and not larger than 2048. So valid options
are (2048x2048, 1024x1024, 512x512, etc).

Each probe can be stored in their own resolution and can be set by the user.
> NOTE: Eventually we would like to add automatic resolution selection.

The probes are packed in an 2d texture array with the dimension of 2048*2048. The number of
layers depends on the actual needed layers. If more layers are needed the texture will be recreated.
This can happen when a new reflection probe is added, or an existing reflection probe is made visible
to the scene or its resolution is changed.

### Octahedral mapping

Probes are rendered into a cubemap. To reduce memory needs and improve sampling performance the cubemap
is stored in octahedral mapping space. This is done in `eevee_reflection_probe_remap_comp.glsl`.

The regular octahedral mapping has been extended to fix leakages at the edges of the texture
and to be able to be used on an atlas texture and by sampling the texture once.

To reduce sampling cost and improve the quality we add an border around the
octahedral map and extend the octahedral coordinates. This also allows us to
generate lower resolution mipmaps of the atlas texture using 2x2 box filtering
from a higher resolution.

### Subdivisions and areas

Probes data are stored besides the texture. The data is used to find out where the probe is stored
in the texture. It is also used to find free space to store new probes.

This approach ensures that we can be flexible at storing probes with different
resolutions on the same layer. Lets see an example how that works

Code-wise this is implemented by `ProbeLocationFinder`. ProbeLocationFinder can view a texture in a
given subdivision level and mark areas that are covered by probes. When finding a free spot it returns
the first empty area.

**Notes**

* Currently the cubemap is rendered with a fixed resolution and mipmaps are generated in order to
  increase the quality of the atlas. Eventually we should use dynamic resolution and no mipmaps.
  This will be done as part of the light probe baking change.

Pull Request: https://projects.blender.org/blender/blender/pulls/109688
2023-07-07 15:37:26 +02:00
Ray Molenkamp
f0ee4c3ffe Cleanup: Cmake: use alias target for bf_intern_atomic
This introduces an alias target `bf::intern::atomic` for
`bf_intern_atomic`. This has the following benefits:

- Any target name with `::` in it will be recognized as an actual
target by cmake, rather than a library name it may not know about.
and will be validated by cmake to exist. Which means if you make
a typo in the LIB section, CMake will error out telling you it
doesn't know about this specific target rather than passing it on
to the build system, where you'll either get build or linker errors
because of said typo.

- Given there is quite a cleanup still to do in the build system,
it won't always be obvious which targets have been updated to
modern targets and which still need to be done. Having a namespaced
target name is a good indicator there.

Pull Request: https://projects.blender.org/blender/blender/pulls/109784
2023-07-07 15:37:02 +02:00
Christoph Lendenfeld
79b2e8f211 Animation: Allow setting the slider unit and mode
Split off from [#106952: Animation: Butterworth Smoothing filter](https://projects.blender.org/blender/blender/pulls/106952)

This patch allows the slider to take a different string than just "%",
the use case is on #106952 where we want to display "Hz" instead.

Additionally the slider got the ability to set modes, which determine
how the factor number is displayed.
`SLIDER_MODE_PERCENT` means it will multiply by 100 and display as whole numbers
`SLIDER_MODE_FLOAT` means it will display just floats with one digit after the comma

Additionally to that, because the slider range is now arbitrary and potentially deals with
large numbers, the mouse distance needed to travel from min to max has been normalized
to the range.

Pull Request: https://projects.blender.org/blender/blender/pulls/109768
2023-07-07 15:08:40 +02:00
Christoph Lendenfeld
6332d1b8a8 Animation: Improve drawing of locked FCurves
Locked `FCurves` had 2 visual issues

* the dashing is so short it just creates visual noise
* keyframes are drawn in white looking like they are selected

This PR changes this by

* Increasing the dash width
* Keyframes are drawn in black on locked curves
* To indicate that they can't be selected, draw them in a X shape
* To further reduce visual noise, locked curves no longer draw thicker when selected

This is part of the changes discussed in this design task #104867

Pull Request: https://projects.blender.org/blender/blender/pulls/106052
2023-07-07 15:05:51 +02:00
Hans Goudey
97634b7f6e Cleanup: Make format 2023-07-07 08:50:13 -04:00
Hans Goudey
75b42d1d95 Cleanup: Move BKE_editmesh_cache.h to C++
See #103343
2023-07-07 08:19:52 -04:00
Hans Goudey
ca7f4122da Cleanup: Unused variable in mesh writing, C++ casting 2023-07-07 07:35:56 -04:00
Hans Goudey
7830d9f21e Cleanup: Correct two curves and mesh comments 2023-07-07 07:10:41 -04:00
Hans Goudey
91b27ab637 Refactor: Simplify mesh edit mode modifier evaluation
Instead of keeping track of a local array of positions in the modifier
stack itself, use the existing edit mode SoA "edit cache" which already
contains a contiguous array of positions. Combined with positions as a
generic attribute, this means the state is contained just in the mesh
(and the geometry set) making the code much easier to follow.

To do this we make more use of the mesh wrapper system, where we can
pass a `Mesh` that's actually stored with a `BMesh` and the extra
cached array of positions. This also resolves some confusion-- it was
weird to have the mesh wrapper system for this purpose but not use it.

Since we always created a wrapped mesh in edit mode, there's no need
for `MOD_deform_mesh_eval_get` at all anymore. That function was quite
confusing with "eval" in its name when it really retrieved the original
mesh.

Many deform modifiers had placeholder edit mode evaluation functions.
Since these didn't do anything and since the priority is node-based
deformation now, I removed these. The case is documented more in the
modifier type struct callbacks.

Pull Request: https://projects.blender.org/blender/blender/pulls/108637
2023-07-07 13:07:15 +02:00
Campbell Barton
d0a9595c0d Cleanup: move BLI_vfont to C++ 2023-07-07 20:37:33 +10:00
Campbell Barton
915929e42f Cleanup: remove unused ParticlePathModifier struct 2023-07-07 16:03:47 +10:00
Campbell Barton
d7cfa51e49 Cleanup: declare const variables 2023-07-07 16:00:50 +10:00
Campbell Barton
40ef6c400b Cleanup: utility function to multiple rctf/rcti 2023-07-07 15:42:07 +10:00
Campbell Barton
23acedd432 Cleanup: code-comments 2023-07-07 15:11:19 +10:00
Campbell Barton
6d608cc6b5 Cleanup: use doxy headers in imbuf 2023-07-07 15:03:49 +10:00
Hans Goudey
827baed610 Mesh: Fix missing multithreading in part of BMesh to Mesh conversion
ebe8f8ce71 and 5669c5a61b added multithreading but
a typo meant it wasn't used for half of the process. Fixing that gives a
30% improvement in my tests, from about 80 to 60 ms converting a grid.
2023-07-06 17:10:21 -04:00
Iliya Katueshenock
1beece5f16 Cleanup: Unused spin lock mutex warning
Pull Request: https://projects.blender.org/blender/blender/pulls/109777
2023-07-06 19:43:40 +02:00
Hans Goudey
ec30217755 Cleanup: Simplify access to next face corner in domain interpolation 2023-07-06 13:40:42 -04:00
Joseph Eagar
4fb86952ed Sculpt: Second attempt at fix #109555: Fix floating-point error. 2023-07-06 10:21:32 -07:00
Almaz-Shinbay
af92de664b Outliner: Port 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 bone elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/109684
2023-07-06 18:43:58 +02:00
Germano Cavalcante
d9829c2f87 View 3D: Refactor code to split functions and remove duplication
No functional changes.

Previously, each navigation operation had its own method for restoring
the 3D View's state upon cancellation.

However, this approach did not provide significant advantages.

The number of affected variables was too small to justify considering
it for performance optimization, and the cancellation code was
duplicated across different operations.

To address this, the present commit unifies all restore code into a
single function:

- `void viewops_data_state_restore(ViewOpsData *vod);`

As a result, the `viewmove_apply_reset` function has been removed.

Moreover, since the state now has a dedicated restore function, it
seemed appropriate to create a function for capturing the state as
well.

Therefore, the code responsible for capturing the state (previously
scattered within `viewops_data_init_navigation`) has been extracted to
create the function:

- `void viewops_data_state_capture(ViewOpsData *vod);`

During this separation process, a potential error in the code was
identified, where the state may not be fully restored.

Although this issue persists, a comment has been added to clarify this
situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/109760
2023-07-06 18:21:36 +02:00
Hoshinova
c9fbbea261 Cleanup: Assign corresponding expressions to variable params.max_distance
Pull Request: https://projects.blender.org/blender/blender/pulls/109328
2023-07-06 18:13:22 +02:00
Julian Eisel
71273df2d5 UI: Draw hierarchy lines for tree-views
Hierarchy lines (like we also have in the Outliner) make it easier to
visually parse the hierarchy, and avoid confusion about nesting level.
Especially when some items have icons and/or collapse chevrons and some
not (thus different levels of visual indentation).
They were planned for #93582 and #107881, also see
https://code.blender.org/2023/05/the-next-big-step-grease-pencil-3-0/#layer-groups.

The drawing is implemented as a general tree-view feature, so all
tree-views with collapsable items (which excludes the spreadsheet
data-set tree view) will get them without further setup.
2023-07-06 17:09:32 +02:00
Germano Cavalcante
74772c6920 Fix #109565: Array modifier changes the Root vertex of Skin modifier
The merging behavior of the Array, Mirror, Screw modifiers has changed
since 4369627e71.

Before, only the customdata of the destination vertex was kept. Source
vertices were completely removed.

With 4369627e71, all vertices in the merge group (whether source or
destination) now have their customdata interpolated.

But this can cause problems for example with the root vertex customdata
of the skin modifier, where if only one of the vertices of the group of
vertices has this flag, the resulting one will also have it.

This commit restores the behavior for the vertices customdata and does
not interpolate it if `do_mix_vert_data` is false.

Pull Request: https://projects.blender.org/blender/blender/pulls/109627
2023-07-06 15:05:33 +02:00
Sybren A. Stüvel
899f2bbe32 Refactor: Animation, prevent incrementing null pointer
Only do `next++` if `next` is a non-`NULL` pointer. This doesn't change
the functionality of the code, but it does prevent a sanitizer warning.

No functional changes.
2023-07-06 11:11:24 +02:00
Pratik Borhade
e73273e24b Animation: Set hardmin/max for frame start and end of action
Currently start and end property of action don't have hardmin/hardmax. This results in an
error when exporting action having extreme range values in FBX and gltf formats (#107965).

Pull Request: https://projects.blender.org/blender/blender/pulls/107985
2023-07-06 10:55:33 +02:00
Damien Picard
bbb18137ff Fix #109114: i18n: FPS not displayed in the viewport in Hindi
The FPS in the viewport is displayed in a string of the form "fps:
%.2f". The string that stores it is of length 16, which is plenty
enough in English. But the translated message in Hindi uses
Devanagari, which takes up 4 bytes per char. Because of this, it is
too long and there is not enough room for the numbers to actually
appear.

To solve this, the containing string length was doubled to 32 chars.

Pull Request: https://projects.blender.org/blender/blender/pulls/109408
2023-07-06 09:38:11 +02:00
Guillermo Venegas
5b3ce7b740 UI: Improve 3d text selection
Improve 3D text selection & feedback when moving the mouse outside of
the text. Previously mouse selection only worked if the mouse was over
the text, now there is more margin to select characters or lines.

Ref !109229

Co-authored-by: Campbell Barton <campbell@blender.org>
Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
2023-07-06 13:25:07 +10:00
Campbell Barton
6a79639ef7 Cleanup: use function style casts, remove void function argument
Also remove redundant parenthesis.
2023-07-06 10:40:25 +10:00
Hans Goudey
c65fa57b0b Fix #109691: Edge crease not handled in complex solidify
a8a454287a which moved edge creases out of `MEdge` only
retrieved the result data array if the mesh had vertex creases. Before
the processing always happened though. So process the result creases
if the input has edge creases too, and try to retrieve an existing array
instead of always adding a new one.
2023-07-05 16:53:22 -04:00
Hans Goudey
2b4666b17b Geometry Nodes: Fill new quad poly offsets in parallel
Add an offset indices utility to do fill constant size new offsets in
parallel, which was already done in the duplicate elements node.

For example, filling poly offsets for a new part of a mesh that is only
quads. In the extrude node this was single-threaded before, so the
new poly offsets is about 10x faster, saving about 10 out of 157 ms
when extruding 2 million faces.
2023-07-05 15:39:33 -04:00
Brecht Van Lommel
4c6653274c Fix full frame compositor crash when Image node can't load image
Ref #109168
2023-07-05 20:51:28 +02:00
Martijn Versteegh
a280e8a68c Fix #107416: Check length of Property Collection before type
In edit mode the uv map data length gets set to zero. The specialized
MLoopUV code used to have a check to detect this when trying to access
the UVs using foreach_get/set . Add this check for the Attribute code
path as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109179
2023-07-05 20:06:18 +02:00
Jacques Lucke
0b7d8a20bf Cleanup: Move many editors files to C++
This moves the following `editors/*` directories to C++:
- animation, armature, lattice, mesh, metaball, object, scene.

Much of the changes in this commit (inserting casts in particular)
was automated. Further changes like switching to functional style
casts can be done separately by existing automated scripts.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/109715
2023-07-05 20:03:41 +02:00
Martijn Versteegh
cd4848a574 Cleanup: make format 2023-07-05 19:42:52 +02:00
Brecht Van Lommel
c4ddf16950 Cleanup: remove unused light struct member 2023-07-05 19:16:39 +02:00
Brecht Van Lommel
57d85b32a9 Lights: remove unused Blender Internal properties
For falloff, attenuation and shadow buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/109738
2023-07-05 18:54:36 +02:00
Ray Molenkamp
c591eb1b40 Fix #109596: Xcode project generation fails
Remove dead code that is causing problems with dependencies in Xcode.

Pull Request: https://projects.blender.org/blender/blender/pulls/109751
2023-07-05 18:46:55 +02:00
Hans Goudey
87b8e2e18d Fix #109471: BMesh to Mesh conversion invalid UV boolean attribute data
First we copied the entire BMesh custom data layout to the Mesh, then we
decided not to copy some boolean layers like UV pinning if every value
was false. But that left the layers uninitialized. Instead, copy the
custom data layout _after_ finding which layers to skip.
2023-07-05 12:36:10 -04:00
Miguel Pozo
6ac86d0e81 Workbench Next: Release overlay depth shader
Avoid memory leak.
2023-07-05 18:30:21 +02:00
Miguel Pozo
3d62888ed6 Workbench Next: Fix Overlay composition
Set "In Front" objects depth to 0,
so overlays are not drawn on top of them.
2023-07-05 18:11:50 +02:00
Miguel Pozo
6335af74f2 Workbench Next: Fix transparent depth
transparency_depth_ps_ object sync was being skipped after
a639ec3afa
2023-07-05 18:11:50 +02:00
Julian Eisel
0d57495acf Cleanup: remove accidentally added empty line 2023-07-05 18:03:46 +02:00
Julian Eisel
eb1e8cb4cc Pass context to region polls
Needed for #104831. It makes sense to pass this to the polling, since
polling is typically expected to check context.
2023-07-05 17:56:58 +02:00
Hans Goudey
96ad44a462 Cleanup: Use more explicit casting in mesh RNA code
Also increase use of C++ accessor methods and types.
2023-07-05 10:58:59 -04:00
Hans Goudey
53416281bd BLI: Optimize utility for index counting
The utility counts the number of occurrences of each index in an array.
It's used to build offsets for mesh topology maps, or to count the
number of connected elements. Some users are geometry nodes,
the subdivision draw cache, and mesh to curve conversion.

This PR parallelizes the counting to take advantage of multiple
threads. On a Ryzen 7950x, when counting connected edges to
vertices, I observed an improvement from 10.2 to 3.0 ms.
This most likely makes the counting less efficient, but it is
quite a nice performance improvement.

The new code was much slower for me at less than four threads,
so I added a check so that counting remains single threaded in
that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/109628
2023-07-05 16:05:16 +02:00
Hans Goudey
19e2d7cd0e Fix: Incorrect name for calculate simulation job
Copy and paste mistake caused the job to have the same name as baking.
2023-07-05 08:28:00 -04:00