Commit Graph

108245 Commits

Author SHA1 Message Date
Campbell Barton
d514b3b53b Cleanup: use explicit casts when assigning booleans to floats
While valid, this isn't so common and cppcheck warns about this,
use explicit casts to suppress the warning, also correct "true"
being assigned to a float value.
2024-04-01 22:20:09 +11:00
Campbell Barton
fc266730a2 Cleanup: use 2x copy calls for camera_uv_scale/camera_uv_bias
One copy_v4_v4 call was used to initialize both camera_uv_scale &
camera_uv_bias, replace this with 2x copy calls since passing in
smaller buffers to copy functions is typically an error.
2024-04-01 22:20:09 +11:00
Campbell Barton
7ce68904eb Cleanup: replace suspicious use of "&" with "&&" 2024-04-01 22:20:09 +11:00
Campbell Barton
fa4fdbf356 Cleanup: remove repeated flags in bit-flag literals 2024-04-01 22:20:09 +11:00
Campbell Barton
7e5a712e58 Cleanup: remove redundant null pointer checks
Based on the surrounding context these checks aren't needed.
2024-04-01 22:20:09 +11:00
Campbell Barton
ace64dbf50 Fix potential null pointer de-reference
Refactoring &
2024-04-01 22:20:09 +11:00
Campbell Barton
04b6fe78e7 Fix integer truncation when calculating int64_t values
Large int64_t values were calculated and assigned int however the
calculation was performed on integer types which would truncate the
result before casting to an in64_t.
2024-04-01 22:19:36 +11:00
Campbell Barton
937776b555 Cleanup: sort CMake file lists 2024-04-01 16:48:44 +11:00
Campbell Barton
2be407fc82 Cleanup: spelling in comments 2024-04-01 16:47:57 +11:00
Campbell Barton
add3c6a3b1 Correction to commenting unused axis_v from last commit 2024-04-01 15:51:35 +11:00
Campbell Barton
3ecc626c3d Cleanup: comment unused variable 2024-04-01 15:48:35 +11:00
Campbell Barton
aa308e166a Cleanup: ensure types signatures match for all custom RNA functions
Assign typed function variables to ensure the function signatures
always match. This avoids ambiguity when types don't match and ensures
any discrepancies are caught early.

It also helps when changing types to ensure all callbacks have been
updated.
2024-04-01 15:38:09 +11:00
Campbell Barton
4855f8cd9c BLI_convexhull_2d: optimize rotating calipers
Previously the hulls edges were simply iterated over causing the
rotating calipers to step over points 4x as many times as is needed.

Avoid this by adding angle stepping logic that maps all angles to a
single quadrant, reducing the checks needed to advance the calipers
to each new angle. This gives ~1.4x speedup to AABB fitting logic.

Also add a test for octagon shapes to ensure axis aligned edges work
as expected.
2024-03-31 22:47:23 +11:00
Campbell Barton
7c4b2ec722 BLI_convexhull_2d: adjust order of edge iteration
Begin testing the edge edge between indices [0, 1] indices,
instead of [last, 0]. This only ever makes a difference as a tie breaker,
where [0, 1] is now prioritized.

This minor change simplifies further optimizations.
2024-03-31 22:39:14 +11:00
Campbell Barton
c76eed6717 Unbreak build WITH_TBB disabled
It may be possible to support this case with the non-TBB template,
for now keep the build working.
2024-03-31 21:32:40 +11:00
Lukas Tönne
d7c718dfd4 GPv3: Texture offset modifier
Port of the GPv2 texture modifier for transforming UVs of stroke points.

Pull Request: https://projects.blender.org/blender/blender/pulls/119050
2024-03-29 21:42:30 +01:00
Nika Kutsniashvili
47ced73952 UI: Rename VCols to Color Attributes in edit mesh operators
A couple of edit mesh operators are still using "VCols" terminology,
which should be Color Attributes now. This just renames text seen
in redo panels. Internally it's still called VCols.

Pull Request: https://projects.blender.org/blender/blender/pulls/120075
2024-03-29 19:30:25 +01:00
Falk David
614a23e9f6 Fix: BLI: Bounds is_empty function
This was meant to be the same as `BLI_rct*_is_empty`
but wasn't because the `less_or_equal_than` was
effectively doing a logical "and", when it should have
been doing a logical "or".
2024-03-29 17:12:51 +01:00
Falk David
60e648a7e6 Fix: GPv3: Simplify modifier inconsistency with GPv2
The simplify modifier did not remove points in fixed mode
at level 1. This was the case in GPv2.
This makes sure to get the same result as in GPv2.
2024-03-29 16:48:36 +01:00
Clément Foucault
7797231c6d EEVEE-Next: Shadow: Add LOD system to directional clipmap shadows
This act in multiple phases:

- A shader scan the whole clipmap after tilemap finalize to gather
where valid tiles from lower LODs are available and write the page
location and LOD offset at invalid tiles location.

- At sampling time we add the LOD offset before the pixel page
modulo operation. This offset is equal to the amount of pages of
the **sampling** LOD needed to have the same modulo result as the
**sampled** LOD.

The whole thing being very tricky, I added a lot of unit testing.

This has no use for now but the system is needed to implement:
- Shadows from Volumetrics at lower cost & memory footprint.
- Fixing soft shadows artifacts.

These will be implemented in separate PRs.

Pull Request: https://projects.blender.org/blender/blender/pulls/120031
2024-03-29 16:22:55 +01:00
Falk David
96de8112ee Fix: GPv3: Crash in simplify modifier
The simplify modifier uses
`bke::curves_copy_point_selection` but didn't
build the `points_to_keep` index mask correctly.
This fixes the indices in the index mask and also
optimizes the edge cases of removing all the points/
keeping all the points.
2024-03-29 16:13:44 +01:00
Hoshinova
c78c6b0bdf Fix #119797: Noise Texture Precision Issues
The Perlin noise algorithms suffer from precision issues when a coordinate
is greater than about 250000.

To fix this the Perlin noise texture is repeated every 100000 on each axis.
This causes discontinuities every 100000, however at such scales this
usually shouldn't be noticeable.

Pull Request: https://projects.blender.org/blender/blender/pulls/119884
2024-03-29 16:12:23 +01:00
Hans Goudey
8dbee79844 Fix: Debug build error after recent commit 2024-03-29 10:51:54 -04:00
Hans Goudey
a78d4f31be Cleanup: Add detail to sculpt mesh variable name
Generally sculpt uses a combination of data from the original,
deformed, and final evaluated meshes. Keeping track of all that
is confusing and using a more specific variable name helps a bit.
2024-03-29 10:05:05 -04:00
Brecht Van Lommel
d99f2e8eb7 Refactor: Add ability for UI block to own operator
Instead of only referencing an existing one. This will be used for
collection exporter and presets, to make sure the operator instance
stays alive long enough for the preset to be able to be applied.

Pull Request: https://projects.blender.org/blender/blender/pulls/120034
2024-03-29 14:52:35 +01:00
Brecht Van Lommel
bef3a7b978 Fix: Operator properties don't undo when owner is collection
For collection export, we need operator properties to not assume they
are owned by the window manager.

Pull Request: https://projects.blender.org/blender/blender/pulls/118855
2024-03-29 14:49:04 +01:00
YimingWu
127f879be9 GPv3: Tint tool
This implements the tint tool from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/119323
2024-03-29 12:43:15 +01:00
Falk David
5ce54fbd25 Fix: GPv3: Use const reference to avoid copy
This was resulting in a copy of the layer, which shouldn't
be done.
2024-03-29 12:02:00 +01:00
Sergey Sharybin
adaa55cecc Cleanup: Code formatting
Pull Request: https://projects.blender.org/blender/blender/pulls/120055
2024-03-29 11:58:14 +01:00
Sergey Sharybin
d174959759 Fix #120051: Crash when using shrinkwrap with Target Normal Project
The issue was introduced by b35831ad6c.

Since that commit `tree->boundary` will always be non-nullptr, even
when the target mesh had no boundaries. Some code was still relying
on the fact that `tree->boundary != nullptr` means the mesh has
boundary.

Update shrinkwrap code for this fact, avoiding access past array
boundaries.

Pull Request: https://projects.blender.org/blender/blender/pulls/120054
2024-03-29 11:43:15 +01:00
casey bianco-davis
7669ba7a5c GPv3: Handle UVs in Smooth Modifier
The smooth modifier was made before UVs were implemented.
This adds smoothing to the UV rotations.

Pull Request: https://projects.blender.org/blender/blender/pulls/120032
2024-03-29 11:18:06 +01:00
Campbell Barton
4365d0496a Cleanup: use a const pointer for unit-settings 2024-03-29 16:37:36 +11:00
Campbell Barton
e04aa7c188 Cleanup: remove unit scale initialization in UI logic
Versioning logic was added since 2.5x
2024-03-29 16:30:08 +11:00
Campbell Barton
3d2593b229 Cleanup: replace "derived mesh" with "evaluated mesh" in code comments
References to the evaluated mesh were referring to "derived mesh"
when DerivedMesh wasn't used.
2024-03-29 13:29:30 +11:00
Hans Goudey
ce9970c76b Cleanup: Remove duplicate function for copying edit mesh positions 2024-03-28 21:43:32 -04:00
Jesse Yurkovich
f62f8852dc Cleanup: Remove BLI_array macros in editmesh_knife
This replaces the older dynamic c array macros with blender::Vector in
editmesh_knife. This area is 1 of only 2 remaining which use this
machinery.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/119976
2024-03-29 01:51:55 +01:00
Harley Acheson
6dd0f6627e UI: Removal of Five Operator Confirmations
Removal of confirmation dialogs for the following five operators. For
each of these the UI module felt that they are all either very explicit
actions and/or are easily undone.
* ARMATURE_OT_separate (Move selected bones to a separate armature)
* CURVE_OT_separate - “Move selected points to a new object”
* OBJECT_OT_vertex_parent_set (Parent selected ob to selected vertices)
* OBJECT_OT_parent_no_inverse_set (Make Parent w/o inverse correction)
* FILE_OT_directory_new - (Create New Directory)

Pull Request: https://projects.blender.org/blender/blender/pulls/120036
2024-03-29 01:09:15 +01:00
Campbell Barton
01dceb6b89 Cleanup: remove redundant checks for known states 2024-03-29 10:30:42 +11:00
Campbell Barton
3cfd4b4aba Cleanup: simplify check for the existence of key-blocks
The active key was accessed to check if the key-blocks were empty,
the variable was then shadowed by the iterator.

Check if the key blocks list is empty instead.
2024-03-29 10:13:06 +11:00
Sean Kim
6e997cc757 Sculpt: Add Line Hide tool
This PR adds the *Line Hide* tool and the corresponding
`PAINT_OT_hide_show_line_gesture` operator to Sculpt Mode.

*Line Hide* supports common modal functionality including:
* Snapping to angles
* Flipping the selection area
* Moving selection area

Addresses one of the tools in #80390

Pull Request: https://projects.blender.org/blender/blender/pulls/119671
2024-03-29 00:05:25 +01:00
Hans Goudey
82b88f130a Cleanup: Use const for evaluated cage meshes and related data
Also access the evaluated deform mesh with a function rather than
directly from object runtime data. The goal is to make it easier to use
implicit sharing for these meshes and to improve overall const
correctness.
2024-03-28 18:57:57 -04:00
Hans Goudey
510874f7b9 Mesh: Limit threading for copying positions to GPU data
See b99c1abc3a for more information about how using fewer
threads for just copying data can improve performance. In my simple
test file with mesh data re-uploaded every frame, this improved
performance from 23.5 FPS to 25.5 FPS (almost 9%).
2024-03-28 18:37:23 -04:00
Hans Goudey
5ed99e6361 Cleanup: Remove unused MeshRenderData variable 2024-03-28 18:28:35 -04:00
Hans Goudey
931206d3dc Cleanup: Rename mesh face deformed edit position variables
Use standard naming similar to their `Mesh` counterparts.
2024-03-28 18:28:35 -04:00
Hans Goudey
72347f11fe Cleanup: Use float3, Span, Array for vertex positions 2024-03-28 18:28:35 -04:00
Germano Cavalcante
5bdfec8d67 Fix: unhandled empty Optional in 'bounds_min_max()'
Continuation of fcfce8f69f
2024-03-28 18:59:33 -03:00
Hans Goudey
90c53d265b Cleanup: Outliner: Return early, reduce variable scope 2024-03-28 16:40:15 -04:00
Hans Goudey
9132679f1b Fix #119571: Weight paint vertex selection invisible
After bace4c9a29, the vertex position and vertex normal VBOs
are split. The `overlay_paint_point` shader depends on the normals VBO
because the selection is stored in the `.w` component of the vector.
2024-03-28 15:47:34 -04:00
Hans Goudey
684dbba6a1 Fix #119969: Crash rendering in sculpt mode with multires active
SubdvigCCG is null for the evaluated mesh in the render depsgraph
because of the `!for_render` check in `MOD_multires.cc`. But the PBVH
type is still `PBVH_GRIDS`. That's a weird inconsistency that ideally
wouldn't happen, but probably isn't simple to change. The simplest and
most obviously harmless fix is to just check whether the list of PBVH
nodes to update is empty.
2024-03-28 15:11:02 -04:00
Hans Goudey
0b80d5e755 Cleanup: Access sharp_face attribute with attribute API 2024-03-28 14:45:56 -04:00