summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2016-09-08 14:53:39 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2016-09-08 14:53:39 +0100
commita82ecf6d80c2997fb61c7827de771c1b3a5e36fc (patch)
tree6082bbb6fbf0a13a29e2874d26fe141624e0b789
parente04e55f822284a31e8268df3b0c8b33f0a0fdbf5 (diff)
Added customisable grid color, issue 3781
-rw-r--r--tools/editor/editor_settings.cpp3
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp10
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 99c80fdc36..ad5cd86b4b 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -574,6 +574,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("grid_map/pick_distance", 5000.0);
+ set("3d_editor/grid_color",Color(0,1,0,0.2));
+ hints["3d_editor/grid_color"]=PropertyInfo(Variant::COLOR,"3d_editor/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED);
+
set("3d_editor/default_fov",45.0);
set("3d_editor/default_z_near",0.1);
set("3d_editor/default_z_far",500.0);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 95106d2c81..41956747e1 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3151,6 +3151,8 @@ void SpatialEditor::_init_indicators() {
Vector<Color> origin_colors;
Vector<Vector3> origin_points;
+ Color grid_color = EditorSettings::get_singleton()->get("3d_editor/grid_color");
+
for(int i=0;i<3;i++) {
Vector3 axis;
axis[i]=1;
@@ -3168,10 +3170,10 @@ void SpatialEditor::_init_indicators() {
for(int j=-ORIGIN_GRID_SIZE;j<=ORIGIN_GRID_SIZE;j++) {
- grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2));
- grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2));
- grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2));
- grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2));
+ grid_colors[i].push_back(grid_color);
+ grid_colors[i].push_back(grid_color);
+ grid_colors[i].push_back(grid_color);
+ grid_colors[i].push_back(grid_color);
grid_points[i].push_back(axis_n1*ORIGIN_GRID_SIZE+axis_n2*j);
grid_points[i].push_back(-axis_n1*ORIGIN_GRID_SIZE+axis_n2*j);
grid_points[i].push_back(axis_n2*ORIGIN_GRID_SIZE+axis_n1*j);