Commit Graph

106739 Commits

Author SHA1 Message Date
Campbell Barton
888c4d0766 BLI_convexhull_2d: optimize AABB fitting method
Previously the bounding box was calculated for each rotation,
even though the loop would early exit if the area exceeded the best
known area, this meant the areas of the bounds was checked for
each point too. This scaled poorly, close to O(n^2).

Replace this with simple logic that keeps track of the indices
at the bounds, advancing them forward for each rotation.

This is around ~140x faster for a hull with 10k points on my system.

Note that there is potential for other improvements although
the cases where this new method doesn't perform well are quite specific
and faster than checking all points, see code-comments for details.
2024-02-13 21:29:46 +11:00
Sybren A. Stüvel
ff4a473ad4 RNA: update property flag descriptions
Add new descriptions to the `PROP_HIDDEN`, `PROP_SKIP_SAVE`, and
`PROP_LIB_EXCEPTION` flags. For the former two, these are more
explanatory than the previous descriptions. For the latter it's the
first ever description.

Personally I don't think "Do not use ghost values" was particularly
helpful, as the concept of "ghost values" isn't actually that well known
(compared to generally how many people use `bpy`). Granted, it's
described at [1], but IMO if the term "ghost values" is to be kept here,
it should include a link to that page.

[1]: https://docs.blender.org/api/current/bpy.types.bpy_struct.html

Pull Request: https://projects.blender.org/blender/blender/pulls/118036
2024-02-13 11:14:48 +01:00
Sybren A. Stüvel
f85538a56b RNA: unify property flag descriptions between enum and non-enum flags
These flags (like `'HIDDEN', 'SKIP_SAVE', etc.) mean the same thing when
used on enums and non-enum properties. Now they actually use the same
description definition in the source code, ensuring that any
improvements will apply to both.

No changes to the actual messages. Just using them for both enums and
non-enum property flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/118036
2024-02-13 11:14:39 +01:00
Campbell Barton
0e4f9104bc Cleanup: unused includes in source/blender/gpencil_modifiers_legacy
Remove 159 includes.
2024-02-13 19:59:14 +11:00
Campbell Barton
866974ae56 Cleanup: unused includes in source/blender/animrig
Remove 13 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
38023283ac Cleanup: unused includes in source/blender/bmesh
Remove 26 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
e6cb2ca380 Cleanup: unused includes in source/blender/compositor
Remove 5 inclues.
2024-02-13 19:21:03 +11:00
Campbell Barton
0933e21750 Cleanup: unused includes in source/blender/geometry
Remove 13 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
976c56e69c Cleanup: unused includes in source/blender/render
Remove 37 includes.
2024-02-13 19:20:59 +11:00
Campbell Barton
903a76031a Cleanup: unused includes in source/creator
Remove 7 includes.
2024-02-13 19:14:48 +11:00
Campbell Barton
9ad127780a Tests: remove unnecessary fmod in BLI_convexhull_2d_test
The intention was to accept both 0 and M_PI however this isn't needed
as the result is always M_PI.

See !118186 for details.
2024-02-13 18:22:41 +11:00
Pratik Borhade
da2ba2f3f6 Windows: Compile error due to missing header
Caused by 9e4129feeb
Error: `undeclared identifier M_PI and M_PI_2`

Pull Request: https://projects.blender.org/blender/blender/pulls/118185
2024-02-13 07:48:22 +01:00
Campbell Barton
c8961d150d Tests: update BLI_convexhull_2d_test since fixing vertical segments
Changing the angle was needed as there is no longer a duplicate
end-point added to the polygon for vertical lines.
2024-02-13 16:47:48 +11:00
Campbell Barton
688cf175e5 Merge branch 'blender-v4.1-release' 2024-02-13 16:44:56 +11:00
Campbell Barton
0053de6556 Fix buffer overflow passing a vertical segment to convexhull_2d
Convex hull calculation would "cap" line segments with the first point.
Besides causing a buffer overflow when passing in two points,
it's not needed as matching first/last ends aren't expected
to be set by this function.
2024-02-13 16:42:39 +11:00
Campbell Barton
680701e915 Cleanup: spelling in comments 2024-02-13 14:20:00 +11:00
Campbell Barton
7747b8c944 Fix convexhull_2d_test for macOS & re-enable the test
Use EXPECT_NEAR instead of EXPECT_EQ to account for a differences in
atan2 implementation on macOS, more generally relying on exact
float comparison for tests is error prone.
2024-02-13 14:07:26 +11:00
Campbell Barton
cc154144ef Cleanup: unused includes in source/blender/blenloader
Remove 45 includes.
2024-02-13 13:53:10 +11:00
Campbell Barton
fee47f6da8 Cleanup: unused includes in source/blender/sequencer
Remove 95 includes.
2024-02-13 13:37:56 +11:00
Campbell Barton
1a3b5452c4 Cleanup: unused includes in source/blender/nodes
Remove 166 includes.
2024-02-13 13:23:35 +11:00
Campbell Barton
51bc826ca1 Cleanup: unused includes in source/blender/python
Remove 72 includes.
2024-02-13 13:09:03 +11:00
Hans Goudey
1394907474 Cleanup: Move uvproject.c to C++ 2024-02-12 20:43:24 -05:00
Campbell Barton
bdd9f32f84 Cleanup: unused includes in source/blender/modifiers
Remove 359 includes.
2024-02-13 12:28:24 +11:00
Campbell Barton
e205772596 Cleanup: includes in source/blender/imbuf
Remove 25 includes.
2024-02-13 12:22:50 +11:00
Campbell Barton
6cc6ccecd0 Cleanup: unused includes from source/blender/windowmanager
Remove 56 includes.
2024-02-13 11:58:42 +11:00
Campbell Barton
c29fdd1e12 Fix error in recent blenkernel cleanup
The BLI_endian_defines.h include was removed in [0] because
the resulting object files were unchanged on little endian systems.
Using -Werror=undef with GCC prevents this from happening in the future.

[0]: 9e4129feeb
2024-02-13 11:54:46 +11:00
Campbell Barton
9e4129feeb Cleanup: unused includes in source/blender/blenkernel
Remove 397 includes.
2024-02-13 11:32:38 +11:00
Campbell Barton
de18b629f0 Cleanup: unused includes in source/blender/blenlib
Remove 30 includes.
2024-02-13 11:07:14 +11:00
Campbell Barton
b372ebae68 Cleanup: unused headers for source/blender/editors
Remove 1317 includes from editors.
2024-02-13 10:02:53 +11:00
Campbell Barton
eb318b7733 Cleanup: use FILE_MAX instead of PATH_MAX for paths based on blend files
The blend file path is limited to FILE_MAX.
2024-02-13 09:53:45 +11:00
Campbell Barton
22b382fc84 Cleanup: replace PATH_MAX with FILE_MAX_LIBEXTRA for file drawing 2024-02-13 09:43:04 +11:00
Campbell Barton
39f0dbf47a Cleanup: use FILE_MAX instead of PATH_MAX for operators
FILE_MAX is used by operators, avoid an MSVC specific include.
2024-02-13 09:19:47 +11:00
ok_what
751d9c5999 Fix: VSE transition strip factor is not clamped
Previewing strip outside of it's boundary caused overflow.
Clamp the factor to prevent overflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/118086
2024-02-12 21:21:19 +01:00
Harley Acheson
332efa7250 Merge branch 'blender-v4.1-release' 2024-02-12 12:17:45 -08:00
Harley Acheson
d45175c919 UI: Fix Indentation Issue in Asset Browser
Remove extra indentation for non-collapsible icons that have ICON_NONE,
not needed since #117654

Pull Request: https://projects.blender.org/blender/blender/pulls/118159
2024-02-12 21:16:28 +01:00
Damien Picard
1410615079 Nodes: expose multi-input sockets to custom nodes in the Python API
Currently the multi-input sockets are not exposed to the custom nodes
Python API. This makes some features cumbersome to implement if one
wants a node to process an arbitrary number of inputs.
One workaround is to make inputs duplicate themselves when a link is
created, but a proper multi-input would be easier to use for both
add-on developers and users.

This commit exposes a new `use_multi_input` boolean parameter when
creating a new node socket. This makes it possible to declare a
multi-input, while still leaving the existing `is_multi_input`
property read-only so that existing nodes cannot be made unstable.

The parameter is optional so existing scripts stay compatible. It also
raises an error when used on output sockets, since it makes no sense
for those to be multi-input.

The Custom Node Tree Python template was updated to reflect this
change by making one of the inputs of the custom node multi-input.

Pull Request: https://projects.blender.org/blender/blender/pulls/114474
2024-02-12 20:28:56 +01:00
Julian Eisel
4f68fa453f Fix compiling after previous fix in release branch 2024-02-12 19:51:56 +01:00
Julian Eisel
0ffe2d4848 Merge branch 'blender-v4.1-release' 2024-02-12 19:51:40 +01:00
Hans Goudey
d691ed2f3b GPU: Use std::string instead of C strings for code gen output
The benefits are removing unnecessary reallocations of the string data
and unnecessary recalculations of the size, better type safety, and more
automatic memory management.

Pull Request: https://projects.blender.org/blender/blender/pulls/118045
2024-02-12 19:33:44 +01:00
Julian Eisel
d54a1b0364 Fix asset indexer string shortening breaking UTF-8 strings
Would shorten the string without ensuring the string isn't shortened in
the middle of a multi-byte UTF-8 character.
2024-02-12 19:25:20 +01:00
Harley Acheson
3ac9babe35 Fix #118087: Remove Bad Spacing Introduced With #117310
This reverts to the exact prior spacing values for layout separator
item, so only difference is vertical spacing if vertical bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/118151
2024-02-12 19:10:48 +01:00
Germano Cavalcante
1c77779160 Refactor: Store a 'Mesh' in the editmesh snap cache and use it for snapping
In this commit, a temporary mesh is created representing the edit mesh.
This mesh is then used in the Edit Mesh snapping system instead of the
BMesh.

By using a Mesh object for snapping, we remove a considerable amount of
code and use a more optimized version of snapping.

This simplifies the code and makes it easier to implement new features.

## Performance test: Face + Edge + Vert
|        | Cache     | Gen. Snap |
|--------|-----------|-----------|
| Before | 680.88 ms | 0.1250 ms |
| After  | 489.06 ms | 0.1064 ms |
| Improv | 28.65%    | 14.88%    |

## Performance test: Face
|        | Cache     | Gen. Snap |
|--------|-----------|-----------|
| Before | 293.90 ms | 0.0230 ms |
| After  | 411.92 ms | 0.0256 ms |
| Improv | -40.15%   | -11.30%   |

Pull Request: https://projects.blender.org/blender/blender/pulls/117047
2024-02-12 18:59:13 +01:00
Miguel Pozo
7ca46bb25d Merge branch 'blender-v4.1-release' 2024-02-12 18:35:31 +01:00
Miguel Pozo
1323b9912c Cleanup: Remove outdated comment
gl_InvocationID is always available now.
2024-02-12 18:34:54 +01:00
Miguel Pozo
7821cf068c Fix: Workbench: Shadows
Broken shadows after c0c3565714
GPU_ARB_gpu_shader5 is never defined,
since gl_InvocationID is always available.
2024-02-12 18:34:12 +01:00
Michael Kowalski
e4c45cbce1 Merge branch 'blender-v4.1-release' 2024-02-12 11:58:02 -05:00
Hans Goudey
d434ef6566 Docs: Add comments to node tree runtime struct clarifying design
Currently we have some old code from shader/compositor/texture nodes
that stores runtime data during and after evaluation on the node tree
itself. This is meant to be avoided, since the node tree is just meant
to be evaluation _instructions_.

Pull Request: https://projects.blender.org/blender/blender/pulls/118056
2024-02-12 17:44:12 +01:00
Hans Goudey
b0b6bc86ab Cleanup: Use more standard face corner naming in mesh normals code
Mostly replace "ml" with "corner"
2024-02-12 11:15:01 -05:00
Hans Goudey
f3c55b9f9c Cleanup: Remove unused DerivedMesh function 2024-02-12 10:45:02 -05:00
Hans Goudey
e9b8460ebe Cleanup: Use blender::int2 instead of vec2i 2024-02-12 10:45:02 -05:00