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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-07 20:38:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-07 22:40:51 +0300
commit170223804bee3ee2a3fe373ac858d36fe2361570 (patch)
tree5410bed091eab45ec3aff6a2ed4414167f31ba08 /source/blender
parent036eb6f2f8150afe290edde5d46121aac933116f (diff)
Extrude Widget: orient correctly w/ rotated object
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/ED_transform.h7
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator_3d.c26
3 files changed, 27 insertions, 8 deletions
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 601315e6124..23cc55a239a 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -203,8 +203,13 @@ struct TransformBounds {
float axis_min[3], axis_max[3];
};
+struct TransformCalcParams {
+ uint use_only_center : 1;
+ uint use_local_axis : 1;
+};
int ED_transform_calc_manipulator_stats(
- const struct bContext *C, bool use_only_center,
+ const struct bContext *C,
+ const struct TransformCalcParams *params,
struct TransformBounds *tbounds);
#endif /* __ED_TRANSFORM_H__ */
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index b85913a82f9..04dfeb6b037 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -433,7 +433,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro
return;
}
struct TransformBounds tbounds;
- if (!ED_transform_calc_manipulator_stats(C, false, &tbounds)) {
+ if (!ED_transform_calc_manipulator_stats(C, &(struct TransformCalcParams){0}, &tbounds)) {
return;
}
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index afe40b94d9a..5350bf783aa 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -581,7 +581,8 @@ bool gimbal_axis(Object *ob, float gmat[3][3])
/* centroid, boundbox, of selection */
/* returns total items selected */
int ED_transform_calc_manipulator_stats(
- const bContext *C, bool use_only_center,
+ const bContext *C,
+ const struct TransformCalcParams *params,
struct TransformBounds *tbounds)
{
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -686,7 +687,7 @@ int ED_transform_calc_manipulator_stats(
zero_v3(tbounds->center);
copy_m3_m4(tbounds->axis, rv3d->twmat);
- if (ob && ob->mode & OB_MODE_EDIT) {
+ if (params->use_local_axis && (ob && ob->mode & OB_MODE_EDIT)) {
float diff_mat[3][3];
copy_m3_m4(diff_mat, ob_eval->obmat);
normalize_m3(diff_mat);
@@ -1010,7 +1011,7 @@ int ED_transform_calc_manipulator_stats(
ob = base->object;
ob_eval = base_object_eval;
}
- if (use_only_center || base_object_eval->bb == NULL) {
+ if (params->use_only_center || base_object_eval->bb == NULL) {
calc_tw_center(tbounds, base_object_eval->obmat[3]);
}
else {
@@ -1244,7 +1245,11 @@ static int manipulator_modal(
struct TransformBounds tbounds;
- if (ED_transform_calc_manipulator_stats(C, true, &tbounds)) {
+ if (ED_transform_calc_manipulator_stats(
+ C, &(struct TransformCalcParams){
+ .use_only_center = true,
+ }, &tbounds))
+ {
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
WM_manipulator_set_matrix_location(widget, rv3d->twmat[3]);
}
@@ -1404,8 +1409,14 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
struct TransformBounds tbounds;
/* skip, we don't draw anything anyway */
- if ((man->all_hidden = (ED_transform_calc_manipulator_stats(C, true, &tbounds) == 0)))
+ if ((man->all_hidden =
+ (ED_transform_calc_manipulator_stats(
+ C, &(struct TransformCalcParams){
+ .use_only_center = true,
+ }, &tbounds) == 0)))
+ {
return;
+ }
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
@@ -1637,7 +1648,10 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup
struct TransformBounds tbounds;
- if ((ED_transform_calc_manipulator_stats(C, false, &tbounds) == 0) ||
+ if ((ED_transform_calc_manipulator_stats(
+ C, &(struct TransformCalcParams) {
+ .use_local_axis = true,
+ }, &tbounds) == 0) ||
equals_v3v3(rv3d->tw_axis_min, rv3d->tw_axis_max))
{
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true);