summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPeace Sells <PeaceSells50@gmail.com>2015-07-09 20:51:49 -0600
committerPeace Sells <PeaceSells50@gmail.com>2015-07-09 20:51:49 -0600
commita009fadfff40d6339031a70c760103c76edfdce7 (patch)
treef6232dc48a70d76048af85052cafad27d6c659f6 /modules
parentf697ec2fe022583dde5f3ae650f49cfd7f237c33 (diff)
Added GridMap settings which allows the user to enter a pick distance.
Diffstat (limited to 'modules')
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp24
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h7
2 files changed, 27 insertions, 4 deletions
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 3d56b04cac..e4559ca100 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -220,7 +220,9 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
-
+ case MENU_OPTION_GRIDMAP_SETTINGS: {
+ settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50, 50));
+ } break;
}
}
@@ -304,7 +306,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
p.d=edit_floor[edit_axis]*node->get_cell_size();
Vector3 inters;
- if (!p.intersects_segment(from,from+normal*500,&inters))
+ if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_val(), &inters))
return false;
@@ -1249,6 +1251,24 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
//options->get_popup()->add_separator();
//options->get_popup()->add_item("Configure",MENU_OPTION_CONFIGURE);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item("Settings", MENU_OPTION_GRIDMAP_SETTINGS);
+
+ settings_dialog = memnew(ConfirmationDialog);
+ settings_dialog->set_title("GridMap Settings");
+ add_child(settings_dialog);
+ settings_vbc = memnew(VBoxContainer);
+ settings_vbc->set_custom_minimum_size(Size2(200, 0));
+ settings_dialog->add_child(settings_vbc);
+ settings_dialog->set_child_rect(settings_vbc);
+
+ settings_pick_distance = memnew(SpinBox);
+ settings_pick_distance->set_max(10000.0f);
+ settings_pick_distance->set_min(500.0f);
+ settings_pick_distance->set_step(1.0f);
+ settings_pick_distance->set_val(EDITOR_DEF("gridmap_editor/pick_distance", 5000.0));
+ settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance);
+
clip_mode=CLIP_DISABLED;
options->get_popup()->connect("item_pressed", this,"_menu_option");
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 26fe8f20dc..03b2d4226e 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -78,6 +78,9 @@ class GridMapEditor : public VBoxContainer {
ToolButton *mode_thumbnail;
ToolButton *mode_list;
HBoxContainer *spatial_editor_hb;
+ ConfirmationDialog *settings_dialog;
+ VBoxContainer *settings_vbc;
+ SpinBox *settings_pick_distance;
struct SetItem {
@@ -165,8 +168,8 @@ class GridMapEditor : public VBoxContainer {
MENU_OPTION_SELECTION_MAKE_AREA,
MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR,
MENU_OPTION_SELECTION_CLEAR,
- MENU_OPTION_REMOVE_AREA
-
+ MENU_OPTION_REMOVE_AREA,
+ MENU_OPTION_GRIDMAP_SETTINGS
};