Commit Graph

120055 Commits

Author SHA1 Message Date
jlalleve
2feadc623b Core: Environment variables for deployment
* BLENDER_SYSTEM_SCRIPTS support for multiple script paths, separated by
  ; on Windows and : on other platforms.
* New BLENDER_CUSTOM_SPLASH to replace the splash screen image.
* New BLENDER_CUSTOM_SPLASH_BANNER to overlay an image on the splash.

Contributed by Sony Interactive Entertainment: https://github.com/PlayStation-OpenSource
2025-01-14 20:57:31 +01:00
Harley Acheson
6922418a95 Fix #79388: Increase User Scale Hard Min to 0.5
Increase the hard minimum for Resolution Scale from 0.25 to 0.5. 0.5 is
also the current soft limit (the least you can get by just dragging on
the widget). But, as illustrated by the bug report, accidentally typing
in a value below 0.5 is difficult to recover from since the text is too
small to see. It is a useful minimum though in that this value is good
for tests and captures on High DPI system to simulate low dpi.

Pull Request: https://projects.blender.org/blender/blender/pulls/131688
2025-01-14 20:54:16 +01:00
Hans Goudey
9dd3c64c36 Cleanup: Remove unused includes in some blenkernel files
Pull Request: https://projects.blender.org/blender/blender/pulls/133067
2025-01-14 19:55:11 +01:00
Harley Acheson
de95daaadf Fix #130171: Stop Panel Animation When Removing Regions
When removing areas ensure that none of its panels are currently
running open/close animations. If so turn them off.

Pull Request: https://projects.blender.org/blender/blender/pulls/131998
2025-01-14 19:43:42 +01:00
Bastien Montagne
255f031e3e Refactor: RNA definition of Boolean bitset/bitflags properties.
Existing code had several issues:
* The 'DNA bitset as RNA array' behavior was totally undocumented,
  virtually impossible to discover, very confusing, and without any
  checks that given parameters (like the array length) were valid.
* The DNA defaults handling was fully broken for 'negative' boolean
  properties.

This commit:
* Factorizes all rna define code for boolean properties storing a `booleanbit`
  value into a new static util (this revealed and fixed the 'negative defaults'
  issue).
* Forbids calling `RNA_def_property_array` on a Boolean property with a
  non-null `booleanbit` value.
* Introduces a new `RNA_def_property_boolean_bitset_array_sdna`,
  strictly to define 'DNA bitsets as RNA array' properties.
* Adds several validation checks, in particular regarding the bitset
  case: it takes into account the fact that bitshift operations on
  negative numbers are typically
  [arithmetic ones](https://en.cppreference.com/w/cpp/language/operator_arithmetic),
  which means that they preserve the sign of the value, and that the
  left-most bit should never be used with signed integers for bitsets.

-------------------

The fix to DNA defaults handling on 'negative' properties revealed
several RNA errors, listed below. Fixing them is not necessarily trivial
(as some seem to contradict the DNA default values, e.g. the
`View3DShading.use_studiolight_view_rotation` one), so it is kept
outside of this refactor. Conflicting cases should likely be handled by
the relevant modules (to decide whether the DNA, or the RNA default
should be kept).

-------------------

Also realized that many DNA types are ignored when trying to find DNA
default values. This will also be tackled separately, as fixing it is
fairly straightforward.

Pull Request: https://projects.blender.org/blender/blender/pulls/132917
2025-01-14 18:19:27 +01:00
Jeroen Bakker
264681344f Vulkan: Provide more control on memory allocation
This change give access to preferred and required allocation flags
allowing better control over where memory is allocated.

Pull Request: https://projects.blender.org/blender/blender/pulls/133059
2025-01-14 17:41:35 +01:00
Sybren A. Stüvel
e57172a2ee Refactor: Anim, simplify the function to flip bone names when pasting keys
Replace pointer magic with `std::string` and `blender::StringRef`.

The old code modified the RNA path of F-Curves to extract & flip the
bone name. The new code is not modifying any data, at the expense of a
few more copies. Since these strings are not long, and the call to
`BLI_string_flip_side_name()` also makes quite a few copies, the
performance impact should be negligible.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
9a7f057dde Refactor: Anim, in keyframe pasting code, change to_simple to to_single
The variable/parameter indicates that the user is pasting to a single
F-Curve. It now mirrors `from_single`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
894e242cfa Refactor: Anim, make pastebuf_match_path_property() easier to read
Simplify `pastebuf_match_path_property()` by reducing cognitive complexity
and using `StringRef::endswith()` instead of pointer arithmetic.

I've also added a few unit test cases that cover some unwanted behavior:
the property name check only checks suffixes, and so copying "….location"
will also paste it to a "….not_actually_location" F-Curve.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
44b37ee8ed Refactor: Anim, simplify pastebuf_match_path_full()
Simplify `pastebuf_match_path_full()` by reducing cognitive complexity.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
ae84e23110 Refactor: Anim, keyframe paste: add unittest for bone name flipping func
Add a unit test for the bone name flipping function of the keyframe
paste functionality.

The function itself has been changed a little bit, so that it returns a
`std::string` instead of using a `char **` return parameter that needs
explicit freeing at the call site. This made the tests considerably
simpler to write. This change does cause an extra copy of the RNA path,
but that should be refactored away soon.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
bdc420037d Refactor: Anim, add unit tests for some keyframe paste code
The code under test needed a little refactor to make it testable.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Sybren A. Stüvel
b4e0ff6b8f Refactor: Anim, use strategy pattern in keyframe pasting code
This makes it considerably easier to write  tests for some functions
before I refactor them too.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133005
2025-01-14 17:12:09 +01:00
Jeroen Bakker
04e64b27ea Vulkan: Ignore swapchain image layout/content
Blender always updates all pixels of the swap chain. As an optimization
we can skip the initial layout transition from present to transfer
destination as all pixels will be rewritten.

Pull Request: https://projects.blender.org/blender/blender/pulls/133061
2025-01-14 17:08:04 +01:00
YimingWu
1bacb0de62 Fix #132987: Grease Pencil: Ensure selection domain when switching modes
Grease Pencil tool settings could have different selection modes for
different object modes (like edit mode and sculpt mode). This fix
ensures when switching object modes, the selection domain is updated to
match the selection mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133030
2025-01-14 16:46:23 +01:00
Jacques Lucke
684fd4643a Nodes: use BKE_main_ensure_invariants directly instead of ED_node_tree_propagate_change
`BKE_main_ensure_invariants` was added in 1fae5fd8f6. The older
`ED_node_tree_propagate_change` was already implemented as a thin wrapper around
`BKE_main_ensure_invariants`. This patch removes the wrapper and calls the more
general function directly.

A new overload of `BKE_main_ensure_invariants` is added for the common case when
only a single data-block has been modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133048
2025-01-14 16:26:54 +01:00
Jacques Lucke
476b7ded9e Nodes: make explicit legacy type optional
This makes specifying a legacy type for new node types optional (e.g.
`GEO_NODE_MESH_TO_CURVE`). Instead, only the `idname` is used as a stable
identifier for node types. So there is less redundancy for now.

This change helps with the decentralized definition of nodes and reduces the
number minimum number of files that need to be changed for a new node from 5 to
4. It especially helps when multiple nodes are worked on at the same time,
because the legacy type definition was very prone to have merge conflicts.

For compatibility reasons and because it's still used by existing code, the
`legacy_type` is not removed. All existing nodes keep their current
`legacy_type`. New nodes will receive an auto-incremented legacy type. It's
still necessary to give nodes unique legacy types, because some code checks if
two nodes have the same type by comparing their `legacy_type`. These types only
have to be unique at run-time though. Some randomness is used to avoid depending
on stable generated legacy types accidentally.

Pull Request: https://projects.blender.org/blender/blender/pulls/133044
2025-01-14 14:39:36 +01:00
Omar Emara
9e46e970cf Fix: Zero division in Bloom Glare node
Zero division caused by a zero normalization term. Ensure that it is at
least 1.
2025-01-14 15:22:20 +02:00
Jeroen Bakker
b898fd09b4 Fix: Vulkan: Incorrect swizzling
Swizzling is supported when sampling. Outside samplers the swizzling
must always be the initial swizzling.

Detected when playing rain_restaurant.blend. EEVEE motion vectors use
swizzling.

Pull Request: https://projects.blender.org/blender/blender/pulls/133043
2025-01-14 14:09:57 +01:00
Jeroen Bakker
fbe05ac60b Cleanup: Vulkan: Remove unused code/parameters
Initial design had a more complex use case for render graphs.
They are not really used and will not in the near term. This PR
removes some code that doesn't do a thing

Pull Request: https://projects.blender.org/blender/blender/pulls/133047
2025-01-14 14:09:50 +01:00
Omar Emara
b92a6eab3a Compositor: Normalize Bloom output
This patch normalizes the Bloom output to be more energy conserving and
in a reasonable range. This is essentially constructed such that the
impulse response to a constant input maintains the same input.

The reason why Bloom has a very high range is because it accumulates a
downsampling chain without any sort of attenuation, so the final result
can be quite large. EEVEE fixed that by making the Strength range in the
[0, 0.1] range, so users who are used to that range think the default
value of a unit Strength in the glare node is large and hard to work
with. Hence the need for this patch.

The normalization factor is simply the length of the chain, since for a
constant input, all chain images will have the same constant input.

We need to version this change in a similar manner to how the glare node
was versioned in 004e3d39fa, where the scene render size is assumed. We
also assume the inputs are not connected, because they were turned into
inputs just last week, so we needn't worry about that case.

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

Pull Request: https://projects.blender.org/blender/blender/pulls/133037
2025-01-14 13:05:15 +01:00
Falk David
16e89b7366 Fix #132568: Grease Pencil: runtime error: null pointer as argument
The passed `StringRef` can be empty, so we shouldn't pass it to
`BLI_strdupn` in this case.

If an empty string is passed to either `set` function
makes sure the previous `char *` is freed and set to `nullptr`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133042
2025-01-14 12:46:54 +01:00
Julian Eisel
1bde901bf2 UI: Remove "Adjust Last Operation" region when button sends undo push
Addresses #78171, #61828, #62473 and many closed reports about this.

Until now, the "Adjust Last Operation" would keep being available after
changing various properties in the UI. Actually using it to adjust the
last operation parameters would undo the other changes done through the
UI, which is unexpected and easy to miss. Users would keep running into
this, thinking it was a bug, as the many reports merged into #78171
indicate.

As agreed on in the report, adjusting the last operation shouldn't be
possible after changing properties in the UI that send an undo push.
That's what this PR implements, together with removing the "Adjust Last
Operation" region at that point.

Pull Request: https://projects.blender.org/blender/blender/pulls/133003
2025-01-14 12:45:34 +01:00
YimingWu
e18011fddc Fix #133034: Grease Pencil: Reset ob->actcol when converting from mesh
When converting object to grease pencil from mesh, the material counters
need to be set to the the value that matches
`GreasePencil::material_array_num` to avoid index issues in adding
grease pencil materials downstream.

Pull Request: https://projects.blender.org/blender/blender/pulls/133038
2025-01-14 12:15:31 +01:00
Jeroen Bakker
6cb8cdaa45 Fix: Draw: Tests
Visibility test is not setup correctly and only tests positives. This
test should be adapted with better testing. For now we skip the test.

Resource id test was wrong as it didn't add the null resource for
drawcalls with no handle. Ref `DrawCommandBuf::generate_commands`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133040
2025-01-14 12:11:32 +01:00
Jacques Lucke
a097bca53f Cleanup: improve comment for BKE_main_ensure_invariants
Pull Request: https://projects.blender.org/blender/blender/pulls/133008
2025-01-14 11:56:38 +01:00
Omar Emara
14a380089a Compositor: Reorganize Glare node in panels
This patch reorganizes the Glare node inputs into panels, grouped by the
function they perform. The panels are:

- Highlights: Which are inputs related to highlights extraction.
- Adjust: Which are inputs that adjusts the generated glare.
- Glare: Which are glare type specific inputs.

Additionally, the Threshold parameter was assigned a more unique
identifier to be more future proof and consistent with other inputs, and
the descriptions of some inputs were updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/132993
2025-01-14 11:19:25 +01:00
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