Initialize some graphedit values in the header

This commit is contained in:
Lightning_A 2021-04-26 09:22:28 -06:00
parent 77cf07c013
commit 827f6739a2
2 changed files with 15 additions and 28 deletions

View file

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

View file

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