diff options
Diffstat (limited to 'scene/gui/graph_edit.h')
-rw-r--r-- | scene/gui/graph_edit.h | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 3e9944332f..5166f82310 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -32,41 +32,37 @@ #include "scene/gui/graph_node.h" #include "scene/gui/scroll_bar.h" #include "scene/gui/slider.h" -#include "scene/gui/tool_button.h" #include "scene/gui/spin_box.h" #include "scene/gui/texture_rect.h" +#include "scene/gui/tool_button.h" class GraphEdit; class GraphEditFilter : public Control { - GDCLASS(GraphEditFilter,Control); + GDCLASS(GraphEditFilter, Control); friend class GraphEdit; GraphEdit *ge; - virtual bool has_point(const Point2& p_point) const; + virtual bool has_point(const Point2 &p_point) const; public: - - GraphEditFilter(GraphEdit *p_edit); }; class GraphEdit : public Control { - GDCLASS(GraphEdit,Control); -public: + GDCLASS(GraphEdit, Control); +public: struct Connection { StringName from; StringName to; int from_port; int to_port; - }; -private: - +private: ToolButton *zoom_minus; ToolButton *zoom_reset; ToolButton *zoom_plus; @@ -78,9 +74,8 @@ private: void _zoom_reset(); void _zoom_plus(); - HScrollBar* h_scroll; - VScrollBar* v_scroll; - + HScrollBar *h_scroll; + VScrollBar *v_scroll; bool connecting; String connecting_from; @@ -106,7 +101,7 @@ private: Point2 box_selecting_from; Point2 box_selecting_to; Rect2 box_selecting_rect; - List<GraphNode*> previus_selected; + List<GraphNode *> previus_selected; bool setting_scroll_ofs; bool right_disconnects; @@ -114,20 +109,20 @@ private: bool awaiting_scroll_offset_update; List<Connection> connections; - void _bake_segment2d(CanvasItem* p_where,float p_begin, float p_end, const Vector2& p_a, const Vector2& p_out, const Vector2& p_b, const Vector2& p_in, int p_depth, int p_min_depth, int p_max_depth, float p_tol, const Color& p_color, const Color& p_to_color, int &lines) const; + void _bake_segment2d(CanvasItem *p_where, float p_begin, float p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_min_depth, int p_max_depth, float p_tol, const Color &p_color, const Color &p_to_color, int &lines) const; - void _draw_cos_line(CanvasItem* p_where,const Vector2& p_from, const Vector2& p_to, const Color& p_color, const Color &p_to_color); + void _draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, const Color &p_to_color); - void _graph_node_raised(Node* p_gn); + void _graph_node_raised(Node *p_gn); void _graph_node_moved(Node *p_gn); void _update_scroll(); void _scroll_moved(double); - void _gui_input(const InputEvent& p_ev); + void _gui_input(const InputEvent &p_ev); Control *connections_layer; GraphEditFilter *top_layer; - void _top_layer_input(const InputEvent& p_ev); + void _top_layer_input(const InputEvent &p_ev); void _top_layer_draw(); void _connections_layer_draw(); void _update_scroll_offset(); @@ -136,8 +131,6 @@ private: bool lines_on_bg; - - struct ConnType { union { @@ -148,13 +141,13 @@ private: uint64_t key; }; - bool operator<(const ConnType& p_type) const { - return key<p_type.key; + bool operator<(const ConnType &p_type) const { + return key < p_type.key; } - ConnType(uint32_t a=0, uint32_t b=0) { - type_a=a; - type_b=b; + ConnType(uint32_t a = 0, uint32_t b = 0) { + type_a = a; + type_b = b; } }; @@ -163,26 +156,26 @@ private: Set<int> valid_right_disconnect_types; friend class GraphEditFilter; - bool _filter_input(const Point2& p_point); + bool _filter_input(const Point2 &p_point); void _snap_toggled(); void _snap_value_changed(double); -protected: +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); virtual bool clips_input() const; -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); +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 add_valid_connection_type(int p_type,int p_with_type); - void remove_valid_connection_type(int p_type,int p_with_type); - bool is_valid_connection_type(int p_type,int p_with_type) const; + void add_valid_connection_type(int p_type, int p_with_type); + void remove_valid_connection_type(int p_type, int p_with_type); + bool is_valid_connection_type(int p_type, int p_with_type) const; void set_zoom(float p_zoom); float get_zoom() const; @@ -199,10 +192,10 @@ public: void add_valid_left_disconnect_type(int p_type); void remove_valid_left_disconnect_type(int p_type); - void set_scroll_ofs(const Vector2& p_ofs); + void set_scroll_ofs(const Vector2 &p_ofs); Vector2 get_scroll_ofs() const; - void set_selected(Node* p_child); + void set_selected(Node *p_child); void set_use_snap(bool p_enable); bool is_using_snap() const; @@ -210,7 +203,6 @@ public: int get_snap() const; void set_snap(int p_snap); - GraphEdit(); }; |