summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-05-07 13:09:03 -0300
committerGitHub <noreply@github.com>2018-05-07 13:09:03 -0300
commitd8ea68195a54dfb2be639d2833941d2554a1e28c (patch)
tree65ff0add50667fb2218788280aea8f4f2b7b501e /editor/plugins
parent4db0da0fcc057cb632d7ea573f7a09c622b4d89e (diff)
parent098f9b51b501395a1e1f771934b020ba2fb3fa9e (diff)
Merge pull request #18525 from Calinou/improve-3d-grid
Improve the 3D editor grid
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 1443f22c8f..bd0406a3cb 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -4598,7 +4598,10 @@ void SpatialEditor::_init_grid() {
PoolVector<Color> grid_colors[3];
PoolVector<Vector3> grid_points[3];
- Color grid_color = EditorSettings::get_singleton()->get("editors/3d/grid_color");
+ Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color");
+ Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color");
+ int grid_size = EditorSettings::get_singleton()->get("editors/3d/grid_size");
+ int primary_grid_steps = EditorSettings::get_singleton()->get("editors/3d/primary_grid_steps");
for (int i = 0; i < 3; i++) {
Vector3 axis;
@@ -4608,19 +4611,17 @@ void SpatialEditor::_init_grid() {
Vector3 axis_n2;
axis_n2[(i + 2) % 3] = 1;
-#define ORIGIN_GRID_SIZE 50
-
- for (int j = -ORIGIN_GRID_SIZE; j <= ORIGIN_GRID_SIZE; j++) {
- Vector3 p1 = axis_n1 * j + axis_n2 * -ORIGIN_GRID_SIZE;
+ for (int j = -grid_size; j <= grid_size; j++) {
+ Vector3 p1 = axis_n1 * j + axis_n2 * -grid_size;
Vector3 p1_dest = p1 * (-axis_n2 + axis_n1);
- Vector3 p2 = axis_n2 * j + axis_n1 * -ORIGIN_GRID_SIZE;
+ Vector3 p2 = axis_n2 * j + axis_n1 * -grid_size;
Vector3 p2_dest = p2 * (-axis_n1 + axis_n2);
- Color line_color = grid_color;
+ Color line_color = secondary_grid_color;
if (j == 0) {
continue;
- } else if (j % 10 == 0) {
- line_color *= 1.5;
+ } else if (j % primary_grid_steps == 0) {
+ line_color = primary_grid_color;
}
grid_points[i].push_back(p1);