summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-01-18 16:21:27 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-01-18 16:21:27 +0100
commit765ffc983edc72291156656319054e890fce004d (patch)
tree30c637d26f714eca139be9cfe2859b7553582d78 /tools/editor
parent1469508174aa62ad4a0a0b83c83383ff498a304b (diff)
parentded1acc33eab3c50720a286afc852ea14eb0272e (diff)
Merge pull request #3370 from Ovnuniarchos/NewShadeOpOnCenter
New shader nodes are now created under (more or less) the cursor.
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp
index c6677b6883..36a8c79b84 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp
@@ -2658,13 +2658,13 @@ void ShaderGraphEditor::edit(Ref<ShaderGraph> p_shader) {
void ShaderGraphEditor::_add_node(int p_type) {
ShaderGraph::ShaderType shader_type=ShaderGraph::ShaderType(tabs->get_current_tab());
-
graph_edits[shader_type]->add_node(p_type, next_location);
}
void ShaderGraphEditor::_popup_requested(const Vector2 &p_position)
{
- next_location = get_local_mouse_pos();
+ Vector2 scroll_ofs=graph_edits[tabs->get_current_tab()]->get_graph_edit()->get_scroll_ofs();
+ next_location = get_local_mouse_pos() + scroll_ofs;
popup->set_global_pos(p_position);
popup->set_size( Size2( 200, 0) );
popup->popup();
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h
index 5ac9db3650..0336696911 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.h
+++ b/tools/editor/plugins/shader_graph_editor_plugin.h
@@ -149,7 +149,7 @@ class ShaderGraphView : public Node {
void _end_node_move();
void _move_node(int p_id,const Vector2& p_to);
void _duplicate_nodes_request();
- void _duplicate_nodes(const Array &p_nodes);
+ void _duplicate_nodes(const Array &p_nodes);
void _delete_nodes_request();