blender.git
6 days agoCycles: refactor to move part of KernelData definition to template headerarcpatch-D14645
Michael Jones [Thu, 14 Jul 2022 16:40:21 +0000 (14 17:40 +0100)]
Cycles: refactor to move part of KernelData definition to template header

To be used  for specialization on Metal in a following commit, turning these
members into compile time constants.

Cycles: keep track of SVM nodes used in kernels

To be used for specialization in Metal, to automatically leave out unused nodes
from the kernel.

Cycles: Apple Silicon optimizations (~20% uplift on M1 Max)

M1 Max samples/min over 30 seconds (macOS 13.0):
```
                    PSO_GENERIC  PSO_SPECIALIZED_INTERSECT  PSO_SPECIALIZED_SHADE
barbershop_interior       83.4             89.5                   93.7
bmw27                   1486.1           1671.0                 1825.8
classroom                175.2            196.8                  206.3
fishy_cat                674.2            704.3                  719.3
junkshop                 205.4            212.0                  257.7
koro                     310.1            336.1                  342.8
monster                  376.7            418.6                  424.1
pabellon                 273.5            325.4                  339.8
sponza                   830.6            929.6                 1142.4
victor                    86.7              96.4                   96.3
wdas_cloud               111.8            112.7                  183.1
```

Next steps:

[ ] ~~Include SHADER_EVAL kernels in the "must cache" list~~ //(limited benefit to specializing one off shade steps)//
[ ] Adapt / merge with dynamic kernel compilation caching patch (D14754)
[x] Separate specialization of intersection (fast building) and shading (slow building) kernels
[x] Rate-limiting and invalidation of kernel compilation requests
[ ] UI for enabling / disabling background compilation

---

With this patch, the Metal backend compiles & caches a second set of kernels which are optimized for scene content, enabled for Apple Silicon.

The optimized kernels result in faster render times, but are slower to compile. They are compiled in the background and swapped in when ready. The optimizations are:

- ~~Aggressive inlining. This is not scene-specific, but hasn't been enabled for the generic kernels because it inflates compile time quite a lot. It results in better register usage, reducing the spill that we're seeing in some kernels. Possible adjustments: 1) take the compile hit for generic kernels since they're only compiled once (and it helps in general), or 2) add a _second_ set of generic_kernels with aggressive inlining enabled.~~ //(enabled by D14923)//
  - ~8% uplift in isolation for 3 benchmarking scenes

- Substitution of KernelData constants. Select members of KernelData struct are replaced with macros that are #defined at the top of source. Only constants pertaining to the rendering algorithm is specialized, rather than constants which might affect artistic look.
  - ~13% uplift in isolation for 3 benchmarking scenes

- Removal of unused SVM nodes in `svm_eval_nodes`. In combination with the other optimizations, this results in a further drop in register usage by eliminating dead code that can't be identified by static analysis.

Code contributed by Jason Fielder, Morteza Mostajabodaveh and Michael Jones

Differential Revision: https://developer.blender.org/D15456

6 days agoCycles: keep track of SVM nodes used in kernels
Brecht Van Lommel [Tue, 12 Jul 2022 15:22:36 +0000 (12 17:22 +0200)]
Cycles: keep track of SVM nodes used in kernels

To be used for specialization in Metal, to automatically leave out unused nodes
from the kernel.

6 days agoCycles: refactor to move part of KernelData definition to template header
Brecht Van Lommel [Tue, 12 Jul 2022 15:26:29 +0000 (12 17:26 +0200)]
Cycles: refactor to move part of KernelData definition to template header

To be used  for specialization on Metal in a following commit, turning these
members into compile time constants.

3 weeks agoCleanup: Fix building warnings on gcc 9.4.0
Dalai Felinto [Fri, 24 Jun 2022 09:24:11 +0000 (24 11:24 +0200)]
Cleanup: Fix building warnings on gcc 9.4.0

Solution by Jacques Lucke

3 weeks agoFix T98925: Editor panels are broken
Richard Antalik [Fri, 24 Jun 2022 08:23:31 +0000 (24 10:23 +0200)]
Fix T98925: Editor panels are broken

Commit 277fa2f441f4 added channels region to unintended editors if sequencer was
used in area. This caused issues with some editors having 2 tool regions and
non functioning side panel.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15253

3 weeks agoGHOST/Wayland: support for cursor warp with hidden/wrapped grab enabled
Campbell Barton [Fri, 24 Jun 2022 04:17:38 +0000 (24 14:17 +1000)]
GHOST/Wayland: support for cursor warp with hidden/wrapped grab enabled

As grab already uses it's own virtual coordinates, cursor warping can
be used when grab is enabled.

Currently nothing depends on this however it could be useful in future.

3 weeks agoCleanup: remove unused function WM_cursor_compatible_xy
Campbell Barton [Fri, 24 Jun 2022 04:00:36 +0000 (24 14:00 +1000)]
Cleanup: remove unused function WM_cursor_compatible_xy

3 weeks agoFix T99021: Walk-mode doesn't work in Wayland
Campbell Barton [Fri, 24 Jun 2022 03:45:08 +0000 (24 13:45 +1000)]
Fix T99021: Walk-mode doesn't work in Wayland

Walk mode implemented it's own grab which relied on WM_cursor_warp
to work (which isn't implemented for wayland).

Resolve this by using WM_cursor_grab_{enable/disable}.

Besides fixing Wayland this removes the need for workarounds:

- Ensure the event received were after the event generated from warping.
- Alternate logic that reset the "center" when using tablets.
- Checking the cursor location was scaled by native-pixels on macOS.

There is a minor change in behavior: on completion the cursor is left
at the location walk-mode began instead of the center of the region.

3 weeks agoCleanup: add C++ compatible WL_ARRAY_FOR_EACH macro
Campbell Barton [Fri, 24 Jun 2022 00:21:45 +0000 (24 10:21 +1000)]
Cleanup: add C++ compatible WL_ARRAY_FOR_EACH macro

3 weeks agoCleanup: remove unused cursor struct members in GHOST/Wayland
Campbell Barton [Thu, 23 Jun 2022 23:59:37 +0000 (24 09:59 +1000)]
Cleanup: remove unused cursor struct members in GHOST/Wayland

3 weeks agoCleanup: use const arguments for GHOST/Wayland
Campbell Barton [Thu, 23 Jun 2022 23:58:27 +0000 (24 09:58 +1000)]
Cleanup: use const arguments for GHOST/Wayland

3 weeks agoGHOST: use GHOST_ASSERT for non-release builds
Campbell Barton [Thu, 23 Jun 2022 22:54:48 +0000 (24 08:54 +1000)]
GHOST: use GHOST_ASSERT for non-release builds

GHOST_ASSERT now matches BLI_assert, which is only ignored for release
builds. Otherwise it prints or asserts when WITH_ASSERT_ABORT is enabled.

3 weeks agoDocs: correct GHOST_TimerProcPtr time doc-string
Campbell Barton [Thu, 23 Jun 2022 22:43:18 +0000 (24 08:43 +1000)]
Docs: correct GHOST_TimerProcPtr time doc-string

3 weeks agoFix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Campbell Barton [Thu, 23 Jun 2022 22:19:08 +0000 (24 08:19 +1000)]
Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland

Accumulate tablet data before generating an event using the 'frame'
callback.

3 weeks agoFix T99083: audio bad in command-line video player (blender -a)
Jörg Müller [Thu, 23 Jun 2022 19:32:34 +0000 (23 21:32 +0200)]
Fix T99083: audio bad in command-line video player (blender -a)

There was a wrong sample size computation in PulseAudioDevice.
The sample format is switched to float32 for the command-line player.

3 weeks agoCleanup: Make function static
Hans Goudey [Thu, 23 Jun 2022 18:03:31 +0000 (23 13:03 -0500)]
Cleanup: Make function static

3 weeks agoGeometry Nodes: Speed up Separate color node in RGB mode
Hans Goudey [Thu, 23 Jun 2022 17:33:58 +0000 (23 12:33 -0500)]
Geometry Nodes: Speed up Separate color node in RGB mode

This applies the same optimization as b8bd304bd45397b8c to the separate
color node. I observed about a 50% improvement with 10 million values
when only extracting one channel-- from about 17ms to 11ms.

3 weeks agoCleanup: make format
Brecht Van Lommel [Thu, 23 Jun 2022 17:28:39 +0000 (23 19:28 +0200)]
Cleanup: make format

3 weeks agoFix T97691: undefined behavior sanitizer warning for alignment in RNA functions
Brecht Van Lommel [Wed, 22 Jun 2022 17:02:52 +0000 (22 19:02 +0200)]
Fix T97691: undefined behavior sanitizer warning for alignment in RNA functions

Thanks Loren Osborn for investigating this and proposing solutions.

Ref D14798

3 weeks agoFix T94621: Missing selection indication for virtual node sockets
Max Edge [Thu, 23 Jun 2022 17:22:23 +0000 (23 12:22 -0500)]
Fix T94621: Missing selection indication for virtual node sockets

A small regression as a result of adding a custom outline to the empty
virtual socket, which ended up overriding the colors when selected with
Shift+LMB.

Differential Revision: https://developer.blender.org/D15103

3 weeks agoSpreadsheet: Support operations for filtering colors
Angel Bueno [Thu, 23 Jun 2022 17:16:18 +0000 (23 12:16 -0500)]
Spreadsheet: Support operations for filtering colors

Support choosing an operation when filtering colors,
like the other types.

Differential Revision: https://developer.blender.org/D15191

3 weeks agoCleanup: Remove unused array in vertex paint code
Hans Goudey [Thu, 23 Jun 2022 17:10:12 +0000 (23 12:10 -0500)]
Cleanup: Remove unused array in vertex paint code

Unused since 4f616c93f7cb8c8c8e038

3 weeks agoVertex paint mode tried to do a "fast update" by trying to avoid tagging
Hans Goudey [Thu, 23 Jun 2022 17:05:48 +0000 (23 12:05 -0500)]
Vertex paint mode tried to do a "fast update" by trying to avoid tagging
the mesh ID for a full update. The conditions it uses are troublesome:
 1. There must be an evaluated mesh
 2. The evaluated mesh's active byte color layer must equal the original's

This logic doesn't make sense for a few reasons. First of all, the
`mloopcol` pointer doesn't make sense in the context of color
attributes (rather than the old vertex colors), since it only points
to byte color attribute on face corners. Second, just because the
layer pointers are equal doesn't mean something doesn't depend
on the attribute's values.

I think the best solution currently is to remove this "fast update"
case and instead work on optimizing the general case.

Also, T95842 suggests removing these pointers, and this is one
of the last remaining uses of `Mesh.mloopcol`.

Differential Revision: https://developer.blender.org/D15275

3 weeks agoMesh: Add an explicit "positions changed" function
Hans Goudey [Thu, 23 Jun 2022 17:00:25 +0000 (23 12:00 -0500)]
Mesh: Add an explicit "positions changed" function

We store various lazily calculated caches on meshes, some of which
depend on the vertex positions staying the same. The current API to
invalidate these caches is a bit confusing. With an explicit set of
functions modeled after the functions in `BKE_node_tree_update.h`,
it becomes clear which function to call. This may become more
important if more lazy caches are added in the future.

Differential Revision: https://developer.blender.org/D14760

3 weeks agoGeometry Nodes: Optimize selection for virtual array input
Hans Goudey [Thu, 23 Jun 2022 16:50:53 +0000 (23 11:50 -0500)]
Geometry Nodes: Optimize selection for virtual array input

This makes calculation of selected indices slightly faster when the
input is a virtual array (the direct output of various nodes like
Face Area, etc). The utility can be helpful for other areas that
need to find selected indices besides field evaluation.

With the face area node used as a selection with 4 million faces,
the speedup is 3.51 ms to 3.39 ms, just a slight speedup.

Differential Revision: https://developer.blender.org/D15127

3 weeks agoCyles: switch primitive.h inline hints to forceinline
Xavier Hallade [Thu, 23 Jun 2022 16:30:49 +0000 (23 18:30 +0200)]
Cyles: switch primitive.h inline hints to forceinline

This change helps decrease Intel GPU binaries compile time by 5-10
minutes without impacting other backends.

Reviewed By: sergey, brecht

Differential Revision: http://developer.blender.org/D15273

3 weeks agoFix T98975: Broken vertex paint mode operators
Hans Goudey [Thu, 23 Jun 2022 16:32:53 +0000 (23 11:32 -0500)]
Fix T98975: Broken vertex paint mode operators

All of the operators in vertex paint mode didn't work properly with
the new color attribute system. They only worked on byte color type
attributes on the face corner domain.

Since there are four possible combinations of domains and types now,
it mostly ended up being simpler to convert the code to C++ and use
the geometry component API for retrieving attributes, interpolating
between domains, etc. The code changes ended up being fairly large,
but the result should be simpler now.

Differential Revision: https://developer.blender.org/D15261

3 weeks agoFix T99110: Crash after running view_all operator in VSE
Richard Antalik [Thu, 23 Jun 2022 16:11:33 +0000 (23 18:11 +0200)]
Fix T99110: Crash after running view_all operator in VSE

Crash caused by NULL dereference, when `Editing` is not initialized.

Check if data is initialized in poll function.

3 weeks agoFix T99091: Freeze when changing strip source with thumbnails enabled
Richard Antalik [Thu, 23 Jun 2022 15:49:26 +0000 (23 17:49 +0200)]
Fix T99091: Freeze when changing strip source with thumbnails enabled

When input file is changed, `orig_height` and `orig_width` fields are
reset, which causes thumbnail dimensions to be incorrectly calculated.

Only draw thumbnails if both mentioned fields are non 0.

3 weeks agoFix T99028: crash deleting file output node with color management override
Brecht Van Lommel [Thu, 23 Jun 2022 14:00:43 +0000 (23 16:00 +0200)]
Fix T99028: crash deleting file output node with color management override

One case of copying image formats was not properly using BKE_image_format_copy.
To fix this for existing .blend file we need to do versioning, ensuring the curve
mapping is properly copied.

3 weeks agoCycles: unify math functions names
Andrii Symkin [Thu, 23 Jun 2022 12:29:17 +0000 (23 14:29 +0200)]
Cycles: unify math functions names

This patch unifies the names of math functions for different data types and uses
overloading instead. The goal is to make it possible to swap out all the float3
variables containing RGB data with something else, with as few as possible
changes to the code. It's a requirement for future spectral rendering patches.

Differential Revision: https://developer.blender.org/D15276

3 weeks agoFix T99027: Touch typing in text fields results in dropped key presses
Campbell Barton [Thu, 23 Jun 2022 11:19:22 +0000 (23 21:19 +1000)]
Fix T99027: Touch typing in text fields results in dropped key presses

Fix by always testing unhandled double-click events as press events,
irrespective of the previous event type.

**Details**

Handling double-click events only ran when the previously pressed-key
matched the current pressed-key.

Originally when double-click support was added the previous type was
compared (ignoring it's press/release value) and while not necessary
it was harmless as it matched the check for double-click events being
generated.

As of [0] the logic for click/drag detection changed to ignore release
events as release this could interrupt dragging.
This made it possible to generate double-click events that failed the
`event->prev_press_type == event->type` comparison.
In these cases it was possible to generate double-click
events that would not fall-back to a 'press' value when unhandled.

[0]: 102644cb8cbb8b21e55643cebe2ed364885023a6

3 weeks agoCleanup: fix typo that deactivated clang-format in rna_brush.c
Jacques Lucke [Thu, 23 Jun 2022 11:10:26 +0000 (23 13:10 +0200)]
Cleanup: fix typo that deactivated clang-format in rna_brush.c

3 weeks agoFix T98871: Drivers not updated when joining an armature
Sebastian Parborg [Thu, 23 Jun 2022 09:44:29 +0000 (23 11:44 +0200)]
Fix T98871: Drivers not updated when joining an armature

If the some driver had been flagged as "invalid", the flag would not be
cleared when joining armatures which could lead to now valid drivers
still being flagged as invalid.

Now we clear this invalid flag on all drivers to force a recheck after
joining the armatures.

3 weeks agoAnimation: Add function to remove all FCurves from an Action
Colin Basnett [Thu, 23 Jun 2022 09:41:44 +0000 (23 11:41 +0200)]
Animation: Add function to remove all FCurves from an Action

Add a `BKE_action_fcurves_clear(action)` function, which removes all the
Action's FCurves, and expose it as `ActionFCurves.clear()` in RNA.

This is more ergonomic than calling `remove` on f-curves until the list
is empty.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14660

3 weeks agoArmature: Add poll message explaining bone groups need pose mode
Colin Basnett [Thu, 23 Jun 2022 09:21:43 +0000 (23 11:21 +0200)]
Armature: Add poll message explaining bone groups need pose mode

Add a poll message to the bone group operators, to explain they only
work in pose mode. Before, the buttons would be greyed out with no
explanation.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15119

3 weeks agoDopesheet: Add Custom Properties panel
Colin Basnett [Thu, 23 Jun 2022 09:11:53 +0000 (23 11:11 +0200)]
Dopesheet: Add Custom Properties panel

Adds a custom property panel for the active `Action` to the Dopesheet
editor. There was previously no way to edit these properties outside of
the Python API.

This panel will show up when
`context.active_object.animation_data.action` is set.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14646

3 weeks agoCycles: Add diagnostic tracing of MTLLibrary compilation time
Michael Jones [Thu, 23 Jun 2022 09:05:45 +0000 (23 10:05 +0100)]
Cycles: Add diagnostic tracing of MTLLibrary compilation time

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15268

3 weeks agoFix key repeat continuing after a window loses focus for GHOST/Wayland
Campbell Barton [Thu, 23 Jun 2022 05:38:43 +0000 (23 15:38 +1000)]
Fix key repeat continuing after a window loses focus for GHOST/Wayland

Also remove NULL checks in keyboard enter/leave handlers,
as they didn't serve any purpose.

3 weeks agoLineArt: Cleanup minor warnings from variable type changes.
Yiming Wu [Thu, 23 Jun 2022 05:22:56 +0000 (23 13:22 +0800)]
LineArt: Cleanup minor warnings from variable type changes.

3 weeks agoFix key repeat behavior for GHOST/Wayland
Campbell Barton [Thu, 23 Jun 2022 04:35:10 +0000 (23 14:35 +1000)]
Fix key repeat behavior for GHOST/Wayland

- Respect modifier keys (Shift press/release didn't change the case).

- Changing modifiers resets the timer instead of canceling key-repeat.

- Releasing keys (besides the key being repeated) resets the timer
  instead of canceling key repeat.

This makes key-repeat behave the same way as GTK & WIN32 text input.

3 weeks agoCleanup: Clang tidy
Hans Goudey [Wed, 22 Jun 2022 23:58:25 +0000 (22 18:58 -0500)]
Cleanup: Clang tidy

Mainly duplicate includes and else after return.

4 weeks agoCleanup: Use const arguments
Hans Goudey [Wed, 22 Jun 2022 21:57:57 +0000 (22 16:57 -0500)]
Cleanup: Use const arguments

Also use Curves as an argument instead of Object,
since it's more specific to this situation.

4 weeks agoCycles: Tidy of KernelData patchup code
Michael Jones [Wed, 22 Jun 2022 21:36:33 +0000 (22 22:36 +0100)]
Cycles: Tidy of KernelData patchup code

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15267

4 weeks agoCycles: Distinguish Apple GPUs by core count
Michael Jones [Wed, 22 Jun 2022 21:32:34 +0000 (22 22:32 +0100)]
Cycles: Distinguish Apple GPUs by core count

This patch suffixes Apple GPU device names with `(GPU - # cores)` so that variant GPUs with the same chipset can be distinguished. Currently benchmark scores for these M1 family GPUs are being incorrectly merged:

- M1: 7 or 8 cores
- M1 Pro: 14 or 16 cores
- M1 Max: 24 or 32 cores
- M1 Ultra: 48 or 64 cores

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15257

4 weeks agoCleanup: remove unused sculpt texture cache generation
Brecht Van Lommel [Wed, 22 Jun 2022 17:34:16 +0000 (22 19:34 +0200)]
Cleanup: remove unused sculpt texture cache generation

This has not been used since 5505697ac in 2010.

4 weeks agoD14974: Tip roundness - match square and round brush radius
Ramil Roosileht [Wed, 22 Jun 2022 17:00:47 +0000 (22 10:00 -0700)]
D14974: Tip roundness - match square and round brush radius

Oneliner for T97961.  Square sculpt brushes no longer fit
inside the radius circle, they now use the radius for
the square size.

{F13082514}

Note: original patch was modified to scale PBVH
      search radius to avoid artifacts.

Differential Revision: https://developer.blender.org/D14974
Reviewed By: Joseph Eagar & Julien Kaspar
Ref: D14974

4 weeks agoCleanup: simplify macOS make deps instructions
Brecht Van Lommel [Wed, 22 Jun 2022 16:17:47 +0000 (22 18:17 +0200)]
Cleanup: simplify macOS make deps instructions

4 weeks agoFix T97675: slow zoom in node editor with Continue zoom method
Patrick Huang [Wed, 22 Jun 2022 14:53:15 +0000 (22 16:53 +0200)]
Fix T97675: slow zoom in node editor with Continue zoom method

Speed increased by 10x, making it visually similar to other editors.

Differential Revision: https://developer.blender.org/D15209

4 weeks agoFix T98773: GPU Subdivision breaks auto selection in UV edit mode
Kévin Dietrich [Tue, 21 Jun 2022 05:54:40 +0000 (21 07:54 +0200)]
Fix T98773: GPU Subdivision breaks auto selection in UV edit mode

When GPU subdivision is used, and the modifier is not set to be applied
on the cage, UV selection is not synced with the face selection in the
viewport.

This happens because the extraction, despite being in edit mode, is set
to `MESH` instead of `BMESH` (or `MAPPED` in some cases) like for CPU
subdivision, and since the mesh is not always synchrnised with the BMesh
the edit mode flags are not always updated.

With GPU subdivision, when creating the `MeshRenderData`, the condition
`has_mdata && do_final && editmesh_eval_final != editmesh_eval_cage` is
true which forces the `MESH` extraction. Following comment in D14485,
this replace the `has_mdata` in the condition with `use_mapped` which
solves the issue.

Differential Revision: https://developer.blender.org/D15248

4 weeks agoFix T98956: Crash removing some builtin attributes
Hans Goudey [Wed, 22 Jun 2022 14:06:29 +0000 (22 09:06 -0500)]
Fix T98956: Crash removing some builtin attributes

For example, the "id" attribute is stored as a named attribute.
If it doesn't exist already, `layer_index` was uninitialized, causing
issues with `CustomData_free_layer`. The fix is to use the generic
function to free a named layer in that case. Eventually the other
case will go away as T95965 is finished.

4 weeks agoFix: Memory leak writing to builtin attribute with wrong type
Hans Goudey [Wed, 22 Jun 2022 14:03:27 +0000 (22 09:03 -0500)]
Fix: Memory leak writing to builtin attribute with wrong type

The store named attribute node creates a new buffer to evaluate
the field into. When creating the attribute with that buffer fails,
if must be freed.

4 weeks agoCleanup: Remove unused function arguments
Sergey Sharybin [Wed, 22 Jun 2022 08:54:45 +0000 (22 10:54 +0200)]
Cleanup: Remove unused function arguments

Solves the corresponding compiler warning.

4 weeks agoCleanup: clang-format
Sergey Sharybin [Wed, 22 Jun 2022 08:54:13 +0000 (22 10:54 +0200)]
Cleanup: clang-format

4 weeks agoRevert "LibOverride: Handle dependencies in both directions in partial override cases."
Dalai Felinto [Wed, 22 Jun 2022 08:34:55 +0000 (22 10:34 +0200)]
Revert "LibOverride: Handle dependencies in both directions in partial override cases."

This reverts commit f0b4aa5d59e3b3754bfcf3827f7524d34c809c62.

This commit was making files to get bigger and bigger every time they
were saved and re-opened.

In the orphaned data in the outliner new collections would show up
there, even after continuously purging it. This would lead to a massive
file which get also very slow.

This problem will fix itself after a few re-open/re-saves of the files.
For anyone also experimenting this you can fix this faster by purging
the unused data multiple times in the file.

Example of file from the Project Heist (rev. 1014):
heist/pro/shots/010_opening/010_0050/010_0050.anim.blend

4 weeks agoMask Editor: Add toggle for mask spline drawing
Simon Lenz [Thu, 16 Jun 2022 08:13:03 +0000 (16 10:13 +0200)]
Mask Editor: Add toggle for mask spline drawing

Adds an overlay option to show/hide the spline points & lines of masks in the Mask Editor.

It also moves the "smooth" option up (its position left of the selection dropdown was missleading).

{F11847272}

This emerged from a discussion in https://developer.blender.org/D12776

Differential Revision: https://developer.blender.org/D13314

4 weeks agoD14975: Voxel Remesh Size Edit - Constant Size by default
Ramil Roosileht [Wed, 22 Jun 2022 08:36:13 +0000 (22 01:36 -0700)]
D14975: Voxel Remesh Size Edit - Constant Size by default

This patch makes constant size a default for size edit operator of voxel remesh.
In turn, pressing CTRL now enables relative scale, the old default.

Patch also changes workspace status text entry with new additions. Note that it is a simple text and not an array of keymaps (for that further changes are needed)

{F13082567}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14975
Ref D14975

4 weeks agoRigid body physics: Move effector force update into substep loop.
Lukas Tönne [Wed, 22 Jun 2022 05:37:45 +0000 (22 06:37 +0100)]
Rigid body physics: Move effector force update into substep loop.

The substep loop for rigid bodies causes unequal effects of force fields depedending on the substep setting, larger
substep counts cause a diminishing effect of force fields.
This is because the force to apply on a body is reset in Bullet after each step and needs to be recomputed. Without this
the body will just coast with constant velocity after the first substep. Since the per-step impulse with larger substep
counts is smaller, the effect is that more substeps cause a smaller total impulse.

The fix is to move external force calculation into the substep loop and update forces for each substep.

Note that this may be considered a breaking change, because the breaking commit rB1aa54d4921c2 has been in master for
a long time and after this fix force fields will generally have a much larger effect on rigid bodies (10x for the
default setting of 10 substeps).

Differential Revision: https://developer.blender.org/D15173

4 weeks agoCleanup: remove redundant GPU headers
Campbell Barton [Wed, 22 Jun 2022 04:59:42 +0000 (22 14:59 +1000)]
Cleanup: remove redundant GPU headers

4 weeks agoCleanup: replace BLF defines with enum, formatting
Campbell Barton [Wed, 22 Jun 2022 04:50:22 +0000 (22 14:50 +1000)]
Cleanup: replace BLF defines with enum, formatting

4 weeks agoFix T99078: Crash closing the file selector in Wayland
Campbell Barton [Wed, 22 Jun 2022 03:08:55 +0000 (22 13:08 +1000)]
Fix T99078: Crash closing the file selector in Wayland

Ensure wayland handlers run that clear the window immediately after
the window has been removed so dangling pointers to the window
aren't left set.

4 weeks agoCleanup: Grammar in comments
Hans Goudey [Tue, 21 Jun 2022 20:47:25 +0000 (21 15:47 -0500)]
Cleanup: Grammar in comments

4 weeks agoCleanup: Remove unused argument
Hans Goudey [Tue, 21 Jun 2022 19:17:24 +0000 (21 14:17 -0500)]
Cleanup: Remove unused argument

4 weeks agoFix T98960: Baking to active color attribute uses wrong layer
Hans Goudey [Tue, 21 Jun 2022 19:15:18 +0000 (21 14:15 -0500)]
Fix T98960: Baking to active color attribute uses wrong layer

Baking assumed that color attributes could only have two configurations:
float color data type on vertices, or byte color type on face corners.
In reality the options can be combined to make four total options.
This commit handles the four cases explicitly with a somewhat
more scaleable approach (though this should really be C++ code).

This commit also changes some related error messages, tooltips,
and an enum name, in order to make the functionality more obvious.

Differential Revision: https://developer.blender.org/D15244

4 weeks agoGPencil: Move New Layer option to menu top
Antonio Vazquez [Tue, 21 Jun 2022 14:38:58 +0000 (21 16:38 +0200)]
GPencil: Move New Layer option to menu top

The new layer option must be the first in the menu.

Differential Revision: https://developer.blender.org/D15255

4 weeks agoFix crash editing anisotropic filter preference from background mode
Brecht Van Lommel [Tue, 21 Jun 2022 13:41:36 +0000 (21 15:41 +0200)]
Fix crash editing anisotropic filter preference from background mode

4 weeks agoCleanup: removed unused Blender Internal bump/normal mapping texture code
Brecht Van Lommel [Mon, 20 Jun 2022 15:10:27 +0000 (20 17:10 +0200)]
Cleanup: removed unused Blender Internal bump/normal mapping texture code

The TexResult.nor output does not appear to be used anywhere.

4 weeks agoFix T97533: Extrapolation of NLA strips outside current view are not rendered
Colin Basnett [Tue, 21 Jun 2022 12:43:19 +0000 (21 14:43 +0200)]
Fix T97533: Extrapolation of NLA strips outside current view are not rendered

Do a more thorough search for strips that are not visible themselves,
but still influence the viewed time range.

The problem before was that tracks not immediately visible would not be
drawn at all. The strategy for fixing this was to simply include strips
that are visible only because of their extrapolation mode.

To do this, there is now a new function `get_visible_nla_strips` which
gives a first and last `NlaTrack` that needs to  be drawn.

Tagging along with this is the removal of the strip index indicator from
the name on meta tracks. Because of the new structure of the code, it
would incur a performance penalty to restore the previous behavior
(requiring a linear search for the index). Since this number is of
virtually no utility to the user anyways (it has the look & feel of
developer debugging information), this is something I think we can
safely remove without regret.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14738

4 weeks agoNLA: when searching for active track/strip, shortcut when none is active
Sybren A. Stüvel [Tue, 21 Jun 2022 13:27:22 +0000 (21 15:27 +0200)]
NLA: when searching for active track/strip, shortcut when none is active

In the `update_active_track()` function, add a shortcut that just sets
`NULL`, instead of searching for `NULL` pointers. Should give a tiny
speedup.

4 weeks agoFix 2 for T98700: Crash when recursively nesting NLA meta strips
Sybren A. Stüvel [Tue, 21 Jun 2022 13:26:03 +0000 (21 15:26 +0200)]
Fix 2 for T98700: Crash when recursively nesting NLA meta strips

When searching for the active NLA strip, avoid overwriting the found strip
pointer with NULL if it was already found in a previous iteration.

The active strip is searched for while looping over the NLA tracks. If the
active strip was found on a previous track, and not on the current track,
this would effectively set `actstrip = NULL`. This is now avoided.

Another benefit is that the search for the active strip is stopped as soon
as it's found, which should increase performance a tiny bit.

4 weeks agoNLA: update comment to reflect the current implementation
Sybren A. Stüvel [Tue, 21 Jun 2022 13:23:13 +0000 (21 15:23 +0200)]
NLA: update comment to reflect the current implementation

No functional changes.

4 weeks agoNLA: add `BLI_assert_msg()` to check for assumption
Sybren A. Stüvel [Tue, 21 Jun 2022 13:22:52 +0000 (21 15:22 +0200)]
NLA: add `BLI_assert_msg()` to check for assumption

`find_active_strip_from_listbase()` expects two lists of strips with an
equal number of items. This is now not only documented, but also checked
for in an assertion.

4 weeks agoLineArt: Move style options to top of the modifier.
Yiming Wu [Tue, 21 Jun 2022 07:17:30 +0000 (21 15:17 +0800)]
LineArt: Move style options to top of the modifier.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15164

4 weeks agoFix T98919: Eevee unlinked aov output nodes don't render.
Jeroen Bakker [Tue, 21 Jun 2022 07:45:40 +0000 (21 09:45 +0200)]
Fix T98919: Eevee unlinked aov output nodes don't render.

Eevee rendered an empty image for aov nodes that weren't linked to
any other nodes. When connected the result was OK. The root cause was
that the AOV nodes were not marked as output node and pruned when not
connected to any other nodes. The pruning process is there to reduce
the complexity of the GLSL and improve compilation time and
execution time.

4 weeks agoCleanup: remove unneeded code in eevee_bloom.
Jeroen Bakker [Tue, 21 Jun 2022 06:27:20 +0000 (21 08:27 +0200)]
Cleanup: remove unneeded code in eevee_bloom.

This had to be added to the previous commit.

4 weeks agoFix T98972: EEVEE Bloom Pass Outputs Final Image Instead of Bloom.
Jeroen Bakker [Tue, 21 Jun 2022 06:20:26 +0000 (21 08:20 +0200)]
Fix T98972: EEVEE Bloom Pass Outputs Final Image Instead of Bloom.

Regression introduced by {rBca37654b6327}. This commit reversed the
order of loading uniforms. The bloom renderpass used the previous
loading order to overwrite an existing uniform (bloomBaseAdd).

Due to the new ordering this doesn't work anymore where the render
pass outputted an image similar to the final image. This was fixed
by loading the correct value for bloomAddBase and remove the rewrite.

4 weeks agoCleanup: use full names for generated wayland headers, use own directory
Campbell Barton [Mon, 20 Jun 2022 23:11:30 +0000 (21 09:11 +1000)]
Cleanup: use full names for generated wayland headers, use own directory

Instead of providing our own names for wayland headers, use the filename
component as the basis for the header names. This matches most reference
documentation for Wayland.

Also generate client protocols into a sub-directory `libwayland`,
instead of generating headers into the ghost directory. Making the
include path more specific & makes it easier to differentiate generated
headers from other build files.

4 weeks agoFix error in GHOST_ASSERT under Wayland
Campbell Barton [Tue, 21 Jun 2022 06:03:26 +0000 (21 16:03 +1000)]
Fix error in GHOST_ASSERT under Wayland

4 weeks agoGPU subdiv: fix hidden faces in paint mode when hidden in edit mode
Kévin Dietrich [Tue, 21 Jun 2022 05:39:28 +0000 (21 07:39 +0200)]
GPU subdiv: fix hidden faces in paint mode when hidden in edit mode

Pass `use_hide` to the compute shaders so that we can override the
hidden face flags, like CPU extraction is doing.

4 weeks agoCleanup: Fix format on previous commit
Chris Blackbourn [Tue, 21 Jun 2022 05:37:15 +0000 (21 17:37 +1200)]
Cleanup: Fix format on previous commit

4 weeks agoUV: Add "Select Similar" operator in UV editor
Chris Blackbourn [Tue, 21 Jun 2022 05:31:59 +0000 (21 17:31 +1200)]
UV: Add "Select Similar" operator in UV editor

Resolves T47437.

Differential Revision: https://developer.blender.org/D15164

4 weeks agoCleanup: Type safety and asserts around ED_select_similar_compare
Chris Blackbourn [Tue, 21 Jun 2022 04:36:25 +0000 (21 16:36 +1200)]
Cleanup: Type safety and asserts around ED_select_similar_compare

4 weeks agoFix T99016: GPU subdiv artifacts in weight paint with smooth shading
Kévin Dietrich [Tue, 21 Jun 2022 04:25:08 +0000 (21 06:25 +0200)]
Fix T99016: GPU subdiv artifacts in weight paint with smooth shading

Flags in the smooth shading case were not properly set.

4 weeks agoFix T99033: KDTree deduplication can erase values
Chris Blackbourn [Fri, 17 Jun 2022 08:12:23 +0000 (17 20:12 +1200)]
Fix T99033: KDTree deduplication can erase values

Differential Revision: https://developer.blender.org/D15220

4 weeks agoCleanup (UV): Use blenlib math utilities
Chris Blackbourn [Mon, 20 Jun 2022 22:42:05 +0000 (21 10:42 +1200)]
Cleanup (UV): Use blenlib math utilities

4 weeks agoCleanup: Move paint_vertex_color_ops.c to C++
Hans Goudey [Mon, 20 Jun 2022 18:57:21 +0000 (20 13:57 -0500)]
Cleanup: Move paint_vertex_color_ops.c to C++

4 weeks agoFix T94969: Crash in Volume to Mesh with 0 voxels
Erik [Mon, 20 Jun 2022 18:12:44 +0000 (20 20:12 +0200)]
Fix T94969: Crash in Volume to Mesh with 0 voxels

Checks if voxel amount or -size is <= 0 and if so, returns early.

Differential Revision: https://developer.blender.org/D15241

4 weeks agoCleanup: Grammar: a vs an
Hans Goudey [Mon, 20 Jun 2022 15:14:00 +0000 (20 10:14 -0500)]
Cleanup: Grammar: a vs an

4 weeks agoBuild Deps: Disallow looking for Python in registry for ISPC
Sergey Sharybin [Mon, 20 Jun 2022 15:11:33 +0000 (20 17:11 +0200)]
Build Deps: Disallow looking for Python in registry for ISPC

Should prevent accidental use of wrong Python.

4 weeks agoBuild Deps: Pass Python3 root to ISPC
Sergey Sharybin [Mon, 20 Jun 2022 15:08:43 +0000 (20 17:08 +0200)]
Build Deps: Pass Python3 root to ISPC

Following what is done for LLVM. Being consistent feels good here.

Not strictly needed as the build here passed anyway, but it does
feel good to be consistent.

4 weeks agoBuild Deps: Fix ISPVC and OIDN compilation on fresh Windows
Sergey Sharybin [Mon, 20 Jun 2022 14:49:47 +0000 (20 16:49 +0200)]
Build Deps: Fix ISPVC and OIDN compilation on fresh Windows

Make them to use self-compiled Python, similar to previous fixes
for other libraries.

4 weeks agoFix T99019 EEVEE: Regression: Specular BSDF does not apply occlusion
Clément Foucault [Mon, 20 Jun 2022 14:31:22 +0000 (20 16:31 +0200)]
Fix T99019 EEVEE: Regression: Specular BSDF does not apply occlusion

Since the occlusion input is going to be removed in EEVEE-Next, I just
added a temporary workaround. The occlusion is passed as SSS radius
as the Specular BSDF does not use it.

The final result matches 3.1 release

4 weeks agoFix T99018: EEVEE: Regression: Specular BSDF apply specular color input twice
Clément Foucault [Mon, 20 Jun 2022 14:26:26 +0000 (20 16:26 +0200)]
Fix T99018: EEVEE: Regression: Specular BSDF apply specular color input twice

This was an oversight. I checked that no other node had the same regression.

4 weeks agoCurves: extract surface brush sampling into separate function
Jacques Lucke [Mon, 20 Jun 2022 14:27:42 +0000 (20 16:27 +0200)]
Curves: extract surface brush sampling into separate function

This functionality will also be necessary in the Density brush.

4 weeks agoBLI: add min_inplace and max_inplace functions
Jacques Lucke [Mon, 20 Jun 2022 14:22:04 +0000 (20 16:22 +0200)]
BLI: add min_inplace and max_inplace functions

4 weeks agoFix: assert when deleting all curves
Jacques Lucke [Mon, 20 Jun 2022 14:21:31 +0000 (20 16:21 +0200)]
Fix: assert when deleting all curves

4 weeks agoMask Editor: Add mask blending factor for combined overlay
Simon Lenz [Wed, 15 Jun 2022 13:15:23 +0000 (15 15:15 +0200)]
Mask Editor: Add mask blending factor for combined overlay

This adds a new parameter to the "Combined" overlay mode of the mask editor.
The "blending factor" allows users to blend the mask exterior with the original
footage to visualise the content of the mask in a more intuitive way.  The
"Alpha" overlay is unaffected by this change.

The existing "Combined" overlay is used like before (covering everything
outside the mask in black), but can be blended with the slider in the mask
overlay to look at the exterior.

This is part of an effort to make mask editing more intuitive & easy to use:
https://developer.blender.org/T93097

Differential Revision: https://developer.blender.org/D13284

4 weeks agoFix artefacts with GPU subdiv and weight paint face selection
Kévin Dietrich [Mon, 20 Jun 2022 12:32:48 +0000 (20 14:32 +0200)]
Fix artefacts with GPU subdiv and weight paint face selection

Addendum to previous fix, which was for point selection, this fixes the
face selection mode. The issue is caused by wrong flags used for paint
mode (the edit mode flag was always used). Also add back flag which was
accidentally removed in 16f5d51109bce849dff5379c60360f271622ac0f.

4 weeks agoCleanup: renaming and consistency for kernel data
Brecht Van Lommel [Fri, 17 Jun 2022 15:16:37 +0000 (17 17:16 +0200)]
Cleanup: renaming and consistency for kernel data

* Rename "texture" to "data array". This has not used textures for a long time,
  there are just global memory arrays now. (On old CUDA GPUs there was a cache
  for textures but not global memory, so we used to put all data in textures.)
* For CUDA and HIP, put globals in KernelParams struct like other devices.
* Drop __ prefix for data array names, no possibility for naming conflict now that
  these are in a struct.

4 weeks agoFix T98913: GPU Subdivision: "Show Wire" overlay glitch
Kévin Dietrich [Mon, 20 Jun 2022 10:13:55 +0000 (20 12:13 +0200)]
Fix T98913: GPU Subdivision: "Show Wire" overlay glitch

Issue is caused by an off by one error which would map some edge loops to
the loops of some the next polygon in the list of polygon, which may not
be a topological neighbor.