[Bf-blender-cvs] [0246128b7f9] master: Fix wrong Anim Auto-Snap Ctrl toggle
Philipp Oeser
noreply at git.blender.org
Tue Aug 17 15:56:04 CEST 2021
Commit: 0246128b7f9c353641733f38dfafec362c3cf933
Author: Philipp Oeser
Date: Tue Aug 17 15:10:50 2021 +0200
Branches: master
https://developer.blender.org/rB0246128b7f9c353641733f38dfafec362c3cf933
Fix wrong Anim Auto-Snap Ctrl toggle
This was not working like elsewhere in both NLA and Graph Editor
(meaning that when snapping was already enabled, {key Ctrl} during
transform did not disable it).
Now use getAnimEdit_SnapMode() for this in NLA and GE as well.
Maniphest Tasks: T87173
Differential Revision: https://developer.blender.org/D12244
===================================================================
M source/blender/editors/transform/transform_convert_graph.c
M source/blender/editors/transform/transform_convert_nla.c
===================================================================
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c
index 111f81ff87b..a6cbbb299ac 100644
--- a/source/blender/editors/transform/transform_convert_graph.c
+++ b/source/blender/editors/transform/transform_convert_graph.c
@@ -41,6 +41,7 @@
#include "transform.h"
#include "transform_convert.h"
+#include "transform_mode.h"
typedef struct TransDataGraph {
float unit_scale;
@@ -656,7 +657,6 @@ static bool fcu_test_selected(FCurve *fcu)
*/
static void flushTransGraphData(TransInfo *t)
{
- SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
TransData *td;
TransData2D *td2d;
TransDataGraph *tdg;
@@ -680,7 +680,8 @@ static void flushTransGraphData(TransInfo *t)
* - Don't do this when canceling, or else these changes won't go away.
*/
if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) {
- switch (sipo->autosnap) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
td2d->loc[0] = floor((double)td2d->loc[0] + 0.5);
break;
@@ -714,9 +715,9 @@ static void flushTransGraphData(TransInfo *t)
*
* \note We don't do this when canceling transforms, or else these changes don't go away.
*/
- if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0 &&
- ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP)) {
- switch (sipo->autosnap) {
+ if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_STEP: /* frame step */
td2d->loc2d[0] = floor((double)td2d->loc[0] + 0.5);
td->loc[0] = floor((double)td->loc[0] + 0.5);
diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c
index b55005673d9..f96f2e93bbc 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -42,6 +42,7 @@
#include "transform.h"
#include "transform_convert.h"
+#include "transform_mode.h"
/** Used for NLA transform (stored in #TransData.extra pointer). */
typedef struct TransDataNla {
@@ -411,7 +412,8 @@ void recalcData_nla(TransInfo *t)
* NOTE: only do this when transform is still running, or we can't restore
*/
if (t->state != TRANS_CANCEL) {
- switch (snla->autosnap) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
case SACTSNAP_STEP: /* frame step - this is basically the same,
* since we don't have any remapping going on */
More information about the Bf-blender-cvs
mailing list