Commit Graph

116231 Commits

Author SHA1 Message Date
Habib Gahbiche
55c38c9850 Fix #127254: Compositor crop gizmo suggests there is a valid crop when there isn't one
Prevent users from creating an invalid bounding box for cropping. The user input is checked and is overridden if it will invert the bounding box, i.e. `xmin > xmax` and `ymin > ymax` of gizmos is not allowed.

Pull Request: https://projects.blender.org/blender/blender/pulls/128550
2025-01-08 12:14:31 +01:00
Aras Pranckevicius
368c5b245b Fix #123821: VSE Curves modifier does not update when switching between Standard/Filmic
The issue was that the current frame was already cached, and the cache
was not invalidated when switching CurveMapping "tone"
(standard/filmic) property.

There does not seem to be a good way of doing it, besides scanning
the whole scene searching for which strips use the modified curve
mapping.

Various other properties of curve mapping seem to work right now, as
a byproduct of cache invalidation being done at UI level, not RNA
level. Arguably (see comments on #123821) these should not be done at
UI level, but that's for another day. The reason why "tone" is not
done at UI level is that the UI widget is different (just a button)
and is hard to hook up invalidation logic into that.

Pull Request: https://projects.blender.org/blender/blender/pulls/132742
2025-01-08 11:33:21 +01:00
Aras Pranckevicius
e0044790d3 Fix #115493: AV1 lossless encoding is not actually lossless
All other YUV based codecs switch from default 4:2:0 YUV layout
(which is lossy) to a full resolution 4:4:4 YUV. However AV1 was not
doing that, probably by oversight.

Pull Request: https://projects.blender.org/blender/blender/pulls/132738
2025-01-08 11:26:53 +01:00
Aras Pranckevicius
5839d03c0b Fix #85392: Clarify movie clip theme color labels
Theme color UI labels for both path_before and path_keyframe_before
(and likewise for "after") were identical. Clarify them.

Pull Request: https://projects.blender.org/blender/blender/pulls/132745
2025-01-08 11:25:31 +01:00
Campbell Barton
7e8dcf77db Cleanup: pass UnitSettings as a const reference 2025-01-08 21:22:45 +11:00
Campbell Barton
e949ff7334 Fix unit scale use when when units were disabled
UnitSettings::scale_length was used to scale reported
values for operators (translate, shrink-fatten, voxel-size).

This isn't expected as the value isn't editable when the unit-system
is set to None.

Add BKE_unit_value_as_string_scaled utility function for clarity &
to ensure scaling is only applied when it should be.
2025-01-08 21:07:23 +11:00
Campbell Barton
361e98b09e Cleanup: move BKE_scene_unit_scale to BKE_unit_value_scale
This doesn't use any scene types, move to BKE_unit.hh
2025-01-08 21:03:50 +11:00
Aras Pranckevicius
5ef08c2a96 Fix #112586: VSE can't use multi-layer EXR images
The rest of blender does handle multi-layer EXR images, using the
"combined" or RGBA/RGB layers when the visual result is needed. Make
VSE do the same.

While fixing this, I found several issues in other not well tested code
and had to fix them:

- IMB_buffer_float_from_float_threaded was wrongly using source channels
  as destination channels, producing garbage result.
- IMB_scale_into_new was not assigning channels to destination image.

Pull Request: https://projects.blender.org/blender/blender/pulls/132790
2025-01-08 10:45:24 +01:00
Julian Eisel
d7a480e863 Fix #79937: Brush cursor doesn't draw under transparent tool panel
Paint cursor polling and drawing should get the active region via
`bScreen.active_region`, since this handles overlapped regions better.
This way the cursor handling will still get the main region while
hovering transparent parts of the sidebar, headers or other overlapped
regions.

Alternative fix to #132226.

Pull Request: https://projects.blender.org/blender/blender/pulls/132765
2025-01-08 10:34:52 +01:00
Campbell Barton
fc6702ccc7 Edit Mesh: increase the hard-max for select similar
For large scenes, a much larger threshold is sometimes needed.

Ref #81542.
2025-01-08 18:25:38 +11:00
Campbell Barton
fbfe88fd80 Fix "Select Similar" faces when building without freestyle
Most options for select similar faces weren't displayed.
2025-01-08 18:25:38 +11:00
Campbell Barton
3f8b482e6d Docs: improve the description of "Correct Aspect"
Clarification to address #131629.
2025-01-08 14:30:21 +11:00
Harley Acheson
f71afc6bbb Fix #91360: Remove Printf When Changing Screens
wm_gizmomap_handler_context_op currently prints an error message to the
console when screen layouts change while modal operations are running.
The operations work, and the comment above it says "this is not an
error to print", and it is confusing for users to see a console message
like this. Looks to be a left-over debugging tool.

Pull Request: https://projects.blender.org/blender/blender/pulls/132778
2025-01-08 01:57:17 +01:00
Campbell Barton
61a2f7a431 Cleanup: resolve check_spelling & check_licenses warnings 2025-01-08 11:31:43 +11:00
Harley Acheson
1717eb1919 Fix 132769: Reset Mouse Cursor In Popups
Changes in 02b1e5a48f don't work correctly in popovers. Which means you
can hover over a numerical input, then off again, and it will show an
incorrect mouse cursor. This PR just uses ED_region_cursor_set which
works there and elsewhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/132775
2025-01-08 00:32:59 +01:00
Hans Goudey
782e771627 Cleanup: Reorder misplaced include 2025-01-07 14:31:34 -05:00
Jesse Yurkovich
4d5be451a7 Cleanup: USD: Simplify our usd-path to material map processing
Since the `usd_path_to_mat_name` map seems to always be used in tandem
with `mat_name_to_mat` to get the material, change it from a map of
[string, string] to [string, Material] and store the Material directly.
This removes the need to do a secondary lookup through `mat_name_to_mat`
and less memory will be used at runtime due to the smaller Value size.

Pull Request: https://projects.blender.org/blender/blender/pulls/132647
2025-01-07 19:59:42 +01:00
Hans Goudey
30b48f32fb Fix #132692: Grease Pencil Python attribute lookup broken
Caused by c5ba8bd7c2.
2025-01-07 13:39:05 -05:00
Bastien Montagne
1c2b8d6957 Fix broken build on clang 18 after recent "cleanups".
Issues probably caused by !132608 (920e709069). Recent Clang
seems to be more strict than our Rocky 8 GCC compiler...
2025-01-07 19:18:48 +01:00
Harley Acheson
6a06e87f85 Fix #120833: Align Reset to Default with Preferences Defaults
This PR fixes a number of items in Preferences that "Reset to Default"
to different values than the default preferences. For some items this
is because they just have incorrect values, some have redundancies
between the U_default struct and property default, and many others are
caused by our code that reverses struct defaults for properties that
are "negative SDNA", or don't struct defaults for enum_bitflag_sdna
properly. Items include "show_splash", "anisotropic_filter", etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/132762
2025-01-07 18:58:27 +01:00
Sean Kim
92d85a85ad Fix #132562: Scrape Multiplane brush causes assert without samples
In some cases, using the Scrape Multiplane brush in Dynamic mode, the
brush stroke will have no vertices to sample from to find the associated
planes used to calculate deformations. This results in attempting to
divide by 0.

To make this potential error case more obvious, this commit changes the
helper method `sample_surface` to instead return a `std::optional` of
`ScrapeSampleData` in the rare occurance that we have no samples, so
that calling code is required to handle this case explicitly.

Pull Request: https://projects.blender.org/blender/blender/pulls/132573
2025-01-07 18:01:12 +01:00
Iliya Katueshenock
8e85d3105f Refactor: Nodes: Reroute node data type propagation simplification
Any reroute can be connected only to single source, or can be not connected at
all. So reroutes usually form trees. It is possible that there will be a cycle,
but such cycle can be only single in strongly connected set of reroutes. To
propagate a types from some certain target to all the reroutes in such a tree we
need to know all such a trees and all possible targets for each tree.

Before its was done with a stack-base breath first search and with implicit aim
to a targets of types to propagate.

Now everything is done explicitly, with grouping all reroutes to a strongly
connected sets. All source targets are handled now explicitly, which lets us to
use additional function to define priority between types later. Large number of
loops can be parallel, and as-is code 2-3 times faster for large node trees like
main tree in `Erindale_Flower_Shop` file.

Now possible change of the behavior:
1. For multiple targets use function to decide the most priority type.
2. In case of merge non-connected rerouted sets use statistic to decide the most
   popular type.
3. Change behavior in case there is no explicit targets (dangling reroutes set).

Pull Request: https://projects.blender.org/blender/blender/pulls/131910
2025-01-07 17:32:45 +01:00
Falk David
a9c87a15fc Cleanup: VSE: Rename SequenceColorTag to StripColorTag and flags
Also rename the flags from `SEQUENCE_COLOR_*` to `STRIP_COLOR_*`.
2025-01-07 17:19:24 +01:00
Falk David
ff99dcdf0d Cleanup: VSE: Use explicit type of Span 2025-01-07 17:10:12 +01:00
Lukas Tönne
f5eb916a08 Fix #131938: Fill tool should also use fill materials as boundaries
The fill tool was excluding fill-only materials when computing the image size for the boundary render. Removing this stroke filter extends the flood fill area to include the strokes with fill materials.

Note that all curves are rendered as strokes without fill triangulation for the purposes of the fill tool. This is the same behavior as in GPv2. The consequence is that for most fill strokes, which are _not actually cyclic and closed_ there may be non-obvious open boundaries which lead to the flood fill covering the interior of the fill strokes (the inside edges of the flower petals are open). This is usually ok because the flood fill is rendered behind existing strokes. If necessary we could simply render all the boundaries as cyclic for fill materials, but that goes beyond a simple regression fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/132746
2025-01-07 17:09:37 +01:00
Sybren A. Stüvel
ed58b945dd Anim: fix versioning of empty legacy Actions
Empty legacy Actions were skipped from versioning, because they are
technically valid layered Actions as well. However, this created an
issue where there was no "Legacy Slot" created for those. Furthermore,
their `idroot` could still be set to a non-zero value, which is not
allowed on layered Actions.

`bAction::idroot` is not a very reliable field. It can be zero on legacy
Actions as well, and it can in certain cases be downright wrong (can
happen in certain linking scenarios). Because of this, the field is not
included in any "is this a layered or a legacy Action?" checks.

Pull Request: https://projects.blender.org/blender/blender/pulls/132757
2025-01-07 17:05:36 +01:00
Falk David
63d3573c2b Cleanup: VSE: Rename occurences of sequence in lookup code
Rename `sequence` -> `strip` for all the lookup code for strips.
2025-01-07 17:04:00 +01:00
Falk David
9421d4f623 Cleanup: VSE: Remove unused declaration in header 2025-01-07 17:04:00 +01:00
Falk David
32a1de9f78 Cleanup: VSE: Rename SEQ macros to STRIP
Rename `SEQ` macros (that refer to strips) to `STRIP`.
2025-01-07 17:04:00 +01:00
Miguel Pozo
164f6d0591 Fix #132667, #132665: Overlay-Next: Sculpt selection
Use draw_expand, like regular meshes.
2025-01-07 16:57:06 +01:00
Falk David
c9772fee13 Fix: Build error after cleanup commit
Broken by ff91c27481.
2025-01-07 16:27:59 +01:00
Jonas Holzman
8a855f9cbd UI: Refactor templates into individual files
This PR refactors each UI template into its own `interface_template_*.cc`
file.

* Added `interface_templates_intern.hh` which exposes shared utility
  functions and macros.
* Doxygen comment sections that were redundant of the file name were
  removed. If they contained additional description, they were added
  to the file Doxygen `\file` header.
* Short templates that were closely related were kept together in single
  files (e.g `uiTemplateHistogram`, `uiTemplateWaveform` and
  `uiTemplateVectorScope` are all in `interface_template_scopes.cc`).
  In this case, Doxygen comment section were preserved.

The only things remaining in `interface_templates.cc` are:
* Common utility function exposed by `interface_templates_intern.hh`
* Small independent templates (`uiTemplatePathBuilder`,
  `uiTemplateNodeSocket` and `uiTemplateFileSelectPath`)

Ref: https://projects.blender.org/blender/blender/issues/117604
Pull Request: https://projects.blender.org/blender/blender/pulls/132468
2025-01-07 16:21:07 +01:00
Falk David
ff91c27481 Cleanup: VSE: Rename SequenceType to StripType as well as flags
Rename the flags from `SEQ_TYPE_*` to `STRIP_TYPE_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132753
2025-01-07 16:10:36 +01:00
Falk David
82cfa92233 Cleanup: VSE: Rename seq_ functions/variables to strip_
This should only rename functions and variables that are
referring to (operations on) a single `Strip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132748
2025-01-07 16:03:11 +01:00
Yahia
de9d021830 Fix #119557: XYZ labels on vector outputs missing if Single Value is disabled
Pull Request: https://projects.blender.org/blender/blender/pulls/132144
2025-01-07 15:48:43 +01:00
Sybren A. Stüvel
446f0a806e Anim: version Actions before versioning Action Assignments
Split the versioning of legacy Actions to slotted ones into two steps:

1. Versioning the Actions themselves, in the regular versioning code
   (`do_versions_after_linking_400`). This has to happen in the 'after
   linking' stage, and not in the 'before linking' stage, as there's
   older 'after linking' code that will break when it gets fed slotted
   actions. Any ID that is using a legacy Action will get tagged.
2. Versioning Action assignments, where the correct Action Slot has to
   be chosen & assigned for each tagged ID. This has to happen in the
   `do_versions_after_setup` stage, as choosing a slot requires that the
   actions (both local & linked) have been converted already.

This also includes some necessary changes to the pre-2.50 Action versioning
code.

Note that this change does not handle library overrides. That's dealt
with in !131426.

Pull Request: https://projects.blender.org/blender/blender/pulls/131627
2025-01-07 15:35:19 +01:00
Nathan Vegdahl
2f84d20455 Anim: Fix versioning of pre-2.50 animation data
The code for converting pre-Animato actions was not getting run properly
because `chanbase` (where animation data used to be stored) was
erroneously getting cleared before the relevant versioning code was run.

The root cause was that the code checking whether an action was already
valid as a layered action or not was NOT confirming that `chanbase` was
empty as part of that check (as it is a DNA-deprecated field), which in
turn triggered code that defensively clears `chanbase` (among other
things) when an action is identified as layered.

Note that the conversion of IPO curves and other pre-Animato data
happens quite late in the versioning, even _after_ the "versioning after
linking" stage. This is not introduced in this commit, this is just to
illuminate pre-existing design that might not be entirely obvious.

Pull Request: https://projects.blender.org/blender/blender/pulls/131975
2025-01-07 15:35:09 +01:00
Sybren A. Stüvel
63adbb19fb Anim: Always name the slot "Legacy Slot" when versioning legacy Actions
When creating Action Slots for legacy Actions, always name those slots
"Legacy Slot". Before this commit, the slot was named after the ID that
is animated by the Action; this matches what Blender will do when
animating that ID from scratch.

The old versioning behaviour caused issues when dealing with legacy
Actions: if there are multiple Actions in a file (for example multiple
run cycle animations) and only one of those was assigned to the
character (the rest has a fake user), Blender would only name that one
action slot after the character. The "fake user" Actions would just be
get a slot named "Slot".

This causes issues when toggling between the different Actions, as
Blender will not automatically assign a slot when switching from the
character- named one to the "Slot" one.

Ref: #129563, #130261

Pull Request: https://projects.blender.org/blender/blender/pulls/131425
2025-01-07 15:34:53 +01:00
Falk David
8541296e9d Cleanup: VSE: Rename Strip *seq variables to strip
This only renames variables named `seq` and not other variants,
like `seq_*` or `seq1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132736
2025-01-07 14:09:45 +01:00
Brecht Van Lommel
019269e2cb Fix: Build error on some Windows build configurations after recent changes 2025-01-07 13:40:03 +01:00
Miguel Pozo
f740923793 Fix #132035: Add line strip variation for custom bone shape wires
Add a shader version for line strip buffers that takes the different
input primitive rates and restart indices into account.

Pull Request: https://projects.blender.org/blender/blender/pulls/132084
2025-01-07 13:31:54 +01:00
Miguel Pozo
3f5fa8b65e Fix #132211: Overlay-Next: Drag&Drop material assets doesn't work
`GLIndexBuf::bind_as_ssbo` didn't bind subrange index buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/132712
2025-01-07 13:19:03 +01:00
Philipp Oeser
5d8ba173c4 Fix #132629: Generating asset previews for grease pencil is broken
Reason is that `BKE_camera_view_frame_fit_to_scene` cannot handle grease
pencil data [it used to, that was once added in 80d0b68290 but lost in
the switch to GPv3 (see 5c57e24fea)].

So to resolve, add back support for grease pencil in
`BKE_camera_view_frame_fit_to_scene` which is similar to what we do for
getting the bounding box.

Pull Request: https://projects.blender.org/blender/blender/pulls/132733
2025-01-07 13:09:30 +01:00
Omar Emara
508ee95db6 Fix: Missing include for reduce_max 2025-01-07 14:01:14 +02:00
Brecht Van Lommel
920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00
Brecht Van Lommel
85df741aca Fix #131931: Joining mesh material slots fails with invalid indices
* Clamp invalid per-face slot numbers to match rendering logic.
* When objects have no slots, ensure faces get assigned to an empty slot.
* Refactor code to avoid strong coupling between far away code.

Pull Request: https://projects.blender.org/blender/blender/pulls/132728
2025-01-07 12:25:39 +01:00
Omar Emara
2d6353a50e Fix: Zero division in Glare node
Zero division might happen in the Glare node for Fog Glow and Bloom if
the input Size is zero. This fix protects against those cases.
2025-01-07 13:20:18 +02:00
Pratik Borhade
92f777557f Cleanup: Grease Pencil: Remove layer reorder operator
`GREASE_PENCIL_OT_layer_reorder` operator is not exposed in UI.
Alternative options exists for rearranging layers/groups: drag-drop and
`grease_pencil.layer_move()`.
As discussed previously in chat, remove the operator code.

Pull Request: https://projects.blender.org/blender/blender/pulls/132299
2025-01-07 11:46:50 +01:00
Omar Emara
004e3d39fa Compositor: Improve Glare node UX
This patch redesigns the Glare node to improve the user experience. The
improvements are as follows.

Two new outputs were added, Glare and Highlights. The Glare output gives
the generated glare without the input, and is useful when the user wants
to adjust the glare before adding it to the image. The Highlights output
gives the areas that are considered highlights when computing the glare,
and is useful if the user wants to temporally check the highlights while
doing adjustments or wants to use those as a base for creating a custom
glare setup.

The Mix node option was removed and a new Strength single value input
was added to serve the same functionality. The Mix option had a range of
[-1, 1], where the [-1, 0] sub-range essentially controlled the strength
of the glare, 0 being full strength and -1 being zero strength. While
the [0, 1] range returned the generated glare with an attenuated version
of the image added, that is, it was useless except for the value of 1,
which returned the generate glare only.
Aside from being a very intuitive range, it also meant that the power of
glare can't be boosted beyond the full strength of, you guessed it, 0.
The newly added Strength input has a soft range of [0, 1] and can be
boosted beyond 1. If the users want the glare only, they can use the
newly provided Glare output.

The Size node option used for Bloom and Fog Glow was removed and a new
Size single value input was added. The Size node option had yet another
very intuitive range of [1, 9], and it was related exponentially to the
actual size of the Glare. For Bloom, the actual bloom size relative to
the image was 2^(Size-9), so a Size of 8 means the bloom covers half of
the image. For Fog Glow, the actual bloom size in pixels is 2^Size, so
the glare size is not relative to the image size and would thus change
as the image resolution change. Furthermore, the maximum possible glare
size was 512 pixels, and the user couldn't make fine adjustments to the
size.
The newly added Size input has a range [0, 1], where 1 means the glare
covers the entire image, 0.5 means it covers half the image, and so on.
That means it is consistent between Bloom and Fog Glow, it is relative
to the image size, it allows as large of a glare as possible, it is
continuous for Fog Glow, but not for Bloom because that requires an
algorithmic change that will be implemented separately.

The Threshold, Streaks, Streaks Angle, Iterations, Fade, and Color
Modulation node option was turned into a single value node input to
allow the option to be used in node groups.

---

Versioning was added to transfer node options into sockets, but it is
not all 1:1 versioning, since the old Size option was not relative to
the image size, so it depends on runtime information of the input size.
As a guess, we assume the render size in that case. Versioning the
[0, 1] range of the Mix option intentionally omits the attenuation of
the image input, because that is almost certainly not what the user
wants and was probably done thinking it controls the strength.

Glare code now sets the alpha channel to 1, that's because it was
already ignored in the mixing step, but now that we expose the Glare
output, we need to set it to 1. So this is not a functional change.

The get_glare_size() method was renamed for clarity since it now
conflicts with the newly added Size input.

---

This is a partial implementation of #124176 to address #131325. In
particular, it adjust existing functionality, it doesn't add any new
ones. Those will be added in separate patches.

Pull Request: https://projects.blender.org/blender/blender/pulls/132499
2025-01-07 11:15:26 +01:00
Brecht Van Lommel
0c2ec3dcf9 Fix #132716: Selected to active bake broken after recent bugfix
Consistently pass evaluated bake target objects to Cycles, instead
of using the original for this case. This way it can be matched with
evaluated objects being rendered.

Pull Request: https://projects.blender.org/blender/blender/pulls/132722
2025-01-07 10:57:46 +01:00