Commit Graph

107 Commits

Author SHA1 Message Date
Philipp Oeser
1d0c11987f Fix: Scale/Rotate proportional editing for Grease Pencil / Curves
If the `transdata_check_local_islands` check does not succeed, we end up
with `CTX_NO_PET` for scaling/rotation.

For `Grease Pencil`, this was lost in the transition from GPv2 > GPv3
(type was renamed to "legacy", then removed from
`transdata_check_local_islands` in a804320138, but the new type was
never added).

Curves never specified support for this, but both types are (in theory)
taking into account `V3D_AROUND_LOCAL_ORIGINS` in
`curve_populate_trans_data_structs` (logic from 9d86fada03 might be a
bit broken for proportional editing "islands" without anything selected
as reported in #139101, but that will be corrected in another PR).

So to resolve, add `Grease Pencil` and `Curves` as supported object
types in `transdata_check_local_islands`

NOTE: `transdata_check_local_center` already has these two types as
well.

Part of #139101

Pull Request: https://projects.blender.org/blender/blender/pulls/139209
2025-05-22 13:38:22 +02:00
Jacques Lucke
578f935170 Nodes: support changing attached frame while transforming nodes
Currently, removing a node frame a frame is rather annoying. The `alt+P`
shortcut is hard to reach and probably not very intuitive. Furthermore, often
one only notices that one wants to remove a node from a frame after starting to
move the node. So one would have to put the node back down, detach it from the
frame and then start moving again.

This patch simplifies this entire process by adding a new shortcut that can be
used while dragging nodes. When `F` is pressed, the selected nodes are detached
from their parents. Alternatively, if the nodes are detached already, they may
be attached to the frame under the cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/138650
2025-05-15 20:54:29 +02:00
Harley Acheson
d2f6514686 UI: Status Bar Proportional Size Include MsPan
Currently while transforming with proportional editing we see an item
in the status bar for "MsPan: Adjust Proportional Influence". This is
actually for trackpad pan gesture (only available on some laptops).
This PR just combines this entry with those for Page Up and Page Down.

Pull Request: https://projects.blender.org/blender/blender/pulls/138574
2025-05-08 00:44:09 +02:00
Brecht Van Lommel
637c6497e9 Refactor: Use more typed MEM_calloc<>, avoid unnecessary size_t cast
Handle some cases that were missed in previous refactor. And eliminate
unnecessary size_t casts as these could hide issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Campbell Barton
bcdcc3dbde Refactor: use enum types for event modifiers & types
Use enum types for event modifier and types,
`wmEventModifierFlag` & `wmEventType` respectively.

This helps with readability and avoids unintended mixing with other
types. To quiet GCC's `-Wswitch` warnings many `default` cases needed
to be added to switch statements on event types.

Ref !136759
2025-03-31 23:48:29 +00:00
Campbell Barton
b252a6c7fb Cleanup: various non-functional changes for C++ 2025-03-28 00:59:15 +00:00
Campbell Barton
5e2b421996 WM: support the "Hyper" modifier key on Linux
Add support for a 5th modifier key called "hyper",
this is a modifier supported on Wayland & X11 although
other platforms could support an additional modifier too.

Both GNOME and KDE can map CapsLock to Hyper.
Other compositors can use the XKB_DEFAULT_OPTIONS environment variable.

This allows users to have an additional modifier for their own use
that doesn't conflict with other keys.

Ref !136340
2025-03-26 10:39:55 +11:00
Campbell Barton
10233e95dd Cleanup: use a typed enum for operator & gizmo callbacks
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.

This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.

It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.

Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.

No functional changes expected.

Ref !136227
2025-03-20 21:11:06 +00:00
Germano Cavalcante
015b7483e7 Fix #136061: Shear and Edge Slide not displaying custom keys in statusbar
Since 40eadc75be, `ED_workspace_status_text` is now called at the
beginning of the modal function.

This clears any custom keymap and redraws the status bar.

The `Edge Slide` and `Shear` operations only update the status bar if a
modal key is pressed (not on mouse move).

The solution to avoid losing custom modal keys, and not having to
update the status bar more often is: call `ED_workspace_status_text`
only when an operation that requires redraw is performed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136101
2025-03-18 12:46:56 +01:00
Campbell Barton
23de65afab Merge branch 'blender-v4.4-release' 2025-03-17 21:44:29 +11:00
Campbell Barton
044b8ab6f0 Fix #136077: Crash transforming in background mode with an active region
Don't attempt to add region draw callbacks in background mode.
This caused by the regions runtime being null.

Even if the runtime was initialized, drawing callbacks aren't needed
in background mode.

Ref !136078
2025-03-17 21:41:34 +11:00
Richard Antalik
68abed543b Refactor: Remove module prefix form symbols in sequnecer namespaces
Remove
SEQ_ prefix for blender::seq namespace and
ED_sequencer for blender::ed::vse namespace

Pull Request: https://projects.blender.org/blender/blender/pulls/135560
2025-03-06 13:04:39 +01:00
Richard Antalik
a08246a1a2 Refactor: Move VSE code to namespaces
This PR creates 2 namespaces for VSE code:
- `blender::seq` for sequencer core code
- `blender::ed::vse` for editor code

These names are chosen to not be in conflict with each other.
No namespace was used for RNA.

Finally, file `BKE_sequencer_offscreen.h` was moved from BKE to sequencer.

Pull Request: https://projects.blender.org/blender/blender/pulls/135500
2025-03-06 06:22:14 +01:00
Hans Goudey
b4c9b3e87f Cleanup: Move transform editors module to C++ namespace
Pull Request: https://projects.blender.org/blender/blender/pulls/134701
2025-02-18 01:27:04 +01:00
Richard Antalik
2a44bdfbd0 Refactor: Use C++ types for vectors strip image transform code
All 2D vectors related to image transform code were changed to float2.
Previously, it was decided, that 4x4 matrix should be used for 2D
affine transform, but this is changed to 3x3 now.

Texture painting code did rely on `IMB_transform` with 4x4 matrix.
To avoid large changes, I have added function
`BLI_rctf_transform_calc_m3_pivot_min`.

Main motivation is cleaner code - ease of use of c++ API, and avoiding
returning values by arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/133692
2025-02-17 11:23:00 +01:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Harley Acheson
41b1b4f95c Revert 867e9d879a: Status Bar Impossible Confirms & Cancels
As noted in #134241 this modal poll function cannot return false on an
item because there is a conflict in the way the operation is started
versus how it is set to cancel. Doing so also stops the escape key from
canceling the operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/134273
2025-02-08 20:40:31 +01:00
Brecht Van Lommel
3725fad82f Cleanup: Various clang-tidy warnings in editors
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Harley Acheson
867e9d879a Fix #59358: Don't Show Status Bar Impossible Confirms & Cancels
When performing a transform operation that drags or tweaks, do not show
the Cancel or Confirm keymap item on the Status Bar if they use the
same mouse button that initiated the operation. For example if you are
RCS and are tweaking an object, don't show Cancel on status bar since
that requires right click. If LCS then don't show Confirm (requires
left click) when tweaking, dragging gizmo parts, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/131336
2025-01-29 03:57:08 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Hans Goudey
c6f5c44350 Cleanup: Remove unused includes in editors modules
Pull Request: https://projects.blender.org/blender/blender/pulls/133166
2025-01-16 23:17:51 +01:00
Bastien Montagne
4bf5a2f5cb Cleanup: PointerRNA: Remove 'C-style' zero-initializations.
These are useless now that PointerRNA has explicit default values, and
become a problem when real constructors are added to this struct. Simply
use the default empty value initialization instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/130927
2024-11-25 19:09:56 +01:00
Germano Cavalcante
18d758d7b5 Fix #130864: Snap toggle is enabled if operation has snap option enabled
Add the condition that snapping was not enabled via properties.
2024-11-25 10:20:18 -03:00
Hans Goudey
129a2aa0f4 Refactor: Move region runtime data out of DNA
Pull Request: https://projects.blender.org/blender/blender/pulls/130303
2024-11-21 19:34:53 +01:00
Hans Goudey
a804320138 Cleanup: Remove unused grease pencil legacy handling in some operators
See #123468.
2024-11-02 23:14:41 +01:00
Campbell Barton
15c207a294 Merge branch 'blender-v4.3-release' 2024-11-02 17:34:00 +11:00
Campbell Barton
4df285ccd5 Cleanup: move function comments into headers or implementation notes
For C/C++ doc-strings should be located in headers,
move function comments into the headers, in some cases merging
with existing doc-strings, in other cases, moving implementation
notes into the function body.
2024-11-02 17:27:09 +11: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
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
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
Campbell Barton
6a1bd2ff40 Cleanup: use C++ comments for disabled code 2024-09-14 12:35:00 +10:00
Bastien Montagne
faf56cc3bf RNA generated code: Move extern'ed PropertyRNA from pointers to references.
Clang (at least on OSX) has optimization issues with the pointer
version, which seem to be 'fixed' by using references.

Note that using references here is not a bad thing anyway (none of these
pointers would ever be expected to be NULL).

Pull Request: https://projects.blender.org/blender/blender/pulls/124883
2024-07-17 15:19:54 +02:00
Bastien Montagne
e25756cb62 RNA: Fix illegal types mismatch in extern'ed PropertyRNA data.
Previous code would declare properties as `extern PropertyRNA`, but
implement them as type-refined data (e.g. `FloatPropertyRNA`).

This is fully illegal thing, it happened to work 'fine' so far for two
main reasons:
* C-linking does not do type-checks on extern data.
* Code using these publicly exposed data would always use them as
  `PorpertyRNA *` pointers, and pass them to RNA API.

However, this (finally !) breaks when trying to move generated
`RNA_property.h` header to C++, since at least MSVC2022 does mangle the
type in the extern'ed symbol name, which makes linking fails epically.

This commit fixes the issue by only declaring `PointerRNA *` pointers in
the headers. These pointers are then defined in each implementation file
(the `rna_xxx_gen.cc` ones), and assinged to the address of a matching
local static variable. These static variables are type-refined, and
actually contain the property definition data.

Pull Request: https://projects.blender.org/blender/blender/pulls/124603
2024-07-15 11:34:27 +02:00
Omar Emara
cbabe2d3ef Compositor: Remove Auto Render option
This patch removes the Auto Render option from the compositor. This is
done for the following reason:

- The option didn't really work except in the case of transforming an
  object. So it wasn't really reliable.
- It made little sense to use since the introduction of the Viewport
  Compositor.
- It had a number of UX issues, including the fact that it can't be used
  with animation playback, and the fact that rendering can get in the
  way of the UI depending on the preferences for temporary editors.

Pull Request: https://projects.blender.org/blender/blender/pulls/123132
2024-06-13 07:29:37 +02:00
Pratik Borhade
8e6b276f84 Fix #121660: Auto-keyframe icon Overlapping when Navigation Controls are off
This is due to the wrong offset when "navigation controls" is off. Axis
gizmo is still visible so "else" codeblock is expected to handle the
correct offset value.

Pull Request: https://projects.blender.org/blender/blender/pulls/121775
2024-05-15 14:22:32 +02:00
Harley Acheson
d42e507c14 UI: Fix AutoKeying Text
Recent changes overlay drawing code resulted in a call to draw the
"Autokeying" text being removed, showing only the icon.  This PR just
replaces one removed line.

Pull Request: https://projects.blender.org/blender/blender/pulls/121811
2024-05-15 01:41:10 +02:00
Harley Acheson
92e0545e9f UI: Remove BLF_draw_default_shadowed
With Aras's recent changes in #121383, our text shader now supports
outline shadows, which gives a result that has more contrast than can
be achieved with BLF_draw_default_shadowed. This removes that function.

Pull Request: https://projects.blender.org/blender/blender/pulls/121676
2024-05-13 22:32:59 +02:00
Harley Acheson
03cd8b359b UI: Edge Slide Status Display
While using Edge Slide show only changing values in the area header and
only keymap entries on the Status Bar

Pull Request: https://projects.blender.org/blender/blender/pulls/121585
2024-05-09 00:06:31 +02:00
Germano Cavalcante
93e47ad9a8 Fix #120744: Shrink/Fatten Even with Alt not working
Continuation of 3d6bb6ce04

This 'alt' hotkey is captured in the modal map
`TFM_MODAL_PASSTHROUGH_NAVIGATE` in order to appear in the header.
But this modal map is not necessary.
2024-04-17 12:25:00 -03:00
Germano Cavalcante
115a925ffe Fix: Incremental snap not matching grid resolution
Caused by f0479e915f

`t->snap_spatial` is still required for Incremental snap.
2024-04-07 10:26:21 -03:00
Germano Cavalcante
f0479e915f Transform: Implement Snap to Grid mode
Addresses two improvements to `Snap to Grid` as suggested in #73993:
- Make 'Absolute Grid Snapping' a new Snap Mode
- Snap to Grid in Non-Side View performed at ground level

Implementation details:

- Snap to Grid has no cursor symbol, unless we are in `Set Snap Base`
  mode. Similar to the previous 'Absolute Grid Snap' behavior.
- In Non-Side view, Snap to Grid is performed at ground level.
- If `Snap Base` is `Closest`, Snap to Grid uses the transform pivot
  point instead. Similar to the previous 'Absolute Grid Snap' behavior.
- The "Absolute Grid Snap" option has been removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/116109
2024-03-27 13:17:24 +01:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00