Commit Graph

120055 Commits

Author SHA1 Message Date
Falk David
b0c3836280 Cleanup: Grease Pencil: Use ensure_vertex_group kernel function
Use the `bke::greasepencil::ensure_vertex_group` function instead
of a local static copy of the same function.
2024-12-10 11:53:55 +01:00
Falk David
612be514c6 Grease Pencil: Add lasso/box erase operators in draw mode
In Blender 4.2 in Grease Pencil draw mode it was possible to
erase strokes using box and lasso gestures.

Under the hood, these were just using the selection operators
that had special deletion handling if the object was in draw mode.

Rather than hacking this into the selection operations, this adds
two new operators:
* `grease_pencil.erase_lasso`
* `grease_pencil.erase_box`

When using one of the erase operations with auto-key, the previous
keyframe will be duplicated to the current frame (for the drawings
that are affected by the eraser).

They are mapped to the same shortcuts than the selection
operators in Blender 4.2.
* Lasso erase: `Ctrl`+`Alt`+`RMB`.
* Box erase: `B`.

This is part of #130518.

Pull Request: https://projects.blender.org/blender/blender/pulls/131504
2024-12-10 11:50:05 +01:00
Clément Foucault
fe228d26b4 Cleanup: DRW: Remove unused part of DRWTexture API 2024-12-10 11:33:00 +01:00
Clément Foucault
a005efd680 Refactor: Grease Pencil: Port usage of DRW_texture_create_* to Texture
Removes call to legacy API.

Pull Request: https://projects.blender.org/blender/blender/pulls/131636
2024-12-10 11:21:32 +01:00
Jeroen Bakker
0ac92bda89 Fix #131602: Workbench: Incorrect texture usage depth of field.
Depth of field attaches the half res and scene color texture, but
doesn't provide the correct usage flags. This resulted in validation
errors in Metal & Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/131655
2024-12-10 11:06:51 +01:00
Jeroen Bakker
ccab973556 Vulkan: Add support for LocalSizeId execution model
Vulkan version 1.2 supports Workgroup execution model. Vulkan 1.3
introduced the LocalSizeId execution model and has been backported in
the VK_KHR_maintenance4 extension. In future SPIR-V versions the
Workgroup execution model will be deprecated.

This PR checks the availability of VK_KHR_maintenance4 extension and
when enabled compile the shaders towards Vulkan 1.3. This would
automatically use the LocalSizeId execution model.

See https://registry.khronos.org/vulkan/specs/latest/man/html/WorkgroupSize.html

Pull Request: https://projects.blender.org/blender/blender/pulls/131663
2024-12-10 11:06:12 +01:00
Jeroen Bakker
5ed49184fe Vulkan: Rebalance pool sizes.
Update the default pool sizes using some metrics from production files.
Adds a tool to check actual used pool sizes which can be enabled at
build time.

Pull Request: https://projects.blender.org/blender/blender/pulls/131661
2024-12-10 10:48:27 +01:00
Jeroen Bakker
f33433485e Fix #131512: Missing border in image editor overlay
Incorrect framebuffer was attached.

Pull Request: https://projects.blender.org/blender/blender/pulls/131651
2024-12-10 10:47:23 +01:00
Lukas Tönne
d6e78d05c9 Transform: Crazyspace support in edit mode for Curves and Grease Pencil
Edit mode for curves and Grease Pencil was using the plain object transform for
all points without support for individual crazyspace transforms. This patch adds
support for the local rotation matrices, so editing curves on top of modifiers
converts offsets into original geometry space.

For Curves objects these matrices are currently only computed by the surface
deformation node, so editing on top of a surface deformation is the only case
that works currently.
For Grease Pencil the armature modifier is supported and more should be added
in future (see overview task #131599).

Pull Request: https://projects.blender.org/blender/blender/pulls/131619
2024-12-10 10:16:56 +01:00
Jeroen Bakker
1bd8719a7f Vulkan: Add asserts to check attachment usage flags
When using a texture as attachment it must be created witht the
GPU_TEXTURE_USAGE_ATTACHMENT flag. If this is not the case it would lead
to incorrect usage in Vulkan. This change adds asserts to detect
incorrect usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/131656
2024-12-10 09:53:18 +01:00
Aras Pranckevicius
f4b1e169aa Fix: VSE white balance modifier undefined results for HDR colors
Commit 073ce98231 back in 2016 changed white balance math to do
a pow based pixel operation instead of multiplication. However
pow on negative numbers (which would happen on any HDR input) is
undefined. Until some better math is decided upon, at least ensure
the input is not negative.
2024-12-10 10:21:24 +02:00
Jeroen Bakker
500b1f3c69 Vulkan: Add support for clearing depth via GPU_texture_clear
GPU_texture_clear was only used for clearing color textures, but that
changed recently. This PR adds supports for clearing depth/stencil
textures using GPU_texture_clear.

Pull Request: https://projects.blender.org/blender/blender/pulls/131653
2024-12-10 09:06:43 +01:00
Jeroen Bakker
95b9281de1 Vulkan: Add support to clear D24_S8 texture
Depth 24 stencil 8 texture could not be cleared directly. Recently
GPUViewports clear their attachments when created. This resulted into
non consistent behavior between backends.

This change adds support to clear depth 24 stencil 8 textures using
`GPU_texture_clear`. The implementation currently assumes that the input
value is a float.

Pull Request: https://projects.blender.org/blender/blender/pulls/131650
2024-12-10 07:49:49 +01:00
Urko Mauduit
0a6e7e9140 Fix #129527: Unified brush strength does not update cursor visualization
Pull Request: https://projects.blender.org/blender/blender/pulls/131145
2024-12-10 07:00:29 +01:00
Richard Antalik
eea1a65821 Fix: VSE: assert when strips are too short
When handle tweaking is enabled and strips are short, hovering over them
would trigger assert in `mouseover_strips_sorted_get()`, because more
than 2 strips would be picked. Sorting was done just by swapping strips
if order was incorrect

Use `std::sort()` instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/131594
2024-12-10 02:24:53 +01:00
Sean Kim
bdb9b11a53 Cleanup: Add warning for CTX_data_ensure_evaluated_depsgraph
Part of #131010

Pull Request: https://projects.blender.org/blender/blender/pulls/131557
2024-12-10 00:01:12 +01:00
Clément Foucault
2e0f4eea66 Cleanup: DRW: Replace DRW_TEXTURE_FREE_SAFE by GPU_TEXTURE_FREE_SAFE 2024-12-09 23:23:53 +01:00
Clément Foucault
74a2b61fb5 Overlay: Remove call to legacy API 2024-12-09 23:23:53 +01:00
Hans Goudey
b56b1ed6c1 Fix #131226: Remove named attribute node skips Grease Pencil data 2024-12-09 17:16:53 -05:00
Hans Goudey
dabca8d5ee Fix #131323: Compositor missing "Unassigned" node group assets
When there were no "Assigned" assets, the add menu would also skip
the "Unassigned" assets. Needs a correction to an early return check.
2024-12-09 17:13:49 -05:00
Clément Foucault
d01b689302 Overlay: Port usage of DRW_texture_create_* to Texture
Removes call to legacy API.
2024-12-09 23:11:29 +01:00
Hans Goudey
bbb5975202 Fix #131621: "Normal" node incorrect in "Set Curve Normal" evalaution
First the normal mode was changed, then the custom normal input was
evaluated. That's incorrect because changing the normal mode changes
the output of the normal mode. The fix is to avoid changing the normal
mode until after the normals are calculated.
2024-12-09 17:01:47 -05:00
Harley Acheson
d8358edc1b Fix #131561: Adjust for Width of Modifiers in Status Bar Items
Some Status Bar icons differ in width, like "Ctrl". For these items we
have to add a spacer before the next item. Unfortunately there is one
code path where this does not happen for modifiers even though it does
for the main icon. This PR fixes this and removes the chance of icons
overlapping on the status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/131584
2024-12-09 20:18:49 +01:00
Philipp Oeser
c67e96e8ea Fix #131585: UV translation wrong in header when constraints are used
For a bit of (somewhat related) history, check 8d590e4b86.

The real problem here is that for non square images, the
`applyAspectRatio` works with "wrong" vectors if translation constraints
(`CON_APPLY`) are used. Then, the passed vector might actually have axis
changed, e.g. constraining to the Y axis does not hold the Y translation
value in dvec[1], but in dvec[0]. This is expected by design, but
`applyAspectRatio` is not aware of this and does wrong things.

The easy way around this is to actually call `applyAspectRatio` before
the `CON_APPLY` stuff takes place.

NOTE: future improvement might be to split (or rename)
`removeAspectRatio` / `applyAspectRatio` becaues these functions also
handle the "conversion" to pixel values which is not obvious atm.

Pull Request: https://projects.blender.org/blender/blender/pulls/131608
2024-12-09 19:55:43 +01:00
Miguel Pozo
4d8f9bb88e Fix #131420: EEVEE: Temporal projection+Motion blur artifacts
Regression from #131134.

The shader still reads `vel.obj.ofs[STEP_NEXT]`  even when in the
viewport.

- Ensure that `vel.obj.ofs[STEP_NEXT]` points to a valid memory
  location even if the computed value is still wrong.
- Ensure that the viewport always uses a 2 channel  vector_tx and all
  texture reads are always swizzled.

This also seems to fix the motion vector pass for the realtime compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/131445
2024-12-09 18:16:34 +01:00
Iliya Katueshenock
aba0174b48 Sculpt: Simplify sphere mesh filter code
Function itself is 25% faster since no more need for a branch/matrix
/addition vector math. Meaning of the code is the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/131556
2024-12-09 18:14:57 +01:00
Lukas Tönne
c77933e748 Fix potentially incorrect index when looking up layer hints for GP crazyspace
The layer mask used by the armature modifier can be incomplete, in which case
the indices may not match the edit hints list of layer data. The actual
layer index must be used instead.

Also fixes a build error on Win64 ARM which cannot compile a parallel_for_each
over an index range.

Pull Request: https://projects.blender.org/blender/blender/pulls/131620
2024-12-09 17:05:42 +01:00
Omar Emara
7f6058c1fb Fix: Memory leak in Translate node
The Translate node leaks memory when no realization happens. That's
because the code passes the input through, then passes it again inside
the transform algorithm. To fix this, remove the pass through in the
node code and leave potential pass through to the algorithm.
2024-12-09 17:48:11 +02:00
Iliya Katueshenock
8a97d33733 Cleanup: Sculpt: Outdated comment
This notes no more relevant since 583ae8990c

Pull Request: https://projects.blender.org/blender/blender/pulls/131541
2024-12-09 16:25:25 +01:00
Jeroen Bakker
cf0db73571 Workbench: Separate depth of field shaders
Workbench shaders uses one fragment shaders, but uses different
resources based on the step of the effect. This failed in vulkan as all
defined resources should be found. This PR separates the steps in its
own fragment shader and adds sampler binding per step.

- Removed the max coc input texture as it wasn't used.
- Removed the background texture as it wasn't used.
- Renumbered the resources.

Pull Request: https://projects.blender.org/blender/blender/pulls/131606
2024-12-09 16:01:41 +01:00
Jacques Lucke
c3f012b719 Fix #131598: missing node tree update after regenerating overrides 2024-12-09 15:50:37 +01:00
Jacques Lucke
5809c46e1f Fix #127511: inconsistent tangents in Set Position node
The issue was that the `handle_left`, `handle_right` and `position` attribute
are updated one after another and the input field is evaluated again for each
attribute. If the handle positions are updated first, then the tangent will
change in consecutive evaluations.

The fix is to set the three attributes at the same time and to evaluate the
inputs only once.

Pull Request: https://projects.blender.org/blender/blender/pulls/131609
2024-12-09 15:34:47 +01:00
Pratik Borhade
fa0c927e76 Fix #131597: Grease Pencil: Active pivot point doesn't work in edit mode
Grease Pencil never had an "active" point/stroke. So similar to like in 4.2,
use objects location as pivot when `active` is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/131603
2024-12-09 15:21:06 +01:00
Nathan Vegdahl
454677ad49 Fix: use unspecified idroot when duplicating Action from Action Editor
With Slotted Actions, an Action's `idroot` should always be zero,
corresponding to "unspecified". However, there was still some old
leftover code that, when duplicating an Action via the Action Editor,
would set the new Action's `idroot` to either OB or KE, depending
on the editor mode.

In addition to now being incorrect, this was also tripping an assert
elsewhere in the code when trying to then assign that duplicate action
to an ID.

This commit simply removes the outdated code, which is no longer needed,
leaving the `idroot` as the default (unspecified).

Pull Request: https://projects.blender.org/blender/blender/pulls/131601
2024-12-09 15:16:38 +01:00
Sybren A. Stüvel
bf9eb57554 Anim: Fix bug in Action Slot auto-assignment code
The generic Action assignment function tries to find a slot to
auto-assign. This would always look at the last-used slot identifier on
the ID's `AnimData` struct, even when assigning to an NLA strip or
Action constraint.

This commit removes the `Action::find_suitable_slot(ID)` method, and
replaces it with a `generic_slot_for_autoassign(ID, action,
last_slot_identifier)` function. That function basically copies the
behaviour of `find_suitable_slot()`, except that it gets the
`last_slot_identifier` from the caller.

Another difference is that it no longer checks whether the Action is
already assigned, and so also never uses the currently-assigned slot
handle. In the only code flow that calls `generic_slot_for_autoassign()`
this situation would never occur, and thus it's better to delete this
dead code.

Pull Request: https://projects.blender.org/blender/blender/pulls/131491
2024-12-09 14:48:14 +01:00
quackarooni
ea8c45e10a Nodes: remove labels and use placeholder in Attribute Node
It's a relatively common occurrence to run out of space for the property name
when using the Attribute Node, making it unreadable. A big part of this space is
eaten up by the labels, especially since the space they take up scales up with
the node width.

It can be argued that the info provided by the labels (`Type:` & `Name:`), are
superfluous and not essential. Removing them does not make the node harder to
use, and frees up more space for the user to type longer property names.

This is quite similar to changes done in #127992 for Geometry Nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131543
2024-12-09 14:47:40 +01:00
Jacques Lucke
745b93062c Fix: crash adding node input without identifier
This is the same fix as in 680dbe70ae.
2024-12-09 14:15:07 +01:00
Pratik Borhade
03b2fc744e Grease Pencil: Add layer channel color property
This adds a `channel_color` property to layers.
The color is stored in the tree nodes.
It's currently used by the dopesheet for the channel colors.

Resolves #130370.

Pull Request: https://projects.blender.org/blender/blender/pulls/130512
2024-12-09 14:11:29 +01:00
Jacques Lucke
b6e1afb6e1 Fix #108719: correct link is shown as invalid
The issue was that the links was tagged as invalid for one render engine,
because it does not support the output pass. However, switching back
to Cycles did not make the link valid again.
2024-12-09 14:05:07 +01:00
Jacques Lucke
4a0be9ed1a Fix #130741: link_limit is 1 for multi-input sockets 2024-12-09 13:48:55 +01:00
Campbell Barton
a4f67e5958 Cleanup: revert channel-bag hyphenation & add to the dictionary
The combind terms are preferred by the animation team.
2024-12-09 23:44:23 +11:00
Jacques Lucke
205d480219 Fix #131598: handle missing linked data blocks in Geometry Nodes modifier 2024-12-09 13:42:47 +01:00
Jacques Lucke
289962911c Fix #131577: missing node tree updates after duplicating tree 2024-12-09 13:42:47 +01:00
Aras Pranckevicius
074df4ceeb GPU: ensure viewport does not use uninitialized images (#119685 and others)
GPUViewport is creating a bunch of framebuffer textures for itself, but
some space types never initialize/use them. E.g. Sequencer, Nodes etc.
only ever use the "overlay" texture. Eventually when viewport is
"drawn", it combines this uninitialized texture data and then only by
luck it happens that most of the time it is black. But not always!

The textures were only cleared (right now) on Metal backend, under
GPU_clear_viewport_workaround as if it was some driver workaround. Stop
doing that, and just clear them always.

However, there was seemingly a performance issue on OpenGL, when this
clear was being done. At least on my machine (Win10, Geforce RTX
3080Ti), the overhead of doing the clears is measurable, and is caused
by usage of GL4.4 glClearTexImage instead of a framebuffer clear. As if
glClearTexImage makes "pixel data to exist" on the CPU side and then
later on binding this framebuffer sends off that data to the GPU, or
somesuch.

More details in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/131518
2024-12-09 13:23:18 +01:00
Sybren A. Stüvel
e909a17554 Anim: when creating action slot by keying, name it after last-used slot
When a new Action slot is created by keying a property, it is now
named after the last-assigned slot. This is in support of the
following scenario:

- Action `A` is assigned, with slot `Legacy Slot`.
- The slot is renamed to `Main Light`, because that's what being
  animated by it.
- Animator wants to try an alternative animation, and unassigns the
  Action.
- Animator starts keying the light, which creates Action `B` and a
  slot.
- This slot is now also named `Main Light`, independently of the
  actual name of the light being animated.
- Animator can switch between actions `A` and `B`, and because the
  slots have the same name, the auto-assignment Just Works™.

Pull Request: https://projects.blender.org/blender/blender/pulls/131600
2024-12-09 12:57:06 +01:00
Laurynas Duburas
b68be2aedd Fix #131451: Crash moving Grease Pencil points
Proportional editing expects `IndexMask` from all Bezier points not only from selection as it affects not only selected curves.
Therefore `selected_editable_strokes` changed `editable_strokes` and initialized with `retrieve_editable_strokes`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131519
2024-12-09 12:48:02 +01:00
Lukas Tönne
0d8f040c8b Fix #130945: Grease Pencil: Crazyspace support in sculpt mode
Grease Pencil v3 did not have crazyspace support yet. Without this sculpting on
deformed geometry (e.g. on top of an armature modifier) will yield incorrect
offsets because the tool writes to original data based on deformed positions.

This patch adds computation of local deformation matrices which are stored in
the `GeometryComponentEditData`. Those matrices are then used to convert local
deformation of the evaluated geometry back to a deformation of the original
geometry. All the relevant sculpt tools support the crazyspace correction now,
using the `compute_orig_delta` helper function.

Computing the deformation matrices should happen alongside modifier evaluation
for any deforming modifier. This has been implemented for the armature modifier,
others can be added.

A fallback implementation for curves could also be added for modifiers that
don't have an easy way to calculate local transformation. A "natural"
orientation for both the original and deformed positions is calculated, then the
difference yields deform matrices. For meshes the approach is to use the surface
normal and a stable tangent space. For curves the common local coordinate frame
based on parallel transport might be used.

Currently crazyspace correction for the _Clone_ tool does not work because of
#131496.

Pull Request: https://projects.blender.org/blender/blender/pulls/131499
2024-12-09 12:33:44 +01:00
Sean
46cd7afcda Grease Pencil: "Set Start Point" operator
Adds back the operator to change the start point on cyclical strokes.
Behaves the same way as in 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/128540
2024-12-09 11:04:16 +01:00
Clément Foucault
695620120b Fix #131588: Workbench: Missing or frozen geometry when AA is disabled
The view was not synced when AA was turned off.
2024-12-09 10:55:22 +01:00
Laurynas Duburas
cfa63bfefa Fix #130688: Grease Pencil: Multiframe Editing not applying falloff curve
Mutliframe editing wasn't using the falloff.

The fix adds a new field `Vector<float> grease_pencil_falloffs` to
`struct CurvesTransformData`. References it's values with `TransData.extra`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131147
2024-12-09 10:40:08 +01:00