Commit Graph

413 Commits

Author SHA1 Message Date
Miguel Pozo
ff470f3f2e EEVEE Next: Volumes
Port of EEVEE unified volume rendering to EEVEE Next, using compute
shaders.

Improvements:
- Skip empty volume outside object bounds. (Large performance
  increase)

Currently missing:
- Shadows and irradiance integration.
- Grid-space TAA.

Main Task: #105672

Pull Request: https://projects.blender.org/blender/blender/pulls/107176
2023-08-04 16:47:16 +02:00
Campbell Barton
e548294de2 License headers: remove GPL header from OSL template script
Original script from Sylvio Sell [0] has "Blender Foundation" listed
as copyright holder. In general template scripts are examples
that users can use as a reference without the copyright applying to
their work.

[0]: http://maitag.de/~semmi/blender/lyapunov/osl/lyapunov.osl
2023-08-04 13:24:15 +10:00
Campbell Barton
f7be60eff0 Cleanup: format 2023-08-04 08:46:18 +10:00
Julian Eisel
6764e69491 UI: Add asset shelf Python UI template
Adds a new "Ui Asset Shelf" template to the script editor, demonstrating
how scripts can register own asset shelves. The asset shelf is designed
as a new standard UI element that add-ons, application templates and the
like can use, so this is useful. It's also useful as a quick way to test
and customize the asset shelf.

The script is only available in the UI if the "Asset Shelf" experimental
feature is enabled in the Preferences.
2023-08-03 17:16:10 +02:00
Julian Eisel
94fdafe906 Sculpt/UI: Experimental asset shelf for brush assets in sculpt mode
With the "Extended Asset Browser" and "Asset Shelf" experimental
features enabled, an asset shelf will now be displayed in sculpt mode.
This is useful for testing and development for the brush assets project,
see #101895.

Approved as part of #104831, then split off as separate commit.
2023-08-03 17:13:38 +02:00
Julian Eisel
8b19477e9c UI: Support asset shelves in 3D Views
The previous commit introduced all the basic bits and pieces necessary
to support asset shelves as experimental feature, but didn't actually
add support for any specific editor. With this commit asset shelves can
be registered in 3D Views, which should soon be used by the Pose Library
add-on to replace its previous UI in the sidebar (see
blender/blender-addons#104546). Note that until then, there will still be no
actual asset shelf to display.

Also adds:
- Toggle to hide/unhide the asset shelf under "View" -> "Asset Shelf"
- 3D View theme settings for the asset shelf regions.

None of the changes are visible if the experimental option for the asset
shelf is not enabled.

Approved as part of #104831, then split off as separate commit.

Pull Request: #110767
2023-08-03 16:59:50 +02:00
Julian Eisel
98142f5e35 UI: Asset Shelf Support (Experimental Feature)
No user visible changes expected, except of new experimental feature
option.

------------------------------------------------------------------------------

This introduces asset shelves as a new standard UI element for accessing
assets. Based on the current context (like the active mode and/or tool), they
can provide assets for specific workflows/tasks. As such they are more limited
in functionality than the asset browser, but a lot more efficient for certain
tasks.

The asset shelf is developed as part of the brush assets project (see #101895),
but is also meant to replace the current pose library UI.

Support for asset shelves can quite easily be added to different editor types,
the following commit will add support for the 3D View. If an editor type
supports asset shelves, add-ons can chose to register an asset shelf type for
an editor with just a few lines of Python.

It should be possible to entirely remove `UILayout.asset_view_template()` once
asset shelves are non-experimental.

Some changes are to be expected still, see #107881.

Task: #102879
Brush asset workflow blog post: https://code.blender.org/2022/12/brush-assets-workflow/
Initial technical documentation: https://developer.blender.org/docs/asset_system/user_interface/asset_shelf/

Pull Request: #104831
2023-08-03 16:54:39 +02:00
Hans Goudey
733f90bd24 Geometry Nodes: Rename "Operator" context to "Tool"
"Tool" is a more friendly word with mostly the same meaning within
Blender. Eventually it should be possible to create active tools with
node groups anyway, so the distinction isn't even helpful.

See #101778
2023-08-03 10:51:37 -04:00
Clément Foucault
0dc3318ffd EEVEE-Next: Irradiance Bake: Virtual Offset
Implement capture point bias. This offsets the capture
points to reduce the amount bad capture locations (i.e.:
inside objects, near walls etc...).

Two new parameters are added:
- Capture Surface Bias: Ensure a minimum distance between
capture points and surrounding geometry. This is expressed as the
relative distance between two capture point. Requires re-bake
to take effect.
- Capture Escape Bias: Moves capture points enclosed inside
objects above the nearest surface. This bias defines how far a
capture point can be moved for escaping the object. This is
expressed as the relative distance between two capture point.
Requires re-bake to take effect.

This is called virtual offset in the reference material.

A quick prepass runs before the baking to offset the samples away
from any surface that could potentially make bad samples.

In order to speedup the process, we create cluster list of surfels
near each irradiance grid point. This allow access to neighboring
surfels that can contribute to the virtual offset which should
never be more than half a cell wide.

Pull Request: https://projects.blender.org/blender/blender/pulls/110355
2023-08-03 16:47:05 +02:00
Miguel Pozo
567a2e5a6f EEVEE Next: Overscan support
Add overscan support for both viewport and final renders.

Pull Request: https://projects.blender.org/blender/blender/pulls/110313
2023-08-03 16:19:08 +02:00
Clément Foucault
8e33b20de9 EEVEE-Next: Irradiance Bake: Add validity based dilation
Implement invalid sample points filling. Improves invalid regions
but introduce light leak.

Grid sample points are considered invalid if they have a ratio of
front-face ray hit under the given threshold. This is a post-processing
pass on the baked lighting that fills dark regions produced by
invalid sample location (e.g.: inside walls) with valid neighbor
samples data.

Two new parameters are added:

- Dilation Threshold: Validity threshold under which grid samples are
considered invalid. Invalid samples will gather valid lighting data
from valid neighbors inside the dilation radius.
- Dilation Radius: Radius of the dilation process. Expressed in grid
sample distance.

The validity of each point is progressively refined just like the
lighting data during the baking process.

The dilation process is implemented as a post-processing pass during
the loading of the grid data into the irradiance atlas. This allows
live tweaking the dilation parameters.

Pull Request: https://projects.blender.org/blender/blender/pulls/110386
2023-08-03 15:48:33 +02:00
Clément Foucault
17db856686 EEVEE-Next: Ray-tracing Denoise Pipeline
This is a full rewrite of the raytracing denoise pipeline. It uses the
same principle as before but now uses compute shaders for every stages
and a tile base approach. More aggressive filtering is needed since we
are moving towards having no prefiltered screen radiance buffer. Thus
we introduce a temporal denoise and a bilateral denoise stage to the
denoising. These are optionnal and can be disabled.

Note that this patch does not include any tracing part and only samples
the reflection probes. It is focused on denoising only. Tracing will
come in another PR.

The motivation for this is that having hardware raytracing support
means we can't prefilter the radiance in screen space so we have to
have better denoising. Also this means we can have better surface
appearance with support for other BxDF model than GGX. Also GGX support
is improved.

Technically, the new denoising fixes some implementation mistake the
old pipeline did. It separates all 3 stages (spatial, temporal,
bilateral) and use random sampling for all stages hoping to create
a noisy enough (but still stable) output so that the TAA soaks the
remaining noise. However that's not always the case. Depending on the
nature of the scene, the input can be very high frequency and might
create lots of flickering. That why another solution needs to be found
for the higher roughness material as denoising them becomes expensive
and low quality.

Pull Request: https://projects.blender.org/blender/blender/pulls/110117
2023-08-03 15:32:06 +02:00
Hans Goudey
731d296f35 Cleanup: Move mesh related blenkernel headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110730
2023-08-02 22:14:18 +02:00
Amelie Fondevilla
fd75695bed GPv3: Insert grease pencil keyframe from the dopesheet
Adaptation of the operator `ACTION_OT_keyframe_insert` to take into account grease pencil channels.
Grease pencil keyframes can now be inserted in blank mode, or in additive mode (duplicate the current frame in the new keyframe).

Two API functions were added :
 * `add_duplicate_drawings` which copies the data of a drawing to creates a duplicate, and
 * `insert_duplicate_frame` which creates a duplicate frame of an existing one either by copy or instance.

The additive mode option is also added to the UI.

The Layer method `frame_key_at` previously private was set to public.

Pull Request: https://projects.blender.org/blender/blender/pulls/110649
2023-08-02 14:56:18 +02:00
fiord
0c8785a249 Fix #106257: Move to Nodes error with no geometry input/output
If group input/output has no geometry, errors will occur,
so some validations are required.

Pull Request: https://projects.blender.org/blender/blender/pulls/110670
2023-08-02 14:00:32 +02:00
Damien Picard
c6118da243 I18n: translate Repeat Zone in the Add Node menu
The Repeat Zone operator from the Geometry nodes Add Node -> Utilities
menu was not translated because it used the "Operator" translation
context, instead of the default context.

Since the function displaying the menu item, `add_repeat_zone()`, is
only ever called from the Utilities menu, and the label is specified
there as "Repeat Zone", we know in advance that it will have this
name.

For the same reason, this commit also simplifies the function which
creates the menu entry for simulation zones. This function is also
only called from the Simulation menu with a specific label using the
default context, so it should also use this one.

Pull Request: https://projects.blender.org/blender/blender/pulls/110644
2023-08-01 18:07:32 +02:00
Damien Picard
eca984e79d UI: make external text editor presets upper case
The presets for external text editors introduced in e16ec95a16 are
stored in Python files. The names of these files are used to generate
the UI name, and are case-sensitive.

They are currently lower case, but should be title case like other
presets. This commit renames the files so they are title case.

Pull Request: https://projects.blender.org/blender/blender/pulls/110642
2023-08-01 15:53:32 +02:00
Damien Picard
d922233363 Cleanup: remove unused SSS presets
These SSS presets were used for the Blender Internal engine, pre-2.80.

Pull Request: https://projects.blender.org/blender/blender/pulls/110643
2023-08-01 15:52:05 +02:00
Campbell Barton
52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10:00
Campbell Barton
344ba9691b WM: use repr for WM_OT_context_toggle_enum
Use instead of "'%s'" to avoid problems in the unlikely instance of
the strings containing characters that need escaping.

Also use a ternary operator instead of indexing a tuple.
2023-07-30 16:14:14 +10:00
Campbell Barton
53e6803977 Cleanup: check for "BaseException" instead of "Exception"
Prefer the more generic exception type as it's possible exceptions
derive from this and not "Exception".

Also use the name 'ex' for exceptions instead of 'e'.
2023-07-30 16:14:13 +10:00
Campbell Barton
9f5be2a861 Cleanup: quiet pylint warnings using BaseException 2023-07-30 16:14:11 +10:00
Campbell Barton
52109ff7f0 Refactor: out addon_utils fake_module(..) into a top-level function
Even though it's private, it's useful to be able to access this for
prototyping support for scanning addons in other other locations.
2023-07-29 22:20:40 +10:00
Campbell Barton
6ff81c6505 PyAPI: internal changes needed to support sub-modules as add-ons
Apply minor changes needed for an add-on to be a sub-module.
2023-07-29 22:15:11 +10:00
Campbell Barton
916f6a7bf3 UI: add weight paint gradient menu items for discoverability 2023-07-29 16:33:14 +10:00
Campbell Barton
69e290d2fe Cleanup: code comments
Note that the previous commit [0] added a workaround for MMB-Emulation,
which should have been a separate commit.
(Ctrl-Shift-LMB for weight paint selection).
Extended the code comment for this.

[0]: cfffd813c1
2023-07-29 16:20:03 +10:00
Campbell Barton
cfffd813c1 Cleanup: use typed enum for UI_ITEM_* flags
Using an int lead to confusion with other flags often used with buttons.
For e.g. these flags could be easily confused with uiItem::flag.
2023-07-29 15:32:45 +10:00
Hans Goudey
a632f1ddfd Sculpt: Remove dynamic topology "Smooth Shading" option
Dynamic topology drawing can now use the smooth status saved in each
edge. Because of that, the "Smooth Shading" draw option is unnecessary
and just adds confusion because of inconsistency between dynamic
topology drawing and other modes.

Fixes #109191

Pull Request: https://projects.blender.org/blender/blender/pulls/110548
2023-07-28 13:44:01 +02:00
Andras-Borsanyi
f418e4f648 Walk Navigation: Controls to adjust jump height interactively
In Walk Navigation mode with gravity enabled, the jump height is
often inappropriate for the scene that you are viewing. This is a small
feature that lets you change the jump height in modal walk navigation
as you go, i.e. if there are varying elevation changes across the scene.

Pressing '.' increases and ',' decreases the jump height (because these keys
are the same for most layouts).

Pull Request: https://projects.blender.org/blender/blender/pulls/109827
2023-07-28 13:43:35 +02:00
Campbell Barton
fb54d3f865 Keymap: Use Alt-LMB for selection in vertex/weight paint modes
Use Alt-LMB for selecting in vertex/weight paint modes for vertex, face
& pose bone selection - replacing Ctrl which was previously used for
selecting. This is needed so Ctrl & Shift can be consistent between all
paint modes.

Loop selection is available With Alt-LMB but only when selection tools
are active (with the LMB select key-map). They're always available with
the RMB select key-map.

This also resolves a conflict where box & lasso select tools couldn't
be used to de-select (via Ctrl) because the Ctrl-LMB was also clearing
the selection.

Part of #105298 design task.
2023-07-28 20:54:53 +10:00
Julien Kaspar
827918c925 Keymap: add/update selection mode shortcuts
Selection modes are typically assigned to the number keys.
These are some updates for more consistency among painting and grease
pencil modes:

- Paint Mask = `M` changed to `1`.
- Vertex Selection = `V` changed to `2`.
- GP: Point Selection = `1`.
- GP: Stroke Selection = `2`.
- GP: Segment Selection = `3`.

Design task: #105298

Ref !108714.
2023-07-28 18:26:57 +10:00
Campbell Barton
88902a273e UI: add menu items for sample weight/color
These were only available as shortcuts without any menu item.
2023-07-28 16:27:24 +10:00
Julien Kaspar
6de6d7267f Keymap: improve consistency for paint modes
Various changes to common keymap entries to:

- Sync up very common shortcuts between all Draw, Paint & Sculpt modes
- Avoid shortcut conflicts and remap blocking shortcuts
- Add missing common shortcuts
- Make some important shortcuts more accessible

Some standards this is setting across these modes are:

- Holding `Ctrl` & `Shift` for inverted/smoothing brush strokes
- `X` (+ modifier keys) for Color operations
  (for example flip, sample & fill).
- `Ctrl R` for remeshing
- `I` and `Alt I` for creating and removing keyframes.

- Sample Color = `S` -> `Shift X`
- Set Vertex Color = `Shift K` -> `Ctrl X`
- Stroke Method Menu = `E` -> `Alt E`

New
- Paint Smooth = `Shift Left Mouse`

- Sample Weight = `Ctrl Left Mouse` -> `Shift X`
- Sample Group = `Shift Left Mouse` -> `Shift Ctrl X`
- Set Weight = `Shift K` -> `Ctrl X`
- Linear Gradient = `Alt Left Mouse` -> `Shift A`
- Radial Gradient = `Ctrl Alt Left Mouse` -> `Shift Alt A`
- Stroke Method Menu = `E` -> `Alt E`

New
- Invert Paint = `Ctrl Left Mouse`
- Smooth Paint = `Shift Left Mouse`

- Sample Color = `S` -> `Shift X`

New
- Smooth Paint = `Shift Left Mouse`

- Face Sets Visibility = `H` -> `Shift H`
- Face Sets Visibility = `Shift H` -> `H`
- Face Set Edit Pie = `W` -> `Alt W`
- Sample Color = `S` -> `Shift X`
- Context Enum Menu = `E` -> `Alt E`
- Subdivision Set (Level -1 relative) = `Pg Down` -> `Alt 1`
- Subdivision Set (Level 1 relative) = `Pg Up` -> `Alt 2`

New
- `paint.brush_colors_flip` = `X`
- `sculpt.detail_flood_fill` = `Ctrl R`
- `sculpt.set_pivot_position` (Mode=Surface) = `Shift Right Mouse`

New
- `brush.scale_size` (scalar=0.9) = `[`.
- `brush.scale_size` (scalar=1.1) = `]`.

Removed
- Delete All Active Frames = `Shift X`

New
- `wm.call_menu (GPENCIL_MT_gpencil_draw_delete)` = `Alt I`

- Delete = `X` -> `Alt I`

New
- `wm.call_menu (GPENCIL_MT_gpencil_draw_delete)` = `Alt I`

- Sample Weight = `Ctrl Left Mouse` -> `Shift X`

New
- `wm.call_menu (GPENCIL_MT_gpencil_draw_delete)` = `Alt I`

New
- `gpencil.tint_flip` = `X`
- `wm.call_menu (GPENCIL_MT_gpencil_draw_delete)` = `Alt I`

Ref !108791.
2023-07-28 12:31:52 +10:00
Campbell Barton
93ac697091 Cleanup: remove redundant transform entries in the "Weight Paint" keymap
The pose keymap already handles these actions.
2023-07-28 12:18:48 +10:00
Nate Rupsis
8183f21258 Animation: Default NLA duplucation hot keys to duplicate linked
## Overview

Much like node groups, or a VSE clip, when we duplicate we actually want a _linked_ duplicate. This PR updates the NLA key board for Duplicate linked to `Shift + D`, and Duplicate to `Alt + D`.

Additionally, update Tool tips to reflect duplicate vs linked duplicate.

Pull Request: https://projects.blender.org/blender/blender/pulls/110316
2023-07-27 18:14:05 +02:00
Bastien Montagne
a1d7ec7139 Core: Implement new blendfile compatibility handling.
This implements the main aspects of changes to blendfile compatibility
as designed in #109151:
* Blender files which file minversion is newer than current Blender
  executable won't be loaded at all.
* Blender files which file version is newer than current Blender will
  triger systematic warning to user:
  * In the status info bar (lower right corner in default UI).
  * When attempting to save (overwrite) them.

This means that the file minversion becomes a hard limit, and not a
soft, warning-only as it used to be. Further more, forward compatibility
warning is now systematic (instead of depending on file minversion),
and more visible for users.

See also https://wiki.blender.org/wiki/Process/Compatibility_Handling
for details over the new policy.

Technically:
* Opening any file with a minversion newer than current Blender file one
  now triggers an early abort, with an error message reported to the user.
  This is handled by a new utils called from `blo_decode_and_check`.
* Any file newer than current Blender version sets a new
  `has_forward_compatibility_issues` flag in Main struct at read time.
* Status bar info area is turned into a template, which uses this flag
  to display special warning UI and tooltip when set.
* A new confirmation popup appears when user tries to save (overwrite)
  such a 'newer' blendfile, stating potential loos of data, and
  proposing by default to 'save as' instead.
* The 'quit unsaved' popup has also been updated to 'save as' instead of
  'save' when the edited file is has potential forward compitibility
  issues.

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Germano Cavalcante
d9c3cffd91 UI: Rename 'Proportional Influence' to 'Proportional Editing' in tooltip
"Proportional Editing" is the term officially used by the Blender
community to describe this specific feature.

Also, "Proportional Editing" seems to be more descriptive than
"Proportional Influence", as it emphasizes the ability to
proportionally edit the areas around the selection.
2023-07-27 09:09:22 -03:00
Campbell Barton
1339400845 Cleanup: quite pylint keymap warnings 2023-07-27 16:54:09 +10:00
Julien Kaspar
a7dd864dcf Keymap: simplify default keymap for paint modes
Part of design task #105298 to improve overall consistency.

This removes various shortcuts unused or blocking shortcuts:

- Brush tool shortcuts
  - Mesh sculpt mode shortcuts
     - `X` = Draw
     - `Shift S` = Smooth
     - `P` = Pinch
     - `I` = Inflate
     - `G` = Grab
     - `L` - Layer
     - `Shift T` = Flatten
     - `C` = Clay
     - `Shift C` = Crease
     - `K` = Snake Hook
     - `M` = Mask
  - `D` = Gpencil Vertex Paint - Draw brush

- Duplicate dyntopo shortcut for editing detail size

- Grease Pencil: Undocumented draw tool specific guide shortcuts:
  - `O`, `J`, `Alt J`, `K`, `Alt K`, `Shift K`, `L`, `Alt L`, `Ctrl L`,
    `V`, `M`, `C` & `Alt C`

- `L` = Gpencil: "Alternate" operator shortcut

Also moved erasing box and lasso gesture shortcuts out of specific tools
and into the Draw mode overall.

Ref !108712.
2023-07-27 16:42:17 +10:00
Campbell Barton
98ed1fd011 Fix region toggle pie menu exception on unknown regions
Loading a blend file with unknown regions would raise an exception.
Also remove exception where channels were skipped when the attribute
isn't found as it's no longer needed.
2023-07-27 16:16:23 +10:00
Campbell Barton
3857668756 Remove duplicate keymap item in c14a43acce 2023-07-27 16:00:53 +10:00
Campbell Barton
c14a43acce Fix paint stroke "mode" property being reused when weight painting
Binding a key to weight-paint with mode set (invert/smooth for e.g.)
caused regular weight painting to reuse this setting.

Don't reuse paint "mode" between strokes.
This also allows the default to be removed from the key-map.
2023-07-27 15:58:50 +10:00
Campbell Barton
bdd09a16ef Cleanup: internal keymap function names
- Use km_edit_ prefix for edit-modes.
- Rename "curve" to "curve_legacy".
- Consistent naming for naming for vertex/face selection mask.
- Group object/grease-pencil/paint/edit mode key-map functions together.
2023-07-27 15:17:12 +10:00
Campbell Barton
7548059886 Keymap: restore mirror transform shortcut in weight paint mode
Unintentionally removed in [0]. Weight paint transform should always
follow pose-mode transform.

[0]: d7558a243c
2023-07-27 12:30:44 +10:00
Campbell Barton
88dd1d4408 Keymap: rename "Toolbar Toggle" to "Region Toggle"
The toolbar is only one kind of region that can be toggled.
2023-07-26 21:52:37 +10:00
Campbell Barton
ab7161e41a Keymap: add experimental "Toolbar Toggle Pie" preference
When pressing N-key a pie menu is shown which can toggle regions,
typically the toolbar, sidebar and the header.

This supports toggling regions without having to add a separate shortcut
for each one.

The pie menu locations selected based on the region alignment.

See #107785.
2023-07-26 15:24:30 +10:00
Campbell Barton
d7558a243c Keymap: avoid 3D View transform inheritance
Move shared transform operations out of the 3D viewport key-map into a
template function which each modes key-map uses.

This allows sculpt mode to key-bindings which where bound to transform
actions that don't make sense in sculpt mode.

Note that this enables `alt_navigation` for some 2D viewport actions
where it's not yet used.

Based on design task: #105298.

PR !110019.

Co-authored-by: Julien Kaspar <JulienKaspar>
2023-07-25 21:22:09 +10:00
Campbell Barton
5f764b361c Fix 'bl_keymap_validate' test
Exporting & importing the key-map changed results,
resolve by using float literals.
2023-07-25 20:51:33 +10:00
Damien Picard
39a94e370c I18n: restore unit messages after c++ migration broke extraction
The units defined in blenkernel/intern/unit.c were extracted using a
regex which contained `NULL`. Commit 129f78eee7 converted this file to
c++, and these `NULL` were replaced with `nullptr`, breaking the
regex.

This commit changes the regex to `nullptr` as well to restore the
translations.

Pull Request: https://projects.blender.org/blender/blender/pulls/110420
2023-07-24 17:01:41 +02:00
Germano Cavalcante
017d4912b2 Transform: Use alternative hotkeys for Transform Navigation
In order to avoid navigation hotkey conflicts during transform
operations, this commit implements the "Transform Navigation with Alt"
option.

This option is enabled by default and makes navigation hotkeys require
the `Alt` key during a transforming in the 3D View.

Pull Request: https://projects.blender.org/blender/blender/pulls/109754
2023-07-24 15:51:58 +02:00