2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-10-29 00:45:05 +11:00
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#define SNAP_MIN_DISTANCE 30
|
|
|
|
|
|
2025-01-07 12:39:13 +01:00
|
|
|
#include "transform.hh"
|
|
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
bool peelObjectsTransform(TransInfo *t,
|
2019-10-29 00:45:05 +11:00
|
|
|
const float mval[2],
|
2022-01-07 11:38:08 +11:00
|
|
|
bool use_peel_object,
|
2024-03-09 23:25:40 +11:00
|
|
|
/* Return args. */
|
2019-10-29 00:45:05 +11:00
|
|
|
float r_loc[3],
|
|
|
|
|
float r_no[3],
|
|
|
|
|
float *r_thickness);
|
|
|
|
|
|
|
|
|
|
bool transformModeUseSnap(const TransInfo *t);
|
|
|
|
|
|
2022-10-22 12:27:59 -03:00
|
|
|
void tranform_snap_target_median_calc(const TransInfo *t, float r_median[3]);
|
2021-06-29 20:13:55 +10:00
|
|
|
bool transform_snap_increment_ex(const TransInfo *t, bool use_local_space, float *r_val);
|
|
|
|
|
bool transform_snap_increment(const TransInfo *t, float *val);
|
2022-06-06 22:59:32 -03:00
|
|
|
float transform_snap_increment_get(const TransInfo *t);
|
2019-10-29 00:45:05 +11:00
|
|
|
|
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
|
|
|
void tranform_snap_source_restore_context(TransInfo *t);
|
|
|
|
|
|
2023-03-20 20:11:22 -03:00
|
|
|
void transform_snap_flag_from_modifiers_set(TransInfo *t);
|
2023-01-09 23:45:12 -03:00
|
|
|
bool transform_snap_is_active(const TransInfo *t);
|
2021-06-26 16:57:03 +10:00
|
|
|
|
2019-10-29 00:45:05 +11:00
|
|
|
bool validSnap(const TransInfo *t);
|
|
|
|
|
|
2024-10-08 23:29:57 -03:00
|
|
|
void transform_snap_grid_init(const TransInfo *t, float r_snap[3], float *r_snap_precision);
|
2023-07-13 17:59:52 +02:00
|
|
|
void initSnapping(TransInfo *t, wmOperator *op);
|
|
|
|
|
void freeSnapping(TransInfo *t);
|
2024-03-09 16:50:06 +11:00
|
|
|
void initSnapAngleIncrements(TransInfo *t);
|
2023-01-09 23:45:12 -03:00
|
|
|
bool transform_snap_project_individual_is_active(const TransInfo *t);
|
|
|
|
|
void transform_snap_project_individual_apply(TransInfo *t);
|
|
|
|
|
void transform_snap_mixed_apply(TransInfo *t, float *vec);
|
2019-10-29 00:45:05 +11:00
|
|
|
void resetSnapping(TransInfo *t);
|
2023-07-13 17:59:52 +02:00
|
|
|
eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event);
|
2023-08-25 10:25:58 +10:00
|
|
|
void drawSnapping(TransInfo *t);
|
2019-10-29 00:45:05 +11:00
|
|
|
bool usingSnappingNormal(const TransInfo *t);
|
|
|
|
|
bool validSnappingNormal(const TransInfo *t);
|
|
|
|
|
|
2024-10-08 18:45:01 -03:00
|
|
|
short *transform_snap_flag_from_spacetype_ptr(TransInfo *t, const struct PropertyRNA **r_prop);
|
|
|
|
|
|
2019-10-29 00:45:05 +11:00
|
|
|
void getSnapPoint(const TransInfo *t, float vec[3]);
|
|
|
|
|
void addSnapPoint(TransInfo *t);
|
|
|
|
|
eRedrawFlag updateSelectedSnapPoint(TransInfo *t);
|
|
|
|
|
void removeSnapPoint(TransInfo *t);
|
|
|
|
|
|
2020-06-22 09:07:51 -03:00
|
|
|
float transform_snap_distance_len_squared_fn(TransInfo *t, const float p1[3], const float p2[3]);
|
2021-06-29 20:12:19 +02:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `transform_snap_sequencer.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-07-13 17:59:52 +02:00
|
|
|
TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t);
|
|
|
|
|
void transform_snap_sequencer_data_free(TransSeqSnapData *data);
|
|
|
|
|
bool transform_snap_sequencer_calc(TransInfo *t);
|
2024-07-06 15:24:52 +02:00
|
|
|
void transform_snap_sequencer_apply_seqslide(TransInfo *t, float *vec);
|
2024-10-08 18:45:01 -03:00
|
|
|
void transform_snap_sequencer_image_apply_translate(TransInfo *t, float vec[2]);
|
2021-08-19 09:52:09 -03:00
|
|
|
|
2024-03-09 23:25:40 +11:00
|
|
|
/* `transform_snap_animation.cc` */
|
2023-09-05 10:06:55 +02:00
|
|
|
void snapFrameTransform(
|
2025-01-26 20:08:00 +01:00
|
|
|
TransInfo *t, eSnapMode snap_mode, float val_initial, float val_final, float *r_val_final);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* This function is used by Animation Editor specific transform functions to do
|
2024-03-09 23:25:40 +11:00
|
|
|
* the Snap Keyframe to Nearest Frame/Marker.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2021-08-19 10:28:43 -03:00
|
|
|
void transform_snap_anim_flush_data(TransInfo *t,
|
|
|
|
|
TransData *td,
|
2025-01-26 20:08:00 +01:00
|
|
|
eSnapMode snap_mode,
|
2021-08-19 10:28:43 -03:00
|
|
|
float *r_val_final);
|
2023-10-20 14:24:50 +02:00
|
|
|
bool transform_snap_nla_calc(TransInfo *t, float *vec);
|