summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2018-08-09 16:34:18 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2018-08-09 16:34:18 +0200
commitdcca20027c70bc52d9879a7da9825d7b3217cac4 (patch)
treecb5c9150656731991b5f293eeaf2cf96c0ced110
parenta71a5fc0c3f5d487d3f18c3b9e9a768052795e86 (diff)
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.
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 47f10d977a..7a663245ef 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -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++) {