Commit Graph

117289 Commits

Author SHA1 Message Date
Charlie Jolly
bf04513dec Geometry Nodes: new Integer Math node
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
2024-09-23 15:01:31 +02:00
YimingWu
801a73887a Fix #128032: GPv3: Texture mapping modifier name typo
Was previously "TimeOffset" which obviously wasn't correct. Corrected to
"TextureMapping".
2024-09-23 20:58:32 +08:00
Iliya Katueshenock
c40dc9aa03 Nodes: use node storage to store type of reroute node
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
2024-09-23 14:47:05 +02:00
Falk David
3c8d4becc8 Cleanup: GPv3: Return reference from GreasePencil::layer() functions
Since we only assert and never return `nullptr`, it's better to just return a reference.
The access into the span already asserts anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/128025
2024-09-23 13:54:02 +02:00
Pratik Borhade
e494a44024 Fix #128007: Outliner visibility toggles can be edited on linked data
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
2024-09-23 13:06:47 +02:00
Pratik Borhade
c29a2eb451 Fix #127928: Default radius value for gpv3 draw brush
Set default value of `unprojected_radius`

Pull Request: https://projects.blender.org/blender/blender/pulls/128023
2024-09-23 13:05:26 +02:00
Falk David
bb9489070a Cleanup: GPv3: Remove const qualifier in function declaration
The `const` isn't needed for trivial types and shouldn't be used.
2024-09-23 12:16:12 +02:00
Falk David
332f7517da GPv3: Add function to insert a keyframe into multiple layers
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
2024-09-23 12:12:59 +02:00
Clément FOUCAULT
3d74be9c5b Fix #126947: EEVEE: Color drifting & darkening at high sample count
The hardware seems to truncate the mantissa instead
of rounding. Doing the rounding manually fixes the issue.

See PR for in depth analysis.

Pull Request: https://projects.blender.org/blender/blender/pulls/127948
2024-09-23 11:30:59 +02:00
Jeroen Bakker
ddb2179e37 Vulkan: GPU device selection
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.

![image](/attachments/5d9198a8-af08-4eee-aa73-363edea11cd9)

**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
2024-09-23 11:18:24 +02:00
Campbell Barton
f4c8845b60 Cleanup: remove duplicate check for AMD W6800 GPU
This read like a typo (which missed W6700) however the GPU
wasn't released. Remove the duplicate check and add a note.

Ref !127993
2024-09-23 19:09:14 +10:00
Jeroen Bakker
e7793cbc4d UI: Incorrect usage shader and primitive
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
2024-09-23 10:31:22 +02:00
Jeroen Bakker
56b7ff256f Vulkan: Fix validation error push constants for compute shaders
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
2024-09-23 09:44:29 +02:00
Aras Pranckevicius
5a1cf200aa Fix #127542: OBJ material groups are not written unless .mtl file is also written
These two settings are not coupled together, one should be able to
export face material groups without exporting the .mtl file.
2024-09-23 10:16:25 +03:00
Campbell Barton
72b6ffd508 Fix IDPropertyUIManager.as_dict() non-array default for arrays
When a non-array default was set for an array,
the returned default would be empty.
2024-09-23 16:25:13 +10:00
Campbell Barton
57eae31ce9 Fix #127952: Crash on load after id_properties_ui type change
Resolve regression in [0] which keeps UI data when ID property types
change.

[0]: 91466f71f1
2024-09-23 16:18:39 +10:00
Campbell Barton
3e6c816ad4 BLI_math: convert to double before halving for eulO_to_quat
As doubles are used for higher precision, promote to double before
halving the euler for a marginally more precise result.
2024-09-23 12:28:05 +10:00
Campbell Barton
7feccafbb0 Cleanup: various non functional changes
- Use const arguments.
- Quiet unused assignment warnings.
- Use explicit cast to suppress CPPCHECK's truncLongCastReturn warning.
2024-09-23 11:20:14 +10:00
Jacques Lucke
a34b0e17d6 Fix: Geometry Nodes: avoid dangling zone nodes when copying zones
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.
2024-09-23 01:31:59 +02:00
Jacques Lucke
b7bfdfa983 Geometry Nodes: propagate string property subtype to modifier
The only exposed subtype for strings is `file path` currently. Inputs of this
type will show a button to select a path with the file browser.
2024-09-23 01:16:17 +02:00
Jacques Lucke
9239c00eda Geometry Nodes: support showing viewer attribute for grease pencil in spreadsheet 2024-09-22 22:52:28 +02:00
Aras Pranckevicius
c6f5c89669 BLI: faster float<->half array conversions, use in Vulkan
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
2024-09-22 17:39:54 +02:00
Campbell Barton
2b2a176d8d Cleanup: remove dead code from system path lookup
Commit [0] missed removing this.

[0]: 53dc251fd3
2024-09-22 22:45:11 +10:00
Aras Pranckevicius
958433194e Fix #127932: STL importer was not setting faces as sharp
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.
2024-09-22 14:19:38 +03:00
Campbell Barton
b302f37952 Cleanup: remove/comment unused struct members & variables 2024-09-22 18:25:40 +10:00
Campbell Barton
4bd0cc888e Cleanup: various non functional changes
- Reduce variable scope.
- Function style casts.
- Avoid variable shadowing.
- Quiet unused assignment warnings.
- Remove redundant call in GHOST_WindowNULL constructor.
2024-09-22 18:25:40 +10:00
Sean Kim
31e908bce4 Fix #127910: Bake Object Transform does not set an active layer
Missed in bd7c6208b7.

Pull Request: https://projects.blender.org/blender/blender/pulls/127961
2024-09-22 09:17:46 +02:00
Jesse Yurkovich
447cde140d Cleanup: Remove unused BLI_array macro implementation
Remove unused files.

Pull Request: https://projects.blender.org/blender/blender/pulls/127962
2024-09-22 00:53:14 +02:00
Jesse Yurkovich
1dbf75ff52 Cleanup: Remove BLI_array macros in bmesh edgenet
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
2024-09-21 23:59:14 +02:00
Sean Kim
e908a9d39e Cleanup: Rename bmesh detail size raycast function
Pull Request: https://projects.blender.org/blender/blender/pulls/127954
2024-09-21 22:20:00 +02:00
Sean Kim
fc8a163892 Refactor: Sculpt: Remove usage of PBVHVertRef in raycast methods
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
2024-09-21 20:17:18 +02:00
Campbell Barton
0d8149d4ff Cleanup: various non-functional changes
- Use const pointers.
- Avoid shadowing variables.
- Remove redundant check.
2024-09-21 23:01:59 +10:00
Aras Pranckevicius
754495247b VSE: Speedup drawing of the timeline channels sidebar
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
2024-09-21 14:30:48 +02:00
Campbell Barton
5c784edf96 Cleanup: remove unused headers from bpath.cc 2024-09-21 19:56:20 +10:00
Campbell Barton
890f06ec42 WM: prevent potential freed memory access for the UV unwrapping timer 2024-09-21 17:17:25 +10:00
Campbell Barton
a5453ce992 Cleanup: use bool for unwrap cancel argument 2024-09-21 16:58:19 +10:00
Lukasz Czyz
788bc5158e UV: add support for the SLIM unwrapping algorithm
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
2024-09-21 16:48:53 +10:00
Campbell Barton
427be373f7 Cleanup: sort cmake file lists 2024-09-21 16:26:43 +10:00
Campbell Barton
f030e6f0b2 Cleanup: spelling in comments 2024-09-21 16:22:52 +10:00
Campbell Barton
0707369bb0 Cleanup: prefer ASCII symbols in code-comments 2024-09-21 16:18:40 +10:00
Sean Kim
c95a89f92b Fix #127828: Clay brush deforms mesh incorrectly
Missed in 0bc7631693

Pull Request: https://projects.blender.org/blender/blender/pulls/127938
2024-09-21 04:40:58 +02:00
Hans Goudey
079a8b395e Geometry Nodes: Optimize realize instances for single component inputs
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
2024-09-21 04:27:39 +02:00
Campbell Barton
37e3397968 Cleanup: replace magic number with enum (missed last commit) 2024-09-21 11:09:00 +10:00
Campbell Barton
8a683632c7 Cleanup: replace magic number with enum 2024-09-21 10:58:59 +10:00
Campbell Barton
ef098befcb Cleanup: use DEG2RADF macro for clarity 2024-09-21 10:58:20 +10:00
Jesse Yurkovich
460aa3c231 USD: Point Cloud export support
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
2024-09-20 19:57:12 +02:00
Jacques Lucke
4aa99f5647 Fix: add missing virtual destructor 2024-09-20 19:24:37 +02:00
Falk David
d1a6cd92fe GPv3: Fix compiler warning
Introduced by c20399442d.
2024-09-20 18:53:20 +02:00
Julian Eisel
a38c96b92c Sculpt/Paint: Bring back support for multiple brush based tools
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
2024-09-20 18:09:31 +02:00
Philipp Oeser
2ba13677ad Fix: Sculpt Scale tool adds up scale with non-uniform object scaling
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
2024-09-20 18:02:31 +02:00