2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup edtransform
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2025-06-22 11:54:17 +02:00
|
|
|
#include "BLI_function_ref.hh"
|
2023-07-25 10:53:08 -03:00
|
|
|
#include "BLI_math_vector_types.hh"
|
|
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_numinput.hh"
|
|
|
|
|
#include "ED_transform.hh"
|
|
|
|
|
#include "ED_view3d.hh"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-12-01 18:26:18 +00:00
|
|
|
#include "DNA_listBase.h"
|
2025-03-20 21:11:06 +00:00
|
|
|
#include "DNA_windowmanager_enums.h"
|
2009-12-01 18:26:18 +00:00
|
|
|
|
2023-09-22 03:18:17 +02:00
|
|
|
#include "DEG_depsgraph.hh"
|
2018-02-06 16:34:11 +11:00
|
|
|
|
2024-11-17 11:22:43 -03:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Macros/
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
#define T_ALL_RESTRICTIONS (T_NO_CONSTRAINT | T_NULL_ONE)
|
|
|
|
|
#define T_PROP_EDIT_ALL (T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED)
|
|
|
|
|
|
|
|
|
|
/* Hard min/max for proportional size. */
|
|
|
|
|
#define T_PROP_SIZE_MIN 1e-6f
|
|
|
|
|
#define T_PROP_SIZE_MAX 1e12f
|
|
|
|
|
|
|
|
|
|
#define TRANSFORM_SNAP_MAX_PX 100.0f
|
|
|
|
|
#define TRANSFORM_DIST_INVALID -FLT_MAX
|
|
|
|
|
|
|
|
|
|
#define TRANS_DATA_CONTAINER_FIRST_OK(t) (&(t)->data_container[0])
|
|
|
|
|
/* For cases we _know_ there is only one handle. */
|
|
|
|
|
#define TRANS_DATA_CONTAINER_FIRST_SINGLE(t) \
|
|
|
|
|
(BLI_assert((t)->data_container_len == 1), (&(t)->data_container[0]))
|
|
|
|
|
|
|
|
|
|
#define FOREACH_TRANS_DATA_CONTAINER(t, th) \
|
|
|
|
|
for (TransDataContainer *tc = (t)->data_container, \
|
|
|
|
|
*tc_end = (t)->data_container + (t)->data_container_len; \
|
|
|
|
|
th != tc_end; \
|
|
|
|
|
th++)
|
|
|
|
|
|
|
|
|
|
#define FOREACH_TRANS_DATA_CONTAINER_INDEX(t, th, i) \
|
|
|
|
|
for (TransDataContainer *tc = ((i = 0), (t)->data_container), \
|
|
|
|
|
*tc_end = (t)->data_container + (t)->data_container_len; \
|
|
|
|
|
th != tc_end; \
|
|
|
|
|
th++, i++)
|
|
|
|
|
|
|
|
|
|
/** \} */
|
2022-10-11 18:01:08 -05:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Types/
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ARegion;
|
2024-11-17 11:22:43 -03:00
|
|
|
struct bConstraint;
|
2018-01-18 15:58:02 +01:00
|
|
|
struct Depsgraph;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
struct NumInput;
|
|
|
|
|
struct Object;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct RNG;
|
|
|
|
|
struct ReportList;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ScrArea;
|
2017-11-22 10:52:39 -02:00
|
|
|
struct ViewLayer;
|
2023-05-19 23:45:27 +02:00
|
|
|
struct ViewOpsData;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
struct bContext;
|
|
|
|
|
struct wmEvent;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmKeyConfig;
|
|
|
|
|
struct wmKeyMap;
|
2023-07-13 17:59:52 +02:00
|
|
|
struct wmMsgBus;
|
2020-12-16 16:19:04 +11:00
|
|
|
struct wmOperator;
|
2009-02-16 03:01:56 +00:00
|
|
|
struct wmTimer;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Enums and Flags
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2025-02-18 01:27:04 +01:00
|
|
|
namespace blender::ed::transform {
|
|
|
|
|
|
|
|
|
|
struct TransSnap;
|
|
|
|
|
struct TransConvertTypeInfo;
|
|
|
|
|
struct TransDataContainer;
|
|
|
|
|
struct TransInfo;
|
|
|
|
|
struct TransModeInfo;
|
|
|
|
|
struct TransSeqSnapData;
|
|
|
|
|
struct SnapObjectContext;
|
|
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** #TransInfo.options */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTContext {
|
2021-02-03 19:25:16 -03:00
|
|
|
CTX_NONE = 0,
|
2021-02-05 11:56:43 -03:00
|
|
|
|
|
|
|
|
/* These are similar to TransInfo::data_type. */
|
|
|
|
|
CTX_CAMERA = (1 << 0),
|
|
|
|
|
CTX_CURSOR = (1 << 1),
|
|
|
|
|
CTX_EDGE_DATA = (1 << 2),
|
|
|
|
|
CTX_GPENCIL_STROKES = (1 << 3),
|
|
|
|
|
CTX_MASK = (1 << 4),
|
|
|
|
|
CTX_MOVIECLIP = (1 << 5),
|
|
|
|
|
CTX_OBJECT = (1 << 6),
|
|
|
|
|
CTX_PAINT_CURVE = (1 << 7),
|
|
|
|
|
CTX_POSE_BONE = (1 << 8),
|
|
|
|
|
CTX_TEXTURE_SPACE = (1 << 9),
|
2021-09-21 09:38:30 +02:00
|
|
|
CTX_SEQUENCER_IMAGE = (1 << 10),
|
2021-02-05 11:56:43 -03:00
|
|
|
|
2021-09-21 09:38:30 +02:00
|
|
|
CTX_NO_PET = (1 << 11),
|
|
|
|
|
CTX_AUTOCONFIRM = (1 << 12),
|
2021-02-03 19:25:16 -03:00
|
|
|
/** When transforming object's, adjust the object data so it stays in the same place. */
|
2021-09-21 09:38:30 +02:00
|
|
|
CTX_OBMODE_XFORM_OBDATA = (1 << 13),
|
2021-02-03 19:25:16 -03:00
|
|
|
/** Transform object parents without moving their children. */
|
2021-09-21 09:38:30 +02:00
|
|
|
CTX_OBMODE_XFORM_SKIP_CHILDREN = (1 << 14),
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Enable edge scrolling in 2D views. */
|
2021-09-21 09:38:30 +02:00
|
|
|
CTX_VIEW2D_EDGE_PAN = (1 << 15),
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
|
|
|
|
ENUM_OPERATORS(eTContext, CTX_VIEW2D_EDGE_PAN)
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** #TransInfo.flag */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTFlag {
|
2021-02-03 19:25:16 -03:00
|
|
|
/** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
|
2021-02-05 11:56:43 -03:00
|
|
|
T_EDIT = 1 << 0,
|
2021-02-03 19:25:16 -03:00
|
|
|
/** Transform points, having no rotation/scale. */
|
2021-02-05 11:56:43 -03:00
|
|
|
T_POINTS = 1 << 1,
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Restrictions flags. */
|
2021-02-05 11:56:43 -03:00
|
|
|
T_NO_CONSTRAINT = 1 << 2,
|
|
|
|
|
T_NULL_ONE = 1 << 3,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2021-04-24 11:34:02 -03:00
|
|
|
T_PROP_EDIT = 1 << 4,
|
|
|
|
|
T_PROP_CONNECTED = 1 << 5,
|
|
|
|
|
T_PROP_PROJECTED = 1 << 6,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2021-04-24 11:34:02 -03:00
|
|
|
T_V3D_ALIGN = 1 << 7,
|
2021-02-03 19:25:16 -03:00
|
|
|
/** For 2D views such as UV or f-curve. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_2D_EDIT = 1 << 8,
|
|
|
|
|
T_CLIP_UV = 1 << 9,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Auto-IK is on. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_AUTOIK = 1 << 10,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Don't use mirror even if the data-block option is set. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_NO_MIRROR = 1 << 11,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** To indicate that the value set in the `value` parameter is the final
|
|
|
|
|
* value of the transformation, modified only by the constrain. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_INPUT_IS_VALUES_FINAL = 1 << 12,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** To specify if we save back settings at the end. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_MODAL = 1 << 13,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** No re-topology (projection). */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_NO_PROJECT = 1 << 14,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2021-04-24 11:34:02 -03:00
|
|
|
T_RELEASE_CONFIRM = 1 << 15,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Alternative transformation. used to add offset to tracking markers. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_ALT_TRANSFORM = 1 << 16,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** #TransInfo.center has been set, don't change it. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_OVERRIDE_CENTER = 1 << 17,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2021-04-24 11:34:02 -03:00
|
|
|
T_MODAL_CURSOR_SET = 1 << 18,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2021-04-24 11:34:02 -03:00
|
|
|
T_CLNOR_REBUILD = 1 << 19,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Merges unselected into selected after transforming (runs after transforming). */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_AUTOMERGE = 1 << 20,
|
2021-02-03 19:25:16 -03:00
|
|
|
/** Runs auto-merge & splits. */
|
2021-04-24 11:34:02 -03:00
|
|
|
T_AUTOSPLIT = 1 << 21,
|
2021-06-16 18:17:07 +01:00
|
|
|
|
2022-03-09 08:36:36 +11:00
|
|
|
/** Use drag-start position of the event, otherwise use the cursor coordinates (unmodified). */
|
2022-04-25 12:35:43 -03:00
|
|
|
T_EVENT_DRAG_START = 1 << 22,
|
2022-03-09 08:36:36 +11:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** No cursor wrapping on region bounds. */
|
2021-06-16 18:17:07 +01:00
|
|
|
T_NO_CURSOR_WRAP = 1 << 23,
|
2023-01-26 07:54:04 -03:00
|
|
|
|
|
|
|
|
/** Do not display Xform gizmo even though it is available. */
|
|
|
|
|
T_NO_GIZMO = 1 << 24,
|
2023-06-09 14:12:15 +02:00
|
|
|
|
|
|
|
|
T_DRAW_SNAP_SOURCE = 1 << 25,
|
2023-09-11 14:43:35 +02:00
|
|
|
|
|
|
|
|
/** Special flag for when the transform code is called after keys have been duplicated. */
|
|
|
|
|
T_DUPLICATED_KEYFRAMES = 1 << 26,
|
2025-05-06 05:16:56 +02:00
|
|
|
|
|
|
|
|
/** Transform origin. */
|
|
|
|
|
T_ORIGIN = 1 << 27,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2025-05-06 05:16:56 +02:00
|
|
|
ENUM_OPERATORS(eTFlag, T_ORIGIN);
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** #TransInfo.modifiers */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTModifier {
|
2021-05-24 11:35:33 -03:00
|
|
|
MOD_CONSTRAINT_SELECT_AXIS = 1 << 0,
|
2021-02-03 19:25:16 -03:00
|
|
|
MOD_PRECISION = 1 << 1,
|
|
|
|
|
MOD_SNAP = 1 << 2,
|
|
|
|
|
MOD_SNAP_INVERT = 1 << 3,
|
2021-11-18 14:19:59 -03:00
|
|
|
MOD_CONSTRAINT_SELECT_PLANE = 1 << 4,
|
2022-12-15 14:03:28 -06:00
|
|
|
MOD_NODE_ATTACH = 1 << 5,
|
2023-02-06 11:04:07 -03:00
|
|
|
MOD_SNAP_FORCED = 1 << 6,
|
Transform: new feature to edit the 'Snap Base'
This commit implements a new modifier key (`B`) for the transform
operators.
This new key allows changing the 'Snap Base' of a transform by snapping
it to a defined point in the scene.
Ref #66424
# Implementation Details
- This feature is only available in the 3D View.
- This feature is only available for the transform modes:
- `Move`,
- `Rotate`,
- `Scale`,
- `Vert Slide` and
- `Edge Slide`.
- The `Snap Base Edit` is enabled while we are transforming and we
press the key `B`
- The `Snap Base Edit` is confirmed when we press any of the keys:
`B`, `LMB`, `Enter`
- During um operation, if no snap target is set for an element in the
scene (Vertex, Edge...), the snap targets to geometry Vertex, Edge,
Face, Center of Edge and Perpendicular of Edge are set automatically.
- Constraint or similar modal features are not available during the
`Snap Base Edit` mode.
- Text input is not available during the `Snap Base Edit` mode.
- A prone snap base point is indicated with an small cursor drawing.
Pull Request: https://projects.blender.org/blender/blender/pulls/104443
2023-06-03 04:18:49 +02:00
|
|
|
MOD_EDIT_SNAP_SOURCE = 1 << 7,
|
2025-05-15 20:54:29 +02:00
|
|
|
MOD_NODE_FRAME = 1 << 8,
|
VSE: Clamp strip handles to video/audio bounds
This initial commit properly clamps handles for video/audio strips, and
provides functionality to enable/disable the behavior for all strip types
(addresses #90280).
Toggling handle clamping is done with "C",
just like with the redesigned slip operator (#137072).
If a strip is not already clamped when you start moving its handles,
then clamping behavior is disabled starting out. This means no abrupt
clamp until you explicitly ask for it.
Transform logic was altered, fixing a few bugs:
- When initializing a transform, `createTransSeqData` would already
create some clamping data for channels. This patch replaces it with
`offset_clamp` (for unconditional clamping which cannot be disabled)
and `handle_xmin/xmax` (for hold offset clamping, which is optional).
- Collecting this data ahead of time is necessary for the double
handle tweak case -- `flushTransSeq` only works one strip at a
time, so we can't clamp post-hoc.
- In `applySeqSlideValue`, we apply `transform_convert_sequencer_clamp`
before values are printed to the header, but let the unclamped values
get flushed to the strips themselves. This is so that we can have the
data later at the individual strip level to recalculate clamps.
Otherwise, if transform values are clamped preemptively, then we have
no idea whether strips are clamped vs. merely resting at their
boundaries.
Note that currently, handle clamping is drawn identically to overlaps.
More information in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/134319
2025-07-16 06:16:19 +02:00
|
|
|
MOD_STRIP_CLAMP_HOLDS = 1 << 9,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2024-10-18 14:18:20 -03:00
|
|
|
ENUM_OPERATORS(eTModifier, MOD_EDIT_SNAP_SOURCE)
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** #TransSnap.status */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTSnap {
|
Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes. This patch contains refactored code to improve this. This patch does (should) not change functionality of snapping.
Clarified ambiguously / incorrectly named attributes.
- "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped. Moreover, the implications of the previous terms do not match the descriptions. For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
- "Select" refers to the condition for an object to be a possible target for snapping.
- `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).
Refactored related `#define` into `enum`s. In particular, constants relating to...
- `ToolSettings.snap_flag` are now in `enum eSnapFlag`
- `ToolSettings.snap_mode` are now in `enum eSnapMode`
- `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
- `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`
As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous. For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source. This patch also adds a small amount of clarity.
This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.
Note: I did leave myself some comments to follow-up with further refactoring. Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`). If the API is going to change, it would be good to make sure that the used terms are descriptive enough. For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming. Perhaps `use_snap` might be an improvement that's more consistent with other conventions.
This patch is (mostly) a subset of D14591, as suggested by @mano-wii.
Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method. Also, there might be reason to create additional snapping methods or options. (Indeed, D14591 heads in this direction). This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:28:14 -04:00
|
|
|
SNAP_RESETTED = 0,
|
2023-02-06 11:04:07 -03:00
|
|
|
SNAP_SOURCE_FOUND = 1 << 0,
|
2021-02-05 11:01:30 -03:00
|
|
|
/* Special flag for snap to grid. */
|
2024-03-27 13:17:24 +01:00
|
|
|
SNAP_TARGET_FOUND = 1 << 1,
|
|
|
|
|
SNAP_MULTI_POINTS = 1 << 2,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2023-01-12 10:16:25 -03:00
|
|
|
ENUM_OPERATORS(eTSnap, SNAP_MULTI_POINTS)
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2024-07-06 15:24:52 +02:00
|
|
|
/** #TransSnap.direction */
|
|
|
|
|
enum eSnapDir {
|
|
|
|
|
DIR_GLOBAL_X = (1 << 0),
|
|
|
|
|
DIR_GLOBAL_Y = (1 << 1),
|
|
|
|
|
DIR_GLOBAL_Z = (1 << 2),
|
|
|
|
|
};
|
|
|
|
|
ENUM_OPERATORS(eSnapDir, DIR_GLOBAL_Z)
|
|
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** #TransCon.mode, #TransInfo.con.mode */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTConstraint {
|
2021-02-03 19:25:16 -03:00
|
|
|
/** When set constraints are in use. */
|
|
|
|
|
CON_APPLY = 1 << 0,
|
|
|
|
|
/** These are only used for modal execution. */
|
|
|
|
|
CON_AXIS0 = 1 << 1,
|
|
|
|
|
CON_AXIS1 = 1 << 2,
|
|
|
|
|
CON_AXIS2 = 1 << 3,
|
|
|
|
|
CON_SELECT = 1 << 4,
|
Refactor: Transform: Unify logic of "orient_axis" and "constraint_axis"
In rotation-based transform operations, the rotation axis can be
determined in two ways:
1. Through "orient_axis" (X, Y or Z)
2. Through "constraint_axis"
When the axis is obtained through the constraint, "orient_axis" is
ignored, and the angle may be negated depending on the view orientation
to match the mouse movement.
However, "orient_axis" never has its angle negated. Since the default
orientation is "View", the Z axis is inverted by default, aligning with
the mouse movement but not with the constraint axis.
This causes problems in the Redo Panel because the constraint fields
are hidden in the Rotation operation, so they need to be unset for the
Axis field to work. However, if you change the value of the Rotation
field, the object may have its rotation negated unexpectedly.
This issue was partially shown in #93078. Commit c30e6a37b0 attempted
to fix it by unsetting the constraint property when the Axis was
changed. However, this solution is incomplete: if the Axis is changed
and then reverted, the negative rotation issue reappears. In addition,
it has not been implemented in all operations.
This commit resolves the issue by reverting c30e6a37b0, aligning the
behavior of "orient_axis" and "constraint_axis", and unsetting
"constraint_axis" in `saveTranform`.
A downside of this solution is that it may break operators invoked from
Python that rely on "orient_axis" as the rotation axis, as the rotation
value now needs to be negated.
Pull Request: https://projects.blender.org/blender/blender/pulls/141101
2025-07-04 20:47:25 +02:00
|
|
|
CON_USER = 1 << 5,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
|
|
|
|
ENUM_OPERATORS(eTConstraint, CON_USER)
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** #TransInfo.state */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTState {
|
2021-02-03 19:25:16 -03:00
|
|
|
TRANS_STARTING = 0,
|
|
|
|
|
TRANS_RUNNING = 1,
|
|
|
|
|
TRANS_CONFIRM = 2,
|
|
|
|
|
TRANS_CANCEL = 3,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** #TransInfo.redraw */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eRedrawFlag {
|
2013-10-23 06:48:36 +00:00
|
|
|
TREDRAW_NOTHING = 0,
|
2022-03-28 13:54:59 -03:00
|
|
|
TREDRAW_SOFT = (1 << 0),
|
|
|
|
|
TREDRAW_HARD = (1 << 1) | TREDRAW_SOFT,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2022-11-17 17:13:38 +01:00
|
|
|
ENUM_OPERATORS(eRedrawFlag, TREDRAW_HARD)
|
2013-10-23 06:48:36 +00:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** #TransInfo.helpline */
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTHelpline {
|
2021-02-03 19:25:16 -03:00
|
|
|
HLP_NONE = 0,
|
|
|
|
|
HLP_SPRING = 1,
|
|
|
|
|
HLP_ANGLE = 2,
|
|
|
|
|
HLP_HARROW = 3,
|
|
|
|
|
HLP_VARROW = 4,
|
|
|
|
|
HLP_CARROW = 5,
|
|
|
|
|
HLP_TRACKBALL = 6,
|
2025-01-30 17:11:14 +01:00
|
|
|
HLP_ERROR = 7,
|
2025-02-28 21:14:36 +01:00
|
|
|
HLP_ERROR_DASH = 8,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
enum eTOType {
|
2023-02-11 15:20:38 -03:00
|
|
|
O_DEFAULT = 0,
|
|
|
|
|
O_SCENE,
|
|
|
|
|
O_SET,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2023-02-11 15:20:38 -03:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Keymap Modal Items
|
|
|
|
|
*
|
|
|
|
|
* \note these values are saved in key-map files, do not change then but just add new ones.
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
TFM_MODAL_CANCEL = 1,
|
|
|
|
|
TFM_MODAL_CONFIRM = 2,
|
|
|
|
|
TFM_MODAL_TRANSLATE = 3,
|
|
|
|
|
TFM_MODAL_ROTATE = 4,
|
|
|
|
|
TFM_MODAL_RESIZE = 5,
|
|
|
|
|
TFM_MODAL_SNAP_INV_ON = 6,
|
|
|
|
|
TFM_MODAL_SNAP_INV_OFF = 7,
|
|
|
|
|
TFM_MODAL_SNAP_TOGGLE = 8,
|
|
|
|
|
TFM_MODAL_AXIS_X = 9,
|
|
|
|
|
TFM_MODAL_AXIS_Y = 10,
|
|
|
|
|
TFM_MODAL_AXIS_Z = 11,
|
|
|
|
|
TFM_MODAL_PLANE_X = 12,
|
|
|
|
|
TFM_MODAL_PLANE_Y = 13,
|
|
|
|
|
TFM_MODAL_PLANE_Z = 14,
|
|
|
|
|
TFM_MODAL_CONS_OFF = 15,
|
|
|
|
|
TFM_MODAL_ADD_SNAP = 16,
|
|
|
|
|
TFM_MODAL_REMOVE_SNAP = 17,
|
|
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
/* 18 and 19 used by number-input, defined in `ED_numinput.hh`. */
|
2021-02-03 19:25:16 -03:00
|
|
|
// NUM_MODAL_INCREMENT_UP = 18,
|
|
|
|
|
// NUM_MODAL_INCREMENT_DOWN = 19,
|
|
|
|
|
|
|
|
|
|
TFM_MODAL_PROPSIZE_UP = 20,
|
|
|
|
|
TFM_MODAL_PROPSIZE_DOWN = 21,
|
|
|
|
|
TFM_MODAL_AUTOIK_LEN_INC = 22,
|
|
|
|
|
TFM_MODAL_AUTOIK_LEN_DEC = 23,
|
|
|
|
|
|
2022-12-15 14:03:28 -06:00
|
|
|
TFM_MODAL_NODE_ATTACH_ON = 24,
|
|
|
|
|
TFM_MODAL_NODE_ATTACH_OFF = 25,
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2023-12-15 22:54:55 +11:00
|
|
|
/** For analog input, like trackpad. */
|
2021-02-03 19:25:16 -03:00
|
|
|
TFM_MODAL_PROPSIZE = 26,
|
|
|
|
|
/** Node editor insert offset (also called auto-offset) direction toggle. */
|
|
|
|
|
TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27,
|
|
|
|
|
|
|
|
|
|
TFM_MODAL_AUTOCONSTRAINT = 28,
|
|
|
|
|
TFM_MODAL_AUTOCONSTRAINTPLANE = 29,
|
2021-02-09 12:28:51 -03:00
|
|
|
|
|
|
|
|
TFM_MODAL_PRECISION = 30,
|
2022-12-22 18:41:44 -03:00
|
|
|
|
|
|
|
|
TFM_MODAL_VERT_EDGE_SLIDE = 31,
|
|
|
|
|
TFM_MODAL_TRACKBALL = 32,
|
2023-03-27 14:38:47 -03:00
|
|
|
TFM_MODAL_ROTATE_NORMALS = 33,
|
Transform: new feature to edit the 'Snap Base'
This commit implements a new modifier key (`B`) for the transform
operators.
This new key allows changing the 'Snap Base' of a transform by snapping
it to a defined point in the scene.
Ref #66424
# Implementation Details
- This feature is only available in the 3D View.
- This feature is only available for the transform modes:
- `Move`,
- `Rotate`,
- `Scale`,
- `Vert Slide` and
- `Edge Slide`.
- The `Snap Base Edit` is enabled while we are transforming and we
press the key `B`
- The `Snap Base Edit` is confirmed when we press any of the keys:
`B`, `LMB`, `Enter`
- During um operation, if no snap target is set for an element in the
scene (Vertex, Edge...), the snap targets to geometry Vertex, Edge,
Face, Center of Edge and Perpendicular of Edge are set automatically.
- Constraint or similar modal features are not available during the
`Snap Base Edit` mode.
- Text input is not available during the `Snap Base Edit` mode.
- A prone snap base point is indicated with an small cursor drawing.
Pull Request: https://projects.blender.org/blender/blender/pulls/104443
2023-06-03 04:18:49 +02:00
|
|
|
|
|
|
|
|
TFM_MODAL_EDIT_SNAP_SOURCE_ON = 34,
|
|
|
|
|
TFM_MODAL_EDIT_SNAP_SOURCE_OFF = 35,
|
2023-11-09 21:32:16 -03:00
|
|
|
|
|
|
|
|
TFM_MODAL_PASSTHROUGH_NAVIGATE = 36,
|
2025-05-15 20:54:29 +02:00
|
|
|
|
|
|
|
|
TFM_MODAL_NODE_FRAME = 37,
|
VSE: Clamp strip handles to video/audio bounds
This initial commit properly clamps handles for video/audio strips, and
provides functionality to enable/disable the behavior for all strip types
(addresses #90280).
Toggling handle clamping is done with "C",
just like with the redesigned slip operator (#137072).
If a strip is not already clamped when you start moving its handles,
then clamping behavior is disabled starting out. This means no abrupt
clamp until you explicitly ask for it.
Transform logic was altered, fixing a few bugs:
- When initializing a transform, `createTransSeqData` would already
create some clamping data for channels. This patch replaces it with
`offset_clamp` (for unconditional clamping which cannot be disabled)
and `handle_xmin/xmax` (for hold offset clamping, which is optional).
- Collecting this data ahead of time is necessary for the double
handle tweak case -- `flushTransSeq` only works one strip at a
time, so we can't clamp post-hoc.
- In `applySeqSlideValue`, we apply `transform_convert_sequencer_clamp`
before values are printed to the header, but let the unclamped values
get flushed to the strips themselves. This is so that we can have the
data later at the individual strip level to recalculate clamps.
Otherwise, if transform values are clamped preemptively, then we have
no idea whether strips are clamped vs. merely resting at their
boundaries.
Note that currently, handle clamping is drawn identically to overlaps.
More information in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/134319
2025-07-16 06:16:19 +02:00
|
|
|
|
|
|
|
|
TFM_MODAL_STRIP_CLAMP = 38,
|
2021-02-03 19:25:16 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2024-11-17 11:22:43 -03:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Transform Data
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/** #TransData.flag */
|
|
|
|
|
enum {
|
|
|
|
|
TD_SELECTED = 1 << 0,
|
|
|
|
|
TD_USEQUAT = 1 << 1,
|
|
|
|
|
/* TD_NOTCONNECTED = 1 << 2, */
|
|
|
|
|
/** Used for scaling of #MetaElem.rad. */
|
2025-03-19 10:35:53 +11:00
|
|
|
TD_SINGLE_SCALE = 1 << 3,
|
2024-11-17 11:22:43 -03:00
|
|
|
/** Scale relative to individual element center. */
|
|
|
|
|
TD_INDIVIDUAL_SCALE = 1 << 4,
|
|
|
|
|
TD_NOCENTER = 1 << 5,
|
|
|
|
|
/** #TransData.ext abused for particle key timing. */
|
|
|
|
|
TD_NO_EXT = 1 << 6,
|
|
|
|
|
/** Don't transform this data. */
|
|
|
|
|
TD_SKIP = 1 << 7,
|
|
|
|
|
/**
|
|
|
|
|
* If this is a bezier triple, we need to restore the handles,
|
|
|
|
|
* if this is set #TransData.hdata needs freeing.
|
|
|
|
|
*/
|
|
|
|
|
TD_BEZTRIPLE = 1 << 8,
|
|
|
|
|
/** When this is set, don't apply translation changes to this element. */
|
|
|
|
|
TD_NO_LOC = 1 << 9,
|
|
|
|
|
/** For Graph Editor auto-snap, indicates that point should not undergo auto-snapping. */
|
|
|
|
|
TD_NOTIMESNAP = 1 << 10,
|
|
|
|
|
/**
|
|
|
|
|
* For Graph Editor - curves that can only have int-values
|
|
|
|
|
* need their keyframes tagged with this.
|
|
|
|
|
*/
|
|
|
|
|
TD_INTVALUES = 1 << 11,
|
|
|
|
|
/** For edit-mode mirror. */
|
|
|
|
|
TD_MIRROR_X = 1 << 12,
|
|
|
|
|
TD_MIRROR_Y = 1 << 13,
|
|
|
|
|
TD_MIRROR_Z = 1 << 14,
|
|
|
|
|
#define TD_MIRROR_EDGE_AXIS_SHIFT 12
|
|
|
|
|
/** For edit-mode mirror, clamp axis to 0. */
|
|
|
|
|
TD_MIRROR_EDGE_X = 1 << 12,
|
|
|
|
|
TD_MIRROR_EDGE_Y = 1 << 13,
|
|
|
|
|
TD_MIRROR_EDGE_Z = 1 << 14,
|
|
|
|
|
/** For F-curve handles, move them along with their keyframes. */
|
|
|
|
|
TD_MOVEHANDLE1 = 1 << 15,
|
|
|
|
|
TD_MOVEHANDLE2 = 1 << 16,
|
|
|
|
|
/**
|
|
|
|
|
* Exceptional case with pose bone rotating when a parent bone has 'Local Location'
|
|
|
|
|
* option enabled and rotating also transforms it.
|
|
|
|
|
*/
|
|
|
|
|
TD_PBONE_LOCAL_MTX_P = 1 << 17,
|
|
|
|
|
/** Same as #TD_PBONE_LOCAL_MTX_P but for a child bone. */
|
|
|
|
|
TD_PBONE_LOCAL_MTX_C = 1 << 18,
|
|
|
|
|
/* Grease pencil layer frames. */
|
|
|
|
|
TD_GREASE_PENCIL_FRAME = 1 << 19,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TransDataBasic {
|
|
|
|
|
/** Extra data (mirrored element pointer, in edit-mode mesh to #BMVert) \
|
|
|
|
|
* (edit-bone for roll fixing) (...). */
|
|
|
|
|
void *extra;
|
|
|
|
|
/** Location of the data to transform. */
|
|
|
|
|
float *loc;
|
|
|
|
|
/** Initial location. */
|
|
|
|
|
float iloc[3];
|
|
|
|
|
/** Individual data center. */
|
|
|
|
|
float center[3];
|
|
|
|
|
/** Value pointer for special transforms. */
|
|
|
|
|
float *val;
|
|
|
|
|
/** Old value. */
|
|
|
|
|
float ival;
|
|
|
|
|
/** Various flags. */
|
|
|
|
|
int flag;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TransDataMirror : public TransDataBasic {
|
|
|
|
|
/** Location of the data to transform. */
|
|
|
|
|
float *loc_src;
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-08 20:47:56 +02:00
|
|
|
/** For objects, poses. 1 single allocation per #TransInfo! */
|
2024-11-17 11:22:43 -03:00
|
|
|
struct TransDataExtension {
|
|
|
|
|
/** Initial object drot. */
|
|
|
|
|
float drot[3];
|
|
|
|
|
#if 0 /* TODO: not yet implemented. */
|
|
|
|
|
/* Initial object `drotAngle`. */
|
|
|
|
|
float drotAngle;
|
|
|
|
|
/* Initial object `drotAxis`. */
|
|
|
|
|
float drotAxis[3];
|
|
|
|
|
#endif
|
|
|
|
|
/** Initial object delta quat. */
|
|
|
|
|
float dquat[4];
|
|
|
|
|
/** Initial object delta scale. */
|
|
|
|
|
float dscale[3];
|
|
|
|
|
/** Rotation of the data to transform. */
|
|
|
|
|
float *rot;
|
|
|
|
|
/** Initial rotation. */
|
|
|
|
|
float irot[3];
|
|
|
|
|
/** Rotation quaternion of the data to transform. */
|
|
|
|
|
float *quat;
|
|
|
|
|
/** Initial rotation quaternion. */
|
|
|
|
|
float iquat[4];
|
|
|
|
|
/** Rotation angle of the data to transform. */
|
|
|
|
|
float *rotAngle;
|
|
|
|
|
/** Initial rotation angle. */
|
|
|
|
|
float irotAngle;
|
|
|
|
|
/** Rotation axis of the data to transform. */
|
|
|
|
|
float *rotAxis;
|
|
|
|
|
/** Initial rotation axis. */
|
|
|
|
|
float irotAxis[4];
|
2025-03-19 10:35:53 +11:00
|
|
|
/**
|
|
|
|
|
* Scale of the data to transform.
|
|
|
|
|
* Note that in some cases this is used for "size" (meta-balls & texture-space for example).
|
|
|
|
|
*/
|
|
|
|
|
float *scale;
|
|
|
|
|
/** Initial scale / size. */
|
|
|
|
|
float iscale[3];
|
2024-11-17 11:22:43 -03:00
|
|
|
/** Object matrix. */
|
|
|
|
|
float obmat[4][4];
|
|
|
|
|
/** Use for #V3D_ORIENT_GIMBAL orientation. */
|
|
|
|
|
float axismtx_gimbal[3][3];
|
|
|
|
|
/** Use instead of #TransData.smtx,
|
|
|
|
|
* It is the same but without the #Bone.bone_mat, see #TD_PBONE_LOCAL_MTX_C. */
|
|
|
|
|
float l_smtx[3][3];
|
|
|
|
|
/**
|
|
|
|
|
* The rotation & scale matrix of pose bone, to allow using snap-align in translation mode,
|
|
|
|
|
* when #TransData.mtx is the location pose bone matrix (and hence can't be used to apply
|
|
|
|
|
* rotation in some cases, namely when a bone is in "No-Local" or "Hinge" mode).
|
|
|
|
|
*/
|
|
|
|
|
float r_mtx[3][3];
|
|
|
|
|
/** Inverse of previous one. */
|
|
|
|
|
float r_smtx[3][3];
|
|
|
|
|
/** Rotation mode, as defined in #eRotationModes (DNA_action_types.h). */
|
|
|
|
|
int rotOrder;
|
|
|
|
|
/** Original object transformation used for rigid bodies. */
|
|
|
|
|
float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TransData2D {
|
|
|
|
|
/** Location of data used to transform (x,y,0). */
|
|
|
|
|
float loc[3];
|
|
|
|
|
union {
|
|
|
|
|
/** Pointer to real 2d location of data. */
|
|
|
|
|
float *loc2d;
|
|
|
|
|
int *loc2d_i;
|
|
|
|
|
};
|
|
|
|
|
/** Pointer to handle locations, if handles aren't being moved independently. */
|
|
|
|
|
float *h1, *h2;
|
|
|
|
|
float ih1[2], ih2[2];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Used to store 2 handles for each #TransData in case the other handle wasn't selected.
|
|
|
|
|
* Also to unset temporary flags.
|
|
|
|
|
*/
|
|
|
|
|
struct TransDataCurveHandleFlags {
|
|
|
|
|
uint8_t ih1, ih2;
|
|
|
|
|
uint8_t *h1, *h2;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TransData : public TransDataBasic {
|
|
|
|
|
/** Distance needed to affect element (for Proportional Editing). */
|
|
|
|
|
float dist;
|
|
|
|
|
/** Distance to the nearest element (for Proportional Editing). */
|
|
|
|
|
float rdist;
|
|
|
|
|
/** Factor of the transformation (for Proportional Editing). */
|
|
|
|
|
float factor;
|
|
|
|
|
/** Transformation matrix from data space to global space. */
|
|
|
|
|
float mtx[3][3];
|
|
|
|
|
/** Transformation matrix from global space to data space. */
|
|
|
|
|
float smtx[3][3];
|
|
|
|
|
/** Axis orientation matrix of the data. */
|
|
|
|
|
float axismtx[3][3];
|
|
|
|
|
/** For objects/bones, the first constraint in its constraint stack. */
|
|
|
|
|
bConstraint *con;
|
|
|
|
|
/** For curves, stores handle flags for modification/cancel. */
|
|
|
|
|
TransDataCurveHandleFlags *hdata;
|
|
|
|
|
/** If set, copy of Object or #bPoseChannel protection. */
|
|
|
|
|
short protectflag;
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-14 15:49:31 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Transform Types
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransSnapPoint {
|
|
|
|
|
TransSnapPoint *next, *prev;
|
2009-12-01 18:26:18 +00:00
|
|
|
float co[3];
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2009-12-01 18:26:18 +00:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransSnap {
|
2024-03-09 23:25:40 +11:00
|
|
|
/* Snapping options stored as flags. */
|
Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes. This patch contains refactored code to improve this. This patch does (should) not change functionality of snapping.
Clarified ambiguously / incorrectly named attributes.
- "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped. Moreover, the implications of the previous terms do not match the descriptions. For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
- "Select" refers to the condition for an object to be a possible target for snapping.
- `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).
Refactored related `#define` into `enum`s. In particular, constants relating to...
- `ToolSettings.snap_flag` are now in `enum eSnapFlag`
- `ToolSettings.snap_mode` are now in `enum eSnapMode`
- `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
- `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`
As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous. For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source. This patch also adds a small amount of clarity.
This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.
Note: I did leave myself some comments to follow-up with further refactoring. Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`). If the API is going to change, it would be good to make sure that the used terms are descriptive enough. For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming. Perhaps `use_snap` might be an improvement that's more consistent with other conventions.
This patch is (mostly) a subset of D14591, as suggested by @mano-wii.
Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method. Also, there might be reason to create additional snapping methods or options. (Indeed, D14591 heads in this direction). This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:28:14 -04:00
|
|
|
eSnapFlag flag;
|
2024-03-09 23:25:40 +11:00
|
|
|
/* Method(s) used for snapping source to target. */
|
Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes. This patch contains refactored code to improve this. This patch does (should) not change functionality of snapping.
Clarified ambiguously / incorrectly named attributes.
- "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped. Moreover, the implications of the previous terms do not match the descriptions. For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
- "Select" refers to the condition for an object to be a possible target for snapping.
- `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).
Refactored related `#define` into `enum`s. In particular, constants relating to...
- `ToolSettings.snap_flag` are now in `enum eSnapFlag`
- `ToolSettings.snap_mode` are now in `enum eSnapMode`
- `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
- `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`
As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous. For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source. This patch also adds a small amount of clarity.
This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.
Note: I did leave myself some comments to follow-up with further refactoring. Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`). If the API is going to change, it would be good to make sure that the used terms are descriptive enough. For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming. Perhaps `use_snap` might be an improvement that's more consistent with other conventions.
This patch is (mostly) a subset of D14591, as suggested by @mano-wii.
Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method. Also, there might be reason to create additional snapping methods or options. (Indeed, D14591 heads in this direction). This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:28:14 -04:00
|
|
|
eSnapMode mode;
|
2024-03-09 23:25:40 +11:00
|
|
|
/* Part of source to snap to target. */
|
2023-01-12 10:16:25 -03:00
|
|
|
eSnapSourceOP source_operation;
|
2024-03-09 23:25:40 +11:00
|
|
|
/* Determines which objects are possible target. */
|
2023-01-12 10:16:25 -03:00
|
|
|
eSnapTargetOP target_operation;
|
Transform Snap: nearest face snap mode, snapping options, refactoring.
This commit adds a new face nearest snapping mode, adds new snapping
options, and (lightly) refactors code around snapping.
The new face nearest snapping mode will snap transformed geometry to the
nearest surface in world space. In contrast, the original face snapping
mode uses projection (raycasting) to snap source to target geometry.
Face snapping therefore only works with what is visible, while nearest
face snapping can snap geometry to occluded parts of the scene. This new
mode is critical for retopology work, where some of the target mesh
might be occluded (ex: sliding an edge loop that wraps around the
backside of target mesh).
The nearest face snapping mode has two options: "Snap to Same Target"
and "Face Nearest Steps". When the Snap to Same Object option is
enabled, the selected source geometry will stay near the target that it
is nearest before editing started, which prevents the source geometry
from snapping to other targets. The Face Nearest Steps divides the
overall transformation for each vertex into n smaller transformations,
then applies those n transformations with surface snapping interlacing
each step. This steps option handles transformations that cross U-shaped
targets better.
The new snapping options allow the artist to better control which target
objects (objects to which the edited geometry is snapped) are considered
when snapping. In particular, the only option for filtering target
objects was a "Project onto Self", which allowed the currently edited
mesh to be considered as a target. Now, the artist can choose any
combination of the following to be considered as a target: the active
object, any edited object that isn't active (see note below), any non-
edited object. Additionally, the artist has another snapping option to
exclude objects that are not selectable as potential targets.
The Snapping Options dropdown has been lightly reorganized to allow for
the additional options.
Included in this patch:
- Snap target selection is more controllable for artist with additional
snapping options.
- Renamed a few of the snap-related functions to better reflect what
they actually do now. For example, `applySnapping` implies that this
handles the snapping, while `applyProject` implies something entirely
different is done there. However, better names would be
`applySnappingAsGroup` and `applySnappingIndividual`, respectively,
where `applySnappingIndividual` previously only does Face snapping.
- Added an initial coordinate parameter to snapping functions so that
the nearest target before transforming can be determined(for "Snap to
Same Object"), and so the transformation can be broken into smaller
steps (for "Face Nearest Steps").
- Separated the BVH Tree getter code from mesh/edit mesh to its own
function to reduce code duplication.
- Added icon for nearest face snapping.
- The original "Project onto Self" was actually not correct! This option
should be called "Project onto Active" instead, but that only matters
when editing multiple meshes at the same time. This patch makes this
change in the UI.
Reviewed By: Campbell Barton, Germano Cavalcante
Differential Revision: https://developer.blender.org/D14591
2022-06-29 20:52:00 -04:00
|
|
|
short face_nearest_steps;
|
2021-02-03 19:25:16 -03:00
|
|
|
eTSnap status;
|
2019-08-23 15:20:25 -03:00
|
|
|
/* Snapped Element Type (currently for objects only). */
|
2023-09-27 16:25:55 -03:00
|
|
|
eSnapMode source_type;
|
2023-06-23 15:36:57 -03:00
|
|
|
eSnapMode target_type;
|
2024-07-06 15:24:52 +02:00
|
|
|
/* For independent snapping in different directions (currently used only by VSE preview). */
|
|
|
|
|
eSnapDir direction;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Snapping from this point (in global-space). */
|
2023-01-12 10:16:25 -03:00
|
|
|
float snap_source[3];
|
2024-03-09 23:25:40 +11:00
|
|
|
/** To this point (in global-space). */
|
2023-01-12 10:16:25 -03:00
|
|
|
float snap_target[3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float snapNormal[3];
|
2009-12-01 18:26:18 +00:00
|
|
|
ListBase points;
|
2011-12-26 20:23:07 +00:00
|
|
|
TransSnapPoint *selectedPoint;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
double last;
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*snap_target_fn)(TransInfo *, float *);
|
|
|
|
|
void (*snap_source_fn)(TransInfo *);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-04-21 11:29:32 +10:00
|
|
|
/**
|
|
|
|
|
* Re-usable snap context data.
|
|
|
|
|
*/
|
2021-06-29 20:12:19 +02:00
|
|
|
union {
|
2023-07-13 17:59:52 +02:00
|
|
|
SnapObjectContext *object_context;
|
|
|
|
|
TransSeqSnapData *seq_context;
|
2021-06-29 20:12:19 +02:00
|
|
|
};
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransCon {
|
2019-03-01 10:45:22 +11:00
|
|
|
/** Description of the constraint for header_print. */
|
2019-01-08 10:28:20 +11:00
|
|
|
char text[50];
|
2019-03-01 10:45:22 +11:00
|
|
|
/** Projection constraint matrix (same as #imtx with some axis == 0). */
|
2019-01-08 10:28:20 +11:00
|
|
|
float pmtx[3][3];
|
2019-03-01 10:45:22 +11:00
|
|
|
/** Mode flags of the constraint. */
|
2021-02-03 19:25:16 -03:00
|
|
|
eTConstraint mode;
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*drawExtra)(TransInfo *t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: if 'tc' is NULL, 'td' must also be NULL.
|
2019-01-08 10:28:20 +11:00
|
|
|
* For constraints that needs to draw differently from the other
|
|
|
|
|
* uses this instead of the generic draw function. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Apply function pointer for linear vectorial transformation
|
|
|
|
|
* The last three parameters are pointers to the in/out/printable vectors. */
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*applyVec)(const TransInfo *t,
|
|
|
|
|
const TransDataContainer *tc,
|
|
|
|
|
const TransData *td,
|
2018-04-16 16:27:55 +02:00
|
|
|
const float in[3],
|
2021-06-29 20:13:55 +10:00
|
|
|
float r_out[3]);
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Apply function pointer for size transformation. */
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*applySize)(const TransInfo *t,
|
|
|
|
|
const TransDataContainer *tc,
|
|
|
|
|
const TransData *td,
|
2021-06-29 20:13:55 +10:00
|
|
|
float r_smat[3][3]);
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Apply function pointer for rotation transformation. */
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*applyRot)(const TransInfo *t,
|
|
|
|
|
const TransDataContainer *tc,
|
|
|
|
|
const TransData *td,
|
Refactor: Transform: Unify logic of "orient_axis" and "constraint_axis"
In rotation-based transform operations, the rotation axis can be
determined in two ways:
1. Through "orient_axis" (X, Y or Z)
2. Through "constraint_axis"
When the axis is obtained through the constraint, "orient_axis" is
ignored, and the angle may be negated depending on the view orientation
to match the mouse movement.
However, "orient_axis" never has its angle negated. Since the default
orientation is "View", the Z axis is inverted by default, aligning with
the mouse movement but not with the constraint axis.
This causes problems in the Redo Panel because the constraint fields
are hidden in the Rotation operation, so they need to be unset for the
Axis field to work. However, if you change the value of the Rotation
field, the object may have its rotation negated unexpectedly.
This issue was partially shown in #93078. Commit c30e6a37b0 attempted
to fix it by unsetting the constraint property when the Axis was
changed. However, this solution is incomplete: if the Axis is changed
and then reverted, the negative rotation issue reappears. In addition,
it has not been implemented in all operations.
This commit resolves the issue by reverting c30e6a37b0, aligning the
behavior of "orient_axis" and "constraint_axis", and unsetting
"constraint_axis" in `saveTranform`.
A downside of this solution is that it may break operators invoked from
Python that rely on "orient_axis" as the rotation axis, as the rotation
value now needs to be negated.
Pull Request: https://projects.blender.org/blender/blender/pulls/141101
2025-07-04 20:47:25 +02:00
|
|
|
float r_axis[3]);
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct MouseInput {
|
|
|
|
|
void (*apply)(TransInfo *t, MouseInput *mi, const double mval[2], float output[3]);
|
|
|
|
|
void (*post)(TransInfo *t, float values[3]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Initial mouse position. */
|
2025-02-18 01:27:04 +01:00
|
|
|
float2 imval;
|
|
|
|
|
float2 center;
|
2008-12-29 20:37:54 +00:00
|
|
|
float factor;
|
2022-08-26 13:17:30 -03:00
|
|
|
float precision_factor;
|
|
|
|
|
bool precision;
|
|
|
|
|
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Additional data, if needed by the particular function. */
|
|
|
|
|
void *data;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-30 17:31:07 +11:00
|
|
|
/**
|
2015-11-07 17:31:28 +11:00
|
|
|
* Use virtual cursor, which takes precision into account
|
2015-10-30 17:31:07 +11:00
|
|
|
* keeping track of the cursors 'virtual' location,
|
|
|
|
|
* to avoid jumping values when its toggled.
|
|
|
|
|
*
|
|
|
|
|
* This works well for scaling drag motion,
|
2020-09-06 01:45:38 +10:00
|
|
|
* but not for rotating around a point (rotation needs its own custom accumulator)
|
2015-10-30 17:31:07 +11:00
|
|
|
*/
|
|
|
|
|
bool use_virtual_mval;
|
|
|
|
|
struct {
|
2025-02-18 01:27:04 +01:00
|
|
|
double2 prev;
|
|
|
|
|
double2 accum;
|
2015-10-30 17:31:07 +11:00
|
|
|
} virtual_mval;
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2008-12-29 20:37:54 +00:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransCustomData {
|
2016-02-01 15:15:10 +11:00
|
|
|
void *data;
|
2023-07-13 17:59:52 +02:00
|
|
|
void (*free_cb)(TransInfo *, TransDataContainer *tc, TransCustomData *custom_data);
|
2016-02-01 15:15:10 +11:00
|
|
|
unsigned int use_free : 1;
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2016-02-01 15:15:10 +11:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/**
|
|
|
|
|
* Rule of thumb for choosing between mode/type:
|
|
|
|
|
* - If transform mode uses the data, assign to `mode`
|
2023-07-31 11:50:54 +10:00
|
|
|
* (typically in `transform.cc`).
|
2018-04-16 16:27:55 +02:00
|
|
|
* - If conversion uses the data as an extension to the #TransData, assign to `type`
|
|
|
|
|
* (typically in transform_conversion.c).
|
|
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransCustomDataContainer {
|
2021-06-26 21:35:18 +10:00
|
|
|
/** Owned by the mode (grab, scale, bend... ). */
|
2018-04-16 16:27:55 +02:00
|
|
|
union {
|
|
|
|
|
TransCustomData mode, first_elem;
|
|
|
|
|
};
|
|
|
|
|
TransCustomData type;
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2018-04-16 16:27:55 +02:00
|
|
|
#define TRANS_CUSTOM_DATA_ELEM_MAX (sizeof(TransCustomDataContainer) / sizeof(TransCustomData))
|
|
|
|
|
|
2021-03-13 03:12:24 +11:00
|
|
|
/**
|
|
|
|
|
* Container for Transform Data
|
|
|
|
|
*
|
2021-05-21 22:19:46 +10:00
|
|
|
* Used to implement multi-object modes, so each object can have its
|
2021-03-13 03:12:24 +11:00
|
|
|
* own data array as well as object matrix, local center etc.
|
|
|
|
|
*
|
|
|
|
|
* Anything that can't be shared between all objects
|
|
|
|
|
* and doesn't make sense to store for every vertex (in the #TransDataContainer.data).
|
|
|
|
|
*
|
|
|
|
|
* \note at some point this could be used to store non object containers
|
2021-05-21 22:19:46 +10:00
|
|
|
* although this only makes sense if each container has its own matrices,
|
2021-03-13 03:12:24 +11:00
|
|
|
* otherwise all elements may as well be stored in one array (#TransDataContainer.data),
|
|
|
|
|
* as is already done for curve-objects, f-curves. etc.
|
|
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransDataContainer {
|
2018-04-16 16:27:55 +02:00
|
|
|
/** Transformed data (array). */
|
|
|
|
|
TransData *data;
|
|
|
|
|
/** Transformed data extension (array). */
|
|
|
|
|
TransDataExtension *data_ext;
|
|
|
|
|
/** Transformed data for 2d (array). */
|
|
|
|
|
TransData2D *data_2d;
|
2020-06-08 08:23:04 -03:00
|
|
|
/** Transformed data for mirror elements (array). */
|
|
|
|
|
TransDataMirror *data_mirror;
|
|
|
|
|
|
|
|
|
|
/** Total number of transformed data, data_ext, data_2d. */
|
|
|
|
|
int data_len;
|
|
|
|
|
/** Total number of transformed data_mirror. */
|
|
|
|
|
int data_mirror_len;
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
/** Total number of transformed gp-frames. */
|
|
|
|
|
int data_gpf_len;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
Object *obedit;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-04 14:41:51 +02:00
|
|
|
float mat[4][4];
|
|
|
|
|
float imat[4][4];
|
|
|
|
|
/** 3x3 copies of matrices above. */
|
|
|
|
|
float mat3[3][3];
|
|
|
|
|
float imat3[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Normalized #mat3. */
|
2018-05-04 14:41:51 +02:00
|
|
|
float mat3_unit[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** If `t->flag & T_POSE`, this denotes pose object. */
|
2023-07-13 17:59:52 +02:00
|
|
|
Object *poseobj;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/** Center of transformation (in local-space), Calculated from #TransInfo.center_global. */
|
|
|
|
|
float center_local[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-14 14:59:18 +11:00
|
|
|
/**
|
2020-06-08 08:23:04 -03:00
|
|
|
* Use for cases we care about the active, eg: active vert of active mesh.
|
|
|
|
|
* if set this will _always_ be the first item in the array.
|
2019-01-14 14:59:18 +11:00
|
|
|
*/
|
2020-06-08 08:23:04 -03:00
|
|
|
bool is_active;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store matrix, this avoids having to have duplicate check all over
|
2024-02-14 16:14:49 +01:00
|
|
|
* Typically: 'obedit->object_to_world().ptr()' or 'poseobj->object_to_world().ptr()', but may be
|
|
|
|
|
* used elsewhere too.
|
2020-06-08 08:23:04 -03:00
|
|
|
*/
|
|
|
|
|
bool use_local_mat;
|
|
|
|
|
|
2021-03-21 13:18:20 +11:00
|
|
|
/** Mirror option. */
|
2020-06-08 08:23:04 -03:00
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
uint use_mirror_axis_x : 1;
|
|
|
|
|
uint use_mirror_axis_y : 1;
|
|
|
|
|
uint use_mirror_axis_z : 1;
|
2019-09-11 13:48:42 -03:00
|
|
|
};
|
2020-06-08 08:23:04 -03:00
|
|
|
/* For easy checking. */
|
|
|
|
|
char use_mirror_axis_any;
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
TransCustomDataContainer custom;
|
Fix #139042: use index map instead of sorting transform system data
Avoid modifying the order of transform system data. Instead, create an
index map and use that to traverse the data arrays in sorted order.
The issue observed in #139042 stems from the assumption, in _some_ of
the code, that `tc->data[i]`, `tc->data_ext[i]`, and `tc->data_2d[i]`
all contain information about the same "transformable thing". Since
`tc->data` was sorted (by selection state and, optionally for
proportional editing, by distance) but the other arrays were not, this
caused issues.
The most obvious solution, sorting all arrays the same way, turned out
to be hard to do, as some elements in one array have pointers to
elements in another array. Reordering those arrays would therefore
also make it necessary to find and update those pointers.
Instead, I decided to implement a sorted index map. The arrays can
then be kept in their original order, and the index map can be used to
visit them in sorted order.
Pull Request: https://projects.blender.org/blender/blender/pulls/140132
2025-06-19 11:20:08 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Array of indices for the `data`, `data_ext`, and `data_2d` arrays.
|
|
|
|
|
*
|
|
|
|
|
* When using this index map to traverse the arrays, they will be sorted primarily by selection
|
|
|
|
|
* state (selected before unselected). Depending on the sort function used (see below),
|
|
|
|
|
* unselected items are then sorted by their "distance" for proportional editing.
|
|
|
|
|
*
|
2025-07-07 15:44:12 +02:00
|
|
|
* At the moment of writing, this map is only used in cases where `tc->data` has a mixture of
|
|
|
|
|
* selected and unselected items (as far as I, Sybren, know, just for proportial editing).
|
|
|
|
|
* Without `tc->sorted_index_map`, all items in `tc->data` are expected to be selected.
|
|
|
|
|
*
|
Fix #139042: use index map instead of sorting transform system data
Avoid modifying the order of transform system data. Instead, create an
index map and use that to traverse the data arrays in sorted order.
The issue observed in #139042 stems from the assumption, in _some_ of
the code, that `tc->data[i]`, `tc->data_ext[i]`, and `tc->data_2d[i]`
all contain information about the same "transformable thing". Since
`tc->data` was sorted (by selection state and, optionally for
proportional editing, by distance) but the other arrays were not, this
caused issues.
The most obvious solution, sorting all arrays the same way, turned out
to be hard to do, as some elements in one array have pointers to
elements in another array. Reordering those arrays would therefore
also make it necessary to find and update those pointers.
Instead, I decided to implement a sorted index map. The arrays can
then be kept in their original order, and the index map can be used to
visit them in sorted order.
Pull Request: https://projects.blender.org/blender/blender/pulls/140132
2025-06-19 11:20:08 +02:00
|
|
|
* NOTE: this is set to `nullptr` by default; use one of the sorting functions below to
|
|
|
|
|
* initialize the array.
|
|
|
|
|
*
|
|
|
|
|
* \see #sort_trans_data_selected_first Sorts only by selection state.
|
|
|
|
|
* \see #sort_trans_data_dist Sorts by selection state and distance.
|
|
|
|
|
*/
|
|
|
|
|
int *sorted_index_map;
|
2025-06-22 11:54:17 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Call the given function for each index in the data. This index can then be
|
|
|
|
|
* used to access the `data`, `data_ext`, and `data_2d` arrays.
|
|
|
|
|
*
|
|
|
|
|
* If there is a `sorted_index_map` (see above), this will be used. Otherwise
|
|
|
|
|
* it is assumed that the arrays can be iterated in their natural array order.
|
|
|
|
|
*
|
|
|
|
|
* \param fn: function that's called for each index. The function should
|
|
|
|
|
* return whether to keep looping (true) or break out of the loop (false).
|
|
|
|
|
*
|
|
|
|
|
* \return whether the end of the loop was reached.
|
|
|
|
|
*/
|
|
|
|
|
bool foreach_index(FunctionRef<bool(int)> fn) const
|
|
|
|
|
{
|
|
|
|
|
if (this->sorted_index_map) {
|
|
|
|
|
for (const int i : Span(this->sorted_index_map, this->data_len)) {
|
|
|
|
|
if (!fn(i)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (const int i : IndexRange(this->data_len)) {
|
|
|
|
|
if (!fn(i)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Call \a fn only for indices of selected items.
|
|
|
|
|
* Apart from that, this is the same as `index_map()` above.
|
|
|
|
|
*
|
|
|
|
|
* \param fn: function that's called for each index. Contrary to the `index_map()` function, it
|
|
|
|
|
* is assumed that all selected items should be visited, and so for simplicity there is no `bool`
|
|
|
|
|
* to return.
|
|
|
|
|
*/
|
|
|
|
|
void foreach_index_selected(FunctionRef<void(int)> fn) const
|
|
|
|
|
{
|
|
|
|
|
this->foreach_index([&](const int i) {
|
|
|
|
|
const bool is_selected = (this->data[i].flag & TD_SELECTED);
|
|
|
|
|
if (!is_selected) {
|
|
|
|
|
/* Selected items are sorted first. Either this is trivially true
|
|
|
|
|
* (proportional editing off, so the only transformed data is the
|
|
|
|
|
* selected data) or it's handled by `sorted_index_map`. */
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
fn(i);
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
struct TransInfo {
|
2018-04-16 16:27:55 +02:00
|
|
|
TransDataContainer *data_container;
|
|
|
|
|
int data_container_len;
|
2020-06-07 18:48:33 -03:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/** Combine length of all #TransDataContainer.data_len
|
|
|
|
|
* Use to check if nothing is selected or if we have a single selection. */
|
|
|
|
|
int data_len_all;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** TODO: It should be a member of #TransDataContainer. */
|
2023-07-13 17:59:52 +02:00
|
|
|
TransConvertTypeInfo *data_type;
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2023-06-02 14:42:27 +02:00
|
|
|
/** Mode indicator as set for the operator.
|
|
|
|
|
* NOTE: A same `mode_info` can have different `mode`s. */
|
|
|
|
|
eTfmMode mode;
|
2023-07-13 17:59:52 +02:00
|
|
|
TransModeInfo *mode_info;
|
2023-06-02 14:42:27 +02:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** Current context/options for transform. */
|
|
|
|
|
eTContext options;
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Generic flags for special behaviors. */
|
2021-02-03 19:25:16 -03:00
|
|
|
eTFlag flag;
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Special modifiers, by function, not key. */
|
2021-02-03 19:25:16 -03:00
|
|
|
eTModifier modifiers;
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Current state (running, canceled. */
|
2021-02-03 19:25:16 -03:00
|
|
|
eTState state;
|
|
|
|
|
/** Redraw flag. */
|
|
|
|
|
eRedrawFlag redraw;
|
|
|
|
|
/** Choice of custom cursor with or without a help line from the gizmo to the mouse position. */
|
|
|
|
|
eTHelpline helpline;
|
2022-06-05 23:09:33 +10:00
|
|
|
|
2021-02-03 19:25:16 -03:00
|
|
|
/** Constraint Data. */
|
2019-01-08 10:28:20 +11:00
|
|
|
TransCon con;
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Snap Data. */
|
2010-03-22 09:30:00 +00:00
|
|
|
TransSnap tsnap;
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Numerical input. */
|
2019-01-08 10:28:20 +11:00
|
|
|
NumInput num;
|
2021-02-03 19:25:16 -03:00
|
|
|
|
|
|
|
|
/** Mouse input. */
|
2019-01-08 10:28:20 +11:00
|
|
|
MouseInput mouse;
|
2021-02-03 19:25:16 -03:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Proportional circle radius. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float prop_size;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Proportional falloff text. */
|
2019-01-08 10:28:20 +11:00
|
|
|
char proptext[20];
|
|
|
|
|
/**
|
2023-07-16 15:50:02 +10:00
|
|
|
* Spaces using non 1:1 aspect, (UV's, F-curve, movie-clip... etc).
|
2019-01-08 10:28:20 +11:00
|
|
|
* use for conversion and snapping.
|
|
|
|
|
*/
|
|
|
|
|
float aspect[3];
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Center of transformation (in global-space). */
|
2019-01-08 10:28:20 +11:00
|
|
|
float center_global[3];
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Center in screen coordinates. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float center2d[2];
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Maximum index on the input vector. */
|
2019-01-08 10:28:20 +11:00
|
|
|
short idx_max;
|
2025-06-25 17:31:01 +02:00
|
|
|
/** Increment value for incremental snapping. */
|
|
|
|
|
float3 increment;
|
|
|
|
|
float increment_precision;
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Spatial snapping gears(even when rotating, scaling... etc). */
|
2022-10-22 12:00:01 -03:00
|
|
|
float snap_spatial[3];
|
|
|
|
|
/**
|
|
|
|
|
* Precision factor that is multiplied to snap_spatial when precision
|
2025-06-25 17:31:01 +02:00
|
|
|
* modifier is enabled for snap to grid.
|
2022-10-22 12:00:01 -03:00
|
|
|
*/
|
|
|
|
|
float snap_spatial_precision;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Mouse side of the current frame, 'L', 'R' or 'B'. */
|
2019-01-08 10:28:20 +11:00
|
|
|
char frame_side;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Copy from #RegionView3D, prevents feedback. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float viewmat[4][4];
|
2024-03-09 23:25:40 +11:00
|
|
|
/** And to make sure we don't have to. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float viewinv[4][4];
|
2022-02-04 16:06:15 +11:00
|
|
|
/** Access #RegionView3D from other space types. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float persmat[4][4];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float persinv[4][4];
|
|
|
|
|
short persp;
|
|
|
|
|
short around;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Space-type where transforming is. */
|
2019-01-08 10:28:20 +11:00
|
|
|
char spacetype;
|
2021-08-06 11:44:15 -03:00
|
|
|
/** Type of active object being edited. */
|
2019-01-08 10:28:20 +11:00
|
|
|
short obedit_type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Translation, to show for widget. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float vec[3];
|
2020-11-06 10:29:01 +11:00
|
|
|
/** Rotate/re-scale, to show for widget. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float mat[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Orientation matrix of the current space. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float spacemtx[3][3];
|
2020-05-20 16:22:10 -03:00
|
|
|
float spacemtx_inv[3][3];
|
2025-05-23 03:58:32 +00:00
|
|
|
/** Name of the current space. */
|
|
|
|
|
char spacename[/*MAX_NAME*/ 64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/*************** NEW STUFF *********************/
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Event type used to launch transform. */
|
2020-12-04 10:35:26 -03:00
|
|
|
short launch_event;
|
2022-03-02 14:53:15 +11:00
|
|
|
/**
|
|
|
|
|
* Is the actual launch event a drag event?
|
|
|
|
|
* (`launch_event` is set to the corresponding mouse button then.)
|
|
|
|
|
*/
|
|
|
|
|
bool is_launch_event_drag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-11-26 10:45:28 -03:00
|
|
|
bool is_orient_default_overwrite;
|
2021-05-11 23:40:06 -03:00
|
|
|
|
2018-11-28 10:01:16 +11:00
|
|
|
struct {
|
2020-05-22 12:34:29 -03:00
|
|
|
short type;
|
|
|
|
|
float matrix[3][3];
|
|
|
|
|
} orient[3];
|
2021-05-11 22:40:56 -03:00
|
|
|
|
2023-02-11 15:20:38 -03:00
|
|
|
eTOType orient_curr;
|
2020-05-22 12:34:29 -03:00
|
|
|
|
2021-11-11 21:14:10 +11:00
|
|
|
/**
|
|
|
|
|
* All values from `TransInfo.orient[].type` converted into a flag
|
|
|
|
|
* to allow quickly checking which orientation types are used.
|
|
|
|
|
*/
|
|
|
|
|
int orient_type_mask;
|
|
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
short prop_mode;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-02 01:15:33 -03:00
|
|
|
/** Value taken as input, either through mouse coordinates or entered as a parameter. */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float values[4];
|
2019-08-02 01:15:33 -03:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** Offset applied on top of modal input. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float values_modal_offset[4];
|
2019-08-02 01:15:33 -03:00
|
|
|
|
|
|
|
|
/** Final value of the transformation (displayed in the redo panel).
|
|
|
|
|
* If the operator is executed directly (not modal), this value is usually the
|
|
|
|
|
* value of the input parameter, except when a constrain is entered. */
|
|
|
|
|
float values_final[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-08-27 16:51:53 +12:00
|
|
|
/** Cache safe value for constraints that require iteration or are slow to calculate. */
|
|
|
|
|
float values_inside_constraints[4];
|
|
|
|
|
|
2019-03-01 10:12:26 +11:00
|
|
|
/* Axis members for modes that use an axis separate from the orientation (rotate & shear). */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-01 10:12:26 +11:00
|
|
|
/** Primary axis, rotate only uses this. */
|
2019-02-26 20:22:54 +11:00
|
|
|
int orient_axis;
|
2019-03-01 10:12:26 +11:00
|
|
|
/** Secondary axis, shear uses this. */
|
2019-02-26 20:22:54 +11:00
|
|
|
int orient_axis_ortho;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Remove elements if operator is canceled. */
|
2019-01-08 10:28:20 +11:00
|
|
|
bool remove_on_cancel;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
void *view;
|
2019-01-08 10:28:20 +11:00
|
|
|
/** Only valid (non null) during an operator called function. */
|
2023-07-13 17:59:52 +02:00
|
|
|
bContext *context;
|
|
|
|
|
wmMsgBus *mbus;
|
|
|
|
|
ScrArea *area;
|
|
|
|
|
ARegion *region;
|
|
|
|
|
Depsgraph *depsgraph;
|
|
|
|
|
Scene *scene;
|
|
|
|
|
ViewLayer *view_layer;
|
|
|
|
|
ToolSettings *settings;
|
|
|
|
|
wmTimer *animtimer;
|
2020-11-06 10:29:01 +11:00
|
|
|
/** Needed so we can perform a look up for header text. */
|
2023-07-13 17:59:52 +02:00
|
|
|
wmKeyMap *keymap;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Assign from the operator, or can be NULL. */
|
2023-07-13 17:59:52 +02:00
|
|
|
ReportList *reports;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Current mouse position. */
|
2025-02-18 01:27:04 +01:00
|
|
|
float2 mval;
|
2024-03-09 23:25:40 +11:00
|
|
|
/** Use for 3d view. */
|
2019-01-08 10:28:20 +11:00
|
|
|
float zfac;
|
2010-03-22 09:30:00 +00:00
|
|
|
void *draw_handle_view;
|
|
|
|
|
void *draw_handle_pixel;
|
|
|
|
|
void *draw_handle_cursor;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-12 17:00:07 +02:00
|
|
|
/** Currently only used for random curve of proportional editing. */
|
2023-07-13 17:59:52 +02:00
|
|
|
RNG *rng;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
ViewOpsData *vod;
|
2023-05-19 23:45:27 +02:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/** Typically for mode settings. */
|
|
|
|
|
TransCustomDataContainer custom;
|
2022-08-15 14:52:02 -07:00
|
|
|
|
|
|
|
|
/* Needed for sculpt transform. */
|
|
|
|
|
const char *undo_name;
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** \} */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Public Transform API
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2023-10-19 18:53:16 +11:00
|
|
|
* \note Caller needs to free `t` on a 0 return.
|
2021-12-09 00:55:11 +11:00
|
|
|
* \warning \a event might be NULL (when tweaking from redo panel)
|
|
|
|
|
* \see #saveTransform which writes these values back.
|
|
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* \see #initTransform which reads values from the operator.
|
|
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
void saveTransform(bContext *C, TransInfo *t, wmOperator *op);
|
2025-03-20 21:11:06 +00:00
|
|
|
wmOperatorStatus transformEvent(TransInfo *t, wmOperator *op, const wmEvent *event);
|
2023-07-13 17:59:52 +02:00
|
|
|
void transformApply(bContext *C, TransInfo *t);
|
2025-03-20 21:11:06 +00:00
|
|
|
wmOperatorStatus transformEnd(bContext *C, TransInfo *t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
void setTransformViewMatrices(TransInfo *t);
|
2015-06-26 15:45:09 +10:00
|
|
|
void setTransformViewAspect(TransInfo *t, float r_aspect[3]);
|
2015-10-30 17:31:07 +11:00
|
|
|
void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy);
|
2025-07-10 05:29:47 +00:00
|
|
|
/**
|
|
|
|
|
* If viewport projection fails, calculate a usable fallback.
|
|
|
|
|
*/
|
|
|
|
|
void projectFloatViewCenterFallback(TransInfo *t, float adr[2]);
|
2022-01-07 11:38:08 +11:00
|
|
|
void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], eV3DProjTest flag);
|
2012-03-12 06:53:47 +00:00
|
|
|
void projectIntView(TransInfo *t, const float vec[3], int adr[2]);
|
2022-01-07 11:38:08 +11:00
|
|
|
void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], eV3DProjTest flag);
|
2012-03-12 06:53:47 +00:00
|
|
|
void projectFloatView(TransInfo *t, const float vec[3], float adr[2]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-03-30 11:08:33 +11:00
|
|
|
void applyAspectRatio(TransInfo *t, float vec[2]);
|
|
|
|
|
void removeAspectRatio(TransInfo *t, float vec[2]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2023-07-31 11:50:54 +10:00
|
|
|
* Called in `transform_ops.cc`, on each regeneration of key-maps.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf);
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
2022-06-05 23:09:33 +10:00
|
|
|
/**
|
|
|
|
|
* Transform a single matrix using the current `t->final_values`.
|
|
|
|
|
*/
|
|
|
|
|
bool transform_apply_matrix(TransInfo *t, float mat[4][4]);
|
|
|
|
|
void transform_final_value_get(const TransInfo *t, float *value, int value_num);
|
Refactor: Transform: Unify logic of "orient_axis" and "constraint_axis"
In rotation-based transform operations, the rotation axis can be
determined in two ways:
1. Through "orient_axis" (X, Y or Z)
2. Through "constraint_axis"
When the axis is obtained through the constraint, "orient_axis" is
ignored, and the angle may be negated depending on the view orientation
to match the mouse movement.
However, "orient_axis" never has its angle negated. Since the default
orientation is "View", the Z axis is inverted by default, aligning with
the mouse movement but not with the constraint axis.
This causes problems in the Redo Panel because the constraint fields
are hidden in the Rotation operation, so they need to be unset for the
Axis field to work. However, if you change the value of the Rotation
field, the object may have its rotation negated unexpectedly.
This issue was partially shown in #93078. Commit c30e6a37b0 attempted
to fix it by unsetting the constraint property when the Axis was
changed. However, this solution is incomplete: if the Axis is changed
and then reverted, the negative rotation issue reappears. In addition,
it has not been implemented in all operations.
This commit resolves the issue by reverting c30e6a37b0, aligning the
behavior of "orient_axis" and "constraint_axis", and unsetting
"constraint_axis" in `saveTranform`.
A downside of this solution is that it may break operators invoked from
Python that rely on "orient_axis" as the rotation axis, as the rotation
value now needs to be negated.
Pull Request: https://projects.blender.org/blender/blender/pulls/141101
2025-07-04 20:47:25 +02:00
|
|
|
void view_vector_calc(const TransInfo *t, const float focus[3], float r_vec[3]);
|
2022-06-05 23:09:33 +10:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** \} */
|
2017-04-07 00:35:57 +10:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
2024-02-22 01:31:30 -03:00
|
|
|
/** \name General Utils
|
2020-11-06 10:29:01 +11:00
|
|
|
* \{ */
|
|
|
|
|
|
2024-11-02 17:27:09 +11:00
|
|
|
/** Calculates projection vector based on a location. */
|
2024-03-06 13:05:44 -03:00
|
|
|
void transform_view_vector_calc(const TransInfo *t, const float focus[3], float r_vec[3]);
|
2014-11-27 21:37:42 +01:00
|
|
|
bool transdata_check_local_islands(TransInfo *t, short around);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Mouse Input
|
|
|
|
|
* \{ */
|
2008-12-29 20:37:54 +00:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
enum MouseInputMode {
|
2008-12-29 20:37:54 +00:00
|
|
|
INPUT_NONE,
|
|
|
|
|
INPUT_VECTOR,
|
|
|
|
|
INPUT_SPRING,
|
|
|
|
|
INPUT_SPRING_FLIP,
|
2014-06-03 22:02:02 +06:00
|
|
|
INPUT_SPRING_DELTA,
|
2008-12-29 20:37:54 +00:00
|
|
|
INPUT_ANGLE,
|
2013-10-13 01:09:23 +00:00
|
|
|
INPUT_ANGLE_SPRING,
|
2008-12-29 20:37:54 +00:00
|
|
|
INPUT_TRACKBALL,
|
|
|
|
|
INPUT_HORIZONTAL_RATIO,
|
|
|
|
|
INPUT_HORIZONTAL_ABSOLUTE,
|
|
|
|
|
INPUT_VERTICAL_RATIO,
|
2009-09-21 00:48:36 +00:00
|
|
|
INPUT_VERTICAL_ABSOLUTE,
|
2013-01-31 22:18:37 +00:00
|
|
|
INPUT_CUSTOM_RATIO,
|
2014-06-03 22:02:02 +06:00
|
|
|
INPUT_CUSTOM_RATIO_FLIP,
|
2025-01-30 17:11:14 +01:00
|
|
|
INPUT_ERROR,
|
2025-02-28 21:14:36 +01:00
|
|
|
INPUT_ERROR_DASH,
|
2023-07-13 17:59:52 +02:00
|
|
|
};
|
2008-12-29 20:37:54 +00:00
|
|
|
|
2025-02-18 01:27:04 +01:00
|
|
|
void initMouseInput(
|
|
|
|
|
TransInfo *t, MouseInput *mi, const float2 ¢er, const float2 &mval, bool precision);
|
2008-12-29 20:37:54 +00:00
|
|
|
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode);
|
2025-02-18 01:27:04 +01:00
|
|
|
void applyMouseInput(TransInfo *t, MouseInput *mi, const float2 &mval, float output[3]);
|
2022-08-26 13:17:30 -03:00
|
|
|
void transform_input_update(TransInfo *t, const float fac);
|
2023-05-25 11:34:25 -03:00
|
|
|
void transform_input_virtual_mval_reset(TransInfo *t);
|
2025-02-18 01:27:04 +01:00
|
|
|
void transform_input_reset(TransInfo *t, const float2 &mval);
|
2008-12-29 20:37:54 +00:00
|
|
|
|
2024-07-29 13:01:10 +10:00
|
|
|
void setCustomPoints(TransInfo *t, MouseInput *mi, const int mval_start[2], const int mval_end[2]);
|
2025-02-18 01:27:04 +01:00
|
|
|
void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float2 &dir);
|
2023-07-13 17:59:52 +02:00
|
|
|
void setInputPostFct(MouseInput *mi, void (*post)(TransInfo *t, float values[3]));
|
2009-09-21 00:48:36 +00:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Generics
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Setup internal data, mouse, vectors
|
|
|
|
|
*
|
|
|
|
|
* \note \a op and \a event can be NULL
|
|
|
|
|
*
|
|
|
|
|
* \see #saveTransform does the reverse.
|
|
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Needed for mode switching.
|
|
|
|
|
*/
|
2018-04-26 10:08:41 +02:00
|
|
|
void freeTransCustomDataForMode(TransInfo *t);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2024-03-09 23:25:40 +11:00
|
|
|
* Here I would suggest only #TransInfo related issues, like free data & reset variables.
|
|
|
|
|
* Not redraws.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-07-13 17:59:52 +02:00
|
|
|
void postTrans(bContext *C, TransInfo *t);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Free data before switching to another mode.
|
|
|
|
|
*/
|
2013-04-24 15:15:01 +00:00
|
|
|
void resetTransModal(TransInfo *t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
void resetTransRestrictions(TransInfo *t);
|
|
|
|
|
|
|
|
|
|
void restoreTransObjects(TransInfo *t);
|
|
|
|
|
|
|
|
|
|
void calculateCenter2D(TransInfo *t);
|
2018-04-16 16:27:55 +02:00
|
|
|
void calculateCenterLocal(TransInfo *t, const float center_global[3]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenter(TransInfo *t);
|
2023-03-29 14:16:31 +11:00
|
|
|
/**
|
|
|
|
|
* Called every time the view changes due to navigation.
|
|
|
|
|
* Adjusts the mouse position relative to the object.
|
|
|
|
|
*/
|
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
|
|
|
void transformViewUpdate(TransInfo *t);
|
2014-05-09 16:52:09 +10:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/* API functions for getting center points. */
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenterBound(TransInfo *t, float r_center[3]);
|
|
|
|
|
void calculateCenterMedian(TransInfo *t, float r_center[3]);
|
|
|
|
|
void calculateCenterCursor(TransInfo *t, float r_center[3]);
|
|
|
|
|
void calculateCenterCursor2D(TransInfo *t, float r_center[2]);
|
|
|
|
|
void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* \param select_only: only get active center from data being transformed.
|
|
|
|
|
*/
|
2014-05-09 16:52:09 +10:00
|
|
|
bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]);
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
void calculatePropRatio(TransInfo *t);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Rotate an element, low level code, ignore protected channels.
|
|
|
|
|
* (use for objects or pose-bones)
|
|
|
|
|
* Similar to #ElementRotation.
|
|
|
|
|
*/
|
2025-07-08 20:47:56 +02:00
|
|
|
void transform_data_ext_rotate(TransData *td,
|
|
|
|
|
TransDataExtension *td_ext,
|
|
|
|
|
float mat[3][3],
|
|
|
|
|
bool use_drot);
|
2015-07-14 04:27:32 +10:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
Object *transform_object_deform_pose_armature_get(const TransInfo *t, Object *ob);
|
2021-02-10 12:27:01 -03:00
|
|
|
|
2018-06-05 23:21:08 +05:30
|
|
|
void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data);
|
2018-05-25 22:24:24 +05:30
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/* TODO: move to: `transform_query.c`. */
|
2013-05-01 05:26:10 +00:00
|
|
|
bool checkUseAxisMatrix(TransInfo *t);
|
2013-02-18 16:35:13 +00:00
|
|
|
|
2020-11-06 10:29:01 +11:00
|
|
|
/** \} */
|
2025-02-18 01:27:04 +01:00
|
|
|
|
|
|
|
|
} // namespace blender::ed::transform
|