Commit Graph

4972 Commits

Author SHA1 Message Date
Campbell Barton
11e41f7276 Merge branch 'blender-v4.3-release' 2024-10-15 16:22:09 +11:00
Campbell Barton
44d0452a78 Cleanup: spelling in comments 2024-10-15 12:51:05 +11:00
Richard Antalik
3b8d0abbbe Merge branch 'blender-v4.3-release' 2024-10-14 00:51:33 +02:00
John Kiril Swenson
72be365c6b Fix #126191: Both handle seqslide modal cancel
The issue was that if the seqslide was cancelled such that the
`new_frame` of the left handle was greater than its previous
right_handle (before the cancel), `SEQ_time_left_handle_frame_set()`
would clamp this value and so the left handle would not properly restore
itself.

Fix by updating both handles at once (right handle first) if both
handles are selected and the cancel jump travels in the right direction.

This also seems to fix the situation where strips w/ both handles
selected would be erroneously detected as overlapping when moving them
rapidly side to side.

Pull Request: https://projects.blender.org/blender/blender/pulls/128740
2024-10-14 00:49:01 +02:00
Sean Kim
6ff33b7e92 Merge branch 'blender-v4.3-release' 2024-10-11 15:25:07 -07:00
Julian Eisel
d177388979 Sculpt/Paint: Tag brushes for unsaved changes for UI indication
Part of the brush assets project followups, see #116337.

Based on feedback, it seems important to indicate to the user when a brush has
unsaved changes.

There's no reliable updating mechanism we can use or hook into here, except for
RNA "update" callbacks. Brush data gets changed in many places in code, the only
way to do this seems manual tagging every time a brush property gets changed.
This PR introduces `BKE_brush_tag_unsaved_changes()` for this. I spent some time
going through all brush properties to ensure changes call the tagging function.

A known limitation with this will be that changes to dependencies won't be
indicated in the brush. E.g. Changing the texture attached to a brush won't make
the brush be indicated as changed.

The UI to indicate the changed brushes is being discussed still, see #128846.

Pull Request: https://projects.blender.org/blender/blender/pulls/128845
2024-10-11 22:08:14 +02:00
Campbell Barton
085d959d87 Merge branch 'blender-v4.3-release' 2024-10-10 12:19:54 +11:00
Campbell Barton
de0cfcba67 Merge branch 'blender-v4.3-release' 2024-10-10 12:19:47 +11:00
Campbell Barton
a762f2b664 Merge branch 'blender-v4.3-release' 2024-10-10 12:19:45 +11:00
Campbell Barton
f666902d17 Fix error in snap-grid check
Correct check from 75ffda39b2.
2024-10-10 12:17:40 +11:00
Germano Cavalcante
75ffda39b2 Fix #126665: Reintroduce 'Absolute Grid Snap' (now 'Absolute Increment Snap')
The 'Absolute Grid Snap' feature remains useful even alongside
'Snap to Grid', so this option is being reintroduced, partially
reverting commit f0479e915f.

Pull Request: https://projects.blender.org/blender/blender/pulls/128135
2024-10-09 22:52:28 +02:00
notrudyyy
9da1b8a74b Fix #128473: New node insertion on link search connects to main socket
Fixes an issue with the new node insertion feature where, after a link drag search,
the main input of the new node is connected to, regardless of which one was chosen.

Pull Request: https://projects.blender.org/blender/blender/pulls/128640
2024-10-09 22:18:13 +02:00
Germano Cavalcante
1e161414e0 Merge branch 'blender-v4.3-release' 2024-10-08 23:32:29 -03:00
Germano Cavalcante
0ac66493c0 Fix: Error in previous commit: Snap to grid not updating size while navigating
`t->snap` varies per operator and does not update.
2024-10-08 23:29:57 -03:00
Germano Cavalcante
ae5e72432b Merge branch 'blender-v4.3-release' 2024-10-08 22:18:52 -03:00
Germano Cavalcante
56c98046a5 Fix #122635: Precision mode not working with Snap to Grid
This introduces partial functionality of Precision mode to 'Snap to
Grid'.

However, it behaves differently from 'Absolute Grid Snap', as it lacks
smooth mouse movement.

Precision mode is now available specifically for Transform operations.
2024-10-08 22:17:36 -03:00
Germano Cavalcante
7c539312b7 Merge branch 'blender-v4.3-release' 2024-10-08 19:21:50 -03:00
Germano Cavalcante
ae37656478 Fix #128764: Moving keys in the animation editors enables the 3D view's snap toggle
The issue occurred because the code block that read the snap flag was
out of sync with the code block that saved the flag.

The solution was to centralize snap flag handling in the
`transform_snap_flag_from_spacetype_ptr()` function. This function
retrieves the appropriate snap flag and property based on the editor
type, eliminating the need for repetitive conditional checks and
ensuring that the correct snap flag is set for each editor.
2024-10-08 19:17:51 -03:00
Germano Cavalcante
52136d3afa Merge branch 'blender-v4.3-release' 2024-10-07 14:34:22 -03:00
Germano Cavalcante
49ab0bb844 Fix: Edge Slide: Vertex destination not matching edges intersection
Before version 4.1, the vertex destination during edge sliding for two
independent edges was always the midpoint of the vertices closest to
those edges.

In version 4.1, this behavior was improved to calculate the destination
based on the intersection of the edges. However, when the faces were
coplanar, the behavior would revert to the previous midpoint
calculation instead of using the intersection.

This fix ensures that the vertex destination consistently aligns with
the intersection point, even when the faces are coplanar.
2024-10-07 14:32:33 -03:00
Germano Cavalcante
580e0af309 Fix #128702: Edge Slide can cause Blender to freeze
In non-manifold geometry, the original loop could fail to identify the
correct slide direction because it checked for loop equality
(`l_other != l_edge`), which might never be met.

The condition has been revised to check for face equality
(`l_other->f != l_edge->f`), ensuring the loop terminates correctly and
preventing infinite iterations in problematic geometry cases.
2024-10-07 14:04:52 -03:00
Lukas Tönne
d7e3f55eea Merge branch 'blender-v4.3-release' 2024-10-07 18:22:17 +02:00
Lukas Tönne
a57206dd59 GPv3: Remove unused legacy editor functions for GPv2
Removes all unused functions in ED_gpencil_legacy.hh

Pull Request: https://projects.blender.org/blender/blender/pulls/128597
2024-10-07 18:21:28 +02:00
Germano Cavalcante
6d5d3ce975 Transform: Simplify and specialize the handling of events
The `transformEvent` function is becoming increasingly complex due to
the inclusion of operation-specific code.

To improve this, remove the `handled` boolean and allow each
`TransModeInfo::handle_event_fn` to determine how to handle already
processed events.

Additionally, move some operation-specific logic to the operators file.

Note:
The `handled` boolean was added in aef307cf31 to fix a bug with the
custom events of the Edge and Vertex Slide operators;
2024-10-05 22:11:07 +02:00
Germano Cavalcante
e82ce39e17 Fix: Snap Toggle not updating snap status after a transform operation
Unlike Snap Invert, Snap Toggle (Shift + Tab) saves the snap status in
ToolSettings.

This is a regression from v3.6
2024-10-05 14:20:29 -03:00
Germano Cavalcante
5eae28e685 Fix: Snap Toggle not updating snap status after a transform operation
Unlike Snap Invert, Snap Toggle (Shift + Tab) saves the snap status in
ToolSettings.

This is a regression from v3.6
2024-10-05 14:18:50 -03:00
Sybren A. Stüvel
61bda71083 Anim: Support slotted Actions in 'Push Down' NLA operator
Instead of calling `BKE_nlastrip_new()` (which, due to backward compat
reasons automatically picks a slot), the Push Down operator now calls
`BKE_nlastrip_new_for_slot()`, which explicitly assigns the given slot.

On top of that, the frame range of the slot is used to set the strip's
frame range (instead of the range of the entire Action).

Pull Request: https://projects.blender.org/blender/blender/pulls/128444
2024-10-04 16:20:43 +02:00
Lukas Tönne
3d6a142162 GPv3: Remove unused GPv2 operators
Removes many of the operators, panels, and menus used exclusively by Grease Pencil v2 that are no longer needed in v3.
No functional changes are expected.

Some operators are still used by the annotations system and have to be kept around. These may be renamed in future.

Pull Request: https://projects.blender.org/blender/blender/pulls/128521
2024-10-04 13:05:09 +02:00
Germano Cavalcante
ab3e470b35 Fix: Occlusion of Curves failing during snapping
The geometry of objects behind Curves was being considered for snapping
even when occluded.

The occlusion test logic has been reworked and simplified when the snap
target is a Curve.

As a result, Snap to Face now works correctly for the active Curve.
2024-10-01 15:17:02 -03:00
Germano Cavalcante
304b3e026a Fix: Snap grid point of Rotate operator is closest to the constraint axis
The snap-to-grid constraint in the rotation operation should not be
limited to the grid closest to the constraint axis, as this restricts
rotational freedom.
2024-10-01 15:17:01 -03:00
Jacques Lucke
83fa565ec2 Nodes: improve inserting nodes with link-drag-search
This makes link-drag-search more convenient when one wants to insert a new node
between existing nodes. The change currently also affects normal node-insertion
when dragging it. The exact behavior still has to be figured out.

Pull Request: https://projects.blender.org/blender/blender/pulls/128197
2024-09-30 11:14:43 +02: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
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
Campbell Barton
473bd60164 Cleanup: clarify arguments using const or r_ prefixed return args 2024-09-26 15:03:24 +10:00
Germano Cavalcante
b0d37b4267 Fix #128074: Edit Mesh being occluded for snapping even in Xray
Caused by 1c77779160

That commit removed the part that created the skip_occlusion_plane
variable for edit meshes. Therefore, restore that part of the code.
2024-09-25 22:42:24 -03:00
Germano Cavalcante
504c1506b2 Fix: Snap to Grid with constraint limited to floor level
Caused by 1180a25c23

The `use_init_co` member can vary after a transformation.
It indicates whether to use the ground level or the 3D grid.
2024-09-25 16:06:21 -03:00
Philipp Oeser
e71c844354 Fix #127944: Normal rotates in wrong direction
Not verified by actually building, but pretty sure this was caused by
8bff3ec76b.

Since above commit, the Z axis of the View orientation was not negated
by default anymore.
This was then being accounted for in `applyRotation` (but not
`applyNormalRotation`).

So to resolve, do the same in `applyNormalRotation` as in
`applyRotation` (so negate there).

Pull Request: https://projects.blender.org/blender/blender/pulls/128115
2024-09-25 13:22:06 +02:00
Christoph Lendenfeld
6ea0b8cdb2 Fix #127758: Resorting keys in the Graph Editor with multiple actions failed
When having two objects selected that use the same action,
the Graph Editor would effectively show the same FCurve on 2 channels.
When building the `TransData` array the code would iterate
all channels though not checking for duplicate FCurves.
As a result when transforming keys, the `TransData`
array would contain the same entry twice.

That would break the logic introduced in c6c7d3d8c4 which
builds a Map of the `float *` that needs
updating and the index of that data in the array.
Only the first index of the `TransData` array would be updated since the
Map can only contain a certain value once.

The fix is to ensure that entries in the `TransData` array are unique.
This is done in the construction of the array.

Pull Request: https://projects.blender.org/blender/blender/pulls/127911
2024-09-24 11:34:41 +02:00
Campbell Barton
5b5576993e Transform: skip hidden edges when checking an vertices edge is visible 2024-09-24 15:36:06 +10:00
Campbell Barton
ed2d131887 Transform: use deformed geometry when checking edge visibility 2024-09-24 15:36:03 +10:00
Campbell Barton
a13513ab25 Fix #125646: Resolve edge-slide performance regression when snapping
Partially revert [0] which replaced BMBVHTree with SnapObjectContext.

While SnapObjectContext is a comprehensive method of performing
ray-casts, the purpose of edge-slide visibility checks is mainly to
exclude back-facing vertices.

Using SnapObjectContext has some down-sides that include iterating
over all dupli-instances for every vertex, details in code-comments.

Resolve be restoring simpler self-occlusion check.

[0]: 2d50a41d77

Ref !128016
2024-09-24 15:36:02 +10:00
Aras Pranckevicius
ecce5f45ac Cleanup: rename MAXSEQ -> SEQ_MAX_CHANNELS and make it C++ constexpr
When I was learning VSE code, MAXSEQ constant (a preprocessor define!) was
confusing. It makes it sound like it is "max sequences", but it is actually
"max channels". So rename it to SEQ_MAX_CHANNELS and make it C++ constexpr int
instead of preprocessor macro.

Pull Request: https://projects.blender.org/blender/blender/pulls/128024
2024-09-23 15:43:45 +02:00
Falk David
3c8d4becc8 Cleanup: GPv3: Return reference from GreasePencil::layer() functions
Since we only assert and never return `nullptr`, it's better to just return a reference.
The access into the span already asserts anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/128025
2024-09-23 13:54:02 +02:00
Campbell Barton
890f06ec42 WM: prevent potential freed memory access for the UV unwrapping timer 2024-09-21 17:17:25 +10:00
Lukasz Czyz
788bc5158e UV: add support for the SLIM unwrapping algorithm
Integrate an existing implementation of the SLIM unwrapping algorithm
into Blender. More info about SLIM here:
https://igl.ethz.ch/projects/slim/

This commit is based on the integration code written by Aurel Gruber
for Blender 2.7x (unfinished and never merged with the main branch).

This commit is based on Aurel's code, rebased and further improved.

Details:

- Unwrap has been moved into a sub-menu,
  slim unwrapping is exposed as: "Minimum Stretch".
- Live unwrap with SLIM refines the solutions using a timer.
- When using SLIM there are options to:
  - Set the number of iterations.
  - Weight the influence using vertex weights.
- SLIM can be disabled using the `WITH_UV_SLIM` build option.

Co-authored-by: Aurel Gruber <aurel.gruber@infix.ch>

Ref !114545
2024-09-21 16:48:53 +10:00
Philipp Oeser
2ba13677ad Fix: Sculpt Scale tool adds up scale with non-uniform object scaling
This has already been tried to solve in f71d89bb04 (but apparently
still wrong).

This PR will hopefully address part of the scaling issues (rotation
needs another look, see below)

wrt. to scaling, the is code in place to reorient the size matrix in
`ElementResize` (for `Sculpt`, `Object`, `ObjectTexSpace` & `Pose`) that
multiplies by `td->axismtx` and it can be assumed that this code expects
`td->axismtx` to be normalized (otherwise the scaling adds up). And it
looks like all code coming here actually does this (except sculpt code
from `createTransSculpt`).

So to resolve, normalize `td->axismtx` in `createTransSculpt`.

NOTE: even after this PR, there can still be issues with scaling, namely
with rotated objects and global orientation, or when the pivot is set to 3D
cursor, those need another look.

NOTE: for rotation, I need another look at git history, atm. it seems
puzzling that f71d89bb04 e.g. uses `TransDataExtension::l_smtx` (this
is only ever used for pose related rotation?!)

part of #127398

Pull Request: https://projects.blender.org/blender/blender/pulls/127495
2024-09-20 18:02:31 +02:00
Campbell Barton
6a1bd2ff40 Cleanup: use C++ comments for disabled code 2024-09-14 12:35:00 +10:00
Sybren A. Stüvel
b952782a44 Refactor: Anim, move Action queries from BKE to the animrig::Action class
Move the following BKE functions to the `animrig::Action` class. Some of
those will be extended to support slots in a future commit; for now they
still operate on all F-Curves in the Action.

| Old                             | New                                 |
|---------------------------------|-------------------------------------|
| `BKE_action_frame_range_calc()` | `Action::get_frame_range_of_keys()` |
| `BKE_action_frame_range_get()`  | `Action::get_frame_range()`         |
| `BKE_action_has_motion()`       | `Action::has_keyframes()`           |
| `BKE_action_has_single_frame()` | `Action::has_single_frame()`        |
| `BKE_action_is_cyclic()`        | `Action::is_cyclic()`               |

Implementations have been copied from the BKE functions. The frame range
functions now return `float2` instead of requiring two `float *r_…`
return parameters.

The `has_motion` function is now renamed to `has_keyframes`, as that is
what the implementation was actually testing for.

The functions now no longer are null-safe. The BKE functions handled a
null action pointer, but IMO that doesn't make sense, and in none of the
call sites I could find where this would actually be valid.

No functional changes.

Ref: #127489

Pull Request: https://projects.blender.org/blender/blender/pulls/127512
2024-09-13 15:04:47 +02:00
Sybren A. Stüvel
3417934eff Anim: add Action Slot assignment to NLA strip
For an NLA strip to use a slotted Action, it needs to specify which slot
to use in that action. This is now handled by two new properties on the
strip in DNA & RNA: `action_slot_handle` and `action_slot_name`.

These serve the same purpose as their counterparts on the `AnimData`
struct.

Note that this commit does NOT add NLA evaluation support for slotted
Actions. It merely allows assigning them. Evaluation, tweak mode
support, etc. will be implemented in future commits.

Pull Request: https://projects.blender.org/blender/blender/pulls/127359
2024-09-12 14:08:16 +02:00
Sybren A. Stüvel
3fdc9e9637 Refactor: convert BKE_action.h to C++
Move the contents of `BKE_action.h` into `BKE_action.hh` and remove
C-isms.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/127407
2024-09-10 14:55:47 +02:00