Commit Graph

115830 Commits

Author SHA1 Message Date
Jacques Lucke
55cc2fcd46 BLI: slight Vector move constructor improvement
`OtherInlineBufferCapacity <= InlineBufferCapacity` implies
`size <= InlineBufferCapacity` and can be done at compile time.

So if that is true already (as it commonly is), the `else` branch
is not necessary. This can improve performance in theory, although
I couldn't measure that in practice.

Additionally, this change also reduces the binary size (because of the
omitted else branch). Since this code is inlined fairly often, the impact
is measurable: the binary size is reduced by 50kb.
2024-12-13 12:49:46 +01:00
Bastien Montagne
f2949d387c Fix #131793: Blendfile saving in 4.3 can be a lot slower than in 4.2.
Regression from 536fb53dc6. Turns out `Set::clear()` can be orders
of magnitude slower than `Set::clear_and_shrink()` in some
worst-case scenarii.
2024-12-13 12:25:31 +01:00
Pratik Borhade
a1fc2eb37a UI: Outliner: Support ctrl/shift operations for exclude collection
All restriction toggles supports:
- isolating active element with ctrl click
- Recursively set values to child when holding `shift`,

except "exclude" property. Now added support for `exclude` property in
this PR. When clicked on property of active collection, excute
`view_layer__layer_collection_set_flag_recursive_fn`.

Resolves #131366

Pull Request: https://projects.blender.org/blender/blender/pulls/131423
2024-12-13 12:20:25 +01:00
Julian Eisel
126d59efdd Fix: UI: Crash when trying to display invalid icon
Requesting an icon from an invalid icon ID was always handled
gracefully, resulting in the icon not being shown and an error print in
debug mode. 2b7a968909 caused a null pointer dereference in that case,
leading to a crash.
2024-12-13 11:33:37 +01:00
Pratik Borhade
3dfb7830a6 Fix #131705: Crash when ui created with prop_with_menu
button created from python (`ui_def_but_rna`) does not seem to assign
free/copy callbacks to the menu with rnaprop. So instead of an assert
check, assign callback functions in `ui_but_rna_menu_convert_to_menu_type`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131719
2024-12-13 11:19:13 +01:00
Aras Pranckevicius
aa88b996e4 Cleanup: remove old CPU compositor code
40 thousand lines of now-unused code, poof gone. Blender
executable (Windows, Release config) becomes 670 kilobyte smaller.

Pull Request: https://projects.blender.org/blender/blender/pulls/131819
2024-12-13 10:59:54 +01:00
Sybren A. Stüvel
c116ed473e Anim: explicity handle node trees when rebuilding action slot user cache
Instead of using `BKE_library_foreach_ID_link()` as a way to find
embedded IDs in a generic way, explicitly just get the embedded node
tree. That's the only animatable embeddable ID anyway. And calling
`BKE_library_foreach_ID_link()` can have some unwanted side-effects
(especially when the rebuilding happens while already using a similar
function to loop over IDs).

Pull Request: https://projects.blender.org/blender/blender/pulls/131807
2024-12-13 10:45:48 +01:00
Sybren A. Stüvel
0fb8a64900 Anim: make Slot::users_remove() gracefully deal with duplicate users
`animrig::Slot::users_remove()` now also works when there are multiple
occurrences of the same ID. Because of the above-mentioned pointer
remapping now working correctly, the pointers in the slot user list
are not 100% under control of the Slot class, and thus there could
hypothetically be duplicates there.

This doesn't fix any concrete issues, it's just a safety measure.

Pull Request: https://projects.blender.org/blender/blender/pulls/131806
2024-12-13 10:42:54 +01:00
Hans Goudey
09ef6c1a12 Fix: Stack buffer overflow in BoneStickData constructor
`float4(float3 &)` is currently problematic because of implicit conversions
to and from `float *`. Writing the constructor explicitly fixes the problem.
Also add const to the arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/131828
2024-12-13 10:29:20 +01:00
Jeroen Bakker
b8d67aa10f Vulkan: Make provoking vertex optional for MoltenVK
Provoking vertex isn't supported by Metal and MoltenVK. As it only has
some minor artefacts we make it optional when using MoltenVK.

Pull Request: https://projects.blender.org/blender/blender/pulls/131815
2024-12-13 09:56:37 +01:00
Jeroen Bakker
c698edcf70 Vulkan: Ensure no gaps between attachments when using MoltenVK
MoltenVK dynamic rendering is built on top of render passes and framebuffers.
This also means that dynamic rendering has the same limitations.

This PR enables the workarounds for gaps between attachments for MoltenVK.

Pull Request: https://projects.blender.org/blender/blender/pulls/131816
2024-12-13 09:55:18 +01:00
Omar Emara
718e58fb3b Compositor: Optimize Dilate Distance Threshold node
This patch optimizes the Dilate Distance Threshold node by skipping
out-of-bound access in the structuring element window. Gives a 2x
improvement.

Pull Request: https://projects.blender.org/blender/blender/pulls/131835
2024-12-13 09:37:46 +01:00
Campbell Barton
c16f56c219 Cleanup: remove unused VChar::index
Also use a uint for the character argument since there is no reason
to use a larger type than a 32 bit integer.
2024-12-13 16:50:23 +11:00
Campbell Barton
c9886ca90a VFont: correct log ID 2024-12-13 12:59:15 +11:00
Campbell Barton
5ce10722ab Revert "Fix #122808: Use Default Font when Vfont Missing"
This reverts commit 26ea1f42c3.

In line with [0] which prevents default characters from being used when
a font is selected, don't return characters from the default font when
the font cannot be loaded.

This should be addressed using place holder characters instead.

[0]: 6fa5295c1d
2024-12-13 12:57:37 +11:00
Harley Acheson
5ae220af06 Fix #131743: Consistent Fallback Font Search Order
Currently when a character is requested that is not found in the
selected font we first look in other fonts that are already loaded that
include some of the requested Unicode range. If not found in any of
those we then look in unloaded fonts. But multiple fonts often have
overlapping coverage, so this means you can sometimes get a character
from different fonts depending on the order they are requested. Since
the design of that character could differ, this can lead to visual
changes. This PR changes the fallback search to do so in a consistent
order, not favoring loaded or unloaded. This does not lead to any
measurable performance changes in testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/131812
2024-12-13 01:29:53 +01:00
Campbell Barton
48bf2c08b7 Fix experemental preference use when "Developer Extras" is disabled
When "Developer Extras" is disabled, the experemental options
must not be used.

Some checks for experemental options weren't using the macro which
checks both are set.

Add comment to avoid this happening in the future.
2024-12-13 11:25:39 +11:00
Hans Goudey
da8ecea151 Refactor: Nodes: Move socket field status to array
Instead of storing an optional in the runtime data of each node,
move the field status for the socket to an array in the node tree's
runtime data. This wasn't possible before because selecting nodes
reordered nodes which caused too much cache recomputation.

The benefit is having less geometry-nodes specific data in the
node socket runtime struct, and a slight move to a more data-
oriented storage format.

Pull Request: https://projects.blender.org/blender/blender/pulls/131822
2024-12-12 23:52:39 +01:00
Miguel Pozo
b295df7345 Refactor: Overlay: Port "next" shaders declarations to static CreateInfos
Use static CreateInfos for Overlay-Next shaders using a similar approach to Workbench shader variations.

Remove unused infos and shader sources.
Remove the `gpu_shader_create_info_get_unfinalized_copy` workaround.

Pull Request: https://projects.blender.org/blender/blender/pulls/131514
2024-12-12 23:05:00 +01:00
Harley Acheson
6fa5295c1d 3D Text: only use fallback characters for the default font
When the user selects a font, only use characters from that font,
see code comments in BKE_vfontdata_char_from_freetypefont
for details.

Partially reverts [0] which changed behavior when VFont was
updated to use BLF.

Ref: !131821

[0]: 604ee2d036
2024-12-13 09:01:57 +11:00
Campbell Barton
f7ce3a23fe Cleanup: quiet GCC parentheses warning 2024-12-13 09:01:54 +11:00
Sean Kim
e56c9fc342 Fix #131820: Sculpt brush strength visualization too large
Mistake in 0a6e7e9140

Pull Request: https://projects.blender.org/blender/blender/pulls/131823
2024-12-12 22:39:43 +01:00
Hans Goudey
cd7b901355 Cleanup: Remove unused Grease Pencil legacy functions 2024-12-12 16:17:08 -05:00
Jesse Yurkovich
7eefbd1178 Build: USD: Small change to allow compiling against both 24.05 and 24.11
Handle the different boost python namespaces in the very recently added
code from `0df5d8220b4`

Pull Request: https://projects.blender.org/blender/blender/pulls/131817
2024-12-12 21:00:42 +01:00
Jason Fielder
81f9df606a Fix #130700: Release Metal resources after each frame when rendering Python animations.
Rendering animations from Python scripts via `bpy.ops.render.opengl()`
did not trigger any of the notifications in the Metal back-end to
indicate a frame had been rendered and that the associated resources
could be released. This adds a call to GPU_render_step() after each
render. For the original asset in the bug report this reduces the high
memory watermark from 30gb to 13gb for 500 frames. 13gb is likely
still too high and therefore it is likely there are additional leaks
that need to be addressed so this should only be considered a partial
fix.

Authored by Apple: James McCarthy

Co-authored-by: James McCarthy <jamesmccarthy@apple.com>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/131085
2024-12-12 20:30:18 +01:00
Aras Pranckevicius
82f0578ca3 Compositor: always use the new CPU compositor
Part of #125968: this makes the new CPU compositor always be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131783
2024-12-12 20:17:36 +01:00
Sybren A. Stüvel
7d5143e94c Revert "Refactor: Core, give the IDWALK_… enums an explicit name"
This reverts commit 3ef748789d. It was
landed too hastily, my apologies.

Pull Request: https://projects.blender.org/blender/blender/pulls/131813
2024-12-12 20:03:27 +01:00
Clément Foucault
afb0d41107 EEVEE: Make sampling.reset() and sampling.is_reset() viewport only
This commit ensures correct usage of these functions.
Usage of them was not guarded and caused issues in render.

Fix #131804
2024-12-12 18:49:58 +01:00
Jacques Lucke
8e1aec7664 Fix #108520: Store Named Attribute node does not propagate values if domain changes
Don't just initialize new values to zero but actually take the existing attribute into account.
Once supported, this can also automatically take defaults for built-in attributes into account
without further changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131794
2024-12-12 18:11:45 +01:00
Hans Goudey
4ca3f02601 Refactor: Nodes: Improve socket node lookup functions
- Use return values instead of return arguments
- Remove the socket index lookup which was only used once
- Always use the topology cache for node_find_node
- Improve the documentation
- Add a const version of node_find_node

Overall, I think always using the topology cache will give more
predictable performance. Though it may require more cache
rebuilds after the node tree is changed, in practice there are
plenty of other things that require that already. This way, code
that doesn't change the node tree will get better performance
without having to think about the caching.

Pull Request: https://projects.blender.org/blender/blender/pulls/131811
2024-12-12 18:04:36 +01:00
Sybren A. Stüvel
3ef748789d Refactor: Core, give the IDWALK_… enums an explicit name
Two commits that basically do the same thing for two `enum`s: give
them a name.

- the `IDWALK_…` enum → `LibraryForeachIDFlag`.
- the `IDWALK_CB_…` enum → `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_NOP` and `IDWALK_CB_NOP`,
as those have the same value and are of the right type.

One invalid use of `IDWALK_NOP` was detected by this change, and is
replaced by `IDWALK_CB_NOP`. And another one in the opposite
direction.

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.

----------

I intend to land this PR as its two separate commits. I just put them in the same PR so the buildbot can handle them in one go, and we don't have a stack of highly relatled PRs.

In the future this could also apply to the `IDWALK_RET_…` enum. This one I left out, though, because a proper cleanup there would also have to include their ambiguity on whether they are bitflags (like the enums in this PR) or not. Their values and the code in `BKE_lib_query_foreachid_process()` implies they are bitflags, but in practice they are never or'ed together and just used as discrete values.

Pull Request: https://projects.blender.org/blender/blender/pulls/131803
2024-12-12 17:28:28 +01:00
Germano Cavalcante
ba6b4d4553 Fix: mixed snap not working on geometry generated by curves
`snap_polygon` and `snap_edge_points` were, for no reason, limited to
Mesh type Objects.
2024-12-12 13:10:36 -03:00
YimingWu
bda221ef2e Fix #131711: Grease Pencil: Null check when getting material passes
The material returned by `BKE_object_material_get` could be nullptr when
the material is somehow not a grease pencil material and this situation
needs to be handled. This is likely caused by faulty file from previous
verisons.

Pull Request: https://projects.blender.org/blender/blender/pulls/131714
2024-12-12 17:04:21 +01:00
Omar Emara
e7dfc1c939 Compositor: Optimize Distance Dilate node
This patch optimizes the Distance Dilate code by limiting the search
window to areas within the image, avoiding fallback image sampling and
looping redundant pixels. Gives a 1.8x improvement.
2024-12-12 17:53:44 +02:00
Falk David
635c9c8303 Cleanup: Grease Pencil: Remove using namespace math
This was causing issues after updating tbb and compiling on msvc.
2024-12-12 16:49:11 +01:00
Bastien Montagne
0e0b7e3294 Fix #131748: Error with pasting pose on liboverride armature.
Either initial fix (9405bd25d6) was not fully correct (and properly
tested), or something else changed since then, but the handling of
liboverrides in copy/paste of poses would not be correct for local
overrides.

Instead of relying on generic `BKE_lib_id_make_local` to also work
for local liboverrides, add some more logic in `PartialWriteContext::make_local`
to properly handle local liboverrides when the override data needs to get
removed in the copy buffer blendfile.

NOTE: Not super-happy with how make local and removal of liboverrides
somewhat mix together currently. Will need to revisit once again that
whole process at some point.
2024-12-12 15:45:33 +01:00
Laurynas Duburas
3cbeb8ff2b Curves: Remove usage of IndexMask::operator[] in transform
Removes usage of `IndexMask::operator[]` in transform
function `curve_populate_trans_data_structs`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131784
2024-12-12 15:36:24 +01:00
Jacques Lucke
54f8ef12d8 Fix: crash when using subdiv modifier on curves
This only affected the drawing of the modifier UI, not the actual evaluation.

There was a missing check for the object type before retrieving the data from it.
2024-12-12 14:23:54 +01:00
Philipp Oeser
a01fd34f2d Fix #131785: EEVEE samples affected by (disabled motionblur) samples
This was reported for freestyle, but was also the case for regular
renders.

So even though MotionBlurModule::init and MotionBlurModule::step return
early when motionblur is disabled, Sampling::init would still up the
samples with motionblur samples (even if motionblur was disabled
alltogether).

To resolve, only do this when motionblur is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/131795
2024-12-12 14:03:49 +01:00
Hans Goudey
c3cc3c019d Fix #103785: Geometry Nodes attribute inputs aren't overridable
The "use attribute" and "attribute name" IDProperties were missing
the overrideable status and the static type status. This was an oversight
from when those tags were added.

This commit fixes the flag on new modifier properties as they're created
and applies versioning to old properties. It also fixes the poll of the toggle
input attribute operator so that it isn't possible on non-editable objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/131768
2024-12-12 13:48:52 +01:00
Jeroen Bakker
16a739dc8a GPU: Add unpack row length tests
This PR adds 2 test cases to test uploading sub texture with and
without unpack row length.

Ref #130977

Pull Request: https://projects.blender.org/blender/blender/pulls/131791
2024-12-12 12:58:16 +01:00
Jeroen Bakker
567595e850 Fix: GPU: OpenGL texture tests
Some texture roundtrip tests are not supported on OpenGL. This PR will
skip these tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/131792
2024-12-12 12:57:41 +01:00
Clément Foucault
f6ecd033de Cleanup: DRW: Remove unused functions and variables 2024-12-12 12:53:20 +01:00
Jeroen Bakker
d7c45e6e0c Fix #131754: Out of bounds when drawing active UDIM tile.
There is a case where the active image index could be placed on an
non-existing tile. This PR fixes this by keeping track of the active
tile when looping over all tiles.

Pull Request: https://projects.blender.org/blender/blender/pulls/131789
2024-12-12 12:29:06 +01:00
Jacques Lucke
c22ade6993 Fix #131175: corrupted data when unpacking bake on windows
The issue was that on windows any `\n` byte would be written as
`\r\n` which corrupts the data, unless `std::ios::binary` is provided.
2024-12-12 12:08:42 +01:00
Omar Emara
c8da04a150 Fix: Compositor returns zero for Speed pass
The GPU compositor and the new CPU compositor return zero for the Speed
pass, that's because the output identifier was used as the pass name
which is not guaranteed to work for existing files. To fix this, use the
socket data pass name instead.
2024-12-12 12:11:23 +02:00
Campbell Barton
3e9578485f Fix 3D text underline/rotation depending on the last characters style 2024-12-12 16:09:35 +11:00
Campbell Barton
396fbec4ed Fix 3D text alignment depending on the last characters style
As characters were evaluated, the VFontData was set.
This was then used to calculate text alignment.

Resolve by always using the "Regular" font metrics.
2024-12-12 16:09:35 +11:00
Campbell Barton
4e5a6846bf Refactor: use a struct to track font style in vfont_to_curve
No functional changes, prepare for fixes related to tracking style.
2024-12-12 16:09:35 +11:00
Campbell Barton
2c54da78d1 Cleanup: de-duplicate check in vfont_to_curve 2024-12-12 16:09:35 +11:00