Commit Graph

119087 Commits

Author SHA1 Message Date
Harley Acheson
914d2e8164 UI: Reverse Pen Y Tilt Expected Direction
It is more convenient for math reasons, for Blender to treat a pen tilt
toward the user as a positive angle. This PR just reverses all the
comments about the expected values. And also reverses the values from
WinTab, Windows Ink, and Wayland to match.

Pull Request: https://projects.blender.org/blender/blender/pulls/137636
2025-04-17 04:26:58 +02:00
Jason C. Wenger
4e37bd8c65 Fix #70977: Dissolve can create duplicate faces
Prevent dissolve leaving duplicate faces when dissolving edges.

Also use the builtin reuse of duplicate faces provided by BM_face_join()
instead of doing it manually.

Ref: !137634
2025-04-17 12:14:49 +10:00
Campbell Barton
64f5dee6d7 Cleanup: spelling in comments (make check_spelling_*) 2025-04-17 12:06:12 +10:00
Richard Antalik
57c5228b86 Fix: VSE cache invalidates all strips
Caused by checking if strip frame index falls into a range instead of
timeline frame. This was introduced in 6a39d79967 and was incorrect
solution to the issue.

Cache key had `timeline_frame` field, which was removed, because it is
not updated when strip moves. The value is now calculated from frame
index.

The issue was not very noticable especially when working with larger
strips, but the behavior was incorrect and confused me when working on
cache related features.

Pull Request: https://projects.blender.org/blender/blender/pulls/137583
2025-04-17 02:36:49 +02:00
Richard Antalik
5b9b4661ec Fix #137541: Search in Properties Editor throwing errors
In bf18e8f814, `buttons_context_compute()` was moved "upstream" in code
path, as a de-duplication effort. But this wasn't correct, because
function `property_search_for_context()` was executed in a loop where
the tabs were iterated over.

This commit moves `property_search_for_context()` back where it was
before.

Pull Request: https://projects.blender.org/blender/blender/pulls/137576
2025-04-17 02:36:18 +02:00
Harley Acheson
101d8782f7 UI: Increase Contrast of Scroll Bar Thumb for Light Themes
Since 115d809358 the scroll bars are darker on light theme. But this
makes the circular "handles", in Timeline for example, to not be
visible. This is because we start with the item color and then make
it darker when over a threshold. But we never make them lighter when
they are dark. This PR makes these darker or lighter depending on the
base color.

Pull Request: https://projects.blender.org/blender/blender/pulls/137618
2025-04-17 01:29:06 +02:00
Hans Goudey
b52554b475 Cleanup: Simplify ID management in edit mesh undo
Currently this code uses the `Mesh` struct as a value embedded in the
undo step struct. This causes the need for various hacky workarounds and
abstraction leaks. It's simpler to just allocate it in the regular way
The Shape Key ID can also be freed with the regular ID free function,
avoiding the need to expose the internal free function.

Pull Request: https://projects.blender.org/blender/blender/pulls/137613
2025-04-17 01:09:23 +02:00
Clément Foucault
e9127fd57a Cleanup: Metal: DeDuplicate sources in Cmakefile 2025-04-17 01:04:33 +02:00
Clément Foucault
9d2c09ee2a Fix: Metal: Broken tests because of partial renaming 2025-04-17 01:03:46 +02:00
Sean Kim
c17d6d1893 Cleanup: Move most brush code to nested brushes namespace
Pull Request: https://projects.blender.org/blender/blender/pulls/137567
2025-04-16 23:57:01 +02:00
Jacques Lucke
a0444a5a2d Geometry Nodes: support viewers in closures
This adds support for having viewer nodes in closures. The code attempt to
detect where the closure is evaluated and shows the data from there.

If the closure is evaluated in multiple Evaluate Closure nodes, currently it
just picks the first one it finds. Support for more user control in this case
may be added a bit later. If the Evaluate Closure node is in e.g. the repeat or
foreach zone, it will automatically use the inspection index of that zone to
determine what evaluation to look at specifically.

Overall, not too much had to change conceptually to support viewers in closures.
Just some code like converting between viewer paths and compute contexts had to
be generalized a little bit.

Pull Request: https://projects.blender.org/blender/blender/pulls/137625
2025-04-16 23:35:59 +02:00
Clément Foucault
f2cfa822da Fix: DRW: Broken or non-deterministic tests
The test_draw_submit_only was broken because of the
empty pass optimization #135875. Making the passes
non-empty fixes the test.

`eevee_surfel_list` has non-deterministic result. This
should be investigated in the future.
2025-04-16 21:48:47 +02:00
Clément Foucault
0b2a178efc Fix: DRW: Uninitialized mutex in tests
Tests were calling the submission mutex without
init. Adding functions to expose only setting
up the submission mutex instead of the full
DRW context (which is uneeded here).
2025-04-16 21:38:19 +02:00
Clément Foucault
92496bbfaf Fix: DRW: Nullptr dereference in tests
This happens because there is no global context set
when running the draw tests. Removing the global
access fixes the issue.
2025-04-16 21:36:13 +02:00
Clément Foucault
70570e8571 Fix: GPU: Broken compilation on Mac 2025-04-16 21:34:18 +02:00
Clément Foucault
5bd572d4fd Cleanup: Overlay: Remove _next in overlay filename
These are not needed anymore since the legacy codebase
is gone.
2025-04-16 20:51:24 +02:00
Clément Foucault
2cc0dad451 Cleanup: Overlay: Remove overlay_private.hh and share uv line style enum 2025-04-16 20:46:14 +02:00
Clément Foucault
0f71bb6c71 GPU: Rename shader_shared.h files to .hh
This makes more sense now that everything is C++.
2025-04-16 20:26:48 +02:00
Clément Foucault
a6fa1b5969 DRW: Rename common_*_lib.glsl to follow module prefix 2025-04-16 20:19:09 +02:00
Clément Foucault
f2025f28e7 DRW: Move fullscreen vertex shader to gpu common
This makes no sense to have in the draw namespace.

Also take the opportunity for making the coordinates
a float2 and rename them to something more descriptive.
2025-04-16 20:09:28 +02:00
Hans Goudey
07333adc72 Cleanup: Make CustomData function private 2025-04-16 13:56:02 -04:00
Hans Goudey
63957cf541 Cleanup: Move CustomData_blend_write_prepare to proper section 2025-04-16 13:56:02 -04:00
Clément Foucault
6048a7a765 GPU: Preprocessor: Allow function argument to be references
Pull Request: https://projects.blender.org/blender/blender/pulls/137612
2025-04-16 19:42:27 +02:00
Clément Foucault
50dc6c0060 GPU: Preprocessor: Make source type extension convert to enum type
This allow to clearly define what type of preprocessing to
apply to which file type.
2025-04-16 19:41:51 +02:00
Clément Foucault
ac7e361f3d GPU: Expose preprocessor through API
This is needed to preprocess some source inside the
`intern` directory.
2025-04-16 18:50:10 +02:00
Habib Gahbiche
2d2de60655 UI: Compositor: use viewport icon to indicate active viewer
Viewer nodes in compositor now show the eye icon when they are active,
so after https://projects.blender.org/blender/blender/pulls/134949
both geometry nodes viewers and compositor viewers look the same.

The only remaining difference is that in geometry nodes, clicking on
the eye icon deactivates the viewer and the node tree output
is shown instead. This is not possible in the compositor currently,
because at least one viewer must be active in the node tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/134417
2025-04-16 17:56:03 +02:00
Hans Goudey
ce8bfd6f8f Cleanup: Add comment with reasoning for edit mode object update tag 2025-04-16 11:53:02 -04:00
Pratik Borhade
7dea50e30d Fix #137466: Unable to assign shortcuts to 'weight' operators in Weightpaint Mode
Operators like smooth weights, or transfer weights are exposed in
weight mode. Their definition has `OBJECT_OT_*` prefix, this appends
shortcuts key on those operators to "object mode" keymap. Use
`WM_keymap_guess_from_context` instead. This will allow new shortcut
keys to relevant keymap when object operator is exposed in 3d view.

Pull Request: https://projects.blender.org/blender/blender/pulls/137519
2025-04-16 17:50:02 +02:00
Habib Gahbiche
535d9c63e1 UI: Improve default position of shader nodes
After creating a new shading material, the new node tree might become invisible and the user has to scroll down to see the nodes.

The idea of this PR is to create nodes with x-positions centered around zero, such that they are always visible no matter the screen size or workspace setup. Ideally, the nodes' position should depend on the region's zoom and pan. However, the node creation code currently does not depend on `SpaceNode`, so such solution would complicate the code a bit. Also, this heuristic seem to work well enough for most cases.

Note: this only affects newly created materials. The material of the default cube and the default world material still have invisible nodes sometimes. This is because they are saved in the startup file, which will be addressed in a different patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/136926
2025-04-16 16:25:20 +02:00
Habib Gahbiche
e8a66c0108 UI: Geometry Nodes: Use viewport icon for viewer node
For consistency with other parts of Blender, the geometry visibility in the viewport is controlled by the viewport icon. The compositor will still have the eye icon for previews, but viewer nodes will get the viewport icon, also for consistency reasons.

Pull Request: https://projects.blender.org/blender/blender/pulls/134949
2025-04-16 15:59:58 +02:00
Omar Emara
7f02fd3192 Compositor: Turn Pixelate node options into inputs
This patch turns the options of the Pixelate node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137603
2025-04-16 15:34:50 +02:00
Aras Pranckevicius
fd52a005ec Fix compile warning 2025-04-16 15:57:09 +03:00
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