Commit Graph

123792 Commits

Author SHA1 Message Date
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
Brecht Van Lommel
d1bfda16bb Cycles: re-enable HIP on Linux
Using the new ROCm 5.5 compiler.

Ref #104786

Pull Request: https://projects.blender.org/blender/blender/pulls/107662
2023-05-05 19:36:55 +02:00
Michael Jones
25fe9d74c9 Cycles: Fix hang when MSL->AIR compilation fails
Follow up to [#100066](https://projects.blender.org/blender/blender/pulls/105122/files). Scenes that do pre-render work on the GPU (e.g. the bake unit tests) will still hang if there are MSL compile failures. This patch adds a loop break out in case of an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/107657
2023-05-05 18:52:54 +02: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
Brecht Van Lommel
0ffde36fe7 Refactor: flatten light tree in recursive function
This will make further changes for light linking easier, where we want to
build multiple trees specialized for each light linking set.

It's also easier to understand than the stack used previously.

Pull Request: https://projects.blender.org/blender/blender/pulls/107560
2023-05-05 16:32:59 +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
Sergey Sharybin
ecb8d7f8ab Tests: Add test for broken EXR files
To make sure non-trivial cases like #106977 are not re-introduced.

Pull Request: https://projects.blender.org/blender/blender/pulls/107643
2023-05-05 11:00: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
Campbell Barton
e5598d067b BKE_image: simplify UDIM tile label access, return string length 2023-05-05 10:26:17 +10:00
Joseph Eagar
a79272a790 Sculpt: fix broken pbvh draw
foreach_faces now passes looptri index instead of a
MLoopTri pointer.
2023-05-04 17:09:53 -07:00
Campbell Barton
8cbb42c640 Cleanup: de-duplicate internal function for file/directory split
Also note that BLI_path_basename can be used in place of
BLI_path_split_file_part when a copy isn't needed.
2023-05-05 10:02:46 +10:00
Campbell Barton
831bacec92 Cleanup: use function style casts & nullptr in C++ code 2023-05-05 09:46:28 +10:00
Campbell Barton
ba3d7499fa Cleanup: spelling, use term polygons in polygon callbacks 2023-05-05 09:46:28 +10:00
Campbell Barton
49c09d7640 Cleanup: remove inline pointcache extension stripping
No need to perform inline, and it would not have worked properly for
*.blend1 files.
2023-05-05 09:46:28 +10:00
Campbell Barton
f2bbcc317f Cleanup: format 2023-05-05 09:46:04 +10:00
illua1
e858aa7181 Fix #107623: Do not allow dragging search menu from custom socket
To prevent invalid links, simply disable them for this socket type.
Other nodes with such sockets may appear in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/107628
2023-05-04 19:27:55 +02:00
Germano Cavalcante
93d464dcd1 Fix snapping with constraint flickering
Flickering observed when snapping to edge or face with axis constraint.

It was probably introduced in 4eda60c2d8

The snapping code has a timer, so `t->tsnap.snapElem` isn't always set.

So avoid changing the value of `t->tsnap.snapElem`.
2023-05-04 14:05:47 -03:00
Hans Goudey
730b11034f Cleanup: Move remaining modifier files to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/107626
2023-05-04 18:35:37 +02:00
Sergey Sharybin
eca8e6bf5e Refactor: Convert mask module to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/107615
2023-05-04 17:36:01 +02:00
Clément Foucault
5aa51cf607 EEVEE-Next: Fix warning when using Metal backend 2023-05-04 17:01:28 +02:00