Commit Graph

4977 Commits

Author SHA1 Message Date
Hans Goudey
e1fd7a8a7b Cleanup: Simplify grease pencil line overlay size counting
Avoid the need to iterate over every curve, and only iterate over the
cyclic attribute if it exists. This removes the check that avoided
creating cyclic segments for curves with only two points. If that
was necessary, some of the complexity would return, but the
new `array_utils` function wouldn't be necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/113814
2023-10-17 18:29:17 +02:00
Jacques Lucke
934c68804b Merge branch 'blender-v4.0-release' 2023-10-13 15:46:11 +02:00
Jacques Lucke
75c333ee5c UI: use dash and underscore as word separators in string search
Sometimes, those are used instead of spaces, but there should be
no functional difference to using spaces.
2023-10-13 15:42:10 +02:00
Jacques Lucke
0d83083f29 Merge branch 'blender-v4.0-release' 2023-10-13 10:01:26 +02:00
Jacques Lucke
a9bf212de0 Fix #113563: prioritize main group length in string search
For node search that means that shorter matching node names
are moved further to the top, even if the entire search result is longer
because it is in a deeper menu.

This also more closely resembles how the search worked in Blender 3.6
where the menu path was not included in the search.
2023-10-13 09:59:21 +02:00
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
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
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
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
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
Campbell Barton
42bd9cd1e6 Merge branch 'blender-v4.0-release' 2023-09-29 17:15:16 +10:00
Peng Yan
26b2cc3ffb Fix error in area calculation for polyfill beautify calculation 2023-09-29 17:13:17 +10:00
Hoshinova
d98005da5d Fix #112180: Noise with high detail and lacunarity outputs erratic values
This patch fixes #112180 by aligning the floor fraction function with
the GLSL/SVM ones, through the use of the floor math function.

Pull Request: https://projects.blender.org/blender/blender/pulls/112962
2023-09-27 18:01:17 +02:00
Jacques Lucke
3cbddb2a22 BLI: compute string search scores in parallel
This can make string search a bit faster when there are many
possible search results. There are still multiple serial bottlenecks
though.
2023-09-26 12:07:18 +02:00
Jacques Lucke
56e98f8ba6 UI: prioritize highlighted last words in string search
When using menu search, each search item has multiple segments. In the UI,
 we only highlight last section, which is the actual node/operator name. The
menu path is grayed out. It seems reasonable to give greater weight to the
words in the search item that are highlighted.

See #112839 for an example of what effect this can have.

Pull Request: https://projects.blender.org/blender/blender/pulls/112839
2023-09-26 11:49:49 +02:00
Jacques Lucke
8362563949 UI: show recently selected items at the top of searches
The goal is to make the search faster to use by dynamically adapting to the user.
This can be achieved using the simple but common approach of showing recently
selected items at the top. Note, that the "matching score" between the query and
each search item still has precedence when determining the order. So the last used
item is only at the top, if there is no other search item that matches the query better.

Besides making the search generally faster to use, my hope is that this can also
reduce the need for manually weighting search items in some places. This is
because while the ordering might not be perfect the first time, it will always be
once the user selected the element that should be at the top once.

This patch includes:
* Support for taking recent searches into account in string searching.
* Keep track of a global list of recent searches.
* Store recent searches on disk similar to recently opened files.
* A new setting in the user preferences that allows disabling the functionality.
  This can be used if deterministic key strokes are required, e.g. for automated tests.

In the future this could be improved in different ways:
* Add some kind of separator in the search list to indicate which elements are at
  the top because they have been used recently.
* Store the recent search items per search, instead of in a global list. This way
  it could adapt to the user even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/110828
2023-09-25 10:56:12 +02:00