diff options
| author | Juan Linietsky | 2015-01-03 16:52:37 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-01-03 16:52:37 -0300 |
| commit | fbdd925d9be1c4c96d05089d7d5a58cd938b002c (patch) | |
| tree | 9f4eb2ae7c61450dffb4a86bb5e82cf66e23d496 /scene/gui/graph_edit.h | |
| parent | eb1f978b1c1693018e9a6d353ca914f8e6586b4e (diff) | |
| download | godot-fbdd925d9be1c4c96d05089d7d5a58cd938b002c.tar.gz godot-fbdd925d9be1c4c96d05089d7d5a58cd938b002c.tar.zst godot-fbdd925d9be1c4c96d05089d7d5a58cd938b002c.zip | |
Diffstat (limited to 'scene/gui/graph_edit.h')
| -rw-r--r-- | scene/gui/graph_edit.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h new file mode 100644 index 000000000..f8a2f3fee --- /dev/null +++ b/scene/gui/graph_edit.h @@ -0,0 +1,93 @@ +#ifndef GRAPH_EDIT_H +#define GRAPH_EDIT_H + +#include "scene/gui/graph_node.h" +#include "scene/gui/scroll_bar.h" + +class GraphEdit; + +class GraphEditFilter : public Control { + + OBJ_TYPE(GraphEditFilter,Control); + +friend class GraphEdit; + GraphEdit *ge; + virtual bool has_point(const Point2& p_point) const; + +public: + + + GraphEditFilter(GraphEdit *p_edit); +}; + +class GraphEdit : public Control { + + OBJ_TYPE(GraphEdit,Control); +public: + + struct Connection { + StringName from; + StringName to; + int from_port; + int to_port; + + }; +private: + + HScrollBar* h_scroll; + VScrollBar* v_scroll; + + + bool connecting; + String connecting_from; + bool connecting_out; + int connecting_index; + int connecting_type; + Color connecting_color; + bool connecting_target; + Vector2 connecting_to; + String connecting_target_to; + int connecting_target_index; + + + + bool updating; + List<Connection> connections; + + void _draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color); + + void _graph_node_raised(Node* p_gn); + void _graph_node_moved(Node *p_gn); + + void _update_scroll(); + void _scroll_moved(double); + void _input_event(const InputEvent& p_ev); + + GraphEditFilter *top_layer; + void _top_layer_input(const InputEvent& p_ev); + void _top_layer_draw(); + void _update_scroll_offset(); + +friend class GraphEditFilter; + bool _filter_input(const Point2& p_point); +protected: + + static void _bind_methods(); + virtual void add_child_notify(Node *p_child); + virtual void remove_child_notify(Node *p_child); + void _notification(int p_what); + +public: + + Error connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port); + bool is_node_connected(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port); + void disconnect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port); + void clear_connections(); + + void get_connection_list(List<Connection> *r_connections); + + + GraphEdit(); +}; + +#endif // GRAPHEdit_H |
