Commit Graph

99333 Commits

Author SHA1 Message Date
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
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
Clément Foucault
78d2f162e8 Metal: Fix EEVEE-Next shader compilation errors 2023-05-04 17:01:28 +02:00
Clément Foucault
aa31d9be80 Metal: Fix Workbench-Next shader compilation errors 2023-05-04 17:01:28 +02:00
Germano Cavalcante
6b5b777ca3 UI: add Proportional Size to Proportional Edit popover
Rather than forcing the user to initiate a transform operation to edit the `Proportional Size`, allow editing of the `Proportional Size` through the UI.

The affected headers are:
- View 3D
- Dop Sheet
- Image Editor
- Graph Editor
- Mask Editor

Pull Request: https://projects.blender.org/blender/blender/pulls/107507
2023-05-04 16:39:22 +02:00
illua1
239c1194a0 Fix #107545: Mistakes in recent node.cc cleanup
1. Early return needs inverted null checking.
2. `BLO_expand` macros expect value, not a pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/107622
2023-05-04 16:32:15 +02:00
Campbell Barton
42d3df25f3 Cleanup: pass a const context to menu UI funcitons 2023-05-05 00:19:31 +10:00
Campbell Barton
fc6418ae94 Cleanup: quiet "undef" compiler warning 2023-05-05 00:19:23 +10:00
Sergey Sharybin
2e7b896928 Fix strict compiler warning in ImBuf
Solves the warning C4060: switch statement contains no 'case'
or 'default' labels warning with lite builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/107619
2023-05-04 15:51:24 +02:00
Hans Goudey
d0705bd697 Mesh: Split MLoopTri poly indices into a separate array
For derived mesh triangulation information, currently the three face
corner indices are stored in the same struct as index of the mesh
polygon the triangle is part of. While those pieces of information are
often used together, they often aren't, and combining them prevents
the indices from being used with generic utilities. It also means that
1/3 more memory has to be written when recalculating the triangulation
after deforming the mesh, and that the entire triangle data has to be
read when only the polygon indices are needed.

This commit splits the polygon index into a separate cache on `Mesh`.
The triangulation data isn't saved to files, so this doesn't affect
.blend files at all.

In a simple test deforming a mesh with geometry nodes, the time used
to recalculate the triangulation reduced from 2.0 ms to 1.6 ms,
increasing overall FPS from 14.6 to 15.

Pull Request: https://projects.blender.org/blender/blender/pulls/106774
2023-05-04 15:39:10 +02:00
Julian Eisel
bf77d3436d Cleanup: Comment formatting for preview image enums definitions 2023-05-04 15:22:49 +02:00
Julian Eisel
9d422f2fbc Cleanup: Avoid nesting (use early exit) in icon code
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting to reduce
cognitive load, a number of devs (including myself) consider this good
practice.
2023-05-04 15:05:49 +02:00
YimingWu
1049f11cc0 Fix #107566: Gesture face set respect hidden faces
Gesture face set selection (box and lasso selection) didn't respect hidden
faces, causing selection to bleed unexpectedly, now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/107575
2023-05-04 14:51:36 +02:00
Jeroen Bakker
22e4e97310 macOS: Reduce Edit Mode Drawing Artifacts
Apple Silicon uses tile rendering and can discard tiles if it
is covered. The retopology overlay made some changes to the
shader that introduced some blocking and striping artifacts when
the overlay was disabled.

This PR changes the minimum used offset to reduce the drawing
artifacts. Tweaking the GLSL shader itself didn't work.

Fix #105830

Pull Request: https://projects.blender.org/blender/blender/pulls/107611
2023-05-04 12:42:37 +02:00
Jacques Lucke
e674e32aa1 Fix: missing null check leads to crash when rendering
The simulation cache is allocated lazily during evaluation when the
depsgraph is active. However, during rendering, the depsgraph is not
active, so it's not created.
2023-05-04 11:04:42 +02:00
Clément Foucault
9d6659bf07 Metal: Shader: Remove assertion of compilation success
This allow the compilation tests to finish even on failure.
2023-05-04 10:59:26 +02:00
Clément Foucault
2815f46883 Metal: ShaderLog: Add initial implementation
This is a really rough implementation. Since the MSL sources
do not correspond 1:1 to the GLSL sources, some mapping is
needed to retreive the GLSL source file for a given generated
line. This will be implemented in a later commit.
2023-05-04 10:59:26 +02:00
Clément Foucault
e39c3c600c GPU: ShaderLog: Add more const correctness & notes supports
The metal shader compiler can produce `note` reports.
Treat them as warnings.
2023-05-04 10:59:26 +02:00
Jeroen Bakker
b0c7e83805 Cleanup: formatting
In recent changes to vulkan.
2023-05-04 10:23:15 +02:00
Jacques Lucke
1c57ac6ce7 Cleanup: remove unused member variable 2023-05-04 10:19:40 +02:00
Nathan Vegdahl
10a93aebf1 Fix #95855: prioritize selecting keys on active fcurve
This addresses #95855 by prioritizing the selection of keys in the following order:

1. Keys on the active curve.
2. Keys on any selected curve.
3. Other keys.

Additionally, this fixes an as-yet unreported issue where you couldn't select the main vertex of a key if it was overlapping with another one and one or more of its handle vertices were already selected.  This was due to the selection status of a key and its handles not being properly considered separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/107223
2023-05-04 10:10:34 +02:00
Jeroen Bakker
f428fd8229 Vulkan: Share Device Between Contexts
Previous GHOST_ContextVK would create a logical device for each
context. Blender uses multiple contexts at the same time and wasn't able
to share resources between them as the logical device where different.

This patch will create a single logical device and share them between
multiple contexts. This allows sharing memory/shaders between contexts
and make sure that all memory allocations are freed from the device it
was allocated from.

Some allocations in Blender are freed when there isn't a context, this
was failing in the previous implementation. We didn't noticed it before
as we didn't test multiple contexts.

This patch also moves device specific data structures from VKContext to
VKDevice like the descriptor pools, debug layers etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/107606
2023-05-04 10:06:48 +02:00
Campbell Barton
93b6463113 Assert ImBuf & Main paths never use blend-file relative prefix
Add assertion on free because the final path isn't always known on
creation.
2023-05-04 13:43:28 +10:00
Campbell Barton
4395a35641 Cleanup: reduce indentation with early returns in allocimbuf 2023-05-04 13:18:42 +10:00
Campbell Barton
cf16eab370 Cleanup: avoid calling stat twice in BLI_dir_create_recursive 2023-05-04 13:12:35 +10:00
Campbell Barton
aa7d7c8e4b Cleanup: naming in BLI_path, reserve len for string length
- Names ending with len sometimes referred to the buffer size.
  The same names were used for both buffer size and string length
  depending on the function in some cases.

- Rename str/string to path for generic path functions.

- Rename BLI_path_rel arguments (file, relfile) to (path, basename)
  as it wasn't so clear which is being made relative, `file` can be a
  directory so rename to `path` (matches naming for BLI_path_abs).
2023-05-04 13:09:28 +10:00
Campbell Barton
c891dbd162 RNA: replace BLI_strncpy with strcpy when when the size isn't meaningful
The size limit used in RNA string access wasn't meaningful as the size
of buffers passed into these functions is defined by the length+1 which
uses strlen, unterminated strings would already cause a buffer overflow.
Note that strcpy for accessing RNA is already widely used,
there were just some cases that used BLI_strncpy too.

This also removes use of BLI_strncpy_utf8 in texture slot access as
names are expected to be utf8, sanitizing when copying in this
particular case doesn't make sense and isn't done elsewhere.
2023-05-04 13:09:28 +10:00
Campbell Barton
069db83152 BLI_string: move DEBUG_STRSIZE check into a macro, check sizes after nil
- Avoid inline ifdef checks for DEBUG_STRSIZE
- Add BLI_string_debug_size_after_nil to ensure strings to manipulate
  have the expected buffer size after the nil terminator.
- Add checks to more string manipulation functions.

Further changes are required for this to be enabled during regular
development as the RNA currently allocates the strings length but
passes in the buffer size as a limit which conflicts with DEBUG_STRSIZE.
2023-05-04 13:09:28 +10:00
Campbell Barton
40ff2cfdc5 BLI_path: correct buffer size argument
Pass the size of the string passed in, although in practice
this didn't cause any problems.
2023-05-04 13:09:28 +10:00
Hong Shin
54e397cc78 Cleanup: convert node_exec.h to C++
Ref: #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/107591
2023-05-04 00:09:29 +02:00