From e55ef57f6253673ab9a5553d47964cd378423334 Mon Sep 17 00:00:00 2001 From: marynate Date: Tue, 15 Jul 2014 13:29:03 +0800 Subject: [PATCH 1/2] Fixed #470 View grid toggle in 3d not working --- tools/editor/plugins/spatial_editor_plugin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 1bf425f3f3c..227cfa5c11c 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2653,6 +2653,13 @@ void SpatialEditor::_menu_item_pressed(int p_option) { grid_enabled=!is_checked; + for(int i=0;i<3;++i) { + if (grid_enable[i]) { + VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,grid_enabled); + grid_visible[i]=grid_enabled; + } + } + view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(p_option), grid_enabled ); From f5c56f4a3de502ecc8e5d1730f9657abd81a014b Mon Sep 17 00:00:00 2001 From: marynate Date: Tue, 15 Jul 2014 15:06:55 +0800 Subject: [PATCH 2/2] Make sure View Grid state saved with scene state --- tools/editor/plugins/spatial_editor_plugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 227cfa5c11c..e9020c91f5a 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2345,8 +2345,7 @@ void SpatialEditor::set_state(const Dictionary& p_state) { bool use = d["show_grid"]; if (use!=view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_GRID))) { - view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_GRID), use ); - grid_enabled=use; + _menu_item_pressed(MENU_VIEW_GRID); } }