Transform: Remove 'mouse_coordinate_override' property

This property depends on the view that can change when redoing.
This commit is contained in:
Germano Cavalcante 2020-02-27 16:42:34 -03:00
parent c20caec7f0
commit 91abb70006
Notes: blender-bot 2023-04-19 22:54:54 +02:00
Referenced by issue #75398, Repeat (Shift R) scaling vertex (two or more) to the selected vertex (scale x 0) on axis does not work correctly.
10 changed files with 47 additions and 65 deletions

View File

@ -153,7 +153,6 @@ int BIF_countTransformOrientation(const struct bContext *C);
#define P_GPENCIL_EDIT (1 << 13)
#define P_CURSOR_EDIT (1 << 14)
#define P_CLNOR_INVALIDATE (1 << 15)
#define P_MOUSE (1 << 16)
void Transform_Properties(struct wmOperatorType *ot, int flags);

View File

@ -1635,9 +1635,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
}
if ((prop = RNA_struct_find_property(op->ptr, "mouse_coordinate_override"))) {
if ((prop = RNA_struct_find_property(op->ptr, "center_override"))) {
/* Important for redo operations. */
RNA_property_int_set_array(op->ptr, prop, t->mouse.imval);
RNA_property_float_set_array(op->ptr, prop, t->center_global);
}
if (t->flag & T_PROP_EDIT_ALL) {

View File

@ -69,6 +69,8 @@
#include "ED_clip.h"
#include "ED_mask.h"
#include "UI_view2d.h"
#include "WM_api.h" /* for WM_event_add_notifier to deal with stabilization nodes */
#include "WM_types.h"
@ -787,6 +789,19 @@ void clipUVData(TransInfo *t)
/* ********************* ANIMATION EDITORS (GENERAL) ************************* */
/* In modal, `t->center_global` may not have been inited yet. */
void transform_convert_center_global_v2(TransInfo *t, float r_center[2])
{
/* In modal, `t->center2d` may not have been inited yet. */
if (t->flag & T_MODAL) {
UI_view2d_region_to_view(
(View2D *)t->view, t->mouse.imval[0], t->mouse.imval[1], &r_center[0], &r_center[1]);
}
else {
copy_v2_v2(r_center, t->center_global);
}
}
/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
bool FrameOnMouseSide(char side, float frame, float cframe)
{

View File

@ -104,6 +104,7 @@ void transform_around_single_fallback(TransInfo *t);
bool constraints_list_needinv(TransInfo *t, ListBase *list);
void calc_distanceCurveVerts(TransData *head, TransData *tail);
struct TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt);
void transform_convert_center_global_v2(TransInfo *t, float r_center[2]);
bool FrameOnMouseSide(char side, float frame, float cframe);
/* transform_convert_action.c */

View File

@ -36,8 +36,6 @@
#include "ED_anim_api.h"
#include "UI_view2d.h"
#include "transform.h"
#include "transform_convert.h"
@ -333,11 +331,10 @@ void createTransActionData(bContext *C, TransInfo *t)
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
UI_view2d_region_to_view(&ac.ar->v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
/* only side on which center is gets transformed */
float center[2];
transform_convert_center_global_v2(t, center);
t->frame_side = (center[0] > CFRA) ? 'R' : 'L';
}
else {
/* normal transform - both sides of current frame are considered */

View File

@ -1,4 +1,4 @@
/*
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@ -261,11 +261,10 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
/* which side of the current frame should be allowed */
// XXX we still want this mode, but how to get this using standard transform too?
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
UI_view2d_region_to_view(v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
/* only side on which center is gets transformed */
float center[2];
transform_convert_center_global_v2(t, center);
t->frame_side = (center[0] > CFRA) ? 'R' : 'L';
}
else {
/* normal transform - both sides of current frame are considered */

View File

@ -35,8 +35,6 @@
#include "ED_anim_api.h"
#include "UI_view2d.h"
#include "transform.h"
#include "transform_convert.h"
@ -73,11 +71,10 @@ void createTransNlaData(bContext *C, TransInfo *t)
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
UI_view2d_region_to_view(&ac.ar->v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L';
/* only side on which center is gets transformed */
float center[2];
transform_convert_center_global_v2(t, center);
t->frame_side = (center[0] > CFRA) ? 'R' : 'L';
}
else {
/* normal transform - both sides of current frame are considered */

View File

@ -31,8 +31,6 @@
#include "BKE_sequencer.h"
#include "BKE_report.h"
#include "UI_view2d.h"
#include "transform.h"
#include "transform_convert.h"
@ -526,14 +524,12 @@ void createTransSeqData(bContext *C, TransInfo *t)
{
#define XXX_DURIAN_ANIM_TX_HACK
View2D *v2d = UI_view2d_fromcontext(C);
Scene *scene = t->scene;
Editing *ed = BKE_sequencer_editing_get(t->scene, false);
TransData *td = NULL;
TransData2D *td2d = NULL;
TransDataSeq *tdsq = NULL;
TransSeq *ts = NULL;
int xmouse;
int count = 0;
@ -545,18 +541,10 @@ void createTransSeqData(bContext *C, TransInfo *t)
}
tc->custom.type.free_cb = freeSeqData;
xmouse = (int)UI_view2d_region_to_view_x(v2d, t->mouse.imval[0]);
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
t->frame_side = (xmouse > CFRA) ? 'R' : 'L';
}
else {
/* normal transform - both sides of current frame are considered */
t->frame_side = 'B';
}
/* only side on which center is gets transformed */
float center[2];
transform_convert_center_global_v2(t, center);
t->frame_side = (center[0] > CFRA) ? 'R' : 'L';
#ifdef XXX_DURIAN_ANIM_TX_HACK
{
@ -599,7 +587,7 @@ void createTransSeqData(bContext *C, TransInfo *t)
SeqTransDataBounds(t, ed->seqbasep, ts);
/* set the snap mode based on how close the mouse is at the end/start points */
if (abs(xmouse - ts->max) > abs(xmouse - ts->min)) {
if (abs(center[0] - ts->max) > abs(center[0] - ts->min)) {
ts->snap_left = true;
}

View File

@ -1374,17 +1374,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
bGPdata *gpd = CTX_data_gpencil_data(C);
PropertyRNA *prop;
if (op && (prop = RNA_struct_find_property(op->ptr, "mouse_coordinate_override")) &&
RNA_property_is_set(op->ptr, prop)) {
RNA_property_int_get_array(op->ptr, prop, t->mval);
}
else if (event) {
copy_v2_v2_int(t->mval, event->mval);
}
else {
zero_v2_int(t->mval);
}
t->depsgraph = CTX_data_depsgraph_pointer(C);
t->scene = sce;
t->view_layer = view_layer;
@ -1413,11 +1402,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->redraw = TREDRAW_HARD; /* redraw first time */
t->mouse.imval[0] = t->mval[0];
t->mouse.imval[1] = t->mval[1];
t->con.imval[0] = t->mouse.imval[0];
t->con.imval[1] = t->mouse.imval[1];
int mval[2];
if (event) {
copy_v2_v2_int(mval, event->mval);
}
else {
zero_v2_int(mval);
}
copy_v2_v2_int(t->mval, mval);
copy_v2_v2_int(t->mouse.imval, mval);
copy_v2_v2_int(t->con.imval, mval);
t->transform = NULL;
t->handleEvent = NULL;

View File

@ -694,14 +694,6 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)");
}
if (flags & P_MOUSE) {
prop = RNA_def_property(ot->srna, "mouse_coordinate_override", PROP_INT, PROP_XYZ);
RNA_def_property_array(prop, 2);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
RNA_def_property_ui_text(
prop, "Mouse Coordinate Override", "Force using this mouse value (when set)");
}
if ((flags & P_NO_DEFAULTS) == 0) {
prop = RNA_def_boolean(ot->srna,
"release_confirm",
@ -1247,7 +1239,7 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
Transform_Properties(ot,
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_MOUSE);
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER);
}
static int transform_from_gizmo_invoke(bContext *C,