Commit Graph

111729 Commits

Author SHA1 Message Date
Bill Spitzak
b76603b6bf Fix: Scale node is off by half a pixel
The Scale node was off by half a pixel because pixels were not evaluated
at their center. To fix this, we scale the pixels at their center.
2024-07-25 12:06:32 +03:00
Philipp Oeser
c13c502624 Fix: Tracking related RNA paths incomplete/wrong
While working on !125365, I was running over a couple of places where
RNA paths were also incomplete.

This PR covers:
- MovieTrackingDopeSheet
- MovieTrackingSettings

Pull Request: https://projects.blender.org/blender/blender/pulls/125373
2024-07-25 09:35:21 +02:00
Philipp Oeser
163baad17e Fix #125064 : Cursor Value to Selected wrong with Normalized FCurves
This affected cursor snapping as well as the `Jump to Keyframes`
operator since both use `sum_selected_keyframes` to get the averaged
values of elements. It was already taking into account the normalization
factor, but the way a single `KeyframeEditData` was created from
multiple `bAnimListElem` was wrong:

- first, we should only add to it if we actually have some keys selected
(not a problem without normalization, but with it, we would add values
there
- second, the offset needs to be taken into account for each selected
key when adding to the absolute values

Could go into LTS probably

Pull Request: https://projects.blender.org/blender/blender/pulls/125221
2024-07-25 09:34:37 +02:00
Aras Pranckevicius
d80f0aa068 Fix #124899: Font bounding box calculation is incorrect for some fonts
This is visible in VSE text strip "box" and "outline" options at least.
For some fonts (mostly script/cursive type) BLF_boundbox function
was calculating horizontal bounds purely from pen position and
advance to the next character position. But the actual glyph can extend
beyond the advance distance.

Curiously, blf_font_boundbox_foreach_glyph (used by
blf_str_offset_from_cursor_position and blf_str_offset_to_glyph_bounds)
was already doing the correct thing and taking glyph horizontal bounds
into account.

Pull Request: https://projects.blender.org/blender/blender/pulls/125363
2024-07-25 08:45:17 +02:00
Hans Goudey
e1a30b09eb Cleanup: Sculpt: Use generic functions for mesh data gather/scatter
For meshes (in comparison to multires grids and BMesh) there is nothing
special about position, normals, or mask arrays. We can use the same
functions for gathering and scattering all the arrays. This also gives us
a somewhat nicer temporary solution for the issue of the `array_utils`
utilities using multithreading forcing us to use task isolation. Now the
brushes don't use those utilities.
2024-07-24 23:10:52 -04:00
Campbell Barton
8418ec4952 CMake: include headers in source lists 2024-07-25 11:24:11 +10:00
Campbell Barton
547b63b69b Cleanup: sort cmake file lists 2024-07-25 11:24:10 +10:00
Campbell Barton
e8f9834ef9 Cleanup: clarify names, use a list for SVG icons & unset variables 2024-07-25 10:45:20 +10:00
Campbell Barton
c589634f73 Cleanup: use colon after parameters 2024-07-25 10:17:45 +10:00
Campbell Barton
2edc2393d2 Cleanup: spelling in comments 2024-07-25 10:17:42 +10:00
Campbell Barton
62afbbef9b Cleanup: use const variables & args, pass args by reference 2024-07-25 10:17:40 +10:00
Sean Kim
53df43e064 Cleanup: Move variable initialization into struct definition
Pull Request: https://projects.blender.org/blender/blender/pulls/125388
2024-07-24 23:45:40 +02:00
Jesse Yurkovich
b112549296 Cleanup: Formatting 2024-07-24 22:27:29 +02:00
Bill Spitzak
f701a71b0e Fix: Compositor Rotate node is off by 0.5 pixel
The Rotate node was off by 0.5 pixels because pixels were not evaluated
at their center. Furthermore, the center of rotation was also off by
half a pixel. To fix this, we ensure rotation happen around the exact
center as well as rotate the pixels at their center.
2024-07-24 22:28:35 +03:00
Bill Spitzak
ab51d879c3 Fix #124339: Compositor artifacts with 0.5 translation
The compositor translate node produces artifacts when its fractional
part is 0.5. That's because GPUs do round-to-even for nearest neighbour
sampling in case samples were at pixel boundaries.

To fix this, we bias translations by a small value to break the
rounding and ensure predictable rounding direction.
2024-07-24 19:22:00 +03:00
YimingWu
6041bdd93a Fix #125340: Div by zero in LineArt shadow stage
There could be a rare case where a div by zero situation would take
place in LineArt shadow stage where the silhouette and shadows are
calculated, which would cause infinite shadow edge cutting. Now will
return a non-cutting state for those edge cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/125361
2024-07-24 15:45:33 +02:00
Omar Emara
40be124184 Fix #122253: Image saving ignores EXR color format
All image saving mechanisms in Blender ignores the color format for EXR
images, including Render Pipeline, Save Operator, and File Output nodes.

To fix this, we first allow EXR images to be BW for flexibility. Then we
adjust the EXR saving code to take into account the required number of
channels. This is only done for single layer EXR images. Multi-layer EXR
images correctly ignores the option.

Pull Request: https://projects.blender.org/blender/blender/pulls/124807
2024-07-24 14:20:59 +02:00
Hans Goudey
45e4fecf9b Refactor: Separate mesh and multires PBVH building
Though it results in more duplication currently, splitting these
could help to facilitate further performance improvements here
in the future, and it avoids passing a bunch of useless arguments
for the multires case.
2024-07-24 07:54:59 -04:00
Hans Goudey
aa0ea3cf8f Cleanup: Remove "using" statements
The proper solution is to move the relevant code to the Blender
namespace. It should look ugly until then because it is.
2024-07-24 07:54:59 -04:00
Hans Goudey
dca3d87052 Cleanup: Remove unhelpful PBVH debugging utilities
These were mostly getting in the way of refactoring this code.
If the referenced problems actually happen, there would be
more obvious ways to observe the issues anyway.
2024-07-24 07:54:59 -04:00
Hans Goudey
d4f824b5af Cleanup: Reorder functions to group PBVH building 2024-07-24 07:54:59 -04:00
Hans Goudey
9d1b230a55 Cleanup: Sculpt: Pass BVH nodes by reference 2024-07-24 07:54:59 -04:00
Hans Goudey
f9c6fe30db Sculpt: Extract bounds calculation from BVH build, parallelize
This applies the same change as the previous commit to the bounds
of every BVH node. The bounds calculation can be changed to use
the standard functions from the regular BVH deformation.

In a simple test this makes building the sculpt BVH 64% faster.
I observed a change from 762ms to 464ms for a 1.9m vertex mesh.
2024-07-24 07:46:02 -04:00
Hans Goudey
8ab2a139ca Sculpt: Extract visibility calculation from BVH build, parallelize
This simplifies the BVH build process and potentially improves
its performance when parts of the geometry is hidden. The method
used to calculate whether a node is fully hidden is slightly different
too, vertex indices are used instead of triangle indices and a triangle
to face map.
2024-07-24 07:46:02 -04:00
Hans Goudey
0da90f05fe Cleanup: Sculpt: Simplify scratch array usage for BVH build 2024-07-24 07:46:02 -04:00
Hans Goudey
d40751c7b2 Cleanup: Sculpt: Clarify naming of BVH node field 2024-07-24 07:46:01 -04:00
Hans Goudey
2401a022ab Cleanup: Sculpt: Reduce indirection for painting data access
Remove unnecessary structs that just hold pointers to other data
2024-07-24 07:46:01 -04:00
Hans Goudey
eed48ea5eb Cleanup: Sculpt: Remove unused PBVH struct 2024-07-24 07:46:01 -04:00
Sergey Sharybin
07e31b2da2 Cleanup: Strict compiler warning
The function is only used in debug builds.
2024-07-24 09:55:55 +02:00
Campbell Barton
32c721767e Fix failure to toggle filtering for add-ons with long names
Regression from [0] which didn't increase the length of owner_id names.

[0]: 31cb31d736
2024-07-24 14:49:27 +10:00
Sean Kim
32d1b1c6c6 Refactor: Remove SculptSession from most flood_fill function parameters
Where possible, removes SculptSession as a parameter. Currently, this
only leaves the add_active function with this concept, as how we handle
this concept in the future is currently ambiguous

Pull Request: https://projects.blender.org/blender/blender/pulls/125352
2024-07-24 06:30:51 +02:00
Sean Kim
98c96e12a4 Refactor: Remove dead boundary loop calculation code
Originally added in ed9c0464ba.

`last_visited_vertex` was never assigned to inside the flood fill loop,
therefore the following conditional to check if it had been set would
always be false, meaning that `forms_loop` was always false.

Pull Request: https://projects.blender.org/blender/blender/pulls/125344
2024-07-24 05:21:39 +02:00
Kamil Galik
3da3f678eb GHOST/NDOF: Extend NDOF devices support on Windows
Commit adds support for new format of RawInput packets used by
3Dconnexion devices: SpaceMouse Enterprise, Keyboard Pro and Numpad Pro
specifically. This required distinguishing processing button data
delivered as a bitmask and as a numbers array.

Basically it allows for using said devices buttons in Blender including
using these buttons in shortcuts.

Changes work only for Windows. MacOS will allow only for older format
that is bitmask.

Details:

- NDOF button event values have been moved into the public GHOST_Types.h
  header and are no longer aligned to the WM event values.
  This was done so the values could be changed to match hardware/drivers
  without breaking key-maps stored in user preferences.
- Keyboard Pro and Numpad Pro buttons are not currently used because
  they don't map to any standard keyboard events.
  These could be supported, see the PR for details.

Ref: !124155
2024-07-24 12:37:08 +10:00
Sean Kim
6b559c0225 Fix: Add missed default value for Array
Pull Request: https://projects.blender.org/blender/blender/pulls/125347
2024-07-24 02:38:13 +02:00
Sean Kim
1c3e8fb1fe Cleanup: Add const to nearest_vert_calc methods
Makes the BMesh and Multires APIs match the Mesh API.

Pull Request: https://projects.blender.org/blender/blender/pulls/125145
2024-07-24 01:52:35 +02:00
Sean Kim
fb1fc53f9a Refactor: Simplify closest_boundary_vert calculation
Part of #118145

* Removes unused struct variables
* Adds comment and reorders existing struct variables
* Switches PBVHVertRef for float3 position
* Replaces manually managed array with blender::Array

Pull Request: https://projects.blender.org/blender/blender/pulls/125343
2024-07-24 01:46:20 +02:00
Sean Kim
d6cc3f32db Cleanup: Replace GSet with blender::Set in sculpt_boundary.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/125277
2024-07-23 23:39:20 +02:00
Sean Kim
06aa1ce7b2 Refactor: Switch vector of PBVHVertRef in SculptBoundary for int
Part of #118145

Both int indices and PBVVertRef objects are used in multiple places
throughout the sculpt_boundary.cc code. This commit removes the
external-facing PBVHVertRef in favor of the int index to make further
refactoring of the methods that use this data easier.

Pull Request: https://projects.blender.org/blender/blender/pulls/125274
2024-07-23 23:19:41 +02:00
Harley Acheson
f6ae3bf8f3 UI: Docking Split Order Areas As Previous
Prior behavior for interactive area split would create the new area
immediately. If pulled from the top the new area would be above, while
if pulled from the bottom the new area would always be below. With
docking the split does not occur until the end, which would reverse
the area orders if the split was larger than 50%. This PR creates with
the old expected order, based on the starting position.

Pull Request: https://projects.blender.org/blender/blender/pulls/125338
2024-07-23 23:13:22 +02:00
Sean Kim
b518172ae5 Refactor: Remove SculptBoundary initial_vert field
Pull Request: https://projects.blender.org/blender/blender/pulls/125273
2024-07-23 23:05:03 +02:00
Sean Kim
6181569a21 Refactor: Replace sparse mesh-sized array with map
Currently, the SculptBounary struct initializes and stores an array of
distances from the original boundary vert. However, this data is only
actually stored and calculated for boundary vertices, every other vertex
is initialized to 0.0f.

Pull Request: https://projects.blender.org/blender/blender/pulls/125278
2024-07-23 23:03:57 +02:00
Sean Kim
338140f1e6 Fix #125157: Sculpt multires crashes on box mask and duplicated stroke
Introduced in d527e3a6bd.

The change to update PBVH normals before destroying the PBVH to fix
shading on duplicate meshes issues had the unfortunate side effect of
causing crashes for multires due to a race condition. This commit
simply avoids performing this flushing for multires to allow for
further iteration in the future instead of reverting the offending
commit entirely.

Pull Request: https://projects.blender.org/blender/blender/pulls/125268
2024-07-23 22:56:26 +02:00
Hans Goudey
7daefd730b Refactor: Sculpt: Change PBVH and PBVHNode to public classes
Part of #118145.

These days we aren't really benefiting from making PBVH an opaque type.
As we remove its responsibilities to focus it on being a BVH tree and look
to improve performance with data-oriented design, that will only become
more true.

There are some other future developments the current header structure
makes difficult:
- Storing selections of nodes with `IndexMask` for simpler iteration, etc.
- Specialization of node type for each PBVH type
- Reducing overhead of access to node data as nodes get smaller
- General C++ cleanliness and consistency

This PR moves `PBVH` to `blender::bke::pbvh::Tree` and moves `PBVHNode`
to `blender::bke::pbvh::Node`. Both are classes visible to elsewhere in Blender
but with private data fields.

The difficult part about the change is that we're in the middle of a transition
removing data from PBVH. Rather than making some data truly private I
chose to just give it the `_` suffix, since it will ideally be removed later.
Other things should be class methods or implemented as part of friend
classes. But the "fake" private status is much simpler for now and avoids
increasing the scope of this PR too much. Though that's a bit ugly, there's a
straightforward way to resolve these issues-- it just looks like the sort of
inconsistency you'd expect in the middle of a large refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/124919
2024-07-23 22:31:27 +02:00
Harley Acheson
73e519ded2 UI: When Docking Use Movement Threshold for Dupli & Swap
When docking is enabled it is currently skipping the movement threshold
when holding down shift (dupli) or ctrl (swap). This PR adds that back
by not immediately applying unless no modifiers are held.

Pull Request: https://projects.blender.org/blender/blender/pulls/125329
2024-07-23 20:06:05 +02:00
Bastien Montagne
12f3aec3eb BLO readfile: report error when reading invalid 'data' chunks.
Blendfile format expects all `BLO_CODE_DATA` bheads belonging to a same
ID 'space' to have unique identifiers (their old addresses).

When this is not the case, the blendfile is considered as corrupted.
Consequences can vary, from mere memory leaks, to catastrophic
unrecoverable crashes.

NOTE: This is what happens in file from #125001.
2024-07-23 19:42:01 +02:00
Weizhen Huang
5cbc540a64 Fix #125219: Transmissive BSDF different in Blended and Dithered mode
for transmissive closures the color is squared, but Blended square
BEFORE the weight is applied, and Dithered square AFTER the weight is
applied, causing difference in the final color.

This fix aligns the behaviour of Blended with Dithered.

NOTE that this is a partial fix, because Dithered is also behaving
incorrectly. A more proper fix would be !125233.

Pull Request: https://projects.blender.org/blender/blender/pulls/125299
2024-07-23 19:40:14 +02:00
Julian Eisel
a5970b8248 Fix #124167: Crash opening file after asset browser is closed
Switching to an asset browser, then back to a different editor would
cause a crash when loading a new file.

Basically the file/asset browser tried to free dangling asset and asset
library pointers when trying to free itself. That's because the asset
system gets destructed with a `AS_asset_libraries_exit()` call before
the screen and with that the asset browser were freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/125084
2024-07-23 18:29:50 +02:00
Bastien Montagne
f69f920164 Cleanup: BKE Blendfile: Improve PartialWriteContext documentation. 2024-07-23 18:28:51 +02:00
Falk David
d5a55935ea GPv3: Python API: Add missing functions to BlendDataGreasePencilsV3
This adds the `tag`, `new`, and `remove` functions for `GreasePencil` IDs.

Pull Request: https://projects.blender.org/blender/blender/pulls/125060
2024-07-23 18:26:38 +02:00
Bastien Montagne
03652c851c Fix #122961: Get out of 3D local views when they get empty.
This commit covers the case where all objects get removed from local
view, and an undo or blendfile read leads to such empty local views.

It also adds code to remapping/foreachID View3D callbacks to tag
potential local views as 'maybe empty', and use the View3D refresh
callback to actually check and potentially exit the local empty view.

Pull Request: https://projects.blender.org/blender/blender/pulls/123128
2024-07-23 18:23:02 +02:00