Commit Graph

117289 Commits

Author SHA1 Message Date
Campbell Barton
9c8c786a05 Fix error in studiolight preview
Regression in [0].

[0]: 473bd60164
2024-09-29 14:57:36 +10:00
Germano Cavalcante
68c3517871 Fix: 'Snap to Grid' defaults to 'Center' instead of 'Median' when 'Closest' is selected
The 'Closest' 'Snap With' option does not work well with 'Snap to Grid'
due to the unpredictable nature of this 'Snap With' option. That's why
another option is used in this case.

The option chosen in this case is the same one that was used in
'Absolute Grid Snap', that is, 'Median'.
2024-09-28 17:45:34 -03:00
Hans Goudey
d24483e0cf Geometry: Use StringRef for vertex group lookup
Fixes incorrect usage of StringRef in new grease pencil code, where
`.data()` was passed as a null terminated C string. Removes the now
unnecessary `std::string` creation that attribute accessors used to
fix that problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/128298
2024-09-28 20:58:34 +02:00
Hans Goudey
68be2d9af1 Cleanup: Add helper function to access vertex group index from name
In addition to the existing function which takes an ID argument.
2024-09-28 10:39:04 -04:00
Hans Goudey
751e009898 Cleanup: Remove unused variables in USD attribute writing 2024-09-28 10:26:22 -04:00
Hans Goudey
690d89089f Fix: Sculpt: Clay strips brush ignores hardness
Error in 6d9641daee.
The cube distances calculation actually doesn't fully process hardness.
2024-09-28 10:25:37 -04:00
Iliya Katueshenock
117d4a51c3 Fix #128193: conditional socket visibility broken on Distribute Points on Faces node
Missed disabling of the sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/128214
2024-09-27 22:22:26 +02:00
Jacques Lucke
578fd9b10e Geometry Nodes: support grease pencil in Duplicate Elements node
This adds support for using the Duplicate Elements node on grease pencil on the
point, curve and layer domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/128210
2024-09-27 21:54:19 +02:00
Jesse Yurkovich
63a4b45b43 Cleanup: USD: take advantage of new AttributeIter::get API
Make use of the potentially more efficient `AttributeIter::get` API.

Pull Request: https://projects.blender.org/blender/blender/pulls/128211
2024-09-27 21:38:01 +02:00
Sean Kim
6d83f9a6b3 Cleanup: Sculpt: Extract common factor calculation methods
Part of #118145.

This PR introduces a number of helper methods used across the brush
implementations to reduce duplication when calculating a base value for
the `factors` array.

Not all brushes have been ported to use these helper methods - a
conservative approach was taken to avoid adding complexity for the
common case.

Pull Request: https://projects.blender.org/blender/blender/pulls/128235
2024-09-27 20:42:54 +02:00
Jesse Yurkovich
6c62fe7ac8 Fix: Hydra memory leak when generated images are saved
When attempting to cache a generated image, the ImageFormatData's
view_settings would inadvertently be leaked due to the settings being
assigned a different set of values without first being free'd.

Additionally, there was another missed free from an early return a bit
later in the same function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128229
2024-09-27 19:21:11 +02:00
Jesse Yurkovich
04c5044e61 Fix: Hydra "Object" texture coordinates incorrectly set to "World"
Found by inspection but looks like a simple oversight.

Example images in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/128223
2024-09-27 19:20:25 +02:00
Bastien Montagne
a9fa3657a6 Fix (unreported) link/append code adding full ID names in some cases.
This code handles ID types separately, so id names should not contain
the ID code prefix.
2024-09-27 19:06:55 +02:00
Hans Goudey
5e46e3d28a Subdiv: Remove topology refiner C-API wrapper
Remove the indirection previously used for the topology refiner
to separate C and C++ code. Instead retrieve the base level in
calling code and call opensubdiv API functions directly. This
avoids copying arrays of mesh indices and should reduce
function call overhead since index retrieval can now be inlined.
It also lets us remove a lot of boilerplate shim code.

The downside is increased need for WITH_OPENSUBDIV defines
in various parts of blenkernel, but I think that is required to avoid
the previous indirection and have the kernel deal with OpenSubdiv
more directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/120825
2024-09-27 19:01:12 +02:00
Richard Antalik
580b4a1a2d Fix #127479: VSE produces blank scene offscreen renders
If conditions are not met for offscreen rendering, render job is used as
fallback. This can be skipped if there is possibility of race condition.
This was only considered for case where `context->for_render` was false,
since this indicates that call is invoked by the job itself.

If scene strip display is set to `OB_RENDER`, it needs to start the
render job. So variable `do_seq_gl` was renamed to `is_preview` and
reused in race avoidance connditon. This was done to convey clearer
meaning and match comments.

This change does make code less safe - race is avoided by UI not
allowing to run F12 render and opengl render at the same time. However,
I don't think, this could be easily resolved on VSE side without
suspending thread or being able to run multiple render jobs.

Pull Request: https://projects.blender.org/blender/blender/pulls/127926
2024-09-27 18:41:26 +02:00
Julian Eisel
0a2a8d612a Cleanup: Remove unused sculpt brush reset function
This isn't in use anymore since brush assets were merged, they have
their own resetting logic.
2024-09-27 18:36:23 +02:00
Pratik Borhade
7665e28b37 GPv3: Assert in weight paint with zero points
Memory allocated to vertex buffer but the total verts are zero. This
triggers assert in bind function when `vbo_size_` is zero. Exit out of
funtion early to prevent the assert.
Also wrap `DRW_shgroup_call_no_cull` with if check.

Pull Request: https://projects.blender.org/blender/blender/pulls/128248
2024-09-27 17:29:08 +02:00
Pablo Vazquez
d6ec2f0539 UI: Update icon for Grease Pencil layer and group
The current icon for Grease Pencil layers is a pen, it doesn't really
communicate the "layer" aspect. Replace with a paper sheet-like icon.

The layer group gets its own icon. It's a stack of animation paper.

Inspired by Daniel Correa Flores's design on DevTalk:
https://devtalk.blender.org/t/ui-discussion-grease-pencil-layer-and-layer-group-icons/30693/25

Pull Request: https://projects.blender.org/blender/blender/pulls/128208
2024-09-27 17:24:40 +02:00
Falk David
19465bec19 GPv3: Add canvas options to the overlay settings
This adds the color, subdivisions, scale, and offset options to the canvas overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/128259
2024-09-27 16:58:38 +02:00
Lorenzo-Carpaneto
29c6e6c5b2 GPv3: "Select Similar" operator
Implements the "Select Similar" operator for Grease Pencil v3.

Several modes are available. Each mode has a dedicated "distance" metric:
- layer, material: compared by index
- radius, opacity: simple value difference
- vertex color: euclidian float4 distance metric

The implementation uses a `Set` to find selected values first, then compare each point attribute value to each value in the set until a distance below the threshold is found. This could be optimized by using a KD-Tree in the future. Layer comparison is a special case because points are already separated into drawings by layer, so any drawing in a "selected" layer is becomes fully selected.

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/111410
2024-09-27 16:51:19 +02:00
Christoph Lendenfeld
85e4bd19f6 Anim: Separate Slots operator
This adds an operator that splits all slots of the action on the active object,
into separate actions.

The newly created actions will be named `slot_name+Action`.
All users of those slots will be reassigned to this new action.

The exploded action will not be deleted, but will end up with 0 users
unless a fake user is set.

------

For the review, does that operator name make sense?

Pull Request: https://projects.blender.org/blender/blender/pulls/128251
2024-09-27 16:39:29 +02:00
Julian Eisel
1cf81d733a Fix: Outdated default brush names after essentials library update
Fixes paint modes not having a default brush activated.

Brush names changed to not include the now unnecessary mode suffix in
9dfd0a171f.
2024-09-27 16:31:05 +02:00
Sybren A. Stüvel
b1d2a70dbd Anim: send notifier when deleting a node from a node tree/group
Send a WM notifier when deleting a node from a node tree/group. Removing
a node also removes its animation data, and thus animation editors need
to receive a notification to refresh.

Pull Request: https://projects.blender.org/blender/blender/pulls/128255
2024-09-27 16:24:06 +02:00
Sybren A. Stüvel
7aa99cd562 Anim: make BKE_animdata_fix_paths_remove() compatible with slotted Actions
`BKE_animdata_fix_paths_remove()` now calls into the new function
`animrig::legacy::action_fcurves_remove()`, which works for both
legacy and slotted Actions.

Also I updated the documentation of the BKE function so that it's clear
what it's actually doing.

No functional changes for legacy Actions.

Ref: #123424

Pull Request: https://projects.blender.org/blender/blender/pulls/128252
2024-09-27 16:23:31 +02:00
Sybren A. Stüvel
7acf871aa4 Refactor: Anim, simplify BKE_animdata_fix_paths_remove
Reduce cognitive complexity of `BKE_animdata_fix_paths_remove()` by
returning early, returning literals (instead of variables) when the
returned value is known, and just calling `BKE_animdata_from_id()` instead
of re-implementing it here.

No functional changes.
2024-09-27 16:23:30 +02:00
Campbell Barton
e21b424eee Attributes: support setting the active attribute to "None"
Support setting: `object.data.attributes.active = None` for
ID attributes. Use -1 to represent no active index.

Resolves #127691

Ref !128233
2024-09-27 23:47:13 +10:00
Sybren A. Stüvel
6ed98c912b Anim: Handle legit slot assignment failure in versioning code
With the Slotted Actions experimental feature enabled, Blender will use
versioning to automatically convert legacy Actions into slotted ones.

Assignment of the converted Action's slot can fail in the following
scenario, when dealing with the following dance between "old Blender"
(only supporting legacy Actions) and "new Blender" (versions supporting
slotted/layered Actions):

1. New Blender: create an action with two slots, ME and KE, and assign
   to respectively a Mesh and a Shape Key. Save the file.

2. Old Blender: load the file. This will load the legacy data, but still
   keep the assignments. This means that the Shape Key will get a ME
   Action assigned, which is incompatible. Save the file.

3. New Blender: upgrades the Action, and tries to assign its only slot.
   This will fail for the shape key, as the ID type doesn't match.

The failure is in itself okay, as there was actual data loss in this
scenario, and so issuing a warning is the right way to go about this.
The Action is still assigned, but the data-block won't get a slot
assigned.

Pull Request: https://projects.blender.org/blender/blender/pulls/128199
2024-09-27 15:43:03 +02:00
Sybren A. Stüvel
fff6e59dde Anim: when assigning Action, check its ID type and NLA tweak mode
When assigning an Action with the new API:

- check the Actions ID type (if it is a legacy Action), and
- check whether the ID is in NLA tweak mode.

This means that action assignment can fail, so the
`animrig::assign_action()` and `animrig::unassign_action()` functions
now return a `[[nodiscard]] bool`.

Part of `generic_assign_action()` has now also been shielded with an
`#ifdef WITH_ANIM_BAKLAVA` just to be sure.

This also includes a change in `BKE_animdata_free()`. That function now
first exits NLA tweak mode (if enabled) before freeing the Actions. This
makes it possible to simply un-assign the assigned Action, as all the
NLA tweakmode stuff has already been taken care of by the responsible
function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128199
2024-09-27 15:43:02 +02:00
Sybren A. Stüvel
f7effe8597 Anim: fix null pointer dereference when pushing down an Action
Pull Request: https://projects.blender.org/blender/blender/pulls/128199
2024-09-27 15:43:02 +02:00
Pablo Vazquez
fd59591fdc UI: Use proper icon for Grease Pencil selectors
Layer selectors in Line Art and all modifier's Influence panel was
using the Grease Pencil icon, instead of the Grease Pencil Layer icon.

At the moment they are similar so it's easy to miss. But soon there
will be a new icon for layers so better use the right one.

The Line Art modifier was using Grease Pencil icon for materials
selector.
2024-09-27 15:05:05 +02:00
Jeroen Bakker
481c8fd5a7 Vulkan: Memory leak in immediate mode during exit
When exiting the immediate buffers are discarded, but where not
destroyed making the buffers still leak.
Detected when looking into descriptor set freeze issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/128249
2024-09-27 15:01:10 +02:00
Hans Goudey
98f0926825 Geometry Nodes: Node tools soft selection and sculpt mask support
Implements the design from #120318. The existing selection nodes now have
the ability to deal with float/soft selection. For meshes the soft selection
corresponds to the inverse of the sculpt mask attribute. In the future this
will likely be unified with edit mode selection a bit more which is why
this design was chosen compared to separating masking and selection.
Curves and point clouds already use a single selection attribute with
either data type.

Pull Request: https://projects.blender.org/blender/blender/pulls/126316
2024-09-27 14:39:01 +02:00
Christoph Lendenfeld
95b6cf0099 Anim: operator to move Slots to new action
This adds an operator that moves slots of slot channels selected in
the channel box to a new action.

All slots are moved together into that new action instead of
moving them into separate actions.
I think that's more reasonable because that way the "move slots into separate actions" is
still possible by selecting the slots one by one.
The "explode action" operator that does just that can be a separate operator.

The new action is named after the slot for the case when only one slot is moved.
When multiple slots are moved, the name "CombinedAction" is used.

This also adds a menu entry "Action" to the action editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/128171
2024-09-27 14:34:24 +02:00
Pratik Borhade
59aaf322ba GPv3: Select operations in sculpt mode
Select panel is missing when any selection mask is selected.
Also fix the poll function so operators can be accessed.

Pull Request: https://projects.blender.org/blender/blender/pulls/128177
2024-09-27 13:23:02 +02:00
Falk David
53b9594ee2 Geometry Nodes: Add "Merge Layers" node
This patch improves working with grease pencil layers in geometry nodes.
* Allow layers to have duplicate names in geometry nodes. In original data, unique names are enforced.
  * This allows e.g. duplicating layers and then merging them by name in the end.
  * It also resolves a big serial bottleneck when working with many grease pencil layers in geometry nodes. Enforcing unique names is inefficient.
* New `Merge Layers` node that can merge multiple layers by name or by a custom group id.
* Applying a grease pencil modifier now first merges all layers with the same name to ensure all names are unique.

Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/127873
2024-09-27 13:17:18 +02:00
Brady Johnston
e25405aeb7 Geometry Nodes: improve input labels on Integer Math node
This brings the labels for the Power operation on the integer math node
to align with the regular math node.

Pull Request: https://projects.blender.org/blender/blender/pulls/128222
2024-09-27 11:56:05 +02:00
casey bianco-davis
87bef46096 Fix: Crash when there is no active layer/group.
This fixes a crash in the move operator that would occur when
no layer or group was active.

Pull Request: https://projects.blender.org/blender/blender/pulls/128219
2024-09-27 10:21:23 +02:00
Jeroen Bakker
5250e57294 Fix #127288: Vulkan: Report Marketed Driver Version
A driver (package) installed by the user can have many different drivers
and they can all report a different version. For AMD the version we
reported was from their Vulkan driver. This version isn't useful during
bug triaging.

This PR will use the driver info and driver name from the driver
properties to construct a driver version string that will be used for
reporting.

Pull Request: https://projects.blender.org/blender/blender/pulls/128232
2024-09-27 09:24:15 +02:00
Campbell Barton
38a888c794 Cleanup: correct FOREACH_OBJECT_FLAG_BEGIN flag argument
The macro couldn't take a flag argument unless it was called "flag".
2024-09-27 12:41:07 +10:00
Sean Kim
0f1bdd551c Fix: Sculpt: Debug assert when undoing deformation
This commit ensures that we pass in correctly-sized spans when restoring
position data.

Pull Request: https://projects.blender.org/blender/blender/pulls/128217
2024-09-27 04:35:15 +02:00
Hans Goudey
f241c15042 Cleanup: Sculpt: Simplify threaded node iteration
347ec1acd7 switched to iterating over nodes with index
masks but introduced nested lambdas with the inner one slicing
the index mask with a range provided by `parallel_for`. That was
done to avoid calling `.local()` more than necessary but in practice
that doesn't have an effect, especially with a grain size of 1.

That nested iteration is cumbersome and error-prone. For the
simple parallel loops with thread local data, switch to just using the
`GrainSize` argument to `mask.foreach_index` instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/128221
2024-09-27 04:31:39 +02:00
Hans Goudey
d832bf3ae4 Fix #122096: Crash after editing multi-user mesh with two scenes
In this case there are two dependency graphs, each with a separate
object containing the original mesh. Leaving edit mode modifies the
original mesh by deleting the edit mesh data. The active dependency
graph's object was tagged for that change, but the other dependency
graph didn't know about the change because its object wasn't tagged.
The solution is to tag the original mesh which will cause any
dependency graph using it to properly reevaluate.

Pull Request: https://projects.blender.org/blender/blender/pulls/128192
2024-09-27 04:29:53 +02:00
Campbell Barton
7409db3e89 Fix crash applying object transform for multi-user objects
Regression in [0], note that these struct members may be null.

Also correct macro to support scene argument not called "scene".

[0]: 3a555b60f7
2024-09-27 12:28:29 +10:00
Campbell Barton
33b80415aa Cleanup: use const, correct arg names, spelling, use ELEMN(..) 2024-09-27 11:01:37 +10:00
Campbell Barton
634e44de9f Cleanup: remove redundant null check 2024-09-27 10:51:28 +10:00
Harley Acheson
b2eb8cc0df UI: Edge Highlighting While Resizing Editors
Highlighting of the active edges of editors while resizing.

Pull Request: https://projects.blender.org/blender/blender/pulls/120998
2024-09-27 00:56:52 +02:00
Sean Kim
726fd7365d Fix #126808: Crash when remeshing an object with a mirror modifier
This commit forcibly rebuilds the PBVH whenever the number of verts is
changed by an operation, additionally, the related deform variables are
freed when undoing geometry steps now to ensure data remains consistent.

Pull Request: https://projects.blender.org/blender/blender/pulls/128145
2024-09-26 23:29:39 +02:00
Harley Acheson
28e5c1412e UI: Editor Edge Highlighting
Customizable highlighting of editor edges that can be used to help
differentiate between areas, indicate active area, and/or help users
with visual impairment. Can be completely removed as well. This
replaces the active area header highlighting, which doesn't work for
transparent headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/116684
2024-09-26 21:55:26 +02:00
Hans Goudey
6d9641daee Sculpt: Followup change/fix to clay strips brush
A combination of a few changes:
- Don't apply hardness again, the "cube tip" calculation already factors it in.
- Avoid multiplication by brush radius, just use the 0-1 distances from the
  cube tip calculation directly.
- Add filtering by brush radius to fix the second part of #128004.
- Change brush radius filtering to be consistent with previous code using
  less than or equal instead of less than.

Note that the current radius filtering in BKE_brush_calc_curve_factors is
unnecessary since we already filter by the radius in a separate step.
2024-09-26 15:04:05 -04:00
Jacques Lucke
74f266c119 Fix #127855: crash when changing interface socket type with custom sockets
There were multiple issues that popped up when following the reproduction steps
in the report:
* Somehow, `socket.socket_data` was set for a custom socket type. I don't know
  how that happened yet. I added some code to clean it up on file-load.
* `declaration_for_interface_socket` did not work yet when the socket type is
  not registered. Now it just creates a custom socket with the correct idname,
  even if that's not registered yet.
* There was a missing node tree update when changing `bl_socket_idname` of
  interface sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/128191
2024-09-26 20:41:06 +02:00