Commit Graph

6446 Commits

Author SHA1 Message Date
Campbell Barton
10e840935a Merge branch 'blender-v4.0-release' 2023-10-11 09:13:24 +11:00
Campbell Barton
c006c1809d BLI_fileops: set the errno if read returns an invalid value
Set the "I/O error" if the result from read is larger than the requested
size, while unlikely - set the error so an error return always sets the
`errno`.
2023-10-11 09:04:52 +11:00
Germano Cavalcante
5429d892b7 Merge branch 'blender-v4.0-release' into main 2023-10-10 12:19:37 -03:00
Germano Cavalcante
ab2618e186 Fix compile error due to conversion to 'long unsigned int' from 'int'
Conversion to `long unsigned int` from `int` may change the sign of the
result [-Werror=sign-conversion]
2023-10-10 12:16:31 -03:00
Germano Cavalcante
7d7ca7b90d Merge branch 'blender-v4.0-release' into main 2023-10-10 11:31:35 -03:00
Germano Cavalcante
c351de8b2a Fix #113486: Crash snapping with clipping borders
Caused by 2cead79747

The clip_plane count in BLI_kdopbvh.c was incorrectly reduced.

To solve, make the size of the clip_plane array variable.

This eliminates the need to keep values in sync.
2023-10-10 11:30:28 -03:00
Brecht Van Lommel
46d32d8966 Merge branch 'blender-v4.0-release' into main 2023-10-10 15:36:39 +02:00
Brecht Van Lommel
478e1ab6d3 Fix build error on Windows after BLI_read changes
Don't use posix-only ssize_t in platform independent code.

Pull Request: https://projects.blender.org/blender/blender/pulls/113493
2023-10-10 15:36:15 +02:00
Campbell Barton
57fc3d48b8 Merge branch 'blender-v4.0-release' 2023-10-10 22:49:58 +11:00
Campbell Barton
8d80d611e9 Use BLI_read instead of read to avoid issues with large files
Follow up to fix for #113473, similar issues exist elsewhere.
2023-10-10 22:47:35 +11:00
Campbell Barton
028c4b440c Merge branch 'blender-v4.0-release' 2023-10-10 22:28:53 +11:00
Campbell Barton
fa40724a72 BLI_fileops: Add 'BLI_read' wrapper to ensure the requested data is read
According to the documentation `read` isn't required to read all the
data requested. Although until recently I'd never encountered this and
none of Blender's code checks for read succeeding but not reading the
requested size.

Resolves #113473 where images over 2gb fail to load.

Ref !113474.
2023-10-10 22:27:40 +11:00
Campbell Barton
4afd8ef9a4 Cleanup: add BLI_mmap_get_length, remove duplicate file size access
Remove unnecessary calls to BLI_file_descriptor_size when using
BLI_mmap_open since this stores the file size too.

While accessing the size twice isn't so bad, the additional check
that the file size isn't an error value is unnecessarily verbose.
2023-10-10 15:43:13 +11:00
Campbell Barton
ed8d2d8219 Merge branch 'blender-v4.0-release' 2023-10-10 15:33:47 +11:00
Campbell Barton
7a503d160e BLI_mmap: open now checks for seek failing & exists early
Failure to seek would attempt to MMAP SIZE_T_MAX, while this would
likely fail, prefer an explicit error check instead of relying on
unreasonable requests to be rejected.
2023-10-10 15:32:13 +11:00
Campbell Barton
acd54a2afb Merge branch 'blender-v4.0-release' 2023-10-10 14:57:00 +11:00
Campbell Barton
ae6b1ead4c Fix failure to check the error value for file-size access
Accessing the file size returns -1 on error, for file packing this
was passed directly to an allocation which would wrap around to
SIZE_T_MAX and fail to allocate. In other cases zero was treated
as an error value but -1 wasn't.

Add checks for the error return value, also warn that packing files over
2gb isn't supported.
2023-10-10 14:56:30 +11:00
Hans Goudey
7507251071 Cleanup: Extract attribute function to copy values from group to group
Use the typical combination of an "array utils" function used by an
attribute interpolation function. This helps moves us towards having
a more centralized implementaiton of attribute propagation that can
be changed and optimized more easily.
2023-10-09 15:23:48 +02:00
Falk David
d0ee4f2283 BLI: Support negative steps in findlinkfrom
The function `BLI_findlinkfrom` returns the link that is n-steps
after the given start link. This did not work for negative steps.

This change makes it so that both positive and negative step
values work.
2023-10-09 13:40:01 +02:00
Jacques Lucke
29d4779bf9 Merge branch 'blender-v4.0-release' 2023-10-07 23:19:41 +02:00
Jacques Lucke
e299c41312 BLI: assert that hash of key is the same after inserting it in hash table
These asserts would have caught the issue fixed in the previous
commit earlier.
2023-10-07 23:14:04 +02:00
Jacques Lucke
144a5aa512 Cleanup: replace use of std::iota with more specific function
`iota` is name that has no meaning, it's not an acronym or initialism.
It's usually very cryptic when I come across it. Replacing it with a
specialized function makes the code more readible.
2023-10-06 23:01:16 +02:00
Jacques Lucke
87bf783479 Merge branch 'blender-v4.0-release' 2023-10-06 17:28:14 +02:00
Jacques Lucke
2fdb38f972 Fix: failing string search test 2023-10-06 17:27:48 +02:00
Jacques Lucke
c37faf8c2f Merge branch 'blender-v4.0-release' 2023-10-06 16:41:38 +02:00
Jacques Lucke
0aa91a30dd Fix #113092: take highlighted part of search item into account in more places
When using menu-search, only the last part of a search item is highlighted.
When sorting the search results, this should be taken into account and
the highlighted words should be prioritized.

This was already partially implemented in 56e98f8ba6. Now it's also
taken into account with prefix search. For example, `TC` now prefers
`Input > Texture Coordinate` over `Texture > Checker Texture`.
2023-10-06 16:38:45 +02:00
Jacques Lucke
046155572d UI: use recent search for weighting only if the query is short
The idea is that accessing recent searches is mostly only useful when actually
searching for something very recent, which means that it would show up at the
top even if the query is empty or extremely short. If the user is typing a longer
query, it likely means that what is at the top is not what is actually desired, so
it's better to not take recent searches into account anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/113338
2023-10-06 16:16:07 +02:00
Falk David
7e87435cf4 GPv3: Initial drawing tool
This PR implements an initial drawing tool that can already be used for testing.
While this is not fully feature complete (compared to the current grease pencil draw tool) the following is already implemented:

* Pressure support for radius and opacity.
* Material color and vertex color support.
* New active smoothing algorithm based on curve fitting.
* Simplify algorithm as a post-process step.

Some deliberate limitations include:
* The drawing plane is always the front plane. Drawing on surfaces is also not supported.
*

The current approach has not been optimized for performance yet. The goal was to have a straightforward implementation
first and then focus on performance later.

There are numerous parameters in the code that are hard-coded for now. These should be exposed at some point, potentially as user settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/110093
2023-10-06 10:49:54 +02:00
Campbell Barton
bd66e2e662 Cleanup: use defines for superscript numbers in unit.cc 2023-10-06 14:12:26 +11:00
Jesse Yurkovich
d47ceb53f8 Cleanup: Replace usage of old BLI_array macros with C++ types
This replaces the older dynamic c arrays with blender::Vector as
appropriate. Many files required minimal changes and the before/after
are quite similar.

There's 3 remaining usages of the old machinery but those will require
more involved changes and design.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110981
2023-10-06 03:02:17 +02:00
Campbell Barton
6f23344a7a Merge branch 'blender-v4.0-release' 2023-10-05 13:58:49 +11:00
Campbell Barton
9d20632925 Cleanup: ensure trailing newline, delete trailing space 2023-10-05 13:57:14 +11:00
Campbell Barton
60b2b663cc Merge branch 'blender-v4.0-release' 2023-10-05 13:16:20 +11:00
Campbell Barton
c9130e38e3 Cleanup: spelling in comments 2023-10-05 13:07:58 +11:00
Harley Acheson
544ef3baad Merge branch 'blender-v4.0-release' 2023-10-04 12:09:23 -07:00
ChengduLittleA
6d64c6dcd7 UI: Recognize CJK punctuation when selecting text
Add frequently-used Chinese, Japanese, Korean special character
delimiters (punctuation, quote characters, brackets, etc) to aid the
selection of character segments in text operations.

Pull Request: https://projects.blender.org/blender/blender/pulls/112852
2023-10-04 21:08:13 +02:00
Clément Foucault
9d229aee19 Math: Add from_up_axis matrix creation function
This add the possibility to create a
orthogonal basis around a given unit
vector.

The name was chosen to match the naming
convention already in place and match
the other matrix construction functions.
In other places (ex: renderers), this same
function is commonly named `make_orthonormal`
or `make_basis`.

The function is not given to have a fixed
implementation and might change overtime.
That's why the test only covers the
assumptions and not the raw values.

The implementation is borrowed from
Cycles and adapted to our math API.

Pull Request: https://projects.blender.org/blender/blender/pulls/113218
2023-10-04 14:35:47 +02:00
Campbell Barton
1e50b54ff2 Merge branch 'blender-v4.0-release' 2023-10-03 13:58:31 +11:00
Campbell Barton
26bb029ad8 Fix #113154: Hang double-clicking on UI elements outside a text field
The logic to handle word selection from double clicking ran even when
the event wasn't inside the button. This would pass an invalid position
to BLI_str_cursor_step_bounds_utf8 which hung.

Resolve by limiting word-selection to when the event is inside
the text editing field as well as clamping the position to ensure
it's within the allowed range.
2023-10-03 13:57:33 +11:00
Campbell Barton
83724fe1eb Merge branch 'blender-v4.0-release' 2023-10-03 11:11:17 +11:00
Campbell Barton
69d18c6063 Cleanup: quiet unknown escape sequence warning 2023-10-03 11:08:49 +11:00
Harley Acheson
27aecd34e1 Merge branch 'blender-v4.0-release' 2023-10-02 17:08:26 -07:00
Harley Acheson
68bde462e5 Cleanup: Make format
Formatting changes resulting from Make Format
2023-10-02 17:06:55 -07:00
Harley Acheson
4606935ecb Merge branch 'blender-v4.0-release' 2023-10-02 16:58:48 -07:00
Pratik Borhade
fcd6b6f4f6 Fix #112630: Skip grave and acute quotations when selecting
Treat grave and acute accent characters as delimiters. Allows selection
of words in the same way as if surrounded by double and single
quotation marks.

Pull Request: https://projects.blender.org/blender/blender/pulls/112652
2023-10-03 01:56:59 +02:00
Jacques Lucke
287bcb1b29 Merge branch 'blender-v4.0-release' 2023-10-02 18:20:24 +02:00
Jacques Lucke
9a8f65ef13 Fix #113159: improve best word match heuristic in string search
That was accidentally broken as side effect of 56e98f8ba6.
2023-10-02 18:12:41 +02:00
Jacques Lucke
768ced88dd Fix: String Search: avoid casting match scores to int 2023-10-02 18:12:40 +02:00
Iliya Katueshenock
6c14764f32 Fix #112933: Fix codegen issue on MSVC 17.7
MSVC 17.7 generates bad code in some lambda's, this has been reported
upstream [1], and a workaround has been suggested by MS in the form of
turning the inliner off. In consultation with the geo nodes people this
was deemed a passable solution, there was only a single call to this
method so performance wasn't a concern, so no special care had to be
taken to single out just the problematic MSVC versions.

If this bug pops up in other parts of our code where performance IS a
concern a more delicate approach may be required.

[1] https://developercommunity.visualstudio.com/t/10448291

Pull Request: https://projects.blender.org/blender/blender/pulls/112616
2023-09-29 16:57:02 +02:00
Campbell Barton
42bd9cd1e6 Merge branch 'blender-v4.0-release' 2023-09-29 17:15:16 +10:00