Commit Graph

50 Commits

Author SHA1 Message Date
Richard Antalik
4a11be2656 VSE: Add option to translate pivot point
This feature allows you to change postion of origin/pivot for images
without changing their position.

It is implemented as property of transform operator. It is activated
by pressing `Ctrl + .` shortcut.
Move Origin item was also added to transform menu.

Origin can be snapped to 3x3 grid on strip image. This represents
most usual anchor points.

Ref: #134251
Pull Request: https://projects.blender.org/blender/blender/pulls/134206
2025-05-06 05:16:56 +02:00
Brecht Van Lommel
388a21e260 Refactor: Eliminate various void pointers passed to MEM_freeN
It's safer to pass a type so that it can be checked if delete should be
used instead. Also changes a few void pointer casts to const_cast so that
if the data becomes typed it's an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +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
c49e6a7dd4 Cleanup: reference operators as symbols, spelling in comments 2025-04-15 15:22:53 +10: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
Campbell Barton
c37455acac Fix: crash in transform.from_gizmo from a missing poll function
In practice it's unlikely users would trigger this crash.
2025-03-19 00:51:15 +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
Harley Acheson
46ddd76609 Merge branch 'blender-v4.4-release' 2025-02-28 12:38:10 -08:00
John Kiril Swenson
f874d46589 Fix: UI: Transform Feedback for Invalid Trackball
Patch #132957 added helpful UI feedback when attempting to rotate or
scale an object whose transforms are set to "only affect locations."
But it neglected to check for invalid trackpad rotations that are
affected the same way. This patch renames the original `HLP_ERROR` to
`HLP_ERROR_DASH` to distinguish it from a `HLP_ERROR` transform cursor
with no dashed line present, which matches trackball's normal state.

Pull Request: https://projects.blender.org/blender/blender/pulls/134653
2025-02-28 21:14:36 +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
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Harley Acheson
40eadc75be UI: Transform Feedback for Invalid States
This adds support for Transform MouseInputMode INPUT_ERROR using a new
transform cursor HLP_ERROR (dashed line ending with WM_CURSOR_STOP.
This is shown when attempting an object rotation or scale when
transforms are set to "Affect Only Locations". At this time the status
bar is also cleared and an warning message is shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/132957
2025-01-30 17:11:14 +01: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
Germano Cavalcante
ba3d017929 Transform: remove unused "GPENCIL_SHRINKFATTEN"
Since `c986aa03b9`, this mode is no longer used and is quite difficult
to access, as in version 4.3, `ob->data` should never be of type
`bGPdata *`.

Pull Request: https://projects.blender.org/blender/blender/pulls/130406
2024-11-18 21:09:07 +01:00
John Kiril Swenson
9dd2d7bd75 Fix: VSE snapping with edge panning
Ever since it was added to the VSE in e49fef45ce, edge panning would
break snapping -- edge panning a strip and then bringing it back would
cause snap code to trigger at incorrect locations. This is because the
edge pan system would update the `View2D` in `t->region->v2d.cur`, but
not mouse values, and so `t->values` would end up unchanged even while
the strip was moving.

e6a557952e fixed the issue for the node editor by recalculating mouse
input values when the view changed with `transformViewUpdate()`, but
since the code was separate from VSE, that fix did not get also get
applied here.

Although the code in `view2d_edge_pan_loc_compensate()` is mostly
identical between the two and so one possibility is to move it to
`transform_generics.cc`, adapting it to allow it to be used by both
spaces, custom transform data in the node editor additionally stores and
updates a `viewrect_prev` as mentioned in e040aea7bf, which VSE custom
data does not have. Since the fix is small enough and I don't want to
risk messing with other module code, I've opted to just copy the fix
over to VSE. If further bugs crop up in the future, we can consider
combining the code.

Also fix typo in `tranformViewUpdate()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/126471
2024-08-20 07:11:45 +02:00
Richard Antalik
f98b01e492 VSE: Improved handle tweaking
This commit changes how users can interact with handles:

Unselected handles are not drawn anymore by default. Handles are bit
thinner. If handle can't be selected, because strip is too small,
it is not drawn.

When hovering over strip handle a cursor is changed to represent a
handle shape. It is possible to select 2 handles at once if strips are
adjoined.

When tweak event happens on unselected handle, handle selection is lost
ater tweaking.

This behavior can be disabled in preferences:
Editing > Video Sequencer > Tweak Handles.

Moving strips with G key works same way as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/109522
2024-06-03 23:17:41 +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
f66cb1e635 UI: rename 'Snap With' and 'Snap To' to 'Snap Base' and 'Snap Target'
Since the `Set Snap Base` feature has been implemented, it would be
convenient to reflect the use of the term `Snap Base` in other areas in
the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/119723
2024-03-25 13:35:52 +01:00
Germano Cavalcante
f6a581e28a UV: Vert and Edge Slide UI improvements
Changes:
- Add Vert Slide and Edge Slide to 'UV -> Transform' menu.
- Add a separator for Vert Slide and Edge Slide in the context menu.
- Don't display the "Correct UVs" option in the Redo menu of UV Editor.
2024-03-13 12:16:19 -03:00
Germano Cavalcante
31745a53f4 Cleanup: early return & avoid compare strings unnecessarily
`transform_poll_property` can be smarter in the conditions.
2024-03-13 12:16:18 -03:00
Melissa
aaadb5005e UV: Support Edge and Vert Slide
This commit adapts the existing Edge Slide and Vert Slide to work with
UVs as well.

It addresses [0] for the addition of an edge slide tool to the UV
Editor.

This feature allows users to slide UVs towards adjacent edges,
providing more convenient ways to edit UV maps.

[0]: https://blender.community/c/rightclickselect/66dbbc

Pull Request: https://projects.blender.org/blender/blender/pulls/119041
2024-03-12 10:15:55 -03:00
Campbell Barton
91229f0e16 Cleanup: use full sentences for comments in transform & windowmanager 2024-03-09 23:28:03 +11:00
Campbell Barton
b372ebae68 Cleanup: unused headers for source/blender/editors
Remove 1317 includes from editors.
2024-02-13 10:02:53 +11:00
Bastien Montagne
5aaadebbe4 Cleanup: Make BKE_scene.h a full Cpp header. 2024-02-10 19:16:25 +01:00
Bastien Montagne
29fe777445 Cleanup: Make BKE_report.h a full Cpp header. 2024-02-10 18:34:29 +01:00
Bastien Montagne
54618dbae3 Cleanup: Make BKE_global.h a Cpp header. 2024-02-10 18:25:14 +01:00
Bastien Montagne
45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Hans Goudey
15ae8c3064 Cleanup: Move remaining window manager headers to C++ 2024-01-04 14:30:21 -05:00
Brecht Van Lommel
d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Hans Goudey
0e8c874166 Curves: Add edit mode tilt control
Adds support for the tilt transform operator and a "Clear Tilt"
operator to mirror the functionality from the legacy curve type.
2023-12-16 12:08:28 -05:00
Hans Goudey
3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Germano Cavalcante
78943edc5d Transform: Custom modifier to navigate while transforming
Discussed in #114646.

This commit transforms the "alt_navigation" option of the transform
operators into a new modal key item. "PASSTHROUGH_NAVIGATE"

In addition to cleaning up a lot of the code, it allows you to
customize the key chosen to navigate while transforming.
2023-11-09 21:33:34 -03:00
Pratik Borhade
b8705d342f Fix #113112: Loop Cut and Slide from menu is waiting for cursor input
This is because `TRANSFORM_OT_edge_slide` has `OPTYPE_DEPENDS_ON_CURSOR`
flag set. Due to this, invoke call to loop-cut operator was not sent
from function `WM_operator_name_call_ptr_with_depends_on_cursor`.
Since `edge slide` operator does not depend on actual cusor position, we
can remove this operator flag to fix the problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/113140
2023-10-23 13:05:45 +02:00
Falk David
c0850237a1 Fix: "use_duplicated_keyframes" not found
`5ed35e` introduced the warning:
`RNA_boolean_set: TRANSFORM_OT_transform.use_duplicated_keyframes not found`

This was because the `TRANSFORM_OT_transform` did not pass
the `P_OPTIONS` flag to `Transform_Properties` to define
the `use_duplicated_keyframes` property.
2023-09-12 11:00:43 +02:00
Harley Acheson
08e63b5c26 Cleanup: Make format
Just formatting changes resulting from "make format"
2023-09-11 17:36:10 -07:00
Falk David
5ed35e5665 Cleanup: Anim: Replace use of T_AUTOMERGE
In the animation transform code, `T_AUTOMERGE` was used
to indicate that the duplicated keys need to be merged.

In perparation of #111051, this no longer makes much sense because
in grease pencil we cannot have two keys in the same channel at the same
frame.

This PR replaces the `T_AUTOMERGE` flag in the animation code to
`T_DUPLICATED_KEYS` to indicate that the transform is being called
with duplicated keyframes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111268
2023-09-11 14:43:35 +02:00
Campbell Barton
09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke
cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Aras Pranckevicius
d973355b3a Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).

However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.

This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.

Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
  to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).

Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.

Pull Request #110944
2023-08-10 14:51:40 +03:00
Hans Goudey
ffe4fbe832 Cleanup: Move editors headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110820
2023-08-05 02:57:52 +02:00
Hans Goudey
bc8c892c65 Cleanup: Move WM headers to C++
Also move a few more headers that included WM headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/110815
2023-08-04 23:11:22 +02:00
Germano Cavalcante
f1d44dd64a Transform: Refactor: Use float vector type for 'TransInfo::mval'
In most cases float access is required for this member.
2023-08-02 15:35:09 -03:00
Germano Cavalcante
7897979477 Fix compilation error introduced in last commit
Commit aa1f1167ec was incomplete and introduced unrelated changes.
2023-07-31 11:38:51 -03:00
Campbell Barton
fcacebbfb1 Cleanup: brief unsigned types, bool literals, correct struct comments 2023-07-26 15:23:23 +10:00
Damien Picard
13ec961c4a UI: fix and improve a few messages
- "Rename Channels": only one channel can be renamed at a time, use
  singular.
- "Copy Markers to Scene": rephrase erroneous operator description.
- "Axis tag names with": grammar.
- "Close or open the selected stroke adding an edge from last to first
  point": "segment" is preferred to "edge" elsewhere in the context of
  curves or Grease Pencil.
- "Number of subdivisions [points] by edge[s]": replace "by edge" with
  "per segment" for the same reason.
- "Compatibility mode for SL, OpenSim...": expand to explain that SL
  and OpenSim are respectively Second Life and OpenSimulator.
- "W/m^2" -> "W/m²". This symbol is widely supported and should be
  preferred for exponentiation outside of code.
- "Effect on tracks which are tracked less than specified amount of frames",
  "Effect on tracks which have a larger reprojection error":
  Use "Affect" and "number" instead of "amount".
- "Hull curve" -> "Envelope". This is a calque from German Hüllkurve
  meaning envelope.
- "Frquency Cutoff" -> "Frequency Cutoff" (typo)
- "Check if Select Left or Right": rephrase to "Based on Mouse
  Position" as it better explains the action of the operator.
- "Make cut event if strip is not selected ..." -> even (typo)
- "Shear selected items along the horizontal screen axis":
  Rephrase as this transform operator can act in many different axes.
- Tonemapping compositing node: the two algorithms "R/D Photoreceptor"
  and "Rh Simple" only had names, but no description. Add ones
  explaining at least the basic principle and where the names come
  from.
- In the "Matte dilate/erode side" description for the Keying node's
  Dilate/Erode socket, "side" was likely a typo for "size".
  Reformulate the description to make it clearer, inspired by similar
  ones.
- "Width of the blur edge" -> "Width of the blur for the transition";
  "Edge angle" -> "Angle of the transition";
  "Wipe direction" -> "Whether to fade in or out":
  Better explains the sequencer wipe transition (inspired by the manual).
- OSL shaders now supported on some GPU backends.
- "Add a new repeat input and output nodes " -> "Add new" (typo).

Pull Request: https://projects.blender.org/blender/blender/pulls/110321
2023-07-24 21:22:07 +02:00
Lukas Stockner
8fd0551bfe Cleanup: format 2023-07-24 16:06:45 +02:00
Germano Cavalcante
017d4912b2 Transform: Use alternative hotkeys for Transform Navigation
In order to avoid navigation hotkey conflicts during transform
operations, this commit implements the "Transform Navigation with Alt"
option.

This option is enabled by default and makes navigation hotkeys require
the `Alt` key during a transforming in the 3D View.

Pull Request: https://projects.blender.org/blender/blender/pulls/109754
2023-07-24 15:51:58 +02:00
Campbell Barton
302887c619 Cleanup: use boolean literals in source/
Apply clang-tidy modernize-use-bool-literals to source/.
2023-07-22 11:43:01 +10:00
Jacques Lucke
3a2f5fb9db Editors: move transform code to C++
Also see #103343.

Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: https://projects.blender.org/blender/blender/pulls/110049
2023-07-13 17:59:52 +02:00