Commit Graph

120055 Commits

Author SHA1 Message Date
Omar Emara
55cc96b556 Compositor: Turn Inpaint node options into inputs
This patch turns the options of the Inpaint node into inputs.

The Distance options were renamed to Size for consistency with other
nodes.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137597
2025-04-16 14:56:00 +02:00
Philipp Oeser
c58d48d25f Assets: tag a brush for unsaved changes when its texture changes
Sort of a followup to d177388979

Resolves the limitation mentioned there "A known limitation with this
will be that changes to dependencies won't be indicated in the brush.
E.g. Changing the texture attached to a brush won't make
the brush be indicated as changed."

Part of #136895

Does not fully fix the report though, seems like deleting/relinking the
brush in `asset_reload` still need to do additional stuff to properly
revert the brush textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/136988
2025-04-16 14:17:06 +02:00
Jacques Lucke
f301dfbb10 Cleanup: Nodes: deduplicate logic to get zone for node
Since nodes are not uniquely assigned to zones (some nodes are in two
zones at the same time), it's better not to expose this detail in multiple
APIs. This avoids having to explain the behavior multiple times.

Now one just has to use `get_zone_by_node/socket` and can then use
a seperate method to get the zone stack for that zone like before.
2025-04-16 14:09:48 +02:00
Endor H
4ee56b9b36 Fix: Crash when dragging assets between nodes area and status bar
The issue was a missing null check in a poll function.

Pull Request: https://projects.blender.org/blender/blender/pulls/137594
2025-04-16 13:39:05 +02:00
Campbell Barton
b37543a3de Fix: linking with only WITH_IO_FBX enabled 2025-04-16 21:22:14 +10:00
Omar Emara
e361054df4 Compositor: Turn Dilate node options into inputs
This patch turns the options of the Dilate node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137593
2025-04-16 12:50:46 +02:00
Omar Emara
e7778593f8 Compositor: Turn Tone Map node options into inputs
This patch turns the options of the Tone Map node into inputs.

In the process, a few changes were made. Input ranges were adjusted to
remove artificial limits. The papers indeed mention those limits, but
they were only mentioned as typical values, not valid ranges.

- The Key option is no longer limited to 1.
- Gamma is no longer limited to a value of 3.
- Intensity is no longer limited to [-8, 8].
- Contrast is no longer limited to [0, 1].

A few renames were done to clarify options and match the reference
papers.

- Offset was renamed to Balance, since it is not really an offset, but
  balances between shadows and highlights. This can be looked up in the
  paper.
- Correction was renamed to Chromatic Adaptation, since it doesn't
  really correct anything.
- Adaptation was renamed to Light Adaptation to distinguish from
  Chromatic Adaptation and now default to global tone mapping, since
  this is more useful by default.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137589
2025-04-16 11:59:04 +02:00
Aras Pranckevicius
cc741fbf99 IO: New FBX importer (C++, via ufbx)
Adds a C++ based FBX importer, using 3rd party ufbx library (design task:
#131304). The old Python based importer is still there; the new one is marked
as "(experimental)" in the menu item. Drag-and-drop uses the old Python
importer; the new one is only in the menu item.

The new importer is generally 2x-5x faster than the old one, and often uses
less memory too. There's potential to make it several times faster still.

- ASCII FBX files are supported now
- Binary FBX files older than 7.1 (SDK 2012) version are supported now
- Better handling of "geometric transform" (common in 3dsmax), manifesting
  as wrong rotation for some objects when in a hierarchy (e.g. #131172)
- Some FBX files that the old importer was failing to read are supported now
  (e.g. cases 47344, 134983)
- Materials import more shader parameters (IOR, diffuse roughness,
  anisotropy, subsurface, transmission, coat, sheen, thin film) and shader
  models (e.g. OpenPBR or glTF2 materials from 3dsmax imports much better)
- Importer now creates layered/slotted animation actions. Each "take" inside
  FBX file creates one action, and animated object within it gets a slot.
- Materials that use the same texture several times no longer create
  duplicate images; the same image is used
- Material diffuse color animations were imported, but they only animated
  the viewport color. Now they also animate the nodetree base color too.
- "Ignore Leaf Bones" option no longer ignores leaf bones that are actually
  skinned to some parts of the mesh.
- Previous importer was creating orphan invisible Camera data objects for
  some files (mostly from MotionBuilder?), new one properly creates these
  cameras.

Import settings that existed in Python importer, but are NOT DONE in the new
one (mostly because not sure if they are useful, and no one asked for them
from feedback yet):

- Manual Orientation & Forward/Up Axis: not sure if actually useful. FBX
  file itself specifies the axes fairly clearly. USD/glTF/Alembic also do
  not have settings to override them.
- Use Pre/Post Rotation (defaults on): feels like it should just always be
  on. ufbx handles that internally.
- Apply Transform (defaults off, warning icon): not sure if needed at all.
- Decal Offset: Cycles specific. None of other importers have it.
- Automatic Bone Orientation (defaults off): feels like current behavior
  (either on or off) often produces "nonsensical bones" where bone direction
  does not go towards the children with either setting. There are discussions
  within I/O and Animation modules about different ways of bone
  visualizations and/or different bone length axes, that would solve this
  in general.
- Force Connect Children (defaults off): not sure when that would be useful.
  On several animated armatures I tried, it turns armature animation
  into garbage.
- Primary/Secondary Bone Axis: again not sure when would be useful.

Importer UI screenshots, performance benchmark details and TODOs for later
work are in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/132406
2025-04-16 09:55:00 +02:00
Jason C. Wenger
7c79c303b8 BMesh: maintain the active face if the active face when joining faces
Whenever faces are merged, resetting the active face is bad.
Do it centrally instead of relying on each caller to fix it.

Ref !137535
2025-04-16 13:34:47 +10:00
Jason C. Wenger
486711d685 BMesh: skip recomputing custom-data when face join uses an existing face
If `f_new` is a double of an existing face and the existing face is
being reused, then the existing face already has custom-data and
multi-res data and etc.

There's also a good case to be made that custom or multireas data on the
existing face might be that way because it was hand-edited by the user,
and therefore it's superior to anything we'd interpolate or copy from
faces being removed.

Change BM_faces_join() to not waste time doing that.

Ref: !137537
2025-04-16 13:18:20 +10:00
Campbell Barton
58d80f281a Fix #137507: collection exporter shows relative paths unsupported
This error is technically correct when the operators path doesn't
support relative paths.

The collection exporter allows relative paths and expands them before
passing the value to the operator.

Resolve by suppressing the warning.

Ref: !137510
2025-04-16 01:16:32 +00:00
Hans Goudey
f445df26f7 Refactor: Mesh: Don't share code between "clear geomtry" and "free"
Clearing a mesh's geometry without freeing the mesh has the requirement
that the mesh remain initialized afterwards. Freeing the mesh doesn't
have that requirement and corresponds to a destructor rather than move
construction with the default value. Avoiding conflating the two
operations simplifies some future feature additions (including #122398).
2025-04-15 18:52:20 -04:00
Hans Goudey
26ed4eec96 Fix #137548: Assert propagating unsupported string attribute type
All users of `retrieve_attributes_for_transfer` don't support string
attributes. This needs a check similar to the other functions in this file.
2025-04-15 18:20:01 -04:00
Clément Foucault
a798c48d0d Fix: EEVEE: Shadow acnee caused by large objects in the scene
This was caused by the shadow map Z range loosing too much
precision on the large object.

This can be replicated by adding a very large object in the scene.
The normaly un-shadowed objects gets shadowed because the
float precision is not enough to represent their depth correctly.

To fix this, we bias the shadow depth by 2 ULP to make sure that
there is no self shadowing.

This bias has already been there, but was somehow removed because
of other fixes that simingly fixed this issue. But they did not.

Pull Request: https://projects.blender.org/blender/blender/pulls/137555
2025-04-16 00:13:48 +02:00
Lukas Stockner
160c5e7b44 Fix: Compositor: Crash in Movie Distortion node with extreme distortions (again)
Second version of 2dff457a7c, now without breaking negative deltas.
Thanks to @OmarEmaraDev for the suggestion.
2025-04-15 23:32:24 +02:00
Sean Kim
900b26181a Sculpt: Extract & refactor Clay Strips brush plane calculation
The Clay Strips brush calculates a brush plane and local matrix to use
for a cube distance test. This test is done based on the sampled plane
center, not the current cursor position.

To make the node mask match this brush area, this commit reworks the
node mask calculation similar to the Plane brush, also calculating the
plane normal and plane center to be used later.

Finally, the relative radius scale of the brush is fixed to be a
constant SQRT(3) to ensure that the cube influence area is fully
circumscribed by the spherical distance query.

Further work here can change the type of BVH distance query done to
reduce the number of nodes processed by the brush.

Resolves #123768

Related to #84169

Pull Request: https://projects.blender.org/blender/blender/pulls/137371
2025-04-15 23:10:18 +02:00
Harley Acheson
dd6b2e648e Fix #116937: Position and Size ICON_TYPE_VECTOR icons by float
We have an icon type called ICON_TYPE_VECTOR that are dynamically drawn
at runtime. These are created in icon_draw_size, which takes float
positions, but their callbacks all use integers instead. Truncating so
early in the process takes away flexibility to draw these at more ideal
sizes or to center them better.  The complaint is a situation where we
mix ICON_TYPE_VECTOR for the colored collections and ICON_TYPE_SVG_MONO
for the white ones. Even though they both ultimately just draw the same
SVG icon the former way truncates position and size so there are times
they won't exactly line up.

Pull Request: https://projects.blender.org/blender/blender/pulls/132338
2025-04-15 23:01:01 +02:00
Sean Kim
f29536931a Fix: object.voxel_remesh operator can crash with 0 for input
Similar to 6c05859b12

Allow a value of 0 to avoid the user input from being clamped to an
arbitrarily small value.

Pull Request: https://projects.blender.org/blender/blender/pulls/137377
2025-04-15 22:31:26 +02:00
Bastien Montagne
699d071414 Fix #137412: Make Local on liboverride can break hierarchy.
Making local an intermediate collection in a liboverride hierarchy e.g.
will likely break the link between the objects in that collection, and
their hierarchy root ID (typically the top overridden collection).

This is fixed by this commit, by:
* Adding a new util, `lib_override_root_is_valid`, that check whether a
  given liboverride ID is still 'connected' to its hierarchy root.
* Using this test in `BKE_lib_override_library_main_hierarchy_root_ensure`
  to strengthen the detection of invalid root hierarchy pointers.
2025-04-15 22:30:07 +02:00
Sean Kim
a49cb2777c Sculpt: Adjust inactive cursor display based on tilt
Part of #82877

This commit applies the same calculation used when tilting the normal to
the inactive cursor display inside sculpt mode, as a way to indicate to
users how the normal is affected by the current tilt settings and pen
orientation.

Pull Request: https://projects.blender.org/blender/blender/pulls/137250
2025-04-15 22:26:40 +02:00
Harley Acheson
e1e250aa84 UI: Consistent Pen Tilt Values
Pen tilt values come into Blender through ghost platforms and device
drivers with inconsistent and ambiguous directions. This PR codifies
that we consider tilt-x positive values to be rightward, negative
values as leftward. Similarly tilt-y positive is away from the user,
negative is toward the user. Comments are updated to make this clear.
This fixes Windows Ink (currently always returning left and away). This
also reverses the Wayland tily-y values to match. We might still have
to consider a user preference to swap directions if we find differences
within a platform.

Pull Request: https://projects.blender.org/blender/blender/pulls/137501
2025-04-15 20:23:32 +02:00
Hans Goudey
937358d58e Point Cloud: Enable object type without experimental option
In the past couple months, the basic operations needed for a new object
type were implemented, as well as basic edit mode tools. With that, the
object type is in a good enough state that it doesn't need to be hidden
behind an experimental option. That also resolves some inconsistency,
because the object type is already created by geometry nodes and used by
importers; it's weird that you can't add it manually as original data.

This also removes the "bounds" drawing flag for the object created from
the add menu. It's unnecessary now and there was even a TODO comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/137546
2025-04-15 20:08:46 +02:00
Pratik Borhade
d330c1ec65 Fix #136998: Cannot assign shortcut to insert single keyframe operator
Shortcut is actually assigned to the operator but inside wrong keymap
("Animation"). When "add shortcut" is invoked for a property within
side panel or properties tab, add the new keyitem to "User Interface"
keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/137080
2025-04-15 19:42:55 +02:00
Hans Goudey
1332c21581 Point Cloud: Implement proportional editing for transform operator
This is very simple since there is no connectivity between points.
2025-04-15 13:24:32 -04:00
Hans Goudey
7b88604396 Fix: Missing point cloud bounds update when deleting points 2025-04-15 13:24:32 -04:00
John Kiril Swenson
7999f720c1 Fix #137321: Can't select handles on full-length scrollbars
Masks for scrollbars were properly shrunk to match their drawn
representation in #135021, however, click logic was not updated
alongside this change.

For one, `mouse_in_scroller_handle` incorrectly assumed that if the
slider filled up the entire scrollbar extents, we would only be able to
select the bar. This code never ran in practice since `scrollers` were
always smaller than their mask, but now that they're the right size,
it's being run. Fix by removing the case.

It is also guaranteed that the "scroller"/"bubble"/"thumb" is not out of
view of the scrollbar track itself because it is clamped at the end of
`view2d_scrollers_calc` (which always runs before
`mouse_in_scroller_handle`), so this is dead code that can be removed.

Finally, rename `mouse_in_scroller_handle` to `scrollbar_zone_get` to
better represent its function.

Pull Request: https://projects.blender.org/blender/blender/pulls/137437
2025-04-15 19:04:19 +02:00
Jacques Lucke
79d9e60076 Geometry Nodes: initial support for showing logged data in closures
This adds initial support for showing logged data in closures. This is more
tricky than the other zone types, because the zone content is evaluated
elsewhere. The main new thing here is a function that attempts to find where a
given closure is evaluated statically.

Finding this place statically is also important because we generally decide
which compute contexts we want to log before evaluation starts. That's because
we don't want to log everything (which is expensive), but just the places that
the user is currently looking at.

This also changed a bunch of CMakeLists.txt files so that these modules can
include NOD_* stuff, which is generally fine everywhere in editors code.

Pull Request: https://projects.blender.org/blender/blender/pulls/137403
2025-04-15 18:03:25 +02:00
Clément Foucault
846d88ed17 Fix #137475: Overlay: Empty point cloud crash with geometry nodes
This was caused by an emtpy VBO being bound as
a texture. This is undefined behavior on some implementation.
2025-04-15 17:56:00 +02:00
Bastien Montagne
436a7d0333 LibOverride: Ignore loopback relationships in hierarchies handling.
Not sure why it was not done before... But it should be fine to
completely ignore the loopback relationships (mainly liboverride
hierarchy root pointers themselves, and owners of embedded and
shape key IDs) when handling hierarchies.

Quick tests on complex production cases here also showed no obvious
issue (or even change at all) with this tweak, so think it's safe to try
it out in main.
2025-04-15 17:28:14 +02:00
Clément Foucault
50063c036c Fix: EEVEE: Assert in render
Caused by d354df7483
2025-04-15 17:28:05 +02:00
Clément Foucault
d354df7483 Fix: EEVEE: Missing update from shading popover properties
These properties were triggering a `view_update` call
but this function callback was removed during the
modernization of the DRW module.
2025-04-15 17:16:28 +02:00
Clément Foucault
b01cdf7df2 EEVEE: Remove shadow ray horizon clipping
This make the shadow rays always multiply the lighting,
which can make renders with large light sources darker.

This bias introduced too many light leaking issues. And
these issues are made more visible since the introduction
of 410282e156.

Its first use was to avoid self shadowing artifacts from
large light sources. Since the shading was already
integrated over the visible hemisphere, it made sense
that the shadowing was also in the visible hemisphere.

However this only works if the shading is actually
clipped to the visible hemisphere above the geometric
normal, which might not always be the case.

Given it is better to have self shadowing noise than
light leaking, it is better to just removing this trick.
Self shadow noise can be mitigated by increasing the
sample count or by increasing the terminator bias.
Light leaking, on the other hand, has no known workaround.

Fix #136594

Pull Request: https://projects.blender.org/blender/blender/pulls/137485
2025-04-15 16:38:52 +02:00
Hans Goudey
bbb9b16c88 Fix: Mesh true vert normals uses incorrect face normals 2025-04-15 10:12:52 -04:00
Jacques Lucke
411d4204f6 Refactor: Geometry Nodes: simplify getting compute context for edittree
This adds a simple `compute_context_for_edittree` function that returns the
"active" compute context for the given node editor. This is used in various
places, but previously one had to construct the compute context in multiple
steps (first find the root context (modifier/operator), then handle the tree
path). Since the edittree already has a specific active context, there should be
an easy way to retrieve that.

This also adds a few extra check that avoid redundant work that was done before.

Pull Request: https://projects.blender.org/blender/blender/pulls/137525
2025-04-15 15:24:29 +02:00
Omar Emara
4940418317 Compositor: Turn Z Combine node options into inputs
This patch turns the options of the Z Combine node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137534
2025-04-15 15:20:02 +02:00
Omar Emara
ab81cd7bbb Compositor: Turn Invert node options into inputs
This patch turns the options of the Invert node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137527
2025-04-15 14:18:04 +02:00
Hans Goudey
d6e8c4c124 Fix #63434: Edit mesh undo does not handle vertex group removal
Seems that this was a fundamental design problem that was resolved
with 3b6ee8cee7.

Since the vertex group names are stored on the mesh now, we can
just store their state in the undo mesh, and restore it when decoding
an undo step.

Pull Request: https://projects.blender.org/blender/blender/pulls/137225
2025-04-15 13:58:37 +02:00
Aras Pranckevicius
6b9de30ff1 Anim: Add function for batch-creation of many f-curves, use in USD import
Creating f-curves one by one is quadratic complexity due to:
1) scanning all existing f-curves for possible name+index duplicates,
2) channelbag invariants recalculation after each f-curve addition.
3) f-curve array storage is reallocated for each f-curve addition.

In cases when many f-curves are created at once (primary case:
importing an animated character), using the newly added
fcurve_create_many is much faster, because it:
1) uses a hashtable for duplicate name+index checking, instead of
   linear scan, and
2) recalculates channelbag invariants just once.
3) does f-curve array reallocation just once.

Importing USD file exported out of Blender Studio "Rain Restaurant"
scene (about 20k f-curves), on Ryzen 5950X goes 2.0 sec -> 0.9 sec.

Pull Request: https://projects.blender.org/blender/blender/pulls/137004
2025-04-15 13:58:01 +02:00
Jason C. Wenger
702efd6846 BMesh: add a BM_faces_join() to return a duplicate face (if found)
Every call to BM_faces_join and BM_faces_join_pair has been adjusted to
provide the new face pointer, and a BLI_assert_msg has been added so
that doubles are now consistently identified and flagged as a problem.
BM_faces_join is now also capable of automatically reusing a double
when it is found. This new behavior is currently unused at this point.
Future patch-sets will begin to use it, allowing simplification of
calling functions.

Ref: !137406
2025-04-15 11:03:15 +00:00
Omar Emara
aacd22c186 Fix: Compositor: Boolean socket fails in shader node
Boolean sockets were not handled in shader nodes, so they were assigned
a NONE GPU type which causes crashes later on. No such sockets exist
yet, so this is a fix for future work.
2025-04-15 12:51:41 +02:00
Bastien Montagne
22818f4a6d Fix #136894: Crashes due to invalid code in ID management.
Own mistake in 3e03576b09, confused `BLI_listbase_findafter_string_ptr`
with a (not yet existing) `BLI_listbase_findafter_string` function.
2025-04-15 12:35:54 +02:00
Bastien Montagne
3d52ac536e BLI_listbase: Add a new BLI_listbase_findafter_string util.
Similar to existing `BLI_listbase_findafter_string_ptr`, but for cases
where the searched property is a char array, and not a char pointer.
2025-04-15 12:35:54 +02:00
Christoph Lendenfeld
d2f1b6570d Anim: Separate transform snapping flags in the driver editor
With the move to the new snapping system,
the snapping flags were no longer stored on the editor but on the scene.
While that is good for all editors that deal with animation,
it also affected the Driver Editor since that is effectively a Graph Editor.
However since the driver editor doesn't deal with frames,
it is unlikely that settings should be shared with other animation editors.

With this PR the Driver Editor gets it's own snapping flag,
which means snapping can be controlled without affecting
other animation editors.

This also removes snapping options
* Snap to markers doesn't make sense, there are no markers in drivers
* Snap to seconds also makes no sense

Only snap to frames, i.e. whole numbers is kept with the option
to snap directly to whole numbers or offset the current position
by a whole number.

Pull Request: https://projects.blender.org/blender/blender/pulls/136826
2025-04-15 12:35:18 +02:00
Jeroen Bakker
5102f33ef9 Fix #137081: Vulkan: Memory leak in descriptor pools.
Descriptor pools were never discarded, leading to out of memory issues
when running for a long time. This PR discards used descriptor pool when
the render graph is submitted to the device.

- Detected that to descriptor sets could be uploaded multiple times
  however once was always empty.
- When render graph is flushed all descriptor pools are discarded.
- Improved debugging of discard pools.

Pull Request: https://projects.blender.org/blender/blender/pulls/137521
2025-04-15 12:18:34 +02:00
Omar Emara
a4e7028b4c Compositor: Turn Split node options into inputs
This patch turns the options of the Split node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137518
2025-04-15 11:43:20 +02:00
Sybren A. Stüvel
57fdaadebb Anim: pose mode Select Mirrored keep unmirrorables selected
The pose mode Select Mirrored operator now keeps bones selected when
they cannot be mirrored.

This means that you can now select the spine and the left arm, mirror
the selection, and it'll have the spine and the right arm selected.
Before this change, all non-mirrorable bones (like the spine) would
always get deselected.

I also snuck in a little bugfix, where locked-for-selection bones could
still get selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/136836
2025-04-15 11:41:46 +02:00
Sybren A. Stüvel
442fba3889 Refactor: clean up code of Pose mode Select Mirror operator
A few smaller cleanups to the pose mode Select Mirror operator.

- Don't store flags in a `void *` on the pose channel, but just use a
  map to store the pre-mirroring selection flags.
- Instead of checking the `extend` flag for every bone, use two
  functions to either add to the selection or set the selection, and use
  the 'extend' flag to choose between those once.
- Flip some conditions and use `continue` to reduce cognitive
  complexity.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/136836
2025-04-15 11:41:46 +02:00
Clément Foucault
47d2dffe8c GPU: Shader CodeBase use constexpr instead of const
Do this only when applicable.

This allow better compile time checking in Shader C++ compilation.
Moreover, this allows to have `constexpr` in shared code between
C++ and GLSL.

After investigation the `const` keyword in GLSL has the same
semantic than C/C++.

Rel #137333 and #137446

Pull Request: https://projects.blender.org/blender/blender/pulls/137497
2025-04-15 11:36:53 +02:00
Omar Emara
f71358d281 Compositor: Turn Switch node options into inputs
This patch turns the options of the Switch node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137512
2025-04-15 11:04:20 +02:00
Jacques Lucke
e02a88929f Refactor: Geometry Nodes: extract function to create compute context for zone
This functionality was duplicated in two places and #137403 adds another place
where it is needed.
2025-04-15 10:36:51 +02:00