summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorMariano Javier Suligoy <marianognu.easyrpg@gmail.com>2015-07-16 22:38:12 -0300
committerMariano Javier Suligoy <marianognu.easyrpg@gmail.com>2015-07-16 22:38:12 -0300
commit5b71fc45b703d2ea44cc1aa99830ec3e0966b3e6 (patch)
tree6b3c124a596db674357b98cd28fe9674b1e269aa /scene
parentf697ec2fe022583dde5f3ae650f49cfd7f237c33 (diff)
Use popup menu to add new nodes to the shader graph editor in the last clicked location.
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/graph_edit.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 3cd0dd3d16..d0ff4e48d3 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -499,7 +499,15 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
if (p_ev.type==InputEvent::MOUSE_MOTION && (p_ev.mouse_motion.button_mask&BUTTON_MASK_MIDDLE || (p_ev.mouse_motion.button_mask&BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x );
v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y );
- }
+ } else if (p_ev.type== InputEvent::MOUSE_BUTTON) {
+
+ const InputEventMouseButton &b=p_ev.mouse_button;
+
+ if (b.button_index==2 && b.pressed)
+ {
+ emit_signal("popup_request", Vector2(b.global_x, b.global_y));
+ }
+ }
}
void GraphEdit::clear_connections() {
@@ -554,8 +562,8 @@ void GraphEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_input_event"),&GraphEdit::_input_event);
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
- ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
-
+ ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
+ ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
}