Provide building block support for integer operations.
Manipulation of integer based data should not be limited to using float math nodes.
Using float math comes with accuracy issues for larger integers and requires unnecessary
type conversions.
The node also adds some integer specific operations like GCM and LCD.
Pull Request: https://projects.blender.org/blender/blender/pulls/110735
The reroute node used to be a bit special in the sense that its data type was
only stored in the sockets. However, typically, the ground truth data should be
stored in the node storage and then the socket types are derived from that.
For users, there should not be a noticable difference. However, from Python
it's not possible to modify the socket type directly on the socket anymore.
This is forbidden for other built-in nodes already too.
Instead, one can use the new `reroute_node.socket_idname` property to change
the type of a node. This internally also recreates the sockets with the correct
type.
Pull Request: https://projects.blender.org/blender/blender/pulls/121146
When a linked/overridden collection is child of a local collection,
object/collection level visibility toogles can be edited of library data
if shift clicked on local collection's properties. To fix this, skip further
recursive calls when the property is not editable.
Pull Request: https://projects.blender.org/blender/blender/pulls/128011
This function adds a key into multiple layers. This is more efficient than
inserting a single key multiple times in a loop, because the drawing
array has to be resized one-by-one.
In this function, the resizing happens at once.
Pull Request: https://projects.blender.org/blender/blender/pulls/127930
Allows users to override the auto detection for GPU
selection. Normally the GPU selection is done by looping
over the order Vulkan provides and finding the highest
performing device based on its type (discrete, integrated,
software).
However users might have multiple discrete cards and want
to switch between them. Or developers want to validate other
GPUs without rebooting.
This PR adds the ability to override the auto detection
for the vulkan backend.

**Future improvements**:
- This PR does not include a command line option. This can be added
later for render farms.
Pull Request: https://projects.blender.org/blender/blender/pulls/127860
Some primitives can only work with certain shaders. In OpenGL this
didn't lead to an error, but Metal and Vulkan could not render at all.
The Vulkan backend is more specific on what it supports so we could
detect incorrect usages and fix them.
This was detected when investigating #126947.
Pull Request: https://projects.blender.org/blender/blender/pulls/128013
Since parallel compilations was introduced, a validation error
was signalling that push constants for compute shaders didn't have
the correct pipeline binding. The root cause was that the pipeline
binding was determined, before the type of shader was known.
This PR fixes this by detemining if a shader is a compute shader up
front. It also removes some code that could lead to issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/128010
Previously, it was possible to get an invalid zone by copying e.g. the Simulation Input.
Now, whenever copying only one zone node, the other one will automatically be selected
as well. This effectively avoids the dangling zone node.
The same happens already when deleting and grouping nodes.
There are still ways to get dangling zone nodes, especially from Python.
In addition to float<->half functions to convert one number (#127708), add
float_to_half_array and half_to_float_array functions:
- On x64, this uses SSE2 4-wide implementation to do the conversion
(2x faster half->float, 4x faster float->half compared to scalar),
- There's also an AVX2 codepath that uses CPU hardware F16C instructions
(8-wide), to be used when/if blender codebase will start to be built
for AVX2 (today it is not yet).
- On arm64, this uses NEON VCVT instructions to do the conversion.
Use these functions in Vulkan buffer/texture conversion code. Time taken to
convert float->half texture while viewing EXR file in image space (22M
numbers to convert): 39.7ms -> 10.1ms (would be 6.9ms if building for AVX2)
Pull Request: https://projects.blender.org/blender/blender/pulls/127838
To match what the previous Python STL importer was doing, and what
the documentation / tooltips say is happening, the imported mesh
faces should be marked as sharp. Do that.
This replaces the older dynamic c array macros with blender::Vector in
bmesh_polygon_edgenet. This is the only remaining use of the old array
machinery and removal of `BLI_array.h / .c` can happen immediately
afterwards.
See #103343
Pull Request: https://projects.blender.org/blender/blender/pulls/119975
Part of #118145.
This commit removes the `PBVHVertRef` abstraction and changes the last
remaining usage of it. The `raycast_node` API has been turned into a
static function and the corresponding typed APIs exposed for direct
usage.
Pull Request: https://projects.blender.org/blender/blender/pulls/127933
Drawing the list of channels on the left side of VSE timeline was taking
surprisingly long time (3.5ms in Sprite Fright Edit v135 on Mac M1 Max).
This PR makes them draw in 0.4ms, i.e. 10x faster, by doing two things:
- Stop "search through the whole timeline" work whenever we need to know
which meta strip (if any) owns some VSE channel. Remember that info in
the "sequence lookup" that already holds data to speedup similar queries
(sequence by name, meta by sequence). I.e. this gains "channel owner by
channel" query hashtable.
- Stop alternating between "regular font glyph cache" and "svg icons glyph
cache" on each channel row, which incurs a draw call / UI batch flush.
Instead, draw all the lock/mute widgets first, then all the channel names.
While at it, simplify code related to sequence lookup:
- Use C++ mutex with lock_guard
- Use BLI Map instead of GHash
- Simplify SEQ_sequence_lookup_tag to just SEQ_sequence_lookup_invalidate
- Remove unused SEQ_get_meta_by_seqbase and SEQ_query_all_meta_strips_recursive
Pull Request: https://projects.blender.org/blender/blender/pulls/127913
Integrate an existing implementation of the SLIM unwrapping algorithm
into Blender. More info about SLIM here:
https://igl.ethz.ch/projects/slim/
This commit is based on the integration code written by Aurel Gruber
for Blender 2.7x (unfinished and never merged with the main branch).
This commit is based on Aurel's code, rebased and further improved.
Details:
- Unwrap has been moved into a sub-menu,
slim unwrapping is exposed as: "Minimum Stretch".
- Live unwrap with SLIM refines the solutions using a timer.
- When using SLIM there are options to:
- Set the number of iterations.
- Weight the influence using vertex weights.
- SLIM can be disabled using the `WITH_UV_SLIM` build option.
Co-authored-by: Aurel Gruber <aurel.gruber@infix.ch>
Ref !114545
Previously when there was a single mesh/curve/point cloud/grease pencil
input, the code would still do a deep copy of the entire geometry. Not
only does this waste time and memory usage, it also inhibits the
benefits of the shared cache system, causing normals and other derived
data to be recalculated more than necessary.
This commit makes the realize instance node "free" in those cases.
When the instance has a non-identity transform it only copies and
transforms the positions; the rest of the geometry is untouched.
For the implementation it was simpler to still copy the ID data-block
and rely on implicit sharing to avoid the expense of copying attributes.
That's because we don't have access to the original geometry set
components after all the preprocessing has happened.
Pull Request: https://projects.blender.org/blender/blender/pulls/127867
Export Blender Point Clouds as `UsdGeomPoints` primitives.
Summary
- Adds the `USDPointsWriter` class
- Adds tests to ensure that animated positions, velocities, radii, and
regular attributes are all written correctly (in a sparse format)
- Adds a new `export_points` operator property, mirroring the existing
`import_points` option
Pull Request: https://projects.blender.org/blender/blender/pulls/126389
Design: https://projects.blender.org/blender/blender/issues/126032
The brush assets project merged all brush based tools into a single, "Brush"
tool. After feedback, we want to bring back some of the previous brush based
tools. For example in grease pencil draw mode, not having an eraser or fill tool
available, and having to go through all the brush assets instead made the
workflow more cumbersome, and features less discoverable (an eraser tool in the
toolbar is quite easy to find, a brush deep down in the asset library may not
be).
With this commit we can add back some tools for specific brush types in sculpt &
paint modes. The follow up commit will start with the eraser and fill tools for
grease pencil draw mode, but more tools in other modes are expected to follow.
For every brush type that has a tool in the toolbar, the last used brush is
remembered. This is the biggest part of the changes here.
Brush asset popups will only show the brushes supported by the active tool for
now. The permanent asset shelf region displays all brushes. Activating a brush
that isn't compatible with the current tool will also activate the general
"Brush" tool, but while the brush tool is active we never switch to another one
(e.g. activating an eraser brush will keep the "Brush" tool active). All this
might change after further feedback.
Pull Request: https://projects.blender.org/blender/blender/pulls/125449
This has already been tried to solve in f71d89bb04 (but apparently
still wrong).
This PR will hopefully address part of the scaling issues (rotation
needs another look, see below)
wrt. to scaling, the is code in place to reorient the size matrix in
`ElementResize` (for `Sculpt`, `Object`, `ObjectTexSpace` & `Pose`) that
multiplies by `td->axismtx` and it can be assumed that this code expects
`td->axismtx` to be normalized (otherwise the scaling adds up). And it
looks like all code coming here actually does this (except sculpt code
from `createTransSculpt`).
So to resolve, normalize `td->axismtx` in `createTransSculpt`.
NOTE: even after this PR, there can still be issues with scaling, namely
with rotated objects and global orientation, or when the pivot is set to 3D
cursor, those need another look.
NOTE: for rotation, I need another look at git history, atm. it seems
puzzling that f71d89bb04 e.g. uses `TransDataExtension::l_smtx` (this
is only ever used for pose related rotation?!)
part of #127398
Pull Request: https://projects.blender.org/blender/blender/pulls/127495