summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorgroud <gilles.roudiere@gmail.com>2018-09-19 14:26:04 +0200
committergroud <gilles.roudiere@gmail.com>2018-09-19 14:26:04 +0200
commitc3e66536cc0faaa45a1b15bd90b900e4ae4ff418 (patch)
treedd45f64a9f5318fba3493177645eb367c2422d17 /editor/plugins
parent6f1513545bc1da4adfa0db476457577131b3e936 (diff)
Fixes polygon editor blocking other editor actions (move, scale...)
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp8
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h8
2 files changed, 12 insertions, 4 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 2d341cdd93..b51ff8b320 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -275,6 +275,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return (mb.is_valid() && mb->get_button_index() == 1);
}
+ CanvasItemEditor::Tool tool = CanvasItemEditor::get_singleton()->get_current_tool();
+ if (tool != CanvasItemEditor::TOOL_SELECT)
+ return false;
+
if (mb.is_valid()) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
@@ -283,10 +287,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
-
if (mb->get_button_index() == BUTTON_LEFT) {
-
if (mb->is_pressed()) {
+ if (mb->get_control() || mb->get_shift() || mb->get_alt())
+ return false;
const PosVertex insert = closest_edge_point(gpoint);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 61d77581d3..18ebba4568 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -71,8 +71,7 @@ class CanvasItemEditor : public VBoxContainer {
GDCLASS(CanvasItemEditor, VBoxContainer);
- EditorNode *editor;
-
+public:
enum Tool {
TOOL_SELECT,
TOOL_LIST_SELECT,
@@ -84,6 +83,9 @@ class CanvasItemEditor : public VBoxContainer {
TOOL_MAX
};
+private:
+ EditorNode *editor;
+
enum MenuOption {
SNAP_USE,
SNAP_USE_NODE_PARENT,
@@ -535,6 +537,8 @@ public:
Control *get_viewport_control() { return viewport; }
+ Tool get_current_tool() { return tool; }
+
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
void edit(CanvasItem *p_canvas_item);