Improve the 3D manipulator gizmo

Its size now takes into account the editor scale and the viewport's
half resolution setting. It is now also more detailed.
This commit is contained in:
Hugo Locurcio 2018-08-09 16:34:18 +02:00
parent a71a5fc0c3
commit dcca20027c
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C

View File

@ -2867,7 +2867,7 @@ void SpatialEditorViewport::update_transform_gizmo_view() {
dd = 0.0001;
float gsize = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_size");
gizmo_scale = (gsize / Math::abs(dd));
gizmo_scale = (gsize / Math::abs(dd)) * MAX(1, EDSCALE) / viewport_container->get_stretch_shrink();
Vector3 scale = Vector3(1, 1, 1) * gizmo_scale;
xform.basis.scale(scale);
@ -4519,9 +4519,9 @@ void SpatialEditor::_init_indicators() {
nivec * 0.0 + ivec * (GIZMO_ARROW_OFFSET + GIZMO_ARROW_SIZE),
};
int arrow_sides = 6;
int arrow_sides = 16;
for (int k = 0; k < 6; k++) {
for (int k = 0; k < arrow_sides; k++) {
Basis ma(ivec, Math_PI * 2 * float(k) / arrow_sides);
Basis mb(ivec, Math_PI * 2 * float(k + 1) / arrow_sides);
@ -4605,10 +4605,10 @@ void SpatialEditor::_init_indicators() {
ivec * 0.02 + ivec2 * 0.02 + ivec2 * GIZMO_CIRCLE_SIZE,
};
for (int k = 0; k < 32; k++) {
for (int k = 0; k < 64; k++) {
Basis ma(ivec, Math_PI * 2 * float(k) / 32);
Basis mb(ivec, Math_PI * 2 * float(k + 1) / 32);
Basis ma(ivec, Math_PI * 2 * float(k) / 64);
Basis mb(ivec, Math_PI * 2 * float(k + 1) / 64);
for (int j = 0; j < 4; j++) {