Commit Graph

106264 Commits

Author SHA1 Message Date
Aras Pranckevicius
5bd1e0bb22 VSE: replace Subsampled3x3 filter by a general Box filter
Part of overall "improve filtering situation" (#116980): replace Subsampled3x3
(added for blender 3.5 in f210842a72 et al.) strip scaling filter with a
general Box filter.

Subsampled3x3 is really a Box filter ("average pixel values over NxM region"),
hardcoded to 3x3 size. As such, it works pretty well when downscaling images by
3x on each axis. But starts to break down and introduce aliasing at other
scaling factors. Also when scaling up or scaling down by less than 3x, using
total of 9 samples is a bit of overkill and hurts performance.

So instead, calculate the amount of NxM samples needed by looking at scaling
factors on X/Y axes. Note: use at least 2 samples on each axis, so that when
rotation is present, the result edges will get some anti-aliasing, just like it
was happening in previous filter implementation.

Images in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/117584
2024-01-29 18:41:31 +01:00
Omar Emara
1aafb6802b Compositor: Use SMAA for anti-aliasing in all nodes
This patch changes all anti-aliasing operations to use SMAA instead of
the Scale3x-based operation. That's because SMAA is more accurate while
the Scale3x one is more a hack.
2024-01-29 18:44:10 +02:00
Sybren A. Stüvel
5c6376fd0a Cleanup: anim, add newlines between groups of includes
No functional changes.
2024-01-29 17:33:38 +01:00
Sybren A. Stüvel
ee814b8646 Cleanup: add missing #pragma once to ANIM_animdata.hh
No functional changes.
2024-01-29 17:33:38 +01:00
Miguel Pozo
f185a284f0 Fix: EEVEE-Next: Hair material flags
Add missing tags so the deferred pass can work correctly.
Fixes principled hair render tests.
2024-01-29 17:03:39 +01:00
YimingWu
56439d88f5 GPv3: Noise modifier
This ports the noise modifier to GPv3.
There should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/117057
2024-01-29 16:49:16 +01:00
Omar Emara
8b7b165ad9 Fix: Compositor lighten mix mode is wrong for factors < 1
The Lighten mix mode in the Mix RGB node is wrong for factors less than
one. The lighten blend mode is a simple component-wise maximum in EEVEE,
Cycles, and other implementations. While the compositor seems to define
it as a weighted maximum using the factor as the weight. It should be
noted that its Darken counterpart is correctly implemented for the same
node, so Lighten should follow, which this patch do.

GPU compositor shares the EEVEE code, so it is already correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/117630
2024-01-29 15:58:57 +01:00
Omar Emara
5cc76ea118 Fix: Mask node has an output even with no mask
The Mask compositor node still has an output even when no mask is
selected in the node. Fix this by outputing a single zero value in that
case.
2024-01-29 16:55:53 +02:00
Sybren A. Stüvel
51c6dc06a0 Refactor: reduce indentation of ui_but_anim_flag()
Reduce cognitive complexity of `ui_but_anim_flag()`. Early returns, less
indentation, and variable declarations close to where they are used.

No functional changes.
2024-01-29 15:51:50 +01:00
Sean Kim
c61d1bcb54 Sculpt: Add global automasking propagation steps
This pull request adds the ability for the `propagation_steps` value
for certain automasking settings to be applied globally instead of
using the per-brush attribute.

Previously, while the flag settings were stored at the brush and global
level,  the `propagation_steps` value would always change the brush
attribute even when using the global menu.

Addresses #102377

Pull Request: https://projects.blender.org/blender/blender/pulls/117316
2024-01-29 15:39:34 +01:00
Lukas Tönne
7163873420 Geometry Nodes: Fix memory leak when using empty menu switch nodes.
Connecting an empty menu to the node group inputs causes a memory leak.
The `id_property_int_update_enum_items` function was always allocating
a new `enum_items` list, but then discarding it if there are no enum
items.
2024-01-29 15:36:42 +01:00
Brecht Van Lommel
0e824c5f8d Fix: blender-softwaregl on Linux not working
Files were installed to the wrong directory after 282944caac.
2024-01-29 14:47:44 +01:00
Brecht Van Lommel
efcee6450c Fix ID template not respecting hide_buttons regarding overrides 2024-01-29 14:40:17 +01:00
Sybren A. Stüvel
b79419914a Anim: avoid moving/assigning bones to a linked bone collection
In the M/Shift+M popup menus (3D viewport, armature pose/edit mode),
disable menu items for operators that are owned by a linked armature.

You can only (un)assign bones to local bone collections (so local armature
or added via local library override).
2024-01-29 14:35:53 +01:00
Sybren A. Stüvel
f0aa69ff3a Fix #117620: Crash when moving bones to linked bone collection
`add_or_move_to_collection_bcoll()` already checked for linked collections,
but the caller didn't properly do a `nullptr` check. Adding that check
fixed the crash.

The next commit will actually disable the menu for such collections, so
that it's clear in the UI that it cannot work.
2024-01-29 14:35:53 +01:00
Miguel Pozo
f1c061c97b Fix: EEVEE-Next: Volumes
Regressions from 553b1b6f1f and 545f2c04fa
2024-01-29 13:37:47 +01:00
Jacques Lucke
4ad9d8ac59 Geometry Nodes: disable bake settings on linked object 2024-01-29 13:20:06 +01:00
Casey Bianco-Davis
eb693246b6 Fix #117132: GPv3: Edit mode overlay memory leaks
The problem was that `grease_pencil_edit_batch_ensure` would not return early if the buffers already exist, meaning that multiple buffers could be create but only the last ones would be freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/117580
2024-01-29 11:56:45 +01:00
Jacques Lucke
7bb1ce1241 Geometry Nodes: improve handling baked data after undo
Previously, one could easily "loose" baked data by undoing. The data was not
actually deleted, but Blender didn't find it anymore. This happened because
`update_existing_bake_caches` was expected to be called after changes to
`NodesModifierData.bakes`. However, this was not called after undo.
It was also not possible to call this function from `blend_read`, because it
required access to the referenced node tree.

Now, the bake cache is lazily created during depsgraph evaluation, which
partially solves the problem. It can still seem that Blender lost data, but that
fixes itself much more quickly after the next evaluation. The remaining issue
should be solved a future patch that keeps the bake cache intact over undo
steps using `foreach_cache`.
2024-01-29 11:42:34 +01:00
Campbell Barton
be7f89a9f5 Cleanup: spelling in comments 2024-01-29 11:47:42 +11:00
Alaska
020f6ec0ff Versioning: Better conversion of Specular tint for metals
With the addition of F82 tinting to the Principled BSDF, metals now use
the specular tint parameter.

This can cause issues when converting materials from older versions
of Blender to newer versions if the Specular Tint isn't handled
properly for these materials.

This commit attempts to fix this by adjusting the Specular Tint color
based on the Metallic input to try and keep converted materials
consistent with older versions of Blender.

Thank you to @LukasStockner for helping out.

Pull Request: https://projects.blender.org/blender/blender/pulls/114518
2024-01-29 00:36:28 +01:00
Iliya Katueshenock
93b28b54fc Cleanup: Geometry Nodes: Use int instead of uint16_t
https://developer.blender.org/docs/handbook/guidelines/c_cpp/#integer-types

Pull Request: https://projects.blender.org/blender/blender/pulls/117594
2024-01-28 15:45:32 +01:00
Iliya Katueshenock
25f32a2191 Cleanup: Geometry Nodes: Unused function
Pull Request: https://projects.blender.org/blender/blender/pulls/117591
2024-01-28 15:26:05 +01:00
Iliya Katueshenock
f795d81a88 Cleanup: Use const for enum item variables and arguments
Pull Request: https://projects.blender.org/blender/blender/pulls/117592
2024-01-28 15:25:26 +01:00
Pierrick Bouvier
a3d915310b Build: Fix some excessive Visual Studio compile times
While investigating Blender compilation time for windows-arm64, we
identified two compilation units that were taking a long time to compile
(~1h each). This affects windows-x64 builds as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/117534
2024-01-28 12:12:52 +01:00
Guillermo Venegas
d4bc3bd08d IO: Add file handlers to c++ import operators
Adds file handlers for the C++ import operators.
This will allow these operators to be invoked with drag-and-drop
filepath data in the 3D Viewport or the Outliner.

When the operators are called with drag-and-drop data a dialog popup
will be used instead of invoking the file select window.

Previously OPTYPE_REGISTER tag had no effect, now since these operators
can run as popup dialogs this flag is removed to prevent heavy io
operations in the redo panel.

Also includes drawing functions for ply and stl and a missing
event notifications to collada import.

Important: Presets can override file path properties, so if a preset is
used, file paths provided by drag and drop will be lost. This will be
addressed in follow up changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/116873
2024-01-27 23:38:44 +01:00
Brecht Van Lommel
07de588615 Fix: Revert change to use operator description as title in dialogs
This was part of #117528, but the description is not suitable as a title
in general and this breaks various existing popups. It is often tool long
and detailed, or just not worded in a way that works as a title.
2024-01-27 23:30:20 +01:00
Hans Goudey
359bfbcd78 Cleanup: Use enum class and forward declaration for paint mode 2024-01-26 18:43:13 -05:00
Hans Goudey
fb0d6198c0 Cleanup: Move remaining asset editors code to C++ namespace 2024-01-26 18:43:13 -05:00
Brecht Van Lommel
745c30ad08 Cleanup: removed unused argument 2024-01-27 00:22:49 +01:00
Hans Goudey
2043df4816 Cleanup: Remove unnecessary AssetLibrary C wrapper type 2024-01-26 18:15:41 -05:00
Hans Goudey
f08ce0a8ed Cleanup: Move AS_asset_library.h contents to C++ header 2024-01-26 18:15:41 -05:00
Hans Goudey
1743af0031 Cleanup: Remove unnecessary keywords from C++ headers 2024-01-26 18:15:41 -05:00
Hans Goudey
0e6aad4742 Cleanup: Remove remaining asset editor headers to C++ 2024-01-26 18:15:40 -05:00
Jesse Yurkovich
90c5e0f0c6 Attributes: Reduce memory allocations in attribute accessor 'for_all' func
Based on an instrumented set of our container classes, this code path
was found to be producing an excessive number of Set resizes that are
trivial to remove.

The Set's inline buffer size was tuned from 4 to 16 which eliminates all
allocations, about 77k of them, during FBX import of the Zero-Day
"Measure One" scene[1]. It also eliminates ~90% of allocations, about
844k of them, when loading the Charge demo scene. For additional
context, using a size of 8 would reduce allocs by ~65% for Zero-Day.

[1] Zero-Day, Open Research Content Archive (ORCA):
https://developer.nvidia.com/orca/beeple-zero-day

Pull Request: https://projects.blender.org/blender/blender/pulls/117432
2024-01-26 21:39:19 +01:00
Jesse Yurkovich
068579f3e8 Mesh: Reduce memory allocations in corner normals calculation
Based on an instrumented set of our container classes, it was found that
an excessive number of Vector reallocations were occurring in the corner
normals code path.

The allocations were reduced by increasing inline buffer sizes for the
Vectors in question. The total number of reallocs falls from 433k to
194k when importing the Zero-Day FBX scene[1]. Profiling time spent in
`MEM_lockfree_mallocN_aligned` falls from ~1.3% to ~1.15%

[1] Zero-Day, Open Research Content Archive (ORCA):
https://developer.nvidia.com/orca/beeple-zero-day

Pull Request: https://projects.blender.org/blender/blender/pulls/117431
2024-01-26 21:33:50 +01:00
Harley Acheson
0d6aec1c21 UI: Operator Props Dialog Changes
Changes to WM_operator_props_dialog_popup to allow configuration,
including via python, and with a look consistent with new confirms.

Pull Request: https://projects.blender.org/blender/blender/pulls/117528
2024-01-26 20:52:31 +01:00
Jason Fielder
ac61dad14f EEVEE Next: Resolve motion blur intermittent rendering
Fixes issue where motion blur would not display for
certain objects intermittently due to uninitialized
parameters in the ObjectKey struct causing the
motion object map look-up to fail and for motion
parameters to be reset to default, disabling the
effect for the given objects.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117560
2024-01-26 20:48:00 +01:00
Hans Goudey
1bb358f423 Fix: Tooltip memory leak
Use std::string for custom tooltip function return value.
2024-01-26 14:39:05 -05:00
Hans Goudey
3b2a99af3e Fix: Build error in debug build 2024-01-26 13:47:50 -05:00
Hans Goudey
2a5531b253 Cleanup: Use StringRef instead of const char * in OBJ export 2024-01-26 13:18:58 -05:00
Hans Goudey
2a0c8593c9 Cleanup: Use C++ Array in OBJ import 2024-01-26 13:17:30 -05:00
Hans Goudey
0d03ae4a4d Cleanup: Update mesh naming in OBJ IO code 2024-01-26 13:16:01 -05:00
Hans Goudey
899546d4e4 Cleanup: Use utility to fill index range in OBJ mesh export 2024-01-26 12:58:45 -05:00
Hans Goudey
94ca3aea83 OBJ: Use mesh normals domain properly for normals storage
- Only calculate the necessary normals based on smooth/flat/mixed shading
- Use cached face normals instead of computing them
- Use a `VectorSet` for deduplication instead of a `Map`
- Deduplicate vertex normals and store indices in separate loops
- Avoid unnecessary duplication of face normal indices
- Inline simple function for slicing index span

Export time (ms) of 1.8m vertex mesh:
| Normals Domain  | Before | After |
| --------------- | ------ | ----- |
| Face (flat)     | 559    | 469   |
| Vertex (smooth) | 659    | 466   |
| Corner (mixed)  | 656    | 640   |

The change of using normals from different domains and using a
VectorSet for de-duplication change the order of normals in the OBJ
files. Other than that, the results should be unchanged.

Fixes #117510

Pull Request: https://projects.blender.org/blender/blender/pulls/117522
2024-01-26 18:54:58 +01:00
Jeroen Bakker
ec80264d09 Vulkan: Bundle Calls in DrawList
A draw list bundles multiple draw commands for the same geometry
and sends the draw commands in a single command. This reduces
the overhead of pipeline checking, resource validation and can
keep the load higher on the gpu as more work needs to be done.

Previously the draw list didn't bundle any commands and would still
send each call separately to the GPU. This PR implements the bundling
of the commands.

Pull Request: https://projects.blender.org/blender/blender/pulls/117548
2024-01-26 17:45:18 +01:00
Hans Goudey
b0a4dd56aa Fix: Build error with asserts enabled
74128855be removed a function used in debug builds.
2024-01-26 10:50:13 -05:00
Philipp Oeser
eead38ab97 Fix #117520: Data Transfer modifier not working with Vertex Groups
This was the case for custom normals.

There was an optimization in 91b4f9f1f6 that was skipping computation of
existing normals if the Mix Factor in the UI was at 1.0 (under the
assumption that in this case no old normals would be needed.

Problem is that the resulting mix factor is the product of the Mix
Factor in the UI and the weights, so just doing the check as in the
culprit commit is not enough.

Need to consider if weights are used.

Pull Request: https://projects.blender.org/blender/blender/pulls/117538
2024-01-26 16:44:59 +01:00
Hans Goudey
ebcdf19537 Cleanup: Use consistent camel case for test class names 2024-01-26 10:25:48 -05:00
Philipp Oeser
37e89714ff Fix: Entering node group via icon after exiting it via ctrl+tab broken
This is because the `NODE_OT_group_edit` operator reuses the last value
of the `Exit` property and once this is set it would always try to pop
(instead of push [which is what we want from the icon]) the nodegroup.

Callers of the operator set `Exit` explicitly elsewhere (just not
from node drawing -- where the way it is called [via a more general
callback] makes it difficult to set operator properties from there).

Solve by not saving the property for following usages (flag
`PROP_SKIP_SAVE`).

Fixes #117530.

Pull Request: https://projects.blender.org/blender/blender/pulls/117542
2024-01-26 16:23:02 +01:00