Commit Graph

3492 Commits

Author SHA1 Message Date
Campbell Barton
5088b0154d Cleanup: replace %-formatting with str.format in scripts/modules/
The "bl_i18n_utils" module has been excluded I'm not sure how best
to run it with reasonable code coverage.
2024-04-27 16:06:51 +10:00
Campbell Barton
0c4d3754f1 Cleanup: replace {!s} with {:s} when used with strings
When passing strings to str.format(..) use `{:s}` format specifier
which only takes strings and wont run `.__str__()` on non-strings.

While `{!s}` is an equivalent to `%s`, for the most part `%s` was
used for strings, so using `{:s}` is clearer and more specific.
2024-04-27 16:02:37 +10:00
Campbell Barton
0e3b594edb Refactor: scripts under scripts/startup/ to use str.format
Part of modernizing scripts in Blender, where the previous convention
was to use percentage formatting which has become the "old" way to
format strings in Python.

See proposal for details #120453.

Ref !120552
2024-04-27 16:02:36 +10:00
Campbell Barton
9a40c62863 Cleanup: minor changes to zoom menu
Updates to refactor from [0].

- Rename "_context" as it's no longer unused.
- Remove call to `iface_` as the string no longer contains text.
- Remove redundant `enumerate(..)`.
- Use ternary operator instead of a tuple lookup.
- Assign a ratio variable for reuse.

[0]: 7e2075b809
2024-04-27 14:59:21 +10:00
Campbell Barton
dd864603f1 Cleanup: minor change to string formatting & __file__
Use __repr__ for formatting file instead of __str__ because non-standard
characters will be escaped and the string will be properly quoted.

Also, a modules __file__ is not *guaranteed* to be a string
(although it almost always is), nevertheless, __repr__ generally
results more more humanly readable results.

Note that __repr__ was already used to format __file__ in most places.
2024-04-27 11:58:02 +10:00
Campbell Barton
8250b202e8 Cleanup: use single quotes for enums 2024-04-27 11:58:02 +10:00
Harley Acheson
7e2075b809 UI: Changes to Zoom Menus
For Image, Clip, Sequence editors, try to make their View menus a bit
more consistent. Changes to Zoom menus, including showing current level
if matching.

Pull Request: https://projects.blender.org/blender/blender/pulls/121044
2024-04-26 21:35:49 +02:00
Hans Goudey
ce224fe401 Node Tools: Add mouse position node, wait for cursor option
Add a "Mouse Position" node that outputs the location of the mouse
cursor in region space and the overall size of the region, both in pixel
units. Both outputs are integers to help reflect their pixel units.
If there the mouse position is ever accessible in sub-pixels, they can
easily be changed to floats.

Also add a "Wait for Cursor" option similar to the one for some built-in
operators that delay's the operator's execution until there is a mouse
click in the viewport. That way the operator can be called from menus
even though it is interactive. This option is placed in the node editor
header. When there are more options, it will be part of an "Options"
popover panel similar to the existing "Modes" and "types" popovers.

Combined with the viewport transform node, and other nodes like Raycast,
these features can allow making tools that create geometry where you
click in the scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/121043
2024-04-26 20:14:25 +02:00
Hans Goudey
83ed92d533 Geometry Nodes: Add Viewport Transform node
Add a node that outputs the transform of the viewport relative to the
self object's transform. This node can be used to build effects like
billboarding or aligning geometry to the current view. In combination
with the mouse position node in the future it will allow tools like
generating geometry at the mouse click position.

There are two output matrices. The first is the projection matrix
that takes positions in camera space and applies the final perspective
projection. The other is the "view" matrix which contains the location
and rotation of the camera. These are separate because though their
combination is useful, it isn't used like a typical rotation/transform matrix.

Pull Request: https://projects.blender.org/blender/blender/pulls/118680
2024-04-26 19:47:19 +02:00
Hans Goudey
e3894f0a07 UV: Remove UV sculpt use of brushes
For the brush assets project (#116337) all editors with brushes are
getting an asset shelf, and the brush tools are combined, with
individual brushes accessed in the shelf. That design seems way
overkill for UV sculpting which is just three very simple tools.

In order to avoid one editor with inconsistent use of brushes, which
would significantly increase the complexity of the system after the
brush assets merge, port the three UV sculpt tools to be regular
modal operators that don't use the brush or paint system at all.

To be clear, this is a compromise that doesn't feel ideal, but no
one could think of a better solution. Theoretically this removes
some flexibility from UV edit "sculpting", in practice it probably
won't be a noticeable change.

Pull Request: https://projects.blender.org/blender/blender/pulls/120797
2024-04-26 17:10:04 +02:00
Guillermo Venegas
615100acda IO: Use FileHandler in Node Editors
Use `FileHandlers` to handle file drag-n-drop in Node Editors. Drop-boxes
still remain since they handle Images ID drag-n-drop.

This also allows to open/drag-n-drop multiple files at once.

Also this will allow add-ons to also support drag-n-drop for images and
movies in node editors while still providing access to Blender's native
support since File Handlers let users choose which to invoke if there's
multiple configured.

Pull Request: https://projects.blender.org/blender/blender/pulls/121051
2024-04-26 16:40:16 +02:00
Campbell Barton
d644873252 Preferences: add option to set the trackpad direction for Wayland
When using a version of Wayland that doesn't support trackpad direction
show an option to set the direction manually.

While this is a stop-gap measure until compositors support seat
version 9, the latest GNOME doesn't yet support this, so there will
be users for some years without this functionality.

Addresses issue raised in #107676.
2024-04-26 21:26:49 +10:00
Lukas Tönne
91f1f3fc06 GPv3: Implementation of sculpt mode tools
This implements all the sculpt tools in Grease Pencil 3.

UI changes in the 3D view header and keymap entries for sculpt mode are
still minimal, more entries should be added once the relevant operators
are supported.

A set of utility functions and a shared base class
`GreasePencilStrokeOperationCommon` for sculpt operations has been added
to make individual operations less verbose.
The `GreasePencilStrokeParams` struct bundles common arguments to reduce
the amount of boilerplate code. The `foreach_editable_drawing` utility
function takes care of setting up the parameters and finding the right
drawings, so the tool only has to modify the data. Common features like
tracking mouse movement and inverting brush influence are handled by the
common base class.

Most operations are then relatively simple, with the exception of the
Grab and Clone operations.
- __Grab__ stores a stroke mask and weights on initialization of the
  stroke, rather than working with the usual selection mask.
- __Clone__ needs access to the clipboard, which requires exposing the
  clipboard in the editor API.

Pull Request: https://projects.blender.org/blender/blender/pulls/120508
2024-04-25 20:20:27 +02:00
Sietse Brouwer
5220caeabb GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight)
This PR implements the Weight Paint tools for GPv3.

Tools:
- Draw, for assigning weight to stroke points
- Blur, smooths out weight using adjacent stroke point weights
- Average, smooths weight using the average weight under the brush
- Smear, like finger painting, drags weights in the direction of the brush
- Sample weight, sets the brush weight to the weight under the cursor

The weights are assigned to the active vertex group. When there is no
active vertex group, a group is automatically created.

When the Auto Normalize option is enabled, it is ensured that all
bone-deforming vertex groups add up to the weight of 1.0.
When a vertex group is locked, it's weights will not be altered by
Auto Normalize.

The PR already supports multi frame editing, including the use of a
falloff (defined by a curve).

The implementation is in accordance with the Weight Paint tools in GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118347
2024-04-25 15:21:14 +02:00
Falk David
fe0e2907b3 GPv3: Remove OB_MODE_PAINT_GREASE_PENCIL flag
This reverts part of 36cda3b3116acba3b895daf68689f8af01b62392
and replaces the use of `OB_MODE_PAINT_GREASE_PENCIL`
`OB_MODE_PAINT_GPENCIL_LEGACY` flag instead.
The `OB_MODE_PAINT_GREASE_PENCIL` is removed.

The `GREASE_PENCIL_OT_draw_mode_toggle` operator is removed
and the `GPENCIL_OT_paintmode_toggle`  operator is adapted to
work with GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/121027
2024-04-25 14:23:46 +02:00
Campbell Barton
c555fc8cf3 Cleanup: follow conventions for core-scripts 2024-04-25 12:00:37 +10:00
Campbell Barton
2f003277c5 Fix error in new IO drop handler ignoring uppercase extensions
Resolve oversight in b97ac126f8.
2024-04-25 11:58:40 +10:00
Guillermo Venegas
b97ac126f8 IO: Replace Image space drop-box with a File Handler
Replaces `Space Image` drop-box with a file handler in order to support
opening multiple sets of files at once and to allow users to add their
own file handler to the Image editor space if desired.

A new `Image_OT_open_images` operator is introduced that uses
`Image_OT_open` internally. It groups files by different sequences and
UDIMs and loads each group accordingly.

Co-authored-by: Jesse Yurkovich <deadpin>
Pull Request: https://projects.blender.org/blender/blender/pulls/117707
2024-04-25 03:40:14 +02:00
Aras Pranckevicius
31e56797f0 VSE: indicate missing media in timeline/display
Sequencer timeline displays red tint & appropriate icons for strips that are
missing media file (images, movies, audio, or meta strips that contain such).

Sequencer preview and rendering displays missing media strips as magenta,
similar to missing textures elsewhere in Blender. This is on by default,
sequencer view settings have an option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/116869
2024-04-24 19:54:44 +02:00
Hans Goudey
c60a1006e5 Asset Shelf: Add asset shelf region to image editor
As part of the brush assets project, the image editor needs an asset
shelf to display brush assets for texture paint mode. This commit adds
the unused asset shelf region, similar to the 3D viewport's region that
is currently just used for the pose library. For now, users will just
see an "Asset Shelf" toggle in the view menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/121034
2024-04-24 17:55:37 +02:00
Hans Goudey
3cd1c365c3 Geometry Nodes: Add Project point matrix node
With the matrix socket being introduced into geometry nodes, we
are starting to deal with more complex transforms like perspective
projection. For those matrices projecting a point is not as simple
as just matrix multiplication, there has to be an additional normalization
step after. To solve that in an intuitive way consistent with how it's
typically solved in code, add a new "Project Point" node.

The canonical use case for now is in combination with the mouse
position, viewport transform, and raycast nodes, to find where the
mouse clicked on the edited geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/120597
2024-04-24 15:56:33 +02:00
Aras Pranckevicius
c64050ecd2 VSE: Timeline strip visual design updates
Design updates as per #118288:
- Tweak text labels (colors, drop shadows)
- Strip border colors, inset outlines
- Muted strips are mostly gray, and their thumbnails are faded
- Overlapping strips are not semitransparent anymore
- Locked stripes only in content area
- Missing data blocks
- Updates to meta strips w/ missing data blocks

Pull Request: https://projects.blender.org/blender/blender/pulls/118581
2024-04-24 12:37:38 +02:00
Clément Foucault
252970e5c6 EEVEE-Next: UI: Align influence sliders together 2024-04-23 23:08:19 +02:00
Clément Foucault
71745416b8 EEVEE-Next: UI: Rename material Raytraced Refraction to Transmission
This is more correct as it affects all transmission BSDFs.
2024-04-23 22:17:50 +02:00
YimingWu
7a8e4995c8 Fix #120966: Remove sample_clamp for EEVEE raytracing presents
Variable `sample_clamp` has been removed from EEVEE Raytracing presents
by d44ee7bf11, so clean up the code for making presents.

Pull Request: https://projects.blender.org/blender/blender/pulls/120977
2024-04-23 15:55:49 +02:00
Falk David
0a4a6ebadc GPv3: Use GPv2 object mode flag for weight painting
This mostly reverts bd22059752
and makes sure to use `OB_MODE_WEIGHT_GPENCIL_LEGACY` instead
of `OB_MODE_WEIGHT_PAINT`.

Pull Request: https://projects.blender.org/blender/blender/pulls/120983
2024-04-23 15:48:27 +02:00
Hans Goudey
0c3763ddda Geometry Nodes: Add SDF grid boolean nodes
Add a simple node to compute the intersection, difference, or union
between SDF grids. This should be the first new use case for the
new volume grid nodes that wasn't possible before.

For naming and multi-inputs, the node uses the same design as the
mesh boolean node. We considered splitting each operation into a
separate node, but though most users considered these different
"modes" of the same operation.

One thing to keep in mind is that it's important for the grids to
have exactly the same transform. If they have different transforms,
the second grid must be resampled to match the first, because the
OpenVDB CSG tools have that requirement. Resampling is expensive
(for SDF grids it means a grid -> mesh -> grid round trip) and should
be avoided.

Pull Request: https://projects.blender.org/blender/blender/pulls/118879
2024-04-23 14:48:59 +02:00
John Swenson
cff532e134 VSE: Implement Snapping to Markers
This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker
frame numbers to `snap_data->target_snap_points` within
`seq_snap_target_points_build()`.

To enable `seq_get_snap_target_points_count()` to have access to marker
information, the current Scene object is now passed to the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120450
2024-04-23 01:54:14 +02:00
Clément Foucault
d44ee7bf11 EEVEE-Next: Make light clamping consistent
This adds clamping at the light combine stage for both direct
and indirect light.

This allows for clamping direct and indirect light separately.
While direct light clamping might not be very desirable in
EEVEE, it might be wanted to reduce the flickering from distant
shiny bumpy surfaces, or for artistic reason.

This happens after applying the BSDF throughput just like cycles.
This is done in order to minimize the performance impact and
allows to split the clamp for direct light and indirect light.

The indirect light clamp value is still used in the ray-tracing
pipeline to clamp the ray intensity. But this differs from cycles
as we clamp the ray without the BSDF throughput here. Sphere probe
have the same issues. Some more energy loss is expected compared
to the direct light clamp.

Note that we still clamp the indirect light after applying BSDF
in case the BSDF is scaling the energy up above the threshold.

This also corrects the clamping for volume that now clamps after
applying the scattering term.

Also adds clamping to volume indirect lighting.

Since we use light probe volumes for both surface and volume
indirect lighting, we need to clamp them at sampling time.

Pull Request: https://projects.blender.org/blender/blender/pulls/120866
2024-04-22 21:19:00 +02:00
Jacques Lucke
22c6831f63 Geometry Nodes: improve search weights of some nodes 2024-04-22 18:22:05 +02:00
Sietse Brouwer
4fbef3dc6b GPv3: Cutter tool
This PR implements the Cutter Tool for GPv3. The Cutter tool deletes
points in between intersecting strokes. New points are created at the
exact intersection points, so as a result the cutted strokes will fit
perfectly.

For feature parity, the tool follows the GPv2 behavior:

- The cutter tool works on all editable layers.
- Intersections are only detected for curves on the same layer,
so intersection of curves on _seperate_ layers are not handled.

Technical notes
The implementation uses the `compute_topology_change` function
created for the Hard Eraser. So at intersection points, point
attributes will be interpolated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113953
2024-04-22 14:05:22 +02:00
Jeroen Bakker
0c2085a316 GPU: Remove GPU_compute_shader_support
Compute shaders are required since 4.0. There was one occasion where
an older AMD driver failed and support was turned off. This driver
is now marked unsupported.

This PR includes:
- removing the check in viewport compositing
- remove properties from system info
- always construct draw manager.
- remove unused pass logic in draw hair/curves
- add deprecation warning when accessed from python

Pull Request: https://projects.blender.org/blender/blender/pulls/120909
2024-04-22 13:28:10 +02:00
Bartosz Kosiorek
eb4204120b UI: Add tooltip for Poly Build tool
Pull Request: https://projects.blender.org/blender/blender/pulls/120792
2024-04-22 12:27:49 +02:00
Sietse Brouwer
ec7492ee77 GPv3: Tint tool UI fixes
This PR contains 3 fixes in the tool bar for the Tint tool:
- For the tint color, the general color panel was shown, but it should
be the Grease Pencil color panel (with not just the color wheel, but
also the color palettes).
- The Advanced Brush panel was redundant, because it only showed
Radius and Strength and those are already present in the tool bar.
So the Advanced panel can be removed.
- The 'Active Layer' switch wasn't exposed in the tool bar, so it has
been added.

Pull Request: https://projects.blender.org/blender/blender/pulls/120719
2024-04-22 11:44:10 +02:00
casey bianco-davis
2df13ce4a3 GPv3: Primitive Tools: Line, Polyline, Arc, Curve, Box and Circle Tool
Adds the primitive tools in draw mode to GPv3.

This also adds rotation and scale sub-operators with `r` and `s` keybinds.
Also all control points are editable after extruding.

Pull Request: https://projects.blender.org/blender/blender/pulls/119039
2024-04-22 10:48:03 +02:00
Jesse Yurkovich
8392f69e10 Fix 120863: Update presets with recent rename in EEVEE-Next settings
The `screen_trace_max_roughness` setting was renamed to
`trace_max_roughness` but the Presets were not updated [1].

[1] See 9dd164e1ad

Pull Request: https://projects.blender.org/blender/blender/pulls/120865
2024-04-20 22:34:47 +02:00
Clément Foucault
9dd164e1ad EEVEE-Next: Rename screen trace max roughness
Remove "screen" from the name as it is not limited to
screen trace.
2024-04-19 20:27:24 +02:00
Clément Foucault
7b38873732 EEVEE-Next: Volume: Add custom integration range
This is just adding a switch for enabling custom range.

Custom range is now optional as we compute a tight bound
to integrate around volume objects by default.

The custom range is only needed for scene with really
thick world volumes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120823
2024-04-19 13:51:27 +02:00
Clément Foucault
2c19be2682 EEVEE-Next: UI: Render Panel
- Reorder panels to match Cycles (and rendering pipeline order)
  `Sampling > Objects > Motion Blur / Dof > Film > Performance`
- General reordering of properties to avoid too many panels.
- Make sure panels a disabled if their checkbox is.
- Enabled Freestyle panel for EEVEE-Next.
- Merge some panels into sub-panels.
- Add `Clamping` panel.
- Split Lighprobe panel into `Performance` and `Scene`.
- Move shadow panel to Sampling.
- Generally improve consistency with Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/120691
2024-04-19 12:12:28 +02:00
Campbell Barton
06adfcaf38 Cleanup: unused imports 2024-04-19 16:09:30 +10:00
Campbell Barton
4e8b24f1d1 Cleanup: spelling in comments & punctuation 2024-04-19 15:57:06 +10:00
Clément Foucault
05c1abe59c EEVEE-Next: UI: Small changes to material data panel
- Remove the `Use Nodes` button when nodetree is used.
- Make displacement properties aligned.
- Rename and enable max distance only when not bump.
2024-04-18 23:44:08 +02:00
Clément Foucault
0c50ec866f EEVEE-Next: UI: Light Panel
- Put non-usual settings into sub panels.
- Rename shadow parameters to be shorter

Pull Request: https://projects.blender.org/blender/blender/pulls/120732
2024-04-18 22:35:28 +02:00
Clément Foucault
0791d7c349 EEVEE-Next: Light: Add ray visbility support
This is very straightforward.

We don't do any versionning as we assume that
if a scene was using these, it was not using eevee
as default renderer.
2024-04-18 22:10:54 +02:00
Clément Foucault
125fcc948e EEVEE-Next: Light: Add transmission factor
Now that lights are supported for refraction BSDFs,
there is no reason to not add support for it.

Versionning sets it to zero for compatibility with
legacy EEVEE.

This is also needed in order to support per object
ray visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/120796
2024-04-18 22:08:50 +02:00
Boltzmachine
740c9f220d VSE: Add RGB Parade Display Mode for sequencer
This PR implements #120479 by adding a new Waveform Display Mode
"RGB Parade" that will essentially be the Luma Waveform but with
"Separate Colors" turned on.

Pull Request: https://projects.blender.org/blender/blender/pulls/120615
2024-04-18 21:25:44 +02:00
Hans Goudey
de45c1102f Cleanup: Make format 2024-04-18 15:12:05 -04:00
Hans Goudey
9a7f4a3b58 Modifiers: Affect all selected objects when holding alt
Support holding alt while invoking modifier operations for add, apply,
remove, and move to index in the property editor. This affects all selected
editable objects instead of just the active object.

Though the alt key is not that visible, it's consistent with the
existing multi-object property editing shortcut. If/when multi-
object editing is every made the default, the alt key could
be reversed here too.

Changes as part of #120230.

Pull Request: https://projects.blender.org/blender/blender/pulls/120695
2024-04-18 17:40:50 +02:00
Clément Foucault
aea31a530d EEVEE-Next: UI: More tweak to lightprobes 2024-04-18 17:32:49 +02:00
Clément Foucault
42c77b2107 EEVEE-Next: UI: Improve volume lightprobe props name and tooltips 2024-04-18 16:48:41 +02:00