Commit Graph

135500 Commits

Author SHA1 Message Date
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
Jesse Yurkovich
fea1d1d71f Fix: Unintentional move from constant in retrieve_attributes_for_transfer
Moving a constant variable results in a copy occurring instead. This
looks to have been an accidental change as part of ea937b304d.

A few tools will warn about this:
`Warning	C26478	Don't use std::move on constant variables. (es.56)`
`Warning	cpp:S5415	"std::move" should not be called on a const object.`

Pull Request: https://projects.blender.org/blender/blender/pulls/121063
2024-04-25 18:02:50 +02:00
Clément Foucault
9a530906cf Fix: EEVEE-Next: Metal shader compilation
Caused by implicit cast to float vector.
2024-04-25 17:33:23 +02:00
Pratik Borhade
f1d8b56a8e Fix #121061: Crash when sculpting brush has Occlusion enabled
corner_verts span is empty when occlusion is enabled. So assign value to
it in `SCULPT_vertex_is_occluded`

Pull Request: https://projects.blender.org/blender/blender/pulls/121071
2024-04-25 17:11:40 +02:00
Christoph Lendenfeld
c464426475 Refactor: swap handle logic in Graph Editor transform code
This PR changes the `swap_handles` variable of the
`BeztMap` from `short` to `bool`.
The only reason it was a `short` was so that 0 could be
interpreted as "not checked" within the sorting loop.
Instead, I moved the checking for swapping to a separate loop.
That means the `BeztMap` array needs to be traversed one more time,
but given sorting might already do that multiple times that won't be
a performance issue
(plus we don't have the `if` within the sorting loop potentially messing up branch prediction).

In addition to that this PR also removes `prev_ipo` and
`current_ipo` from the `BeztMap` struct. Those were never used.

This is also partly a fix to restore 3.6 behavior.
With the move to C++, `swap_handles` was never initalized,
so the logic ` if (bezm->swap_handles == 0)` would always be false.
That resulted in the following behavior when
**rotating a bunch of keys 180deg** around their common center.

Pull Request: https://projects.blender.org/blender/blender/pulls/121076
2024-04-25 16:52:16 +02:00
Clément Foucault
b49333a7a0 Fix: EEVEE-Next: Fix spherical harmonic clamping
The previous implementation was not considering each
channel magnitude, which was not rotationally
invariant. This fixes changes in lighting as the world
rotates (and if clamping is enabled).
2024-04-25 16:45:59 +02:00
Clément Foucault
5938ab099d Fix: EEVEE-Next: Correct octahedral texel solid angle
This fixes the slightly incorrect solid angle by using
the symetries of the mapping. This avoids orientation
dependent lighting. The computation is not much more
expensive.
2024-04-25 16:45:59 +02:00
Brecht Van Lommel
2a65681dea Fix #121069: Crash loading EEVEE byte lightcache after recent refactor 2024-04-25 16:15:41 +02:00
Christoph Lendenfeld
78583bf22e Anim: Add option to show modified property on slider
This PR adds the feature of displaying which property is modified
to the slider GUI.

This is useful in cases like #117287
where the slider can modify different properties during the modal operation.

The string is optional and will be empty by default.

This label is placed to the left of the slider where the percentage was usually located.
The percentage has now been moved to the right.

Pull Request: https://projects.blender.org/blender/blender/pulls/119920
2024-04-25 15:48:17 +02:00
Campbell Barton
6d1ffc519f Cleanup: remove unused GizmoGroup reports 2024-04-25 23:24:47 +10:00
Campbell Barton
cb164dabab Cleanup: avoid redundant call to BLI_heap_clear
Add an assertion that the heap is always cleared.
2024-04-25 23:21:32 +10: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
nutti
07f2a0ee9f Python API: Fix invalid Python syntax in Python API docstrings
Ref: !121074
2024-04-25 23:08:35 +10:00
Campbell Barton
d291ec37e0 Cleanup: remove null check in blo_filedata_free
All callers except for one were already checking, add ATTR_NONNULL
attribute to functions that take a FileData to make it clear that
it's not expected to be null.
2024-04-25 23:03:17 +10: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
Pratik Borhade
1f10100f46 Fix: memory leak in sequencer_preview_add_sound
Move memory allocation of `audiojob` after if/else condition. Otherwise
there is possible chance of memory leak due early exit from that
function.

Part of #120767

Pull Request: https://projects.blender.org/blender/blender/pulls/121006
2024-04-25 13:24:49 +02:00
Bastien Montagne
679a05a02c Core: lib_query: Replace raw function pointer by FunctionRef for callback.
Besides using modern code, this also allows to use 'capturing' lambdas
as callbacks here.
2024-04-25 12:38:23 +02:00
Jacques Lucke
de7ea7e60d Fix: don't allow zero bandwidth in sdf grid
Setting the bandwidth to zero caused a crash.
2024-04-25 12:13:11 +02:00
Christoph Lendenfeld
dafcb353b8 Fix #120950: Graph Editor curve drawing artifacts with normalized display
The drawing code in the Graph Editor reduces the points drawn by checking the pixel distance.
The calculation for the pixel distance didn't take the normalization into account though, so
in certain scenarios points would be skipped that shouldn't be skipped.

The fix is to pass the normalization factor into the pixel distance calculation.

Pull Request: https://projects.blender.org/blender/blender/pulls/121070
2024-04-25 11:50:55 +02:00
Jacques Lucke
3f2c4db951 Curves: support more curve type conversion options in edit mode
This adds a new `Handles` checkbox to the conversion operator that
affects how the conversion works in the following cases:
`Bezier -> Catmull Rom / Poly / Nurbs` and `Catmull Rom -> Nurbs`.
If enabled, three control points are added for each original control
point, otherwise only one.

-----

The images show the effect of the toggle. The top result is always the one with handles and the bottom one without.
* `Bezier -> Poly`
  ![image](/attachments/c4833568-fb8a-415e-b4fc-a8af2002ded8)
* `Bezier -> Catmull Rom`
  ![image](/attachments/df62e4c0-1a88-4f04-aa82-506bc40765a2)
* `Bezier -> Nurbs`
  ![image](/attachments/3b78d49d-c840-4c15-a342-050fb1f5c3f5)
* `Catmull Rom -> Nurbs`
  ![image](/attachments/de9a4c08-d442-4f97-a0e0-6393b0f0e6de)

Pull Request: https://projects.blender.org/blender/blender/pulls/120423
2024-04-25 10:56:43 +02:00
Iliya Katueshenock
fa66b52d0a Nodes: tooltips for value of dangling reroute node
Dangling reroute nodes have no source of value. For that reason, such reroute nodes
are ignored by geometry nodes. Other node systems still have to handle this case
more explicitly. To users this behavior generally makes sense, but it's also not completely
obvious. Now, there is a new tooltip when hovering over dangling reroute nodes that
mentions how those work.

Pull Request: https://projects.blender.org/blender/blender/pulls/120851
2024-04-25 10:48:06 +02:00
Campbell Barton
7337d97e13 Fix #120231: Unwrap can crash with shape_method='CONVEX'
There was no check for a convex hull with 1-2 points,
causing unwrap to crash on degenerate faces.

Regression caused by [0] (fix for #115061), which hid this bug.

[0]: 0053de6556
2024-04-25 18:02:33 +10:00
Campbell Barton
e8229fccba Fix #120551: Loop Cut tool fails when Select Circle tool is active
Allow pre-select gizmos to be "highlighted" so they can override
the fallback tool key-map items.
2024-04-25 16:11:19 +10:00
Clément Foucault
2a0074c930 Fix: EEVEE-Next: Compile error on Nvidia drivers
Fixes #121057
2024-04-25 08:00:14 +02:00
Guillermo Venegas
5c2d412a29 Fix image sequence detection to account for the number of digits
Previously when opening 2 images like `['img1.png' ,'img002.png']` the
sequence detection will open this images as a single image sequence.
However internally this is not a supported sequence.
To fix that this changes will also differentiate sequences
by their digit count, so if a group of images like:
`['img1.png','img2.png' ,'img002.png','img003.png']`
are open now it will create 2 images sequences instead of just one.

Ref: !120185
2024-04-25 13:04:23 +10:00
Campbell Barton
0f93f70076 Cleanup: quiet unused variable warnings 2024-04-25 12:09:31 +10:00
Campbell Barton
bc7e7b80fc Cleanup: use const arguments & remove redundant check 2024-04-25 12:02:15 +10:00
Campbell Barton
08b3db500f Cleanup: correct asserts
Also remove redundant assert.
2024-04-25 12:02:14 +10:00
Campbell Barton
29dd91815f Cleanup: remove redundant calls to strlen 2024-04-25 12:02:12 +10:00
Campbell Barton
9558aafafb Sequencer: correct speed assignment
The argument was shadowing the class member.

Ref !121016
2024-04-25 12:02:11 +10: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
Sean Kim
a03bf7e055 Refactor: Invert return value of array_utils::indexed_data_equal
This PR inverts the return values of `indexed_data_equal` to make the
function return as one would expect (i.e. if everything is equal then it
returns true, if any are not equal it returns false)

Pull Request: https://projects.blender.org/blender/blender/pulls/121056
2024-04-25 02:31:27 +02:00
Charles Wardlaw
2548132e23 USD Import: Added mesh validation on import as an option
Added mesh validation on import as an option.

If bad mesh data is imported, there may be a crash on a switch to edit
mode or similar. This adds an option to validate if a user determines
the file is corrupted, allowing the possibility for data recovery.
This is especially useful for importing files exported from certain CAD
applications.

The option here matches the option that OBJ and Alembic both provide.

Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121054
2024-04-25 01:47:08 +02:00
Clément Foucault
1b04a0d494 Fix: EEVEE-Next: Self shadow issue caused by depth buffer precision
This add a small bias to the shading point position. This avoid
most of the self shadowing artifacts caused by depth buffer
precision. If near/far distances are set to reasonable value
this should not create any shading differences.

Fix #119124
2024-04-24 22:59:13 +02:00
Jeroen Bakker
c8ccf77564 Vulkan: Render graph dispatch indirect
Add dispatch indirect node. Also refactored the dispatch (direct) node
so more logic could be reused. The context only stores a `VKResourceAccessInfo`
struct which is reused by both the dispatch and dispatch indirect node.

Pull Request: https://projects.blender.org/blender/blender/pulls/120993
2024-04-24 21:28:45 +02:00
Michael B Johnson
f91b23ef2d USD import: add support for displayColor on non-Mesh USD shape prims
Blender USD import already supports the displayColor primvar, when it is
specified on Mesh prims. These colors are visible in the viewport when
the viewport shading color type is set to Attribute.

This PR extends this displayColor primvar support to also work with the
various shape prims, such as Box, Sphere, etc.

The original displayColor support was implemented in USDMeshReader.
Because USDShapeReader is a sibling to to USDMeshReader, and
USDShapeReader first converts shapes to a Mesh, we have factored out the
mutually beneficial code from usd_reader_mesh.cc into a new usd_mesh_utils.cc.

For now only the displayColor primvar is supported on shapes, but this
could be easily extended in a future PR.

Authored by Apple: Matt McLin

Co-authored-by: Michael Kowalski <makowalski@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/120236
2024-04-24 20:58:53 +02:00
Hans Goudey
777473313e Fix: Correct perferred domain function for point index in curve node 2024-04-24 14:32:10 -04:00
Hans Goudey
36f1336e38 Fix #121041: Node tools asset list missing on startup
Caused by 52cff75ce0 which marked the asset tree "not dirty"
when it was built even if asset loading wasn't finished.
2024-04-24 14:31:56 -04:00
Clément Foucault
fcb19fc4ec Cleanup: EEVEE-Next: Use define for volume probe atlas format 2024-04-24 20:20:35 +02:00
Clément Foucault
211b726f48 Fix: EEVEE-Next: Wrong sphere probe normalization with no volume prove
This was caused by 2 issues:
- The probe selection was running before the volume set_view
  copying undefined data.
- Missing half voxel offset which was making L1 data incorrectly
  blended with other coefficients.
2024-04-24 20:20:35 +02:00
Pratik Borhade
1e61cf7cf4 Fix #120958: Redundant Operations Tips in Status Bar when Transforming
Caused by 49bd285529.
keyitem with "release" events are shown in the status bar which is not
necessary. Move the if condition outside of for loop and exit early from
`uiTemplateStatusBarModalItem` to skip drawing of "release" type of
keyitems.

Pull Request: https://projects.blender.org/blender/blender/pulls/120974
2024-04-24 20:19:59 +02:00
Sergey Sharybin
b24c91e93e Fix #119791: Cycles: Transparent hair curves render slow with volumes
The slowdown was caused by the volume step calculation returning an
infinite value. This was caused by the calculation happening before
the object bounds are calculated via the code path which does some
early update for the displacement and hair transparency. The actual
value was never re-calculated after bounds are valid.

The solution is to only clear need-update after the final call of
the device_update_flags().

Pull Request: https://projects.blender.org/blender/blender/pulls/121042
2024-04-24 20:15:58 +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
Pablo Vazquez
3ac504b8f6 VSE: Draw outline on active unselected strips
In Blender 4.1 and prior, you can tell apart the active-unselected strip
because it would have no thick outline but the text would be highlighted.

However, if label overlays were disabled there would be no way to know tell
them apart. Solve this by drawing a subtle 1px outline on active unselected
strips, using the active outline color but slightly dimmed.

Pull Request: https://projects.blender.org/blender/blender/pulls/121029
2024-04-24 19:24:11 +02:00
Brecht Van Lommel
badec4fc39 Fix: Assert reading light cache texture after recent changes 2024-04-24 18:34:59 +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
Lukas Tönne
13ae2e613e Fix #117721: GPv3: write to vertex and fill color attributes
Fill color attribute (curve domain) needs to be written for custom
fill colors to work.

Pull Request: https://projects.blender.org/blender/blender/pulls/121028
2024-04-24 17:47:17 +02:00
Brecht Van Lommel
1420c7bc60 Fix: Crash when ViewLayer.active_collection is invalid in blend file
Pull Request: https://projects.blender.org/blender/blender/pulls/121035
2024-04-24 17:42:18 +02:00