Don't add directories with the relative prefix to the FSMenu.
While mostly harmless, causes unnecessary checks on startup
and asserts with debug builds.
Prior to this commit, the set of brushes that ignore the gravity brush
effect and the set of brushes that dim the display of the related
options were mismatched.
Pull Request: https://projects.blender.org/blender/blender/pulls/137309
The update function expanded a relative paths and ensured a slash.
Making "safe" could even change the blend file path,
causing the expanded path not to match the blend file path.
There is no need to treat this path as a special case
which is handled differently from other preferences.
Some paths in Blender support the `//` prefix for blend-file relative
paths however this is not communicated anywhere.
Support declaring this with a new flag which can be applied to filepath
& dirpath typed properties.
This is used to:
- Show red-alert when "//" are used in paths which don't support a relative prefix.
- Show a warning in the tooltip that the relative suffix is used when unsupported.
- Python warns if this prefix is ever used in an assignment or
function argument.
Resolves#133456.
Ref !137060
Depending on internal details of how Blender is run, attempting to load
elements from the asset library may either execute as synchronous &
blocking or asynchronously.
When executing a script in background mode, prior to this commit,
operators that are dependent on the asset system will not execute
correctly due to the loading not being complete.
Busy-waiting for this by repeatedly calling the operator over and over
again in python does not resolve. To match behavior of other operators
when called from python scripts such as the quadriflow remesh, this
commit changes the `brush.asset_activate` operator and dependent code to
force a blocking call instead of optionally using the wmJob background
abstraction system.
Related to #117399
Pull Request: https://projects.blender.org/blender/blender/pulls/134203
Prior to this commit, whether or not a brush was capable of using
certain options in Sculpt mode and whether or not these properties would
be shown to the user was spread across a number of files and
inconsistently applied.
This commit moves most of these checks to the bke::brush namespace so
that we have a single source of truth for these checks.
In total this commit:
* Changes all BrushCapabilitiesSculpt methods to use the equivalent
bke::brush function
* Removes brush type macros
* Renames BKE_brush_supports_secondary_color to fit the new pattern
* Refactors inverted logic for the `direction` property
Pull Request: https://projects.blender.org/blender/blender/pulls/137249
Simplifies implementation of curve tangent calculation for polylines
and evaluated curves. Loop now re-uses results from previous
iteration and adjusts for 0-length segments in the same loop,
removing need for a conditional extra loop.
Performance gain comes from removing a normalization and difference per
iteration. Curves with 0-length segments can benefit further.
For a single curve containing 860K points containing 0-length segments
measured improvement was 1.43x (from 33ms to 23ms).
Test does not utilize threading since it's threaded for curves, adding
threading to single/large curves might be better but would require
the current dependency to previous iterations to be removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/137182
Only consider buttons with matching types as matching, when comparing
them between redraws to preserve active button state.
We could have avoided a bunch of issues in the past with this. They are
becoming quite common since we use more spacers and invisible elements
to enable certain behavior. Especially with nodes this caused some issues
recently.
Further code in `ui_but_update_old_active_from_new()` assumed matching
button types resulting in undefined behavior.
Fixes heap-buffer-overflow ASAN crash since 8ec9c62d3e.
Steps to reproduce were:
- Open [emitter-closures.blend](/attachments/e7689016-064c-4390-9f02-c2665b2a6a6b)
- Ctrl+Shift+Click on the header of the "Evaluate Closure" node
Pull Request: https://projects.blender.org/blender/blender/pulls/136943
Gizmos that contain 3D parts, like the rounded lines of the "Rotate"
gizmo, have a fairly small hit size that make it hard to grab with a
tablet pen. This PR just increases the radius around the pointer
position while using a pen.
Pull Request: https://projects.blender.org/blender/blender/pulls/136847
This is helpful for #133123 where we want to use std::unique_ptr for
a struct with a definition that's ideally unavailable in sculpt_intern.hh.
Just adding the constructor changes the initialization of the struct,
so I added explicit defaults for the struct's fields.
Pull Request: https://projects.blender.org/blender/blender/pulls/137233
With commit bf18e8f814 the Properties editor can filter categories.
There is versioning code to ensure that any existing areas show all by
default. But newly-created Properties areas start without any. For
example, start with Factory Settings and then change the 3D Viewport to
a Properties editor and it will be blank. I'm assuming this is not
intended behavior so this PR makes new editors start with all tabs
shown.
Pull Request: https://projects.blender.org/blender/blender/pulls/137237
Vulkan backend is progressing quickly. Lately we improved the
performance and finalized OpenXR support. Removing these
unsupported/limited features from Preferences->System.
The Vulkan backend is still mentioned to be experimental. Removing it as
experimental option requires some more discussions and user feedback.
Some OpenXR platforms do not support OpenGL or Vulkan. To support these
platforms we use a bridge. Blender still renders in OpenGL/Vulkan, but
will copy the render result into a D3D11 swapchain.
OpenGL doesn this by importing the D3D11 swapchain into the OpenGL
context and perfor OpenGL calls to update the swapchain. However for
vulkan that could lead to construct 3 context for OpenXR
- Blender GPU Context
- OpenXR D3D Context
- New context that imports the Blender render result and the OpenXR
Swapchain image and copies them.
Due to Direct3D limitations importing into a vulkan context has known
issues (driver + extensions). Secondly we are not sure if we are running
on the same device as the OpenXR swapchain. The solution provided with
this PR is to only support CPU data transfers.
**SteamVR using d3d bridge**
SteamVR normally would use the Vulkan binding. But by changing the binding
priority in code you can make it select the D3D bridge.
<img width="1518" alt="Screenshot 2025-04-10 114534.png" src="attachments/f856bb2b-9ad5-4bb2-9cfd-a1412da9edd1">
It has been tested and validated to work using Mixed reality portal as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/137264
The `GeoTreeLog::ensure_evaluated_gizmo_nodes()` reran the iteration
over the tree loggers to add the node ids for the evaluated gizmo.
This wasn't an issue because `GeoTreeLog::evaluated_gizmo_nodes` is
a set, so nothing changed when trying to re-add the same ids.
This sets `reduced_evaluated_gizmo_nodes_` to `true` (probably an
oversight when this got added) so that the function returns early when
called again.
The `Group ID` input on every node is a hidden value except for the
Accumulate Field node. This patch just hides that value to bring it
inline with the other nodes, as different single values are meaningless.
Pull Request: https://projects.blender.org/blender/blender/pulls/137160
The nodes from #134640 were initially built off the Accumulate Field node.
During review for those nodes, certain changes to the code were suggested.
This patch applies the same changes to Accumulate Field node.
These changes namely being:
- Use `std::move` for field inputs
- Use `std::nullopt` as default for `node_type_from_other_socket`
Pull Request: https://projects.blender.org/blender/blender/pulls/137209
Incorrect data format was selected when using CPU data transfers in
OpenXR. It always used `GPU_DATA_HALF_FLOAT`, also when the swapchains
where `GPU_RGBA8`. This resulted in black screens in release mode, and
asserts in debud mode.
Fixed by selecting the correct data transfer data type based on the
swapchain format.
Co-authored-by: jeroen@blender.org <Jeroen Bakker>
Pull Request: https://projects.blender.org/blender/blender/pulls/137269
The attribute search for e.g the attribute name input in
the `Store Named Attribute` node did not list attributes
inside Grease Pencil drawings (curve and point domain).
The fix ensures that for the `GeometryComponent::Type::GreasePencil`
we also iterate over the attributes of each evaluated drawing.
Pull Request: https://projects.blender.org/blender/blender/pulls/137267
One of the calls to get the frame falloff was missing a
check for `use_multi_frame_falloff`.
This puts the conditions for when the multi frame falloff
needs to be calculated in the `get_frame_falloff` function.
That fixes the crash and makes a code a bit easier to read
(without ternary operator).
Pull Request: https://projects.blender.org/blender/blender/pulls/137259
We'd rather aggressively clear asset lists on file save since 9a9e2e19a9 (and
some related commits), seems like we can be a bit more precise here. Only
reload assets from the current file when saving the file, which is quite fast
to do and doesn't happen asynchronously (so UIs showing assets will only show
up once the assets are ready).
Actually we might not have to clear on file save at all, but needs more
testing.
Also fixes disappearing of asset previews on file save.
Pull Request: https://projects.blender.org/blender/blender/pulls/137117
When sculpting a grease pencil object, user can hold `Shift` key to
temporarily switch to smooth brush. Previously it will keep using
whatever brush settings from the original brush for smoothing, which is
not ideal, now it will switch to the actual smooth brush but only keep
the radius the same.
The implementation is largely the same as `smooth_brush_toggle_on` from
`sculpt.cc`, brush is changed and restored in `on_stroke_begin/end`.
Part of #136300
Pull Request: https://projects.blender.org/blender/blender/pulls/136827
Current Windows on ARM GPUs don't support
extenral memory. External memory is required
for OpenXR. So most likely OpenXR will not work
on these devices.
Most (read all) OpenXR platforms that support
vulkan also require external memory. So might
just be that those platforms won't work at all
on these devices.
In any case when not supported, the GHOST
OpenXR platform will use CPU for data transfer.
Panel toggles have a subpanel for listing out properties associated with their
Boolean checkbox.
The vertical spacing for properties in this panel is slightly different to how
normal Boolean sockets list their properties. This patch makes it more
consistent by putting the properties after `Default` in a `column` sublayout.
Pull Request: https://projects.blender.org/blender/blender/pulls/137211
The main goal here is to add `GeoTreeLogger.tree_orig_session_uid`. Previously,
it was always possible to derive this information in `ensure_node_warnings`.
However, with closures that's not possible in general anymore, because the
Evaluate Closure node does not know statically which node tree the closure zone
is from that it evaluates. Therefore, this information has to be logged as well.
This patch initializes `tree_orig_session_uid` the same way it initializes
`parent_node_id`, by scanning the compute context when creating the tree logger.
To make this work properly, some extra contextual data had to be stored in some
compute contexts.
This is just a refactor with no expected functional changes. Node warnings for
closures are still not properly logged, because that requires storing
source-location data in closures, which will be implemented separately.
Pull Request: https://projects.blender.org/blender/blender/pulls/137208
The logic to add a file extension to the filename - which runs when
editing the text was not running when resetting/clearing the value.
Resolve by calling `uiBut::func`.
Along with [0], this fixes#134101.
[0]: f2a1c8d77c
When a wide menu is open and you move your mouse outside of it we have
new code that prevents the immediate opening of neighboring menus. But
while in this condition of mouse outside the menu, the rest of the
event processing is not run, so pressing "escape" will not close it.
This PR just moves the conditions around so event handling always
continues unless another menu is opened.
Pull Request: https://projects.blender.org/blender/blender/pulls/137243
Failure to write an image that didn't set `errno` reported:
"Could not write image: Success"
Check errno is non-zero before using it's message,
ideally error prints would be shown here.
* Use C++ math container types instead of arrays
* Use enum class instead of enum
* Use references instead of pointer for PainCursorContext
* Add a few comments
Pull Request: https://projects.blender.org/blender/blender/pulls/137235
Part of #82877
When drawing specialized cursors for the different paint modes via the
`wmPaintCursor` draw callback, tablet tilt direction is unavailable to
use to customize the drawing for the user.
To enable this functionality, this commit adds the `x_tilt` and `y_tilt`
data read while processing MOUSEMOVE events to the `eventstate` variable
so it can be used by consuming functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/137189