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')
-rw-r--r--source/blender/editors/transform/transform.c11
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_generics.c6
-rw-r--r--source/blender/editors/transform/transform_mode_translate.c35
4 files changed, 31 insertions, 22 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8e3ad55bae1..f779a6dea39 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1615,6 +1615,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
int proportional = 0;
PropertyRNA *prop;
+ if (!(t->con.mode & CON_APPLY) && (t->flag & T_MODAL) &&
+ ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE)) {
+ /* When redoing these modes the first time, it's more convenient to save
+ * the Global orientation. */
+ mul_m3_v3(t->spacemtx, t->values_final);
+ unit_m3(t->spacemtx);
+
+ BLI_assert(t->orientation.index == 0);
+ t->orientation.types[0] = V3D_ORIENT_GLOBAL;
+ }
+
// Save back mode in case we're in the generic operator
if ((prop = RNA_struct_find_property(op->ptr, "mode"))) {
RNA_property_enum_set(op->ptr, prop, t->mode);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 943b8234f1e..9f4b3773fd8 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -519,6 +519,7 @@ typedef struct TransInfo {
/** orientation matrix of the current space. */
float spacemtx[3][3];
+ float spacemtx_inv[3][3];
/** name of the current space, MAX_NAME. */
char spacename[64];
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 4472facf183..a33186cd9d3 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1660,15 +1660,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
orient_type_scene += index_custom;
}
- short orient_type_default = V3D_ORIENT_GLOBAL;
+ short orient_type_default = V3D_ORIENT_VIEW;
short orient_type_constraint[2];
if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
t->orient_axis = RNA_property_enum_get(op->ptr, prop);
-
- /* For transfor modes that require "orient_axis" use
- * `V3D_ORIENT_VIEW` as default. */
- orient_type_default = V3D_ORIENT_VIEW;
}
if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 4b380264dde..69552eda5bf 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -318,40 +318,39 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
{
char str[UI_MAX_DRAW_STR];
+ float global_dir[3];
if (t->flag & T_INPUT_IS_VALUES_FINAL) {
- copy_v3_v3(t->values_final, t->values);
+ mul_v3_m3v3(global_dir, t->spacemtx, t->values);
}
else {
- copy_v3_v3(t->values_final, t->values);
+ copy_v3_v3(global_dir, t->values);
if ((t->con.mode & CON_APPLY) == 0) {
- snapGridIncrement(t, t->values_final);
+ snapGridIncrement(t, global_dir);
}
- if (applyNumInput(&t->num, t->values_final)) {
- removeAspectRatio(t, t->values_final);
+ if (applyNumInput(&t->num, global_dir)) {
+ removeAspectRatio(t, global_dir);
}
- applySnapping(t, t->values_final);
+ applySnapping(t, global_dir);
}
if (t->con.mode & CON_APPLY) {
- float values_final[3];
- copy_v3_v3(values_final, t->values_final);
- t->con.applyVec(t, NULL, NULL, values_final, t->values_final);
- headerTranslation(t, t->values_final, str);
+ float in[3];
+ copy_v3_v3(in, global_dir);
+ t->con.applyVec(t, NULL, NULL, in, global_dir);
+ headerTranslation(t, global_dir, str);
}
else {
- headerTranslation(t, t->values_final, str);
+ headerTranslation(t, global_dir, str);
}
- /* don't use 't->values' now on */
-
- applyTranslationValue(t, t->values_final);
+ applyTranslationValue(t, global_dir);
/* evil hack - redo translation if clipping needed */
- if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 0)) {
- applyTranslationValue(t, t->values_final);
+ if (t->flag & T_CLIP_UV && clipUVTransform(t, global_dir, 0)) {
+ applyTranslationValue(t, global_dir);
/* In proportional edit it can happen that */
/* vertices in the radius of the brush end */
@@ -362,8 +361,10 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
}
}
- recalcData(t);
+ /* Set the redo value. */
+ mul_v3_m3v3(t->values_final, t->spacemtx_inv, global_dir);
+ recalcData(t);
ED_area_status_text(t->area, str);
}