Commit Graph

42665 Commits

Author SHA1 Message Date
Jacques Lucke
052d011c5e Fix: group input node socket with gizmo does not show label 2024-07-12 13:09:57 +02:00
Christoph Lendenfeld
1a8053939b Fix #106372: Wrong message in driver for disabled execution
When using a python expression, its execution is disabled by
default unless specified differently in the user preferences.
Previously this only produced the error
"Error: Invalid Python expression". However that isn't really the correct error.

Now the error reads "Python restricted for security".

I've added a new flag to the driver `DRIVER_FLAG_PYTHON_BLOCKED` that is set
if the driver can't run because python is blocked

Co-authored by Phillip Oeser

Pull Request: https://projects.blender.org/blender/blender/pulls/124587
2024-07-12 12:37:15 +02:00
Christoph Lendenfeld
780dc67f6d Fix #124125: Depsgraph and scene time out of sync
When quickly running the "frame step" and "insert key" operators it was possible to
run the key insertion when the depsgraph hasn't yet been updated.
Because the key insertion code took the frame from the scene, but the channel values
from the depsgraph, the inserted keys were appearing to be duplicated from a different frame.

The fix is to ensure an evaluated depsgraph is used, so the correct values are placed
at the correct time.

Pull Request: https://projects.blender.org/blender/blender/pulls/124583
2024-07-12 12:09:12 +02:00
Sybren A. Stüvel
d828e9471e Anim: add concept of 'active slot'
Add the concept of 'active slot' within an Action. This allows
clicking on a slot in the Action editor, to select it and mark it as
'active'.

Note that this does _not_ add support for action slots in
`ANIM_set_active_channel()`, as that function doesn't get enough info
to do that, and refactoring it is not on my wishlist.

RNA property `action.slots.active` can be used to access and set the
active slot in Python. `slot.active` can be used to query the slot's
active state, and is read-only (so that there is one way to set the
active slot).

A panel in the Action editor shows info about the active slot. This
panel is just a minimal UI that shows the name and an icon
representing the idtype of the active slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/124422
2024-07-12 11:59:04 +02:00
Lukas Tönne
d0089e6fe1 GPv3: Automerge feature for joining curve endpoints by distance
This implements the _automerge_ feature which finds nearby end points
during stroke draw and merges the new curve with existing strokes.

New utility functions are added in `geometry` for slightly generalized
functionality. The `curves_merge_endpoints` takes an index map that
describes how to connect curves by index. It performs a topological sort
and reorders connected curves into contiguous ranges. This can be used
with an arbitrary number of connected curves. The tool feature itself
only uses a single curve, based on 2D end point positions.

Unit tests have been added for the curve merge utility function.

Pull Request: https://projects.blender.org/blender/blender/pulls/124459
2024-07-12 11:21:23 +02:00
Julian Eisel
fdf10495d0 Cleanup: Fix missing declaration warning
Own error in 99fe6785d0.
2024-07-12 11:18:34 +02:00
Lukas Tönne
3d4b8f91e7 GPv3: Fill tool overlay for extension lines and circles
The (GPv2) fill tool has an "extension" mode to assist with filling
small gaps where strokes don't fully meet.

- Overlay: Draws various helpers during modal fill tool operation, using
  the same functions as the render-to-image used for applying the fill
  tool.
- Extension lines: Scrolling or page up/down extends the tips of strokes
  and draws extra boundary lines to limit filling.
- Extension circles: Press S to toggle the mode. This draws circles
  around stroke tips.
- Stroke overlay: This can be enabled in the brush settings
  (_Advanced > Visual Aids_) to draw strokes in a simple color on top of
  the viewport.
- Extension line collision: Tests for intersections of extension lines
  with other lines and with strokes, and cuts them short. Enable in
  brush settings (_Advanced > Strokes Collision_).
- Better defaults for extension increments: The values are in Blender
  units, and quite arbitrary. Using lower values makes it feel more like
  GPv2 in the 2D animation template.
- Draw functions in the `ed::greasepencil::image_render` namespace now
  consistently expect coordinates in view space (avoids confusion and
  works better for 2D elements).
- Some internal renaming and cleanup (many variable names come from GPv2
  and were not very clear).

Pull Request: https://projects.blender.org/blender/blender/pulls/122771
2024-07-12 11:11:17 +02:00
Nathan Vegdahl
cb38406a94 Fix: Follow Curve constraint/parenting doesn't animate with layered actions
Both the Follow Curve constraint and parenting with the follow curve option
require a property on the Curve ID to be animated if the user wants the
follower object to animate along the curve. However, the fcurve for this
was always getting created as a legacy action fcurve, regardless of whether
the action was actually legacy or not. If the action was layered, this
resulted in the follower object not animating along the path.

The underlying issue was that the code that created the fcurve was using
`action_fcurve_ensure()`, which hadn't yet been updated to work correctly with
layered actions, and thus the fcurve was created as if the action was legacy.

This commit fixes that by updating `action_fcurve_ensure()` to work with
Baklava phase-1 layered actions in limited circumstances, and also
ensuring that the follow curve code passes an appropriate ID RNA pointer
(required to find/create an appropriate Slot).

Pull Request: https://projects.blender.org/blender/blender/pulls/124353
2024-07-12 10:47:32 +02:00
Julian Eisel
99fe6785d0 Fix issues with asset shelf context menu operators
Shortcut and quick favorite operators wouldn't show up in the regular asset
shelf. In the popup the shortcut operators would but they crashed with use
after frees.

Basic issue is that activating view-items by applying the button didn't work
well. That messes with button storage, but also the operator data (like
`uiBut.optype`) is unset after applying, in this case before the context menu
was built.

Instead, activate the view-item directly, and call the activate operator in its
`on_activate()` callback. The button shouldn't call this operator again, so
added a way to attach operators to buttons without calling them.

Seems generally useful to be able to attach an operator to buttons for
tooltips, "Assign Shortcut" and the like, without it being called on button
apply.

Pull Request: https://projects.blender.org/blender/blender/pulls/124466
2024-07-12 10:02:10 +02:00
Richard Antalik
6282f62449 VSE: Pass scrubbing and playing state in SeqRenderData
This change simplifies access to this state by prefetching code.
Previously it had to iterate over screens from `bMain` in code local to
prefetching. Now this state is available to other code in VSE.
2024-07-12 07:45:17 +02:00
Sean Kim
70d6926ab9 Cleanup: Restructure and rename relax_face_sets.cc
In preparation for the topology relax brush which shares much of this
code, this commit renames the file and distinguishes between methods
that will and will not be shared between the topology relax and face set
relax brushes.

Pull Request: https://projects.blender.org/blender/blender/pulls/124563
2024-07-12 05:24:13 +02:00
Richard Antalik
d97c4e6606 Merge branch 'blender-v4.2-release' 2024-07-12 04:06:29 +02:00
Richard Antalik
5d9f9f9964 Fix: VSE handle position drawing is reversed
When left handle is selected, right handle position was displayed.

Pull Request: https://projects.blender.org/blender/blender/pulls/124503
2024-07-12 03:59:19 +02:00
Harley Acheson
82ca220ad4 Cleanup: Const Arguments for ScrArea name_get Functions
Const arguments for ED_area_name, and space_name_get callbacks.

Pull Request: https://projects.blender.org/blender/blender/pulls/124560
2024-07-12 01:13:44 +02:00
Harley Acheson
a82954cb63 UI: Improved Area Icon Using a SpaceType Callback
Centralized method to obtain ScrArea icons. Areas can add an optional
space_icon_get callback to provide an icon that differs by subtype. If
not defined then ED_area_icon will return RNA UI icon, which is correct
in cases without area subtypes.

Pull Request: https://projects.blender.org/blender/blender/pulls/124556
2024-07-12 00:08:19 +02:00
Sean Kim
66c1341ef9 Cleanup: make format 2024-07-11 11:58:54 -07:00
Pratik Borhade
7ee2938bc1 Fix #124468: UI is not refreshed after copying modifier using Outliner
Add notifier when copying a modifier to a different object so that
Properties and Outliner can update and redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/124510
2024-07-11 20:55:21 +02:00
Sean Kim
4f73bf2871 Sculpt: Initial data oriented refactor of relax face set brush
Part of #118145.

For each of the PBVH types, the refactored Relax Face Set brush
performs the following steps:
* Calculate all relevant element factors like other refactored brushes
* Calculate the displacement by performing the following steps, using a
  displacement of 0 if certain conditions are unfulfilled (e.g. factor
  will have no effect, no relevant neighbor vertices, etc)
  * Find all neighbors for each element
  * Filter the neighbors based on if the current vert is or is not a
    boundary vert, looking at the face sets of each neighbor
  * From the relevant neighbors, calculate a smoothed average position.
  * For boundary verts, calculate the normal based on the summed
    direction towards each neighbor vertex
  * For non-boundary verts, retrieve the current vertex normal.
  * Use the current position and the retrieved normal to create a
    plane.
  * Find the closest point on the plane to the smoothed position, use
    this as the final displacement
* Apply all of these displacements to the relevant elements

Q: Why do we perform three different parallel loops for each method
instead of a single one like other brushes?

Because much of the processing time for these functions is spent in the
neighbor calculation, we opt to process factors in an earlier loop to
short-circuit neighbor calculation if we know it cannot possibly have
an effect (i.e `factor[i] == 0.0f`)

Q: Why are lambdas used in `filtered_neighbors` ?
Simply put, reducing the overall amount of code duplication,
otherwise this function would require 6 different methods to do the
necessary filtering (boundary vs non boundary vertices for each of the
three pbvh types)

### Potential Areas of Improvement
* Unique face set calculation requires iterating over the
  `vert_to_face` map and happens multiple times per brush stroke (each
  stroke performs the vertex tasks 4 times in succession). Some form of
  cache or precomputed map similar to the `boundary_verts` `BitSpan`
  may improve performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/124135
2024-07-11 20:55:03 +02:00
Harley Acheson
1f3d1048d4 Fix #124070: Improved Area Names Using a SpaceType Callback
Centralized method to obtain ScrArea names. Areas can add an optional
space_name_get callback to provide a name that differs by subtype. If
not defined then ED_area_name will return RNA UI name, which is correct
in cases without area subtypes. This eliminates the current use of
RNA_property_enum_name_gettexted using a temporary context, which
results in the reported (hard to duplicate) error.

Pull Request: https://projects.blender.org/blender/blender/pulls/124488
2024-07-11 20:40:06 +02:00
Sean Kim
c3243f363d UI: Voxel Size Edit status display
Updates the `OBJECT_OT_voxel_size_edit` operator to use the new
workspace status display.

Pull Request: https://projects.blender.org/blender/blender/pulls/124492
2024-07-11 20:22:48 +02:00
Sean Kim
f966bb9ed4 UI: Dyntopo Detail Size Edit status text
Updates the `SCULPT_OT_dyntopo_detail_size_edit` operator to use the
new workspace status display.

Pull Request: https://projects.blender.org/blender/blender/pulls/124495
2024-07-11 20:22:16 +02:00
Hans Goudey
9a343ccc9f Cleanup: Sculpt: Use C++ Array and destructor for StrokeCache 2024-07-11 14:18:32 -04:00
Hans Goudey
143fcd3022 Cleanup: Sculpt: Use std::unique_ptr for cloth sim data 2024-07-11 14:18:32 -04:00
Hans Goudey
06dea7c1b2 Cleanup: Sculpt: Use C++ Array/Vector in cloth sim state 2024-07-11 14:18:32 -04:00
Sean Kim
10b871a211 Fix: Dyntopo sample detail doesn't update status text
Pull Request: https://projects.blender.org/blender/blender/pulls/124494
2024-07-11 20:12:19 +02:00
Sean Kim
daee90c7cc Sculpt: Add report for invalid mode for trim tools
Pull Request: https://projects.blender.org/blender/blender/pulls/124498
2024-07-11 20:11:15 +02:00
John Kiril Swenson
901f5495cb VSE: Fix strip icon drawing
VSE icon drawing is larger than previous after #123700, and has an
incorrect check if there is enough space to show them. This PR restores
uses of MISSING_ICON_SIZE and fixes the minimum size check.

Pull Request: https://projects.blender.org/blender/blender/pulls/124378
2024-07-11 19:18:13 +02:00
Julian Eisel
942cefdf91 Fix: Applying poses in asset shelf broken after own earlier fix
This mostly reverts d6e9438e60 and applies a different fix. Consuming
events here would break firing operators on these events, which is what
the pose library does. Added a comment to note this, because this is not
the first time that I want to change this return value to consume
events.
2024-07-11 19:16:57 +02:00
Jesse Yurkovich
6ace3eb065 Merge branch 'blender-v4.2-release' 2024-07-11 08:44:58 -07:00
Jesse Yurkovich
a362c225c0 Fix #124479: Collection Export: Clear last-used operator properties
Collection Export and File->Export were inadvertently sharing the
"last used" operator properties.

This would cause settings that were used during File->Export to
interfere, silently, when exporting the collections. Or vice versa.

Pull Request: https://projects.blender.org/blender/blender/pulls/124481
2024-07-11 17:42:49 +02:00
Sybren A. Stüvel
6e683e26cc Anim: Add dopesheet & graph editor filtering support for layered Actions
Add name-based filtering and graph editor visibility filter to layered
Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/124528
2024-07-11 16:39:00 +02:00
Julian Eisel
d6e9438e60 Fix #124448, #115549: View Drag drop not working
Issue was that the left mouse press event was handled to activate the
dragging state, but not "consumed". So general view item handling would
attempt to force-activate it again, exiting the dragging state
immediately again.

Consume the event now, plus handle properly any similar unexpected cases
(with failing assert), where modal state would be exited because of an
unconsumed event.

Alternative solution to #124529, thanks to Pratik Borhade for finding
the root of the issue.
2024-07-11 16:15:43 +02:00
Hans Goudey
f997d35033 Cleanup: Fix typo in comment 2024-07-11 09:06:44 -04:00
Jacques Lucke
5a4d7611f4 Merge branch 'blender-v4.2-release' 2024-07-11 15:03:07 +02:00
Jacques Lucke
1d4ef04a6d Fix #124463: crash when trying link a node to itself with swapping
The swapping code incorrectly expected the link to have a start and end.
However, this was not necessarily the case when attempting to create
a link from a node to itself. This case has special handling in
`node_link_find_socket`.
2024-07-11 15:00:02 +02:00
Julian Eisel
94d4864fa8 Fix: Asset shelf quick tooltips not showing
Since 4a9e8087a7, preview-tile buttons are non-interactive by default,
so tooltip handling is not triggered. Instead, attach the tooltip to the
underlying view-item button.
2024-07-11 11:58:02 +02:00
Christoph Lendenfeld
907c49da08 Anim: Operator to convert a legacy action to a layered action
This commit creates an operator to convert a `legacy Action` into a `layered Action`.
No data is destroyed, the operator creates a new datablock.
The conversion to the `layered Action` is lossless.

Pull Request: https://projects.blender.org/blender/blender/pulls/122043
2024-07-11 11:57:26 +02:00
Richard Antalik
af1a6d048d VSE: Simplify outline parameters definition and usage
Function `strip_data_outline_params_set()` was simplified, so setting
color and outline parameters are not mixed and overwriting as code flows
and so the function is better readable.

Shader code is changed, so that when strip overlaps other strip, it gets
2 px red outline regardless of whether it is active or selected. This
makes it more consistent when strip is not active or selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/124442
2024-07-11 07:38:02 +02:00
Richard Antalik
d0cf4a4a8b Fix: Retiming keys do not respect strip drawing order
Retiming was drawn for all strips in one draw call. During strip
transformation, if strips overlap, one strip should cover the other.
But all keys were drawn on top.

Retiming drawing API was changed to draw 1 strip, so overlapped strips
can be drawn first, followed by overlapping strips.
Since retiming drawing is also layered, single draw call was split into
drawing continuity line, keys and speed text.
2024-07-11 06:08:21 +02:00
Hans Goudey
b8a1e41dc2 Cleanup: Sculpt: Use utility function to restore positions from undo step 2024-07-10 22:28:25 -04:00
Harley Acheson
cfe77fbafd UI: Use Official Blender Logo As Blender Icon
Our icon sources currently include two versions of the Blender logo,
the official one and one that is modified to align better to our
smallest pixel grid. But with our recent change to SVG icons, and
alignment tweaks to the official version this can be used in all
cases. This PR does so, removes BLENDER_LARGE, and also slightly
tweaks FILE_BACKUP and FILE_BLEND to use the official form.

Pull Request: https://projects.blender.org/blender/blender/pulls/124179
2024-07-11 01:15:07 +02:00
Jesse Yurkovich
e4bf3015a1 Fix #124470: MEM_new/MEM_freeN mismatch for uiEditSourceStore
Pull Request: https://projects.blender.org/blender/blender/pulls/124487
2024-07-11 00:03:51 +02:00
Jesse Yurkovich
57544887d0 CMake: Add WITH_TBB definition to prevent ODR violation for BLI_spin API
The BLI_spin APIs use a `SpinLock` typedef whose underlying type is
contingent on the precense of `WITH_TBB`. Since our projects did not
consistently define the `WITH_TBB` definition, multiple `SpinLock` types
would end up in our final binary creating ODR violations.

Pull Request: https://projects.blender.org/blender/blender/pulls/124285
2024-07-10 23:02:17 +02:00
Jesse Yurkovich
05241f47f5 CMake: Add WITH_TBB definition for the projects that require it
The `WITH_TBB` define needs to be set in order for code using the
various parallel threading helpers [1][2] to actually be multi-threaded.

The affected projects did not have `WITH_TBB` defined and were using the
single-thread variant of all affected APIs.

Additionally, in the case of `EnumerableThreadSpecific`, this results in
an ODR violation where there are 2 versions of the same class linked
into our final binary. One with TBB members and one without.

--------
[1] Namely code using the `BLI_task.hh`, `BLI_sort.hh`, and `BLI_enumerable_thread_specific.hh` headers
[2] `EnumerableThreadSpecific`, `parallel_for_each`, `parallel_reduce`, `parallel_invoke`, `isolate_task`, `parallel_sort`

Pull Request: https://projects.blender.org/blender/blender/pulls/124283
2024-07-10 23:01:38 +02:00
Sean Kim
0ee46f1208 Refactor: Sculpt: Expose per-pbvh type unique face set methods
Part of #118145

Pull Request: https://projects.blender.org/blender/blender/pulls/124478
2024-07-10 20:36:43 +02:00
Richard Antalik
41430ed4bd Cleanup: Split strip foreground drawing function
Pull Request: https://projects.blender.org/blender/blender/pulls/124441
2024-07-10 20:13:40 +02:00
Sean Kim
7a6a2519c5 Refactor: SubdivCCG: Extract utility method for boundary calculation
Pull Request: https://projects.blender.org/blender/blender/pulls/124476
2024-07-10 19:48:00 +02:00
Hans Goudey
7fea77992c Fix: Sculpt: Restore transform symmetry clipping lost in refactor
Restore fix 5a8003091c which was lost in e9318360f1.
2024-07-10 13:07:16 -04:00
Hans Goudey
39c334582b Sculpt: Data oriented refactor for nearest vertex search
Part of #118145.
2024-07-10 12:30:00 -04:00
Hans Goudey
e9318360f1 Sculpt: Data oriented refactor for transform tool
Part of #118145.
2024-07-10 12:30:00 -04:00