浏览代码

Initialize some graphedit values in the header

Lightning_A 4 年之前
父节点
当前提交
827f6739a2
共有 2 个文件被更改,包括 15 次插入28 次删除
  1. 0 13
      scene/gui/graph_edit.cpp
  2. 15 15
      scene/gui/graph_edit.h

+ 0 - 13
scene/gui/graph_edit.cpp

@@ -1717,8 +1717,6 @@ void GraphEdit::_bind_methods() {
 GraphEdit::GraphEdit() {
 	set_focus_mode(FOCUS_ALL);
 
-	awaiting_scroll_offset_update = false;
-	top_layer = NULL;
 	top_layer = memnew(GraphEditFilter(this));
 	add_child(top_layer);
 	top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
@@ -1741,13 +1739,6 @@ GraphEdit::GraphEdit() {
 	v_scroll->set_name("_v_scroll");
 	top_layer->add_child(v_scroll);
 
-	updating = false;
-	connecting = false;
-	right_disconnects = false;
-
-	box_selecting = false;
-	dragging = false;
-
 	//set large minmax so it can scroll even if not resized yet
 	h_scroll->set_min(-10000);
 	h_scroll->set_max(10000);
@@ -1758,8 +1749,6 @@ GraphEdit::GraphEdit() {
 	h_scroll->connect("value_changed", this, "_scroll_moved");
 	v_scroll->connect("value_changed", this, "_scroll_moved");
 
-	zoom = 1;
-
 	zoom_hb = memnew(HBoxContainer);
 	top_layer->add_child(zoom_hb);
 	zoom_hb->set_position(Vector2(10, 10));
@@ -1824,7 +1813,5 @@ GraphEdit::GraphEdit() {
 	minimap->set_margin(Margin::MARGIN_BOTTOM, -MINIMAP_OFFSET);
 	minimap->connect("draw", this, "_minimap_draw");
 
-	setting_scroll_ofs = false;
-	just_disconnected = false;
 	set_clip_contents(true);
 }

+ 15 - 15
scene/gui/graph_edit.h

@@ -126,38 +126,38 @@ private:
 	float port_grab_distance_horizontal;
 	float port_grab_distance_vertical;
 
-	bool connecting;
+	bool connecting = false;
 	String connecting_from;
-	bool connecting_out;
+	bool connecting_out = false;
 	int connecting_index;
 	int connecting_type;
 	Color connecting_color;
-	bool connecting_target;
+	bool connecting_target = false;
 	Vector2 connecting_to;
 	String connecting_target_to;
 	int connecting_target_index;
-	bool just_disconnected;
-	bool connecting_valid;
+	bool just_disconnected = false;
+	bool connecting_valid = false;
 	Vector2 click_pos;
 
-	bool dragging;
-	bool just_selected;
-	bool moving_selection;
+	bool dragging = false;
+	bool just_selected = false;
+	bool moving_selection = false;
 	Vector2 drag_accum;
 
-	float zoom;
+	float zoom = 1.0f;
 
-	bool box_selecting;
-	bool box_selection_mode_additive;
+	bool box_selecting = false;
+	bool box_selection_mode_additive = false;
 	Point2 box_selecting_from;
 	Point2 box_selecting_to;
 	Rect2 box_selecting_rect;
 	List<GraphNode *> previus_selected;
 
-	bool setting_scroll_ofs;
-	bool right_disconnects;
-	bool updating;
-	bool awaiting_scroll_offset_update;
+	bool setting_scroll_ofs = false;
+	bool right_disconnects = false;
+	bool updating = false;
+	bool awaiting_scroll_offset_update = false;
 	List<Connection> connections;
 
 	void _bake_segment2d(Vector<Vector2> &points, Vector<Color> &colors, 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;