Commit Graph

117289 Commits

Author SHA1 Message Date
Harley Acheson
22bda12af7 Fix #131751: When Merging Areas Clear Screen.active_region if Active Area Changes
Area "close" operation is actually an area merge of some area into the
one being closed. This means that screen->active_region will be
pointing at deallocated RAM. Normally not noticed because active_region
is set very quickly to the new area, but error nonetheless and noticed
by ASAN. This PR sets the screen->active_region to null when merges
change the active area.

Pull Request: https://projects.blender.org/blender/blender/pulls/131994
2024-12-16 22:19:08 +01:00
Jesse Yurkovich
afe0ebeb74 Fix: properly export metaballs to USD
While adding tests I found that metaball export has been broken since
Blender 3.4. It would export each metaball geometry twice.

This looks to have been a side effect of a change to `object_dupli.cc`
which no longer sets the `no_draw` flag for metaballs[1]. With the flag
unset we would end up visiting this particular object twice.

Use a direct check for Metaballs now and add test coverage for the
scenario in general.

[1] eaa87101cd

Pull Request: https://projects.blender.org/blender/blender/pulls/131984
2024-12-16 22:11:07 +01:00
Sean Kim
aecf5ea3c7 Revert "Fix #128257: Crash when using Set Vertex Colors with no brush"
This reverts commit 8d11882d07.

The previous commit was misguided. As explained in #131893 and #131924
the desire for the various paint modes is to allow color operations
regardless of the tool that is currently selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/131983
2024-12-16 20:27:22 +01:00
Laurynas Duburas
e2b834a1b1 Fix #130694: Curves: Bézier points do not respect Individual Origins pivot point
Sets TransData.center with the same logic as in legacy curves
(see `createTransCurveVerts`).

Pull Request: https://projects.blender.org/blender/blender/pulls/131110
2024-12-16 19:35:16 +01:00
Bastien Montagne
84c8ce9b40 Add option to not build depsgraph on file load in background mode.
The new `--disable-depsgraph-on-file-load` commandline option, when used
together with the `--background` or `--command` ones, will prevent
building a depsgraph immediately after loading a blendfile.

The goal is to improve performances of batch-processing of blendfiles by
python scripts. It is intended to become the default behavior in Blender
5.0.

Scripts requiring evaluated data then need to explicitly ensure that
an evaluated depsgraph is available (e.g. by calling
`depsgraph = context.evaluated_depsgraph_get()`).

------

This disables the call to `wm_event_do_depsgraph` in `wm_file_read_post`.

Some quick performances tests:
* The whole `blendfile_versioning` tests gain about 2% speedup. These are
almost always small and simple blendfiles.
* Loading a Gold production file however goes from 26.5s to 3.5s (almost
90% faster) when this new option is specified.

Pull Request: https://projects.blender.org/blender/blender/pulls/131978
2024-12-16 19:05:29 +01:00
Jacques Lucke
b8228303bc Materials: take object and geometry material slot counts into account
Previously, the number of material slots on the geometry (e.g. mesh) was the
ground truth. However, this had limitations in the case when the object had more
material slots than the evaluated geometry. All extra slots on the object were
ignored.

This patch changes the definition so that the number of materials used for
rendering is the maximum of the number of material slots on the geometry and on
the object. This also implies that one always needs a reference to an object
when determining that number, but that was fairly straight forward to achieve in
current code.

This patch also cleans up the material count handling a fair amount by using the
`BKE_object_material_*_eval` API more consistently instead of manually accessing
`totcol`. Cycles uses the the same API indirectly through RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/131869
2024-12-16 18:08:06 +01:00
Julian Eisel
e072853e63 Refactor: File Browser: Split off indicator icon drawing
As mentioned in fb6ac24514 and 9a6beb915d, `file_draw_preview()` is a
rather overloaded and confusing function. I'm trying to make it more
readable.

Split out file indicator icon drawing from the preview drawing function,
there's not much reason for it to be there as well. I rather keep
functions a bit simpler and more manageable.

Also added some comments and tried to make logic a bit more clear.
2024-12-16 17:49:43 +01:00
Julian Eisel
fb6ac24514 Refactor: File Browser: Readability of preview image scale calculations
As mentioned in 9a6beb915d, `file_draw_preview()` is a rather
overloaded and confusing function. I'm trying to make it more readable.

Move image scale calculations to a separate function, reducing perceived
complexity of the function and the number of local variables. Also
rename or remove some variables to be more clear, add comments and move
variables closer to where they are used.
2024-12-16 16:51:59 +01:00
Sergey Sharybin
630c3ce94e Cleanup: Compiler warning on the buildbot
The GCC version on the buildbot does not support attribute on
a class member, resulting in the following warning:

  NOD_node_declaration.hh:577:42: warning: ‘maybe_unused’ attribute ignored [-Wattributes]

Use the `UNUSED_VARS` macro instead to solve the original warning
about member being unused in release builds  without introducing
a warning when using older compiler.

Pull Request: https://projects.blender.org/blender/blender/pulls/131974
2024-12-16 16:18:20 +01:00
Aras Pranckevicius
904b0bdbc9 Cleanup: VSE modifiers type info table
The type info table for VSE modifiers was initialized to point
to global variables on first use. But really there's no reason to do
that, we can just declare the actual table instead. This is both
shorter, and avoids dances with preprocessor (INIT_TYPE macro).

Pull Request: https://projects.blender.org/blender/blender/pulls/131958
2024-12-16 15:18:42 +01:00
Julian Eisel
9a6beb915d Cleanup: File Browser: Improve preview/icon drawing names
`file_draw_preview()` does multiple things and is quite hard to follow
already, it needs some improvents. One issue is naming that I always
found made the function unnecessarily confusing. For example `is_icon`
had nothing to do with the `icon` parameter, you'd have to search around
the code a bit to understand what it was actually representing.

Attempt to make variable and function names more clear.

Also reduce variable scope and add a comment.
2024-12-16 14:49:45 +01:00
Richard Antalik
6ce1e18a5b Fix: VSE: Off by 1 error in retiming
Pull Request: https://projects.blender.org/blender/blender/pulls/131658
2024-12-16 14:47:38 +01:00
YimingWu
d8bc0ff2e4 Fix #131884: Line Art: Inverted object matrix when baking strokes
When baking line art strokes, the object matrix that are used for back
transformation was inverted. Should be `world_to_object` instead of
`object_to_world`. Probably a typo during GPv3 rewrite.
2024-12-16 21:15:14 +08:00
Omar Emara
2eb53ba3b2 Fix: Memory leak when compositor contains unavailable links
The compositor leaks memory when the node tree contains unavailable
links. That's because the compositor doesn't ignore those links when
computing the reference counts for outputs. To fix this, check if the
output is logically linked and return 0 in case it isn't.
2024-12-16 11:13:30 +02:00
Jeroen Bakker
7de4e6d2ee Vulkan: Add support for ReBAR
This adds initial support for ReBAR capable platforms.

It ensures that when allocating buffers that should not be host visible, still
tries to allocate in host visible memory. When there is space in this memory
heap the buffer will be automatically mapped to host memory.

When mapped staging buffers can be skipped when the buffer was newly
created. In order to make better usage of ReBAR the `VKBuffer::create`
function will need to be revisit. It currently hides to much options to allocate
in the correct memory heap. This change isn't part of this PR.

Using shader_balls.blend rendering the first 50 frames in main takes 1516ms.
When using ReBAR it takes 1416ms.
```
Operating system: Linux-6.8.0-49-generic-x86_64-with-glibc2.39 64 Bits, X11 UI
Graphics card: AMD Radeon Pro W7700 (RADV NAVI32) Advanced Micro Devices radv Mesa 24.3.1 - kisak-mesa PPA Vulkan Backend
```

Pull Request: https://projects.blender.org/blender/blender/pulls/131856
2024-12-16 10:09:33 +01:00
Philipp Oeser
e6f6db500e Fix: ED_view3d_depth_override cannot disable overlays
Change from ababc2e01b did not actually behave in a way that the
caller can force-disable overlays [which seems like the intention from
the commit message and also desired behavior for e.g. grease pencil
drawing/reprojecion].

Pull Request: https://projects.blender.org/blender/blender/pulls/131861
2024-12-16 10:04:23 +01:00
Jeroen Bakker
075cc13119 GPU: Missing create info when running tests
When running tests `WITH_GTESTS` and `WITH_GPU_DRAW_TESTS` the
GPUShaderCreateInfo's specfically created for the tests could not be
found. This failed running tests on any backend.

This PR fixes this. The root cause what that the name of the compile
directive was incorrect. It should have been `WITH_GTESTS` but was
`WITH_GTEST`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131956
2024-12-16 09:58:42 +01:00
Omar Emara
86e3adc751 Fix #131874: Compositor crash when Render Layers has no scene
The Render Layers node crashes when the Render Layers node has no scene
assigned. This is just a missing nullptr check.
2024-12-16 10:34:14 +02:00
Aras Pranckevicius
fa742d6194 VSE: Optimize and cleanup modifiers
Originally intended to be a code cleanup that makes the code shorter
(part of VSE quality project #130975), but as a side effect many
modifiers are now faster since they no longer do many branches in
the innermost pixel loop.

Main part is having apply_modifier_op that given the "modifier op"
functor object, instantiates the correct processing function based
on type of image (byte vs float) and mask (none, byte, float), for
a total of 6 possible cases. And then a helper like
apply_and_advance_mask that applies mask based on input and result
in a consistent and not "literal copy paste of code" way across the
modifiers.

Brightness/Contrast, Color Balance, Tonemap modifiers were already
optimized to move branches out of inner loops previously; their
performance remains unchanged. Mask modifier performance remains
unchanged; it is very simple and memory bandwidth limited on my
machine.

Other modifiers, tested on 4K resolution, Win10 / Ryzen 5950X, time
in milliseconds taken to apply the modifier calculation, on a byte
image with no mask:
- Curves: 12.1 -> 7.7ms
- Hue Correct: 24.5 -> 15.8ms
- White Balance: 20.5 -> 13.8ms

Same as above, but on a float image with a byte mask:
- Curves: 13.5 -> 12.3ms
- Hue Correct: 19.7 -> 16.4ms
- White Balance: 19.3 -> 15.9ms

Pull Request: https://projects.blender.org/blender/blender/pulls/131736
2024-12-16 09:32:37 +01:00
Campbell Barton
6b75a8206b Cleanup: remove comments referencing Nurb::trim & redundent #undef 2024-12-15 16:39:08 +11:00
Campbell Barton
7e86f188fb Cleanup: variable naming in vfont_curve.cc
UNICODE code points were named "ascii" or "cha",
use the term "charcode" as used elsewhere in BLF and FreeType.

Also use char32_t internally and add a utility function to apply the
small-caps flag.
2024-12-15 16:12:32 +11:00
Campbell Barton
2f3c768208 Cleanup: add/improve code comments for vfont_curve.cc 2024-12-15 15:41:14 +11:00
Campbell Barton
2336b7c6f8 Cleanup: extract vfont character lazy initialization into a function
Sligly reduce the complexity of vfont_to_curve().
2024-12-15 15:41:12 +11:00
RedMser
ade5b5d878 Cleanup: remove redundant brush_strength_get call
It is retrieved twice (again a few lines below).
Other curve sculpt brushes do not seem to have any more duplicate assignments like this.

Pull Request: https://projects.blender.org/blender/blender/pulls/131917
2024-12-14 23:41:43 +01:00
Jacques Lucke
52989a1b9a BLI: simplify creating the union of multiple index masks
This adds a new function to combine multiple index masks into one.

Pull Request: https://projects.blender.org/blender/blender/pulls/131898
2024-12-14 16:56:16 +01:00
Richard Antalik
21534a705b Cleanup: Refactor VSE retiming code
Move functions, so the file is ordered:
 - Generic retiming logic
 - Sound animation logic
 - Selection code

Also try to keep get/set function close.

Pull Request: https://projects.blender.org/blender/blender/pulls/131660
2024-12-14 16:47:45 +01:00
Jacques Lucke
b33a7ca6e8 Cleanup: quiet warning 2024-12-14 14:12:01 +01:00
Campbell Barton
bcfeeeecda Fix #122466: Underlines on Text objects have overlapping geometry
Resolve by welding overaps between adjacent underline glyphs.

Besides avoiding overlap, this makes underlines work better when the
text follows a curve.

Also remove increased underline width which was originally added in [0].
This may have been done to avoid gaps - which is no longer needed.
Further, underlines typically don't extend beyond the glyphs bounds
so the increased width isn't expected behavior.

[0]: a07394ef2c
2024-12-14 23:32:24 +11:00
Campbell Barton
57ba4c4892 Cleanup: use more descriptive variable names for character building
Also improve const correctness.
2024-12-14 23:17:50 +11:00
Campbell Barton
94d39aac0c Cleanup: spelling (make check_spelling_*) 2024-12-14 23:17:49 +11:00
Campbell Barton
c1951f6508 Cleanup: remove unused variables 2024-12-14 23:17:48 +11:00
Jacques Lucke
ebfbc7757b Fix #128589: allow disabling node group interface UI for custom node tree types
This adds a new `bl_use_group_interface` property that can be set on custom node
group types. By default it is `true` to avoid this being a breaking change. If
it's set to `false` some UI elements related to the built-in node group
interface are hidden.

Pull Request: https://projects.blender.org/blender/blender/pulls/131877
2024-12-14 11:51:19 +01:00
Thomas Dinges
f3e5c17283 Cleanup: Remove legacy GPENCIL code from UI python files.
Also remove unused gpencil modifier defines.

Pull Request: https://projects.blender.org/blender/blender/pulls/131879
2024-12-14 11:19:24 +01:00
Campbell Barton
ff2805fd79 Cleanup: improve naming consistency & use doxy groups for vfont* sources 2024-12-14 16:18:00 +11:00
Campbell Barton
c1e275b334 Cleanup: split vfont curve & text layout into its own file
Refactoring functions out of the 3D text layout funciton was
becoming difficult because vfont.cc mixed API's that use VFont
for different purposes (clipboard, text layout, ID management.. etc).

Split VFont to character & text layout into its own file.
2024-12-14 16:18:00 +11:00
Andrej730
6d555ac2a7 PyDoc: typing fix for Vector.to_tuple
Ref: !131855
2024-12-14 15:36:29 +11:00
Campbell Barton
bbc4cfba6a 3D Text: use placeholder glyph, resolve error handling inconsistencies
Resolve multiple inconsistencies when 3D text could not load fonts.

- When the font wasn't found:
  The default font was used.

- When the font existed but could not be loaded:
  The 3D text would fail to display anything.

- When only the VFont assosiated with a style failed to load:
  The 3D text would fail to display only when the stype existed.

  So toggling bold for example could cause all 3D text to vanish.

Instead of falling back to defaults, display a placeholder glyph
(a hollow rectangle) displayed when the font can't be used.

For the UI fallbacks are fine, for user content, it indicates something
is wrong as needs to be corrected - similar to a bright magenta in
renders when images fail to load. This means it's clear to users when
they have broken paths which need to be corrected.

This also simplifies vfont_to_curve, removing a "goto" to go to the
end of the function to cancel 3D text rendering entirely.
2024-12-14 13:41:37 +11:00
Campbell Barton
569ff08de0 Refactor: move VFontData metrics into their own struct
Prepare to support default metrics for placeholder text.
2024-12-14 13:32:19 +11:00
Sean Kim
baa1a835de Fix #131880: Multires & Front Faces option can cause artifacts
Introduced in 750e3a6fba

The commit above incorrectly passes the `grids` `Span` into the
`calc_front_face` function, causing the calculation to miss vertices in
certain cases, as the function attempts to index instead of reading the
`normals` `Span` directly.

This has the potential to cause crashes too, as the indices of the grid
are not guaranteed to be bounded by the size of the `factors` array.

Pull Request: https://projects.blender.org/blender/blender/pulls/131886
2024-12-14 01:36:02 +01:00
Jacques Lucke
6217f68d88 Fix #122683: wrong internal links in Capture Attribute node 2024-12-13 21:29:00 +01:00
YimingWu
c19f83bb50 Fix #131422: Remove OPTYPE_UNDO flag for cursor snapping operators
Cursor snapping operators does not support undo/is not designed to be
undo-able, and currently you can't undo moving of the cursor anyway, so
remove the `OPTYPE_UNDO` flag to make it not show in the undo history.

Pull Request: https://projects.blender.org/blender/blender/pulls/131427
2024-12-13 20:55:22 +01:00
Jacques Lucke
b3a06149bb Fix #127713: propagate materials in Curve to Mesh node
This adds material propagation in two places to fix the bug:
* Conversion from legacy to new curves.
* From the main curve input to the output mesh in the Curve to Mesh node.

Pull Request: https://projects.blender.org/blender/blender/pulls/131862
2024-12-13 19:36:54 +01:00
Sybren A. Stüvel
efd2e762f7 Refactor: Core, give the IDWALK_CB_… enum an explicit name
Give the `IDWALK_CB_…` enum an explicit name:
`LibraryForeachIDCallbackFlag`. This way the flags are type-safe, and
it's known where values come from. This is much preferred (at least by
me) to just having `int flags`.

Uses of `0` have been replaced with `IDWALK_CB_NOP` as that has the same
value and is of the right type.

One invalid use of `IDWALK_NOP` was detected by this change, and is
replaced by `IDWALK_CB_NOP`.

This change might be incomplete; I gave the enum a name, fixed the
compiler errors, and then also updated assignments like `int cb_flag =
cb_data->cb_flag`. I might have missed some assignments to `int` though.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131865
2024-12-13 17:32:24 +01:00
Sybren A. Stüvel
8dd1eb4e8f Refactor: Core, give the IDWALK_… enum an explicit name
Give the `IDWALK_…` enum an explicit name: `LibraryForeachIDFlag`. This way
the flags are type-safe, and it's known where values come from. This is
much preferred (at least by me) to just having `int flags`.

Uses of `0` have been replaced with `IDWALK_NOP` as that has the same value
and is of the right type.

One invalid use of `IDWALK_CB_NOP` was detected by this change, and is
replaced by `IDWALK_NOP`.

This change might be incomplete; I gave the enum a name, and then fixed
the compiler errors.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131865
2024-12-13 17:32:24 +01:00
Hans Goudey
203ad8ad4b Cleanup: Formatting 2024-12-13 11:15:15 -05:00
Jacques Lucke
c36567d156 Revert "Materials: take object and geometry material slot counts into account"
This reverts commit 47c255e2da.

There are unexpected problems with mesh rendering. Looks like some `max(1, ...)`
are missing.
2024-12-13 16:54:08 +01:00
Hans Goudey
87a1984b96 Cleanup: Rename node "totr" to "draw_bounds"
Pull Request: https://projects.blender.org/blender/blender/pulls/131864
2024-12-13 16:51:56 +01:00
Miguel Pozo
37e09218f5 Cleanup: Overlay: Remove redundant setting
The EARLY_FRAGMENT_TEST(true) from select_id_patch already implies
DEPTH_WRITE(DepthWrite::UNCHANGED)
2024-12-13 16:46:13 +01:00
Clément Foucault
556c69f66d Fix: EEVEE: ASAN use after free during baking with hair
This was caused by the `custom_pipeline_wrapper` being
broken up between sync and submit. This was invalid
API usage.
2024-12-13 16:41:54 +01:00
Michael Kowalski
74512cc5cb USD: on_material_import() and texture IO hooks
Supporting a new on_material_import() USDHook callback.

Also added support for import_texture() and export_texture()
utility functions which can be called from on_material_import() and
on_material_export() Python implementations, respectively.

Pull Request: https://projects.blender.org/blender/blender/pulls/131559
2024-12-13 16:36:22 +01:00