Commit Graph

120055 Commits

Author SHA1 Message Date
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
Hans Goudey
f8b914e004 Cleanup: Remove unused node preview variables
These were only written to, never read.
2024-12-13 10:27:11 -05:00
Philipp Oeser
ed1baf0091 Fix #131596: Grease Pencil: "Reproject to View" is wrong
Previous method of doing the projection from the spot of the camera
was not reliable (depending on where the view/camera was located).

Instead, use the same ray origin for all methods and define the plane at
the placement location (with the view direction).
This is also easier to read I think.

Pull Request: https://projects.blender.org/blender/blender/pulls/131790
2024-12-13 16:25:47 +01:00
Miguel Pozo
9ec5a0cb02 Fix #131846: Overlay: Wireframe missing
Regression from b295df7345
Fix fragment/selection logic
2024-12-13 16:04:51 +01:00
Weizhen Huang
c99b7e66b2 Cycles: support Mie Scattering with particle size smaller than 5um
Previous implemenation of 5 < d < 50 was taken from the main paper,
fitting for smaller sizes are found in the supplemental. They are less
forward-scattering.

Pull Request: https://projects.blender.org/blender/blender/pulls/130234
2024-12-13 15:50:54 +01:00
Jacques Lucke
47c255e2da 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/131761
2024-12-13 15:47:04 +01:00
Hans Goudey
bd8edc7c27 Fix #91917: Animation editor useless names for nodes & geometry nodes
This PR improves the animation editor's display of node socket property
animation names, and names from geometry nodes modifier inputs. In both
cases, the names currently displayed are not very useful.

For geometry nodes inputs, the we now look up the name of the the input
rather than just displaying the identifier from the IDProperty name.

For node sockets, we now display the name of the socket instead of just
"Default Value" (which is technically the name of the RNA property).
We also display the label of the node if it's available. We also display
node labels instead of names for node properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/131766
2024-12-13 15:25:03 +01:00
Sybren A. Stüvel
d426813da4 Cleanup: Node tree: document animatability assumption of embedding ID
Add a comment that documents the assumption that a node tree can only be
embedded by animatable ID types. At this moment this assumption holds.

`blender::animrig::internal::rebuild_slot_user_cache()` uses this for an
optimisation. It fully skips all non-animatable IDs, and would therefore
also not see any hypothetically animated node tree embedded in a
non-animatable ID type.

Pull Request: https://projects.blender.org/blender/blender/pulls/131844
2024-12-13 15:16:21 +01:00
Clément Foucault
b006a2c67b Fix: EEVEE: ASAN memcpy-param-overlap when reading float3 passes
Using a temporary variable fixes the issue.
2024-12-13 15:04:55 +01:00
Aras Pranckevicius
7e7f4f0cee Cleanup: Remove WITH_COMPOSITOR_CPU option (compositor is always in)
Compositor is a required feature and parts of it have been always
included anyway. Remove WITH_COMPOSITOR_CPU build option.

Pull Request: https://projects.blender.org/blender/blender/pulls/131838
2024-12-13 14:54:19 +01:00
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