Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r--source/blender/editors/transform/transform_snap.c54
1 files changed, 10 insertions, 44 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 656a1e5d9c7..05a20a14477 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -594,7 +594,7 @@ static void initSnappingMode(TransInfo *t)
else if (t->spacetype == SPACE_SEQ) {
t->tsnap.mode = SEQ_tool_settings_snap_mode_get(t->scene);
}
- else {
+ else if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && !(t->options & CTX_CAMERA)) {
/* force project off when not supported */
if ((ts->snap_mode & SCE_SNAP_MODE_FACE) == 0) {
t->tsnap.project = 0;
@@ -608,6 +608,14 @@ static void initSnappingMode(TransInfo *t)
t->tsnap.mode |= SCE_SNAP_MODE_GRID;
}
}
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) {
+ /* No incremental snapping. */
+ t->tsnap.mode = 0;
+ }
+ else {
+ /* Fallback. */
+ t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
+ }
if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && !(t->options & CTX_CAMERA)) {
/* Only 3D view or UV. */
@@ -654,10 +662,6 @@ static void initSnappingMode(TransInfo *t)
setSnappingCallback(t);
t->tsnap.modeSelect = SNAP_NOT_SELECTED;
}
- else {
- /* Fallback. */
- t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
- }
if (t->spacetype == SPACE_VIEW3D) {
if (t->tsnap.object_context == NULL) {
@@ -1461,47 +1465,9 @@ bool snapNodesTransform(
/** \} */
/* -------------------------------------------------------------------- */
-/** \name snap Frames
+/** \name snap Grid
* \{ */
-/* This function is used by Animation Editor specific transform functions to do
- * the Snap Keyframe to Nearest Frame/Marker
- */
-void snapFrameTransform(TransInfo *t,
- const eAnimEdit_AutoSnap autosnap,
- const bool is_frame_value,
- const float delta,
- float *r_val)
-{
- double val = delta;
- switch (autosnap) {
- case SACTSNAP_STEP:
- case SACTSNAP_FRAME:
- val = floor(val + 0.5);
- break;
- case SACTSNAP_MARKER:
- /* snap to nearest marker */
- /* TODO: need some more careful checks for where data comes from. */
- val = ED_markers_find_nearest_marker_time(&t->scene->markers, (float)val);
- break;
- case SACTSNAP_SECOND:
- case SACTSNAP_TSTEP: {
- /* second step */
- const Scene *scene = t->scene;
- const double secf = FPS;
- val = floor((val / secf) + 0.5);
- if (is_frame_value) {
- val *= secf;
- }
- break;
- }
- case SACTSNAP_OFF: {
- break;
- }
- }
- *r_val = (float)val;
-}
-
static void snap_grid_apply(
TransInfo *t, const int max_index, const float grid_dist, const float loc[3], float r_out[3])
{