Commit Graph

99373 Commits

Author SHA1 Message Date
YimingWu
f080dca2c0 Fix #107717: Missing looptri_polys loading lineart
The `looptri_polys` array was missing likely due to a mesh data
structure update, causing lineart loading function to crash. Now fixed.
2023-05-08 12:18:11 +08:00
Campbell Barton
bb5a22539c Cleanup: correct path size argument
BKE_appdir_folder_documents clamps to FILE_MAXDIR internally.
2023-05-08 12:49:44 +10:00
Campbell Barton
8a852de147 BLI_fileops: change BLI_dir_create_recursive string size handling
Replace MAXPATHLEN with FILE_MAX, always allocate if the buffer isn't
big enough since creating a truncated directory isn't useful.

Having some code-paths only run in an ifdef complicated the code
and made it more difficult to follow.

Also assert the path doesn't contain ".." directories as they aren't
supported.
2023-05-08 12:49:44 +10:00
Campbell Barton
64674b10d1 Cleanup: quiet compiler warnings 2023-05-08 11:47:27 +10:00
Lukas Stockner
893bd37bc0 Cleanup: formatting 2023-05-08 01:20:41 +02:00
Lukas Stockner
c431b69a8a Fix #72011: Visible artifacts after baking normals with bevel shader
Pull Request: https://projects.blender.org/blender/blender/pulls/106988
2023-05-07 22:41:47 +02:00
Marino Toscano
c502d3ac53 Fix #105147: Rename geometry node to Is Face Planar
Renamed geometry node "Face Is Planar" to "Is Face Planar"
so that the name in the menu and in the node are the same.
Translations now also works as expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/107713
2023-05-07 22:37:05 +02:00
Damien Picard
31d71f39ad UI: fix or improve many messages
- The official spelling of FFMPEG is FFmpeg (upper, then lower case).
- The normal vector copy and paste operators shoud be singular because
  they can only be used on a single element.
- The "Parent File" file browser operator goes up one level in the
  file hierarchy. It should be called "Parent Directory", like the
  current description "Go to the parent directory".
- "Mass Vertex Group" used to define the mass, but was reused at some
  point and now actually defines cloth pinning so it should be called
  "Pin Vertex Group", as in the UI.
- The Transformation constraint's Map To Type suffered from a
  typo (probably of -> on).
- "Fall-off" is more commonly spelled "Falloff".
- "Effected" should really be "Affected" in this case.
- Rephrase the descriptions for the curve painting tools drawing
  plane, which did not seem to match what the settings do. Namely,
  they allow selecting in which plane to draw curves using the Curve
  Draw tool.

Reported by @Joan-Pujolar in #43295:
- Force exporting animation on every objects [objects singular]
- Color of the interface widgets text insertion cursor (caret) [delete
  interface widgets]
- Index of active aov [AOV in uppercase everywhere else]
- Does this tool use an painting canvas [an]
- This script was written Blender version %d.%d.%d ["for" missing
  before "Blender"]
- [fcurve -> F-curve]
- unknown error stating file [statting]
- Offset into each stroke before the beginning of  the dashed segment
  generation [Two spaces between of and the]
- Find the nearest element in the a group. [either "the" or "a"]

Pull Request: https://projects.blender.org/blender/blender/pulls/107699
2023-05-07 15:27:28 +02:00
Campbell Barton
de5aca9418 Refactor: unify UNIX/WIN32 BLI_dir_create_recursive & some improvements
- Don't duplicate/allocate the path on each recursion,
  instead make a single copy which is modified in-place.

- Move slash-stepping to a BLI_path utility function that accesses
  the end position of the parent directory, handles multiple slashes
  and '/./'.
2023-05-07 23:09:56 +10:00
Campbell Barton
f7d3115d97 Cleanup: replace BLI_strncpy with memcpy when the size is known
Also remove temporary filename buffer which is no longer needed.
2023-05-07 16:55:40 +10:00
Campbell Barton
0d1362bfd7 Cleanup: spelling in comments 2023-05-07 16:46:37 +10:00
Campbell Barton
df54b627b3 Cleanup: use of the term 'len' & 'maxlen'
Only use the term len & maxlen when they represent the length & maximum
length of a string. Instead of the available bytes to use.

Also include the data they're referencing as a suffix, otherwise it's
not always clear what the length is in reference to.
2023-05-07 16:46:37 +10:00
Chris Blackbourn
5abb3c96cf UV: Add pinned island support to uv packer
New pinned modes:
 * Ignore pinned islands
 * Normal (default)
 * Lock scale
 * Lock rotation
 * Lock position of pinned UV islands.
2023-05-07 17:54:51 +12:00
Campbell Barton
5258604531 Cleanup: use of the term 'len' in BLI_string_utf8, BLI_string_utils
Reserve the term `len` for string length, some functions used this for
an string/array length, others a destination buffer size
(even within a single function declaration).

Also improve naming consistency across different functions.
2023-05-07 14:56:11 +10:00
Campbell Barton
7966888af5 Cleanup: don't use an inline function which is passed as an argument
GCC13 fails to compile this with `-O1`, while it should be supported,
there is no advantage to this being an inline function so remove it.
2023-05-07 14:50:27 +10:00
Campbell Barton
464a40c1a5 Cleanup: use the name of the CMake WITH_STRSIZE_DEBUG for the define
Prefer matching names so there is no reason to confuse the identifiers.
2023-05-07 13:55:19 +10:00
Campbell Barton
7f8495c44b CMake: add WITH_STRSIZE_DEBUG option, RNA support
Support string size debug so it can be used for regular development.

It works be writing values into strings, ensuring the buffer size
given is actually available. Developers can use this with memory
checking tools such as ASAN/valgrind to force an error when
the value used for the size of a buffer is larger than the buffer.

Resolve remaining issue with RNA using BLI_strncpy* in generated
callback functions where the size argument didn't represent the
size of the destination buffer.

This is automatically enabled along with ASAN for the
blender_developer.cmake configuration.

Ref PR !107602.
2023-05-07 13:52:49 +10:00
Campbell Barton
0cf682f570 RNA: ensure string size with RNA_property_string_get_alloc 2023-05-07 13:22:35 +10:00
Campbell Barton
3ed297633d Fix unintended fall-through in ANIM_is_active_channel
Regression in [0] would treat many eAnim_ChannelType types data as a
bActionGroup. Resolve by including the NULL check in the return.

[0]: 80feb13665
2023-05-07 13:14:20 +10:00
Chris Blackbourn
0eba9e41bf Cleanup: Convert float to double during uv unwrap
`sinf(float_angle)` is sometimes producing different results on
x86_64 cpus and apple silicon cpus. Convert to double precision
to increase accuracy and consistency.

Partial fix for #104513. More to come.
2023-05-07 12:07:40 +12:00
Chris Blackbourn
a684e61cbf Cleanup: fix warnings 2023-05-07 11:47:54 +12:00
Bastien Montagne
07dfc6eccc LibOverride: Further fixes/improvements to partial recursive resync process.
This addresses the 'liboverrides still tagged for resync after resync
process' error reports.

Turns out, this situation is (unfortunately) normal in some rare cases,
hwne the hierarchies in the liboverride and the reference data have
drastically diverged.Since the detection of liboverrides to resync, and
which one are valid partial resync roots, happens on the 'old' override
hierarchy, it may not match the actual hierarchy recreated from the
reference data, leading to some part of it being ignored by the resync
code.

There is no real way to avoid this situation, the only thing that can be
done is detect it, and re-process the resync code again when it happens.

From quick limited tests in (extremely dirty/outdated) Pets production files,
most of the time only one resync process is needed. Worst case so far
required 5 reprocessing of the same set of data.

There is no error messages from resync anymore in these tests, so at the
very least resync process should now be significantly more reliable than
before...
2023-05-06 16:27:50 +02:00
Bastien Montagne
40d79e3d2b LibOverride: Fix/Improve partial resync detection code.
This issue tackled here is essentially the same as in ac1ac6be9a
(recursive Purge of unused IDs could delete actually used IDs): handling
of dependency loops is extremely delicate...

This commit essentially rewrites from scratch the code that ensures that
all liboverrides and their dependencies that need it are tagged for resync,
and identifies the partial resync roots.

Dependency loops whitin a hierarchy make this process very complex, as
they can lead to having to recursively process more than once some IDs.
Partial resync roots are also a source of complexity, since some IDs may
be detected a potential roots, and later as dependencies of another
partial resync hierarchy.

This new code generates waaaaaayyyyy less error messages when resyncing
nightmare-like production files (i.e. production files which libraries
have been _heavily_ modified). There are still a few error reports in
some cases though, which are the synptoms of another issue that will be
fixed in the next commit.
2023-05-06 16:21:46 +02:00
Bastien Montagne
370a2bb416 LibOverride: Resync: Do not ignore embedded IDs in hierarchy processing.
While in practice this was probably not a big issue (since usually e.g.
objects used by a nodetree would also be used by other objects or
collections in the liboverride hierarchy), in some corner cases it could
have caused missing 'tag for resync' and improper partial resync roots
detection.
2023-05-06 12:36:52 +02:00
Bastien Montagne
bd412c9e71 Fix crash when accessing length of material_slots on evaluated Empty object.
`BKE_object_material_count_eval` did not take into account the Empty
object case at all.
2023-05-06 12:25:45 +02:00
Jesse Yurkovich
60283c63f1 Cleanup: Remove redundant ImBuf channels assignment
Setting channels is already handled as part of `IMB_allocImBuf`

Pull Request: https://projects.blender.org/blender/blender/pulls/107675
2023-05-06 06:39:17 +02:00
Chris Blackbourn
b01f5444a3 UV: Improve packing efficiency
Introduces "Optimal" packing, where the layout is a theoretical
best possible for a given input.

e.g. https://erich-friedman.github.io/packing/squinsqu

Also calls multiple packing algorithms, and chooses the best one.
2023-05-06 10:39:00 +12:00
Chris Blackbourn
3609ed7eb0 Cleanup: format 2023-05-06 10:39:00 +12:00
Jesse Yurkovich
5cc8fea7e9 Fix #107212: Fix file browser thumbnails for images
Fix several issues found while investigating missing browser thumbnails.

TIFF, PSD, and PNG now use their old file check code. This is due to
OIIO not having an early-out check within `.open`. Calling `.open`
required a large portion of the file to be available (more than 8192
bytes). The code here can be removed in the future if/when a new API is
available which alleviates this problem.

PSD files often carry along a large blob of ICCProfile metadata.
Attempting to roundtrip this metadata when we cache the thumbnail to
.png was leading to problems. We suppress this metadata now as ICC
profiles are not supported in general and are quite large.

Lastly, even after the mentioned new API is available, OIIO will want to
validate the full header of some file formats. DPX is the largest at a
full 2048 bytes so we must have this as our minimum now too. OS's should
be servicing this read call just as efficiently as when using 64. I
could spot no performance difference here at least.

This was missed during development because Blender will cache thumbnails
into a special .thumbnails directory and the images I was using to test
had already been cached there.

Pull Request: https://projects.blender.org/blender/blender/pulls/107515
2023-05-06 00:16:19 +02:00
Germano Cavalcante
fcddc1a1af Fix #107648: Proportional Edit sometimes cancels GPencil keyframe transformation
The selection flag (`TD_SELECTED`) of transform data is essential for
Proportional Edit. If set up incorrectly, it may result in early
cancellation.
2023-05-05 18:47:20 -03:00
Pratik Borhade
80feb13665 Allow select range in animation editor
This patch will add support to select all channels between active channel
and last-clicked channel without deselecting previous selection. `Shift` key is
now assigned for the range selection and `ctrl` key to extend the selection. This
changes will make multi-selection similar as outliner tree-elements. New function is
created `animchannel_select_range` to handle the range selection of channels.

Old Differential revision: https://archive.blender.org/developer/D17079

Pull Request: https://projects.blender.org/blender/blender/pulls/104565
2023-05-05 17:46:05 +02:00
Christoph Lendenfeld
c9b51591da Refactor: Allow to explicitly set the range on the slider UI element
The current implementation goes like this
* default to a 0-1 range
* you can set `is_bidirectional` to get a -1/1 range
* if the slider is bidirectional the overshoot goes both ways, otherwise only on the positive side

The issue is that it is not possible to have a 0-1 range but overshoot both ways.
This is useful for example on the "Blend to Default" operator, where 0 means current position and 1 default.
But overshoot also makes sense for this operator since the other way just scales away from default.

So this patch:
* removes `is_bidirectional`
* adds `float range[2]` to `tSlider` and a setter for it
* rewrite some logic to handle arbitrary ranges
* split the `allow_overshoot` flag into one flag for either side

Pull Request: https://projects.blender.org/blender/blender/pulls/107406
2023-05-05 17:22:39 +02:00
Clément Foucault
c796cbebef Metal: Add atomicExchange and mat3x4 support 2023-05-05 16:18:24 +02:00
Christoph Lendenfeld
9654b96ffa Refactor: pose_slide.c
* add const where possible
* reduce calls to `ED_slider_factor_get` and instead store that in `const float factor`
* rename variables from camel case to snake case, using full words, to conform to naming convention
* use interpf where possible

no functional changes

Pull Request: https://projects.blender.org/blender/blender/pulls/107610
2023-05-05 15:30:29 +02:00
Julian Eisel
878477f250 Fix broken UI view notifier listening
(UI views: https://wiki.blender.org/wiki/Source/Interface/Views)

Noticed while working on asset UIs with views, when async loading of
assets wouldn't trigger redraws.
2023-05-05 15:20:05 +02:00
Chris Blackbourn
48abc09d84 Cleanup: format 2023-05-05 23:44:56 +12:00
Clément Foucault
29053c5c02 EEVEE-Next: Fix validation layer errors on Metal
This only fixes the culling tile group size.
2023-05-05 12:52:47 +02:00
Clément Foucault
5a88afeaec DRW: Fix mixed type comparison warning 2023-05-05 12:52:47 +02:00
Clément Foucault
eab0cd475a EEVEE-Next: Fix wrong texture usage flag 2023-05-05 12:52:47 +02:00
Clément Foucault
c11ac86e03 Cleanup: Metal: Better function name and comments for buffer bindings 2023-05-05 12:52:47 +02:00
Clément Foucault
2f1bf2ff1e EEVEE-Next: World: Fix missing SSBO bind 2023-05-05 12:52:47 +02:00
Julian Eisel
95fa4d73d6 Cleanup: Avoid nested conditional blocks in WM-jobs code
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting (`continue`s in
this case) to reduce cognitive load, a number of devs consider this good
practice.
2023-05-05 12:15:38 +02:00
Julian Eisel
8284bb1ff4 Fix potentially missing redraws when file browser loads recursively
The `do_update` boolean would be overridden with false whenever a single
directory didn't add new items. It should not modify it in this case.
2023-05-05 11:52:54 +02:00
Campbell Barton
70cd2a9741 RNA: use memcpy for copying strings when the length is known
There is no advantage in using BLI_strncpy/BLI_strncpy_utf8 when the
destination string has been allocated and won't be concatenated.

Also no need to calloc memory which is filled by strcpy afterwards.
2023-05-05 15:36:50 +10:00
Campbell Barton
c80e9641ed Cleanup: replace UTF8 string copy macro with function 2023-05-05 14:36:09 +10:00
Campbell Barton
dc4e48fca0 Cleanup: quiet clang-tidy char subscript warning 2023-05-05 14:21:13 +10:00
Campbell Barton
b0aa8fb16a Cleanup: quiet warning 2023-05-05 14:09:38 +10:00
Campbell Barton
f665b73c89 RNA: replace BLI_strncpy with strcpy/memcpy when the size is known
Follow up on [0] handle remaining cases where BLI_strncpy was used
it RNA string get callbacks.

[0]: c891dbd162
2023-05-05 14:01:57 +10:00
Campbell Barton
6796cce11d Refactor: add a function to access images extensions from it's format
Previously accessing the extension needed to ensure an extension
on an empty path.

This conflicted with DEBUG_STRSIZE as it was assumed the input was
FILE_MAX, where as it was a small buffer with RNA, see: !107602.

Resolve by separating the function that ensures the extension
with the function that finds valid extensions for a format.

Also pass the size of the filepath to functions that ensure the
extension.
2023-05-05 14:01:57 +10:00
Joseph Eagar
f15889a9f9 Sculpt: Split face set visibility invert into its own operator
Visibility invert should not use OPTYPE_DEPENDS_ON_CURSOR.
2023-05-04 17:49:40 -07:00