Commit Graph

118328 Commits

Author SHA1 Message Date
Jacques Lucke
b32a5882c1 Cleanup: Nodes: move node class parameter out of node_type_base
The node class is hardly important enough (especially compared to the other parameters)
that it is justified to have to pass it to `node_type_base`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133021
2025-01-14 11:03:28 +01:00
Jeroen Bakker
9091085277 Fix: GPU: Compiling python gpu shaders
Compiling of graphics shaders via gpu crashed. The vulkan backend found
a compute source and continued the evaluation as if it was a compute
shader.

The compute source was added by the preprocessor that wraps the shader
source. Even empty sources were wrapped. Detection based on empty shader
sources failed.

This is not a Vulkan only issue as other platforms would have similar issues when
creating a compute shader.

Pull Request: https://projects.blender.org/blender/blender/pulls/133036
2025-01-14 10:51:24 +01:00
Jeroen Bakker
8a199dc77f Vulkan: pipeline barriers extraction
Pipeline barriers were extracted when recording commands. This works,
but had the downside that it locked the device resources. Extracting
pipeline barriers is fairly small task compared to recording commands.

This PR will perform the extraction of pipelines separate from command
recording. Code is easier to follow and when working with multiple threads
this will reduce locking (enabling this will be done in separate PR).

Original developed in !131965

Pull Request: https://projects.blender.org/blender/blender/pulls/132989
2025-01-14 09:50:42 +01:00
Lukas Tönne
1c9db0e82a Fix #132948: Include pixel scale (aka "Precision") in the boundary transform
The precision factor scales the render region of the fill tool, which
needs to be included in the reverse transform to get boundary curves
back from image space into the Grease Pencil object.

Pull Request: https://projects.blender.org/blender/blender/pulls/133006
2025-01-14 09:49:49 +01:00
YimingWu
9d509de52a Grease Pencil: Convert from mesh to Grease Pencil
Convert mesh objects to grease pencil, optionally preserve mesh faces as
filled shapes, and convert crease edges into strokes. Following options
are available:

- Whether to convert faces to filled strokes.
- Stroke thickness.
- Stroke offset (Using normal direction to lift strokes out of mesh
  surfaces).

Note that "Crease Angle" option from legacy grease pencil is not ported
to this implementation. This option is deemed more suitable for using
geometry nodes to achieve.

Resolves #126480

Pull Request: https://projects.blender.org/blender/blender/pulls/131854
2025-01-14 08:28:52 +01:00
Campbell Barton
d675e886d4 Docs: mention U/V direction cycling in curve select-row description 2025-01-14 17:56:10 +11:00
YimingWu
8dc3735c3d Fix #132982: Guard nullptr in rna_Space_view2d_sync_get
`area` returned by `rna_area_from_space` can be null, this can cause
crashes when viewing "Local View" property in the Outliner. Now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132983
2025-01-14 07:22:33 +01:00
Campbell Barton
14e6e84fb7 Fix stack overflow drawing empty images with the overlay-next engine
Creating a float4 from a float3 performed an out of bounds read
adding the value to the matrix.
2025-01-14 16:39:18 +11:00
Pratik Borhade
0902e835fb Fix #96108: Dimensions remain editable for linked IDs
Disable the button with flag if object ID is linked.

Pull Request: https://projects.blender.org/blender/blender/pulls/132267
2025-01-14 06:14:40 +01:00
Campbell Barton
631495c0e4 Cleanup: sort CMake file lists 2025-01-14 15:45:19 +11:00
Campbell Barton
68f14db441 Cleanup: add checks to the array modifier to skip empty mesh data
Add checks that ensure mesh data copying blocks only run when the
array's aren't empty.

Also note why an early return isn't used.
2025-01-14 15:30:09 +11:00
Campbell Barton
3acbd93779 Fix #132991: Array modifier + X-Ray crash selecting an empty meshes
Resolve regression introduced in [0] intended to fix another regression
introduced in [1] to resolve an assert from [2] (a C++ cleanup).

Recent changes made the array modifier return early with the start-cap's
mesh however this meant the required custom-data layers wouldn't
necessarily exist on the returned mesh, causing selection to crash.
Besides this the same logic was missing from the end-cap.

Resolve by restoring the logic from before [1],
adding a check to prevent the assert.

[0]: 9ad6957574
[1]: 8b2556e8d8
[2]: cb62ab5b28
2025-01-14 15:29:10 +11:00
Campbell Barton
8460dffcbd Fix file-name sanitizing for image "Save As"
ID names of images that included slashes would attempt to write
save the image in a sub-directory based on those slashes.

Also add notes to clarify the intended use of "safe" path functions.
2025-01-14 13:49:25 +11:00
Harley Acheson
6de1e21ec6 Fix #72554: X-Ray Description "Alpha" -> "Opacity"
For xray_alpha and xray_alpha_wireframe replace the word "alpha" with
"opacity" in the tooltip description to better suit its use in the
interface, where 0 is transparent and 1 is fully opaque.

Pull Request: https://projects.blender.org/blender/blender/pulls/133025
2025-01-14 00:59:25 +01:00
Laurynas Duburas
b9f241d468 Curves: Optimization in batch cache create
Prevents creation of Bezier curve's `IndexMask` when it is not needed.
It was created on every request, even when `CurvesBatchCache` was valid.
Also prevents redundant initialization of `GeometryDeformation`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133017
2025-01-13 23:07:39 +01:00
Jonas Holzman
0ee4ae89e4 UI: Capitalize default filenames from "untitled" to "Untitled"
Capitalize the default filename used for .blend files and other savable
and exportable file formats (like images, 3D formats, etc.) from
"untitled" to "Untitled".

Pull Request: https://projects.blender.org/blender/blender/pulls/132424
2025-01-13 20:06:27 +01:00
Miguel Pozo
5f24c61225 Fix #132894: Overlay Next: Edit Mode Xray not working when set to 1.0
Add state.xray_flag_enabled.
2025-01-13 19:52:29 +01:00
John Kiril Swenson
2f228fb0f6 Fix: VSE: Play/stop animation in preview window
8ce5356522 removed the `View2D` and `Frames` keymaps from the
`keymapflag` for the preview in order to avoid having them trigger while
adding/editing text.

Although the `View2D` keymap items were restored by registering them
after the `SequencerPreview` keymap in
`sequencer_preview_region_init()`, the `Frames` keymap was neglected, so
fix by registering it too.

Pull Request: https://projects.blender.org/blender/blender/pulls/132972
2025-01-13 19:21:08 +01:00
Harley Acheson
ba9417470e Fix #126409: Allow Menu Accelerators for Toggles
When menus (that are not type-to-search) open we add underlines to
most items so they can be selected quickly. We currently don't do this
for items that are toggles.  This PR adds accelerators to toggles.

Pull Request: https://projects.blender.org/blender/blender/pulls/132309
2025-01-13 19:14:12 +01:00
Sybren A. Stüvel
2c92cfb687 Anim: when upgrading legacy Actions, name their layer "Legacy Layer"
Just like legacy Actions get a slot "Legacy Slot" when they're
versioned, their layer is now also called "Legacy Layer" to be
consistent with that.

When upgrading a legacy Action to a slotted Action, it also gets a layer
and a keyframe strip on that layer. Those are not shown in the user
interface yet, but will in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/133009
2025-01-13 18:27:54 +01:00
Sybren A. Stüvel
1bfa52b57c Anim: i18n-ize default Action layer names
Internationalize the default Action layer name. Instead of `"Layer"`,
use `DATA_("Layer")`. This is the same for other defaults in Blender.

When upgrading a legacy Action to a slotted Action, it also gets a layer
and a keyframe strip on that layer. Those are not shown in the user
interface yet, but will in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/133009
2025-01-13 18:27:54 +01:00
John Kiril Swenson
09a65ca669 Cleanup: VSE: Rename SeqConnection to StripConnection and seq_ref to strip_ref
Pull Request: https://projects.blender.org/blender/blender/pulls/132932
2025-01-13 18:16:48 +01:00
Miguel Pozo
2abc3ad801 Fix #132056, #132057, #132666: Overlay-Next: X-Ray
Take xray_enabled into account for prepasses.
Fix #132056
Fix #132057
Fix #132666
2025-01-13 17:47:35 +01:00
Jacques Lucke
11f20683f9 Core: support localizing data-block without owner ID
Previously, the owner-id on localized node trees, like the one created in
`GPU_material_from_nodetree` would have `bNodeTree::owner_id` set, even though
they were independent. The leads to asserts when using `BKE_id_owner_get` on the
localized node tree.

The `node_tree_localize` already took a `ID *new_owner_id` parameter. However,
if it was `nullptr` it was ignored instead actually clearing the `owner_id`.
This patch changes the parameter to `std::optional<ID *> new_owner_id`. Now,
`std::nullopt` means that the value is ignored and when `nullptr` is passed in,
the `owner_id` will be cleared on the localized tree.

Since `node_tree_localize` indirectly uses other functions, the same function
signature change is done in `BKE_libblock_copy_in_lib` and `BKE_id_copy_in_lib`.
The callers have been updated to pass in `nullopt` instead of `nullptr`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133002
2025-01-13 16:46:36 +01:00
Miguel Pozo
f7c6159229 Fix #132992: Overlay-Next: Objects displayed as bounds/wires occlude back objects for selection
Disable prepass for display as wire/bound objects
2025-01-13 16:39:10 +01:00
Jacques Lucke
01be014b3d Fix: add missing node tree topology cache 2025-01-13 15:06:50 +01:00
Jacques Lucke
1fae5fd8f6 Core: add concept of invariants in original DNA data
This patch adds a new `BKE_main_ensure_invariants` function. For now it only
ensures node-tree related invariants, but more may be added over time.

The already existing `ED_node_tree_propagate_change` now internally calls
`BKE_main_ensure_invariants`. We can probably remove this indirection at some
point and call the new function directly, but for now it is kept to keep this
patch small.

This is based on a recent discussion in the Core module meeting:
https://devtalk.blender.org/t/2024-12-12-core-meeting/38074

```cpp
/**
 * Makes sure that invariants in original DNA data are maintained after changes.
 *
 * This function has to be idempotent, i.e. after calling it once, additional calls should not
 * modify DNA data further. If it would, it would imply that this function does more than
 * maintaining invariants.
 *
 * This has to be called after any kind of change to original DNA data that may be involved in some
 * of the maintained invariants. It's possible to do multiple changes in a row and then fixing all
 * invariants with a single call in the end. Obviously, the invariants are not maintained in the
 * meantime then and functions relying on them might not work.
 *
 * If nothing is changed, this function does nothing and it should not be slower than checking a
 * flag on every data-block in the given bmain.
 *
 * Sometimes, it is known that only a single or very few data-blocks have been changed (e.g. when a
 * node has been inserted in a node tree). Passing in #modified_ids can speed up the function
 * because it may avoid the need to iterate over all data-blocks to find modified data-blocks.
 *
 * Examples of maintained invariants:
 * - Group nodes need to have the correct sockets based on the referenced node group.
 * - The geometry nodes modifier needs to have the correct inputs based on the referenced group.
 */
void BKE_main_ensure_invariants(Main &bmain,
                                std::optional<blender::Span<ID *>> modified_ids = std::nullopt);
```

This also adds `windowmanager` as a dependency of `blenkernel` to be able to
send notifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/132023
2025-01-13 15:03:24 +01:00
Omar Emara
3b28cf276e Compositor: Add Glare Highlights Smoothness and Max
This patch adds two new inputs to the Glare node, Highlights Smoothness
and Max Highlights. Smoothness allows the user to control how smooth the
highlights are after thresholding and Max allows the user to suppress
very high brightness pixels.

Those are essentially similar to the Knee and Clamp options in old EEVEE
bloom, though they work differently.

The issue with the Knee parameter in old EEVEE bloom, aside from being
named after a body part, is that it actually isn't smooth or continuous
around zero if the threshold is sufficiently close to zero relative to
the Knee parameter. That's because zero lies in the smoothing kernel
region in those cases, and since zero pixels becoming highlights is very
bad, EEVEE just returned zero as a special case for zero brightness, but
values like 0.0001 will be full blown highlights.

The new nicely named Smoothness input uses adaptive smoothing such that
the smoothing kernel size will be reduced as the threshold nears zero,
such that smoothed highlights will be continuous and smooth around zero.

The Max Highlights input is similar to clamped, it it suppresses very
bright highlights such that their brightness doesn't exceed the
specified max.

This is a partial implementation of #124176 to address #131325.

Pull Request: https://projects.blender.org/blender/blender/pulls/132864
2025-01-13 13:54:07 +01:00
Damien Picard
bec7eadcbf I18n: Allow translation of "Warning" node label
The Warning geometry node uses its warning type as label. These enum
items were extracted using the default context, but translated using
"Nodetree". The items Warning, Info and Error, should be quite
unambiguous and translated using the default context instead.

In addition, a string "Unknown" was translated twice. Replace one of
those translations with a simple `N_()` extraction macro.
2025-01-13 12:40:45 +01:00
Damien Picard
c9a1008d51 I18n: Disambiguate "Strength"
- "Strength" in the context of Grease Pencil, deals with opacity, and
  adjusts the brush stroke alpha.
- "Strength" can mean measurable units like 'noise', 'light', etc.
- Anything else using physical strength in a generic concept.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
08ca59b43b I18n: Disambiguate "Steps"
- "Steps" can refer to staircase steps in the context of curve
  profiles. Use already-extracted "Mesh" context.
- In the context of the Grease Pencil noise modifier, refers to a step
  number between frames.
- In the general context, refers to a number of times to do an
  operation.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
49b45a95db I18n: Disambiguate "Space"
- "Space" can be the spacebar key. This uses the UIEvents context
  already. One instance is the event type enum item, where "Spacebar"
  is the label and "Space" is the description. Since there is no way
  to use contexts for descriptions since they are supposed to be more
  verbose, the label was renamed to "Space Bar" (acceptable according
  to Wikipedia), and the description to "Spacebar".
- In the context of the Grease Pencil, "Space" is a method of spacing
  brush strokes.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
e699f0e5c7 I18n: Disambiguate "Smooth"
"Smooth" can be many things, but mostly a verb or adjective depending
on context.

Already handled in the past, but some things were missed or introduced
since then.
2025-01-13 12:40:45 +01:00
Damien Picard
4a8d494240 I18n: Disambiguate "Sharp"
"Sharp" can refer to a curve falloff, not a mesh edge's geometric
property.
For an existing enum property `Brush.curve_preset`, use the same
context ID_CURVE_LEGACY as other messages, instead of ID_CURVES.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
3d254c51f4 I18n: Disambiguate "Shaded"
"Shaded" as in object shading, not UI.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
4b729022f6 I18n: Disambiguate "Precision"
"Precision" mode for a modal operator, not the measurement.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
c3d071e469 I18n: Disambiguate "Power"
- In the context of color balance, refers to a power function. Uses
  ID_MOVIECLIP context, because the ID_NODE is already used for math
  functions.
- In the context of the scale constraint, also a power function.
- In the context of physics and particle settings, refers to a
  falloff.
- In the context of property subtypes and units, refers to a
  quantity.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
88dbe8dcd1 I18n: Disambiguate "Pattern"
- "Pattern" can mean type of texture.
- It can also refer to refers to a type of matching wildcard.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
5857000a65 I18n: Disambiguate "Normal"
"Normal" means "ordinary", not "perpendicular".

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
466af92f7a I18n: Disambiguate "Light"
"Light" already has multiple contexts, but some were missing:
- In general, "Light" refers to a Blender Light object. In many cases,
  this comes from an `id_type` enum, already using the ID context. Use
  it also for properties that were missing that context.
- In the context of render passes, "Light" is the actual illumination
  factor, not the light emitor. A new "Render Layer" translation
  context is introduced for this purpose as no existing ones are both
  specific and explicit enough.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
1ee31effca I18n: Disambiguate "Jitter"
"Jitter" means a type of keyframe, not a sampling strategy.
2025-01-13 12:40:45 +01:00
Damien Picard
f67911cb47 I18n: Disambiguate "Fill"
- In the context of mesh extrusion, "Fill" means "Fill the rim of an
  extruded edge loop" (verb).
- In the context of the file browser, it means select every file
  between beginning and end.
- In the context of an image, fill the tile with  generated image.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
2b3f0d0110 I18n: Disambiguate "Extend"
- "Extend" usually means making selection bigger around the current
one.
- In the context of Grease Pencil filling, it means lengthen lines.
- In the context of curve mappings, it refers to the extrapolation
  mode.
- In the context of volume sequences, it refers to frame range
extension.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
c2096b1c01 I18n: Disambiguate "Error"
"Error" as difference from expected value, not program error.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
100d7094f1 I18n: Disambiguate "Drag"
- In the context of physics, a force.
- In the context of UI, a mouse action.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
973b981158 I18n: Disambiguate "Cross"
- "Cross" can refer to a cross shape "+" in the context of a gizmo or
  a particle display mode.
- In the context of a sequence, refers to a blending mode (cross
  fade).

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
54c0c5539a I18n: Disambiguate "Back"
- In the context of Grease Pencil, meaning "Overshoot".
- In the context of XR navigation, meaning "Going backwards".
  This introduces a "Navigation" context. Closest existing match is
  "View3D" but this is already used to refer to view axes.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
434f7e83e8 I18n: Disambiguate "Additive"
- In the Grease Pencil Build modifier, "Additive" describes how it
  works, not a math operation.
- In the Copy Scale constraint, additive mode is not really a math
  operation either.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
ecb4984d65 I18n: Do not disambiguate some messages
- "Match Case" and "Wrap Around" were renamed but they do not need a
  translation context anymore.
- Spreadsheet tooltips with unneeded translation of format
  strings like `fmt::format(TIP_("{}"))`.
2025-01-13 12:40:45 +01:00
Aras Pranckevicius
4515713db7 Fix #132237: crash when opening Ogg file with embedded album art
This works around ffmpeg bug https://trac.ffmpeg.org/ticket/10755
where for specific files that are:

- Ogg container format, with supported audio stream (e.g. Vorbis),
- But the video stream is not Ogg-compatible (e.g. Theora), but rather
  it is an embedded "album art" (AV_DISPOSITION_ATTACHED_PIC) in
  MJPEG, PNG or some other non-Ogg format.

Calling any sort of ffmpeg "seek" function on that video stream just
aborts from innards of ffmpeg.

So to work around this:
- Detect such files (ogg container, non-theora video, attached picture
  disposition) and for those:
- Never seek within them, and only ever decode one frame. Return that
  frame for any & all "give me a frame" requests.
- Additionally, calculating "how many frames this video has" for such
  files also returns nonsense ("millions of frames") since their frame
  rate is set to like 90000 or similar. So pretend they have a "sane"
  frame rate. Do all this frame rate calculation just once when opening
  the video, and use that result in all other places.
- Never build proxies for such video files, since e.g. "timecode"
  for them does not make sense.

All of this could be removed once/if ffmpeg fixes their issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/132920
2025-01-13 12:16:15 +01:00