diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-12-28 22:19:23 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-12-28 22:19:37 +0300 |
commit | 1db27af38f6c9d2fb331954e29080bf3b902a531 (patch) | |
tree | ba3241c24ba2ba4822b53f6adc3b823348e7d805 /source/blender/editors/transform/transform_orientations.c | |
parent | 6fbeb6e2e05408af448e9409f8e7e11470f82db6 (diff) |
Fix T84200: Rotating a paintcurve [all paintmodes] doesn’t work correctly
The transform code did not provide a 2d context to be used in 3d space.
The solution is to set all matrices for the screen space in these cases.
This commit also removes the dial3d drawing in these cases.
It was not correct anyway.
Diffstat (limited to 'source/blender/editors/transform/transform_orientations.c')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 031cff72095..606862f05aa 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -602,20 +602,34 @@ short transform_orientation_matrix_get( orientation = V3D_ORIENT_CUSTOM; } - if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { + if ((t->spacetype == SPACE_VIEW3D) && t->region && (t->region->regiontype == RGN_TYPE_WINDOW)) { rv3d = t->region->regiondata; } - return ED_transform_calc_orientation_from_type_ex(C, - r_spacemtx, - /* extra args (can be accessed from context) */ - scene, - rv3d, - ob, - obedit, - orientation, - orientation_index_custom, - t->around); + short orient_type = ED_transform_calc_orientation_from_type_ex( + C, + r_spacemtx, + /* extra args (can be accessed from context) */ + scene, + rv3d, + ob, + obedit, + orientation, + orientation_index_custom, + t->around); + + if (rv3d && (t->options & CTX_PAINT_CURVE)) { + /* Screen space in the 3d region. */ + if (orient_type == V3D_ORIENT_VIEW) { + unit_m3(r_spacemtx); + } + else { + mul_m3_m4m3(r_spacemtx, rv3d->viewmat, r_spacemtx); + normalize_m3(r_spacemtx); + } + } + + return orient_type; } const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type) |