Commit Graph

130864 Commits

Author SHA1 Message Date
Hans Goudey 00c22b75d2 Cleanup: Move draw_pbvh.h to C++ 2023-11-30 23:24:11 -05:00
Hans Goudey 666a99da8d Cleanup: use references, const arguments for PBVH draw args function 2023-11-30 23:24:11 -05:00
Hans Goudey 4a1c6b28ae Cleanup: Move PBVH draw args function to where it's used
Somehow this function was in the middle of the section of the
file where the code building the PBVH lives.
2023-11-30 23:24:11 -05:00
Hans Goudey 49f676e6c2 Cleanup: Reduce usage of mesh data pointers in PBVH
Pointers to hide status layers and custom data are removed,
since they can be accessed from the mesh as necessary.
Usage of other arrays has been reduced, so the pointers
can eventually be removed.

The reasoning is the same as some other commits in this area:
the goal is less duplication of state, and a more focused design
of the responsibilities of the PBVH class.

Some of the changes are fairly noisy, since we need to add
arguments to functions in a few places. On the nicer side of
things, some functions for syncing the state can be removed.

Not retrieving hide layers with write access also has performance
implications in some cases, since it means the original arrays can
be reused without a copy when they're shared.
2023-11-30 23:24:11 -05:00
Hans Goudey a5e17dc607 Cleanup: PBVH: Process multiple nodes at once in visibility update
This improves the early out in the mesh case so that it isn't
repeated for every node. Also simplifies using more local
variables that are specific to a certain PBVH type (in this
case, switching to the C++ attribute API and retrieving the
vertex visibility status that way).
2023-11-30 23:24:11 -05:00
Campbell Barton e6c200e94c Fix #113059: file selector shrinks on each display under KDE
Postpone binding the buffer to the surface ensures the XDG window
is created at the correct size.
2023-12-01 14:08:01 +11:00
Campbell Barton aba3fad33c Revert "Fix #113059: file selector shrinks on each display under KDE"
This reverts commit 85e2dd66a0.

Remove the hack in favor of a different fix.
2023-12-01 14:08:00 +11:00
Jesse Yurkovich d304ba7906 Cleanup: Rename GPU_select header to indicate its move to C++
From a prior PR[0] there was a desire to rename this header to more
clearly indicate it's C++ now.

[0] !112491

Pull Request: https://projects.blender.org/blender/blender/pulls/115631
2023-12-01 03:39:03 +01:00
Harley Acheson c8d1bb5902 BLF: Rename Text Shader Depth to Component Len
Rename text shader glyph "depth" to "glyph_comp_len", as requested
by Clément Foucault.

Pull Request: https://projects.blender.org/blender/blender/pulls/115640
2023-12-01 02:07:57 +01:00
Harley Acheson 2052d167c3 BLF: Fix Shader Type Conversion
Implicit conversion of vec2 is not permitted with Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/115638
2023-12-01 01:09:52 +01:00
Campbell Barton 731a443354 Cleanup: pass const vectors BKE_lnor_space_define
Pass const references to lnor_space_define(..), one argument wasn't
const because of a local assignment, declare a new variable instead.
2023-12-01 11:05:29 +11:00
Campbell Barton 94de4087e6 Cleanup: assign values for enums that may be stored in blend files 2023-12-01 11:04:47 +11:00
Campbell Barton afa9a6904d Fix missing null check from !115247 & simplify
- CTX_wm_region(C) must be NULL checked as it's not checked in the
  poll function.
- Add back the removed flag, note it's dirty.
- Replace ternary operators with min/max.
2023-12-01 10:47:21 +11:00
Campbell Barton 8aff65daf2 Cleanup: naming for GPUSelectResult
Prefer the name 'hit_result' since 'result' was sometimes used for
a vector of GPUSelectResult and is often used a functions return value.

Use hit_results for the span/vector and hit_result for a single hit.

Also assign struct members for new GPUSelectResult as it reads better
and avoids depending on struct order.
2023-12-01 09:45:02 +11:00
Hans Goudey ac6e854335 Cleanup: Small tweaks to C++ style in lib remap code
- Pass Span by value. It is a small struct, and passed by reference
  it acts as a pointer to a pointer.
- Remove unnecessary `= {}`. Vector has a default constructor.
- Use initializer list Span constructor to avoid temporary array.

Pull Request: https://projects.blender.org/blender/blender/pulls/115635
2023-11-30 23:03:39 +01:00
Hans Goudey 8b28bb9882 Cleanup: Remove redundant subdiv pointers from PBVH
These are just duplicates of the pointers in `SubdivCCG`, which are
already quickly accessible. Keeping track of the state is too complex
and bloats the responsibilities of the PBVH too much.
2023-11-30 16:40:09 -05:00
Bastien Montagne 050d48edfc BLI_fileops: Harmonize 'rename' behaviors accross platforms.
This commit aim at making the behaviors of `BLI_rename` and
`BLI_rename_overwrite` more consistent and coherent across all
supported platforms.

* `BLI_rename` now only succeeds in case the target `to` path does not
  exists (similar to Windows `rename` behavior).
* `BLI_rename_overwrite` allows to replace an existing target `to` file
  or (empty) directory (similar to Unix `rename` behavior).

NOTE: In case the target is open by some process on the system, trying
to overwrite it will still fail on Windows, while it should succeed on
Unix-like systems.

The main change for Windows is the usage of `MoveFileExW`
instead of `_wrename`, which allows for 'native support' of file
overwrite (using the `MOVEFILE_REPLACE_EXISTING` flag). Directories
still need to be explicitly removed though.

The main change for *nix systems is the use of `renamex_np` (OSX) or
`renameat2` (most Linux systems) to allow forbidding renaming to an
already existing target in an 'atomic' way.

NOTE: While this commit aims at avoiding the TOC/TOU problem as
much as possible by using available system's primitives for most
common cases, there are some situations where race conditions
(filesystem changes between checks on FS state, and actual rename
operation) remain possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/115096
2023-11-30 22:35:00 +01:00
Bastien Montagne dfe1a7d039 BKE_lib_remap: Refactor: Replace `LinkNode` by `blender::Span`. 2023-11-30 22:21:45 +01:00
Harley Acheson 5d330ddb1f BLF: Support All Render and Bitmap Formats
Add support for all of FreeType's various render formats and output
bitmap formats.

Pull Request: https://projects.blender.org/blender/blender/pulls/115452
2023-11-30 22:17:30 +01:00
Jesse Yurkovich abf59eb23a Selection: Remove limit on number of items which can be selected at once
This removes the long-standing static limit for the selection buffer in
favor of a dynamic approach.

It replaces the static array with our Vector type where the inline
buffer provides parity with existing code while also providing the
ability to grow as necessary.

Fixes #102487, #109178, #112350, #112493, and https://projects.blender.org/blender/blender-manual/issues/102485

See PR for further notes and links to the different limits remaining.
Pull Request: https://projects.blender.org/blender/blender/pulls/112491
2023-11-30 21:27:15 +01:00
Miguel Pozo 2e27791df3 Fix: EEVEE-Next: Alpha hashed transparency doesn't converge
Use sub-pixel alpha hash scale when the camera is not moving.
This provides cleaner results, while maintaining temporal coherence on
camera movement.

Pull Request: https://projects.blender.org/blender/blender/pulls/115620
2023-11-30 20:18:08 +01:00
Hans Goudey 4e66769ec0 Sculpt: Improve "Hide/Show" operator performance for mesh
Parallelize the implementation and move constant checks out of hot
loops. Only push undo steps for PBVH nodes that actually have changed
hide status. Optimize the "show all" case to remove the hide attributes.
For timings, I recorded some information on a 16 million vertex mesh:
- Hide masked (1/4 of mesh): 171 ms to 33 ms
- Hide small box: 13 ms to 14 ms
- Show all with small box hidden: 226 ms to 10 ms
- Show with all visible: 173 ms to 0.36 ms

There are a few other visbility operators that aren't affected:
- SCULPT_OT_face_set_invert_visibility
- SCULPT_OT_reveal_all
- SCULPT_OT_face_set_change_visibility
In separate steps, they should be moved to use the same structure, or
maybe even removed in the case of "reveal all".

I expect the "gather, change hidden verts, scatter" steps for each node
could be made a bit more efficient, they do some redundant work.
But it was also a simple way to share a reasonable amount of code.
2023-11-30 14:14:02 -05:00
Hans Goudey 7eb8c4cdda Cleanup: use const variables and arguments 2023-11-30 14:14:02 -05:00
Hans Goudey 841864406f Cleanup: Use enum class int paint hide operator 2023-11-30 14:14:02 -05:00
Hans Goudey 11b4e9311f Cleanup: Move paint hide file to namespace 2023-11-30 14:14:02 -05:00
Hans Goudey 68baa04eeb Cleanup: Move enum definition out of header 2023-11-30 14:14:02 -05:00
Hans Goudey 3adcc1378c Cleanup: Avoid using keyword in sculpt header
This approach doesn't scale well, and the right solution is to move
this code to the proper namespace anyway.
2023-11-30 14:14:02 -05:00
Hans Goudey 759d2634fd Cleanup: Pass all nodes to paint hiding functions
Allows specializing the operation more for each PBVH type.
2023-11-30 14:14:02 -05:00
Bastien Montagne fe3cb11ae4 BKE_lib: Convert `BKE_lib_remap` and `lib_intern` headers to be fully C++. 2023-11-30 19:51:22 +01:00
Harley Acheson 1317c951fb Cleanup: Make format
Formatting changes resulting from Make Format
2023-11-30 09:29:35 -08:00
Guillermo Venegas cf08b088ba Text Editor: Use active text selection as search query
If text is selected, use that as the search query.

Pull Request: https://projects.blender.org/blender/blender/pulls/115247
2023-11-30 18:26:53 +01:00
Aras Pranckevicius 93ca2788ff VSE: speedup Luma Waveform display output mode
Use multithreading, plus make the non-float / non-separate luma
calculations faster by avoiding byte->float->byte conversions
back and forth.

On a 4K resolution sequencer display, time taken to calculate the
waveform (Windows, Ryzen 5950X):

- regular images: 127.0ms -> 6.4ms
- regular images, separate colors: 160.3ms -> 13.1ms
- float images: 86.2ms -> 11.1ms
- float images, separate colors: 162.9ms -> 17.4ms

This also fixes curious "one black pixel row" in the middle of the
waveform, which was caused by the code spreading 256 possible luma
values over "off by one" vertical range:

Pull Request: https://projects.blender.org/blender/blender/pulls/115579
2023-11-30 18:19:40 +01:00
Nate Rupsis da83b2951d Anim: Add "Add/delete" track operations to NLA context menu
Updating NLA context menu, adding in more relevant track operations (tracks add, tracks add above, tracks delete).

Pull Request: https://projects.blender.org/blender/blender/pulls/114202
2023-11-30 17:15:06 +01:00
Clément Busschaert 671f428ead GPv3: "Set Active Layer" operator and menu
Resolves #113915 .

Ports the `layer_active` operator to set the active layer from an index.
Adds the menu to set the active layer from a list.

Pull Request: https://projects.blender.org/blender/blender/pulls/115606
2023-11-30 16:10:06 +01:00
Philipp Oeser 6023a6a423 Fix #115526: missing normals on first chunk of array modifier
Exposed by 383a145a19.

Think the issue actually started in cfa53e0fbe, since then the new
destination normals were only filled from the first array copy onwards
(probably hidden by some recalculation of normals somewhere?).

In any case, starting the destination normals array with what we have
from the input mesh normals and then resizing the array (instead of
reinitializing it from scratch) fixes this.

Pull Request: https://projects.blender.org/blender/blender/pulls/115612
2023-11-30 15:49:52 +01:00
Philipp Oeser 864b07011a Fix #115037: Crash deleting tool node group from outliner
Prevent heap-use-after-free of SpaceNode `geometry_nodes_tool_tree`,
remapping it in `node_id_remap_cb` (so it get null when deleted).

Pull Request: https://projects.blender.org/blender/blender/pulls/115047
2023-11-30 15:48:42 +01:00
Falk David 0185609a26 Fix: GPv3: Smoothing even with factor of 0
The grease pencil draw tool would still do a lot of smoothing
even if the active smoothing factor was set to 0.0.

This was because the screen space coordinates were always pre-blurred
before being passed to the curve fitting. Even if the curve fitting
outputs a line that fits the input exactly, it would still use the pre
smoothed coordinates.

The fix makes sure to use the smoothing factor in the influence
of the pre-blur. This way, no pre-blur is used when the factor is 0
and the lines will be smoothed much less.

Note that we always do some smoothing to avoid artifacts such
as pixel-grid-aligned lines etc.
2023-11-30 14:48:28 +01:00
Christoph Lendenfeld 83287624bc Anim: Change how Only Insert Needed works
When keyframing with the `Only Insert Needed` flag enabled,
the code was able to delete keyframes in certain cases.
This behavior is removed and replaced with the following rules.

* If there is a key on the current frame, and it has the same value, skip it.
* If there is no key, but the FCurve evaluates to the same value, skip it.
* Add a key in all other cases.

Remove that functionality for consistency and simplify the code around it.

Pull Request: https://projects.blender.org/blender/blender/pulls/115360
2023-11-30 14:45:47 +01:00
Brecht Van Lommel f47b1b41c2 Cleanup: compiler warning in release build 2023-11-30 14:32:54 +01:00
Brecht Van Lommel 9ffd6dabf0 Fix build error in freestyle when not using precompiled headers 2023-11-30 14:31:29 +01:00
Omar Emara b8f4c45638 Realtime Compositor: Add utilities to handle texture formats
This patch adds a number of utilities to handle texture formats and
their relation to result types and precisions. This is needed for future
work, and also unifies the places one needs to update when adding a new
result type.
2023-11-30 15:21:56 +02:00
Germano Cavalcante 14c2f6856a Suppress warnings by removing unused properties from keymaps
Between Blender versions, properties of some operators may be removed.

When this happens, when importing the keymap from the previous version,
a series of warnings may appear in the console. For example:
```
Warning: property 'alt_navigation' not found in item 'TRANSFORM_OT_translate'
Warning: property 'alt_navigation' not found in item 'TRANSFORM_OT_rotate'
Warning: property 'alt_navigation' not found in item 'TRANSFORM_OT_resize'
Warning: property 'alt_navigation' not found in item 'VIEW3D_OT_edit_mesh_extrude_move_normal'
...
```

Therefore, it seems to be convenient to edit these properties when
versioning.

This commit implements a `remove_properties` utility that makes this
removal simpler.

Pull Request: https://projects.blender.org/blender/blender/pulls/114936
2023-11-30 12:22:47 +01:00
Nathan Vegdahl 908ce0dd1a Fix: allow overshoot numerical input in the Pose Breakdowner operator
You could already do overshoot via the mouse, but it was arbitrarily
disallowed when entering values numerically.  This simply lifts that
restriction so that numerical input is capable of the same things as
dragging the mouse.

Importantly, the operator slider code already appropriately clamps
both mouse and numerical input when needed.  So the checks and clamping
removed in this commit simply aren't needed, and removing them just
makes numerical input get constrained exactly the same as mouse input.

Pull Request: https://projects.blender.org/blender/blender/pulls/115534
2023-11-30 10:25:16 +01:00
Omar Emara 07e051d7cd Realtime Compositor: Implement zero cost external images
This patch implements a new mechanism for compositor results to wrap
external images, such as those cached in the static cache manager.
Thereby enabling zero cost use of those resources, which previously
needed a copy at each evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/115574
2023-11-30 09:10:41 +01:00
Campbell Barton a226b14984 Fix #114609: compose key sequences includes continuation keys on Wayland
Suppress characters typed while composing.
2023-11-30 16:42:42 +11:00
Campbell Barton dfbda79cbd Cleanup: declare pointers const where possible 2023-11-30 16:42:40 +11:00
Campbell Barton 6b22572967 Cleanup: various non-functional changes for C++ 2023-11-30 16:42:39 +11:00
Aras Pranckevicius 3f7ab7069e Cleanup: move writeffmpeg to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/115585
2023-11-30 06:03:18 +01:00
Campbell Barton 7897e2d299 Cleanup: remove warning suppression which is no longer needed
Since updating fmtlib these aren't needed.
2023-11-30 15:02:52 +11:00
Campbell Barton 7f8efbe593 Cleanup: quiet CLANG conversion warnings 2023-11-30 15:01:58 +11:00