Use popup menu to add new nodes to the shader graph editor in the last clicked location.

This commit is contained in:
Mariano Javier Suligoy 2015-07-16 22:38:12 -03:00
parent f697ec2fe0
commit 5b71fc45b7
3 changed files with 38 additions and 19 deletions

View file

@ -175,7 +175,7 @@ protected:
static void _bind_methods();
public:
void add_node(int p_type);
void add_node(int p_type, const Vector2 &location);
GraphEdit *get_graph_edit() { return graph_edit; }
void set_graph(Ref<ShaderGraph> p_graph);
@ -186,13 +186,15 @@ class ShaderGraphEditor : public VBoxContainer {
OBJ_TYPE(ShaderGraphEditor,VBoxContainer);
MenuButton *menu;
PopupMenu *popup;
TabContainer *tabs;
ShaderGraphView *graph_edits[ShaderGraph::SHADER_TYPE_MAX];
static const char* node_names[ShaderGraph::NODE_TYPE_MAX];
Vector2 next_location;
bool _2d;
void _add_node(int p_type);
void _popup_requested(const Vector2 &p_position);
protected:
void _notification(int p_what);
static void _bind_methods();