Initialize class variables with default values in scene/ [2/2]

This commit is contained in:
Rafał Mikrut 2021-02-09 18:24:36 +01:00
parent df9c98e107
commit 7961a1dea3
171 changed files with 1007 additions and 1889 deletions

View file

@ -277,11 +277,7 @@ void EditorFeatureProfile::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_MAX); BIND_ENUM_CONSTANT(FEATURE_MAX);
} }
EditorFeatureProfile::EditorFeatureProfile() { EditorFeatureProfile::EditorFeatureProfile() {}
for (int i = 0; i < FEATURE_MAX; i++) {
features_disabled[i] = false;
}
}
////////////////////////// //////////////////////////

View file

@ -87,7 +87,7 @@ class VehicleWheel3D : public Node3D {
Vector3 m_wheelDirectionWS; //direction in worldspace Vector3 m_wheelDirectionWS; //direction in worldspace
Vector3 m_wheelAxleWS; // axle in worldspace Vector3 m_wheelAxleWS; // axle in worldspace
bool m_isInContact = false; bool m_isInContact = false;
PhysicsBody3D *m_groundObject; //could be general void* ptr PhysicsBody3D *m_groundObject = nullptr; //could be general void* ptr
} m_raycastInfo; } m_raycastInfo;
void _update(PhysicsDirectBodyState3D *s); void _update(PhysicsDirectBodyState3D *s);

View file

@ -437,7 +437,7 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
Vector2 blend_pos = get_parameter(blend_position); Vector2 blend_pos = get_parameter(blend_position);
int closest = get_parameter(this->closest); int closest = get_parameter(this->closest);
float length_internal = get_parameter(this->length_internal); float length_internal = get_parameter(this->length_internal);
float mind = 0; //time of min distance point float mind = 0.0; //time of min distance point
if (blend_mode == BLEND_MODE_INTERPOLATED) { if (blend_mode == BLEND_MODE_INTERPOLATED) {
if (triangles.size() == 0) { if (triangles.size() == 0) {
@ -529,7 +529,7 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
} }
if (new_closest != closest && new_closest != -1) { if (new_closest != closest && new_closest != -1) {
float from = 0; float from = 0.0;
if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) { if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
//see how much animation remains //see how much animation remains
from = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, true, 0.0, FILTER_IGNORE, false) - length_internal; from = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, true, 0.0, FILTER_IGNORE, false) - length_internal;

View file

@ -702,7 +702,7 @@ float AnimationNodeTransition::process(float p_time, bool p_seek) {
return 0; return 0;
} }
float rem = 0; float rem = 0.0;
if (prev < 0) { // process current animation, check for transition if (prev < 0) { // process current animation, check for transition

View file

@ -393,7 +393,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_st
//find next //find next
StringName next; StringName next;
float next_xfade = 0; float next_xfade = 0.0;
AnimationNodeStateMachineTransition::SwitchMode switch_mode = AnimationNodeStateMachineTransition::SWITCH_MODE_IMMEDIATE; AnimationNodeStateMachineTransition::SwitchMode switch_mode = AnimationNodeStateMachineTransition::SWITCH_MODE_IMMEDIATE;
if (path.size()) { if (path.size()) {

View file

@ -1132,7 +1132,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
Playback &c = playback; Playback &c = playback;
if (c.current.from) { if (c.current.from) {
float blend_time = 0; float blend_time = 0.0;
// find if it can blend // find if it can blend
BlendKey bk; BlendKey bk;
bk.from = c.current.from->name; bk.from = c.current.from->name;

View file

@ -158,7 +158,7 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
Ref<AnimationNode> node = blend_tree->get_node(node_name); Ref<AnimationNode> node = blend_tree->get_node(node_name);
//inputs.write[p_input].last_pass = state->last_pass; //inputs.write[p_input].last_pass = state->last_pass;
float activity = 0; float activity = 0.0;
float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path); Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);

View file

@ -1098,7 +1098,7 @@ void Tween::seek(real_t p_time) {
real_t Tween::tell() const { real_t Tween::tell() const {
// We want to grab the position of the furthest along tween // We want to grab the position of the furthest along tween
pending_update++; pending_update++;
real_t pos = 0; real_t pos = 0.0;
// For each interpolation... // For each interpolation...
for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
@ -1122,7 +1122,7 @@ real_t Tween::get_runtime() const {
pending_update++; pending_update++;
// For each interpolation... // For each interpolation...
real_t runtime = 0; real_t runtime = 0.0;
for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
// Get the tween data and see if it's runtime is greater than the previous tweens // Get the tween data and see if it's runtime is greater than the previous tweens
const InterpolateData &data = E->get(); const InterpolateData &data = E->get();

View file

@ -448,18 +448,7 @@ void BaseButton::_bind_methods() {
} }
BaseButton::BaseButton() { BaseButton::BaseButton() {
toggle_mode = false;
shortcut_in_tooltip = true;
keep_pressed_outside = false;
status.pressed = false;
status.press_attempt = false;
status.hovering = false;
status.pressing_inside = false;
status.disabled = false;
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
action_mode = ACTION_MODE_BUTTON_RELEASE;
button_mask = BUTTON_MASK_LEFT;
shortcut_context = ObjectID();
} }
BaseButton::~BaseButton() { BaseButton::~BaseButton() {

View file

@ -45,21 +45,21 @@ public:
}; };
private: private:
int button_mask; int button_mask = BUTTON_MASK_LEFT;
bool toggle_mode; bool toggle_mode = false;
bool shortcut_in_tooltip; bool shortcut_in_tooltip = true;
bool keep_pressed_outside; bool keep_pressed_outside = false;
Ref<Shortcut> shortcut; Ref<Shortcut> shortcut;
ObjectID shortcut_context; ObjectID shortcut_context;
ActionMode action_mode; ActionMode action_mode = ACTION_MODE_BUTTON_RELEASE;
struct Status { struct Status {
bool pressed; bool pressed = false;
bool hovering; bool hovering = false;
bool press_attempt; bool press_attempt = false;
bool pressing_inside; bool pressing_inside = false;
bool disabled; bool disabled = false;
} status; } status;

View file

@ -33,9 +33,9 @@
#include "margin_container.h" #include "margin_container.h"
struct _MinSizeCache { struct _MinSizeCache {
int min_size; int min_size = 0;
bool will_stretch; bool will_stretch = false;
int final_size; int final_size = 0;
}; };
void BoxContainer::_resort() { void BoxContainer::_resort() {
@ -50,7 +50,7 @@ void BoxContainer::_resort() {
int children_count = 0; int children_count = 0;
int stretch_min = 0; int stretch_min = 0;
int stretch_avail = 0; int stretch_avail = 0;
float stretch_ratio_total = 0; float stretch_ratio_total = 0.0;
Map<Control *, _MinSizeCache> min_size_cache; Map<Control *, _MinSizeCache> min_size_cache;
for (int i = 0; i < get_child_count(); i++) { for (int i = 0; i < get_child_count(); i++) {
@ -105,7 +105,7 @@ void BoxContainer::_resort() {
has_stretched = true; has_stretched = true;
bool refit_successful = true; //assume refit-test will go well bool refit_successful = true; //assume refit-test will go well
float error = 0; // Keep track of accumulated error in pixels float error = 0.0; // Keep track of accumulated error in pixels
for (int i = 0; i < get_child_count(); i++) { for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i)); Control *c = Object::cast_to<Control>(get_child(i));
@ -331,7 +331,6 @@ void BoxContainer::add_spacer(bool p_begin) {
BoxContainer::BoxContainer(bool p_vertical) { BoxContainer::BoxContainer(bool p_vertical) {
vertical = p_vertical; vertical = p_vertical;
align = ALIGN_BEGIN;
} }
void BoxContainer::_bind_methods() { void BoxContainer::_bind_methods() {

View file

@ -44,8 +44,8 @@ public:
}; };
private: private:
bool vertical; bool vertical = false;
AlignMode align; AlignMode align = ALIGN_BEGIN;
void _resort(); void _resort();

View file

@ -203,7 +203,7 @@ void Button::_notification(int p_what) {
color_icon.a = 0.4; color_icon.a = 0.4;
} }
float icon_ofs_region = 0; float icon_ofs_region = 0.0;
if (rtl) { if (rtl) {
if (_internal_margin[SIDE_RIGHT] > 0) { if (_internal_margin[SIDE_RIGHT] > 0) {
icon_ofs_region = _internal_margin[SIDE_RIGHT] + get_theme_constant("hseparation"); icon_ofs_region = _internal_margin[SIDE_RIGHT] + get_theme_constant("hseparation");
@ -544,16 +544,8 @@ Button::Button(const String &p_text) {
text_buf.instance(); text_buf.instance();
text_buf->set_flags(TextServer::BREAK_MANDATORY); text_buf->set_flags(TextServer::BREAK_MANDATORY);
flat = false;
clip_text = false;
expand_icon = false;
set_mouse_filter(MOUSE_FILTER_STOP); set_mouse_filter(MOUSE_FILTER_STOP);
set_text(p_text); set_text(p_text);
align = ALIGN_CENTER;
for (int i = 0; i < 4; i++) {
_internal_margin[i] = 0;
}
} }
Button::~Button() { Button::~Button() {

View file

@ -45,7 +45,7 @@ public:
}; };
private: private:
bool flat; bool flat = false;
String text; String text;
String xl_text; String xl_text;
Ref<TextParagraph> text_buf; Ref<TextParagraph> text_buf;
@ -55,10 +55,10 @@ private:
TextDirection text_direction = TEXT_DIRECTION_AUTO; TextDirection text_direction = TEXT_DIRECTION_AUTO;
Ref<Texture2D> icon; Ref<Texture2D> icon;
bool expand_icon; bool expand_icon = false;
bool clip_text; bool clip_text = false;
TextAlign align; TextAlign align = ALIGN_CENTER;
float _internal_margin[4]; float _internal_margin[4] = {};
void _shape(); void _shape();

View file

@ -95,6 +95,4 @@ void CenterContainer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_top_left"), "set_use_top_left", "is_using_top_left"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_top_left"), "set_use_top_left", "is_using_top_left");
} }
CenterContainer::CenterContainer() { CenterContainer::CenterContainer() {}
use_top_left = false;
}

View file

@ -36,7 +36,7 @@
class CenterContainer : public Container { class CenterContainer : public Container {
GDCLASS(CenterContainer, Container); GDCLASS(CenterContainer, Container);
bool use_top_left; bool use_top_left = false;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -719,17 +719,6 @@ void ColorPicker::_bind_methods() {
ColorPicker::ColorPicker() : ColorPicker::ColorPicker() :
BoxContainer(true) { BoxContainer(true) {
updating = true;
edit_alpha = true;
text_is_constructor = false;
hsv_mode_enabled = false;
raw_mode_enabled = false;
deferred_mode_enabled = false;
changing_color = false;
presets_enabled = true;
presets_visible = true;
screen = nullptr;
HBoxContainer *hb_edit = memnew(HBoxContainer); HBoxContainer *hb_edit = memnew(HBoxContainer);
add_child(hb_edit); add_child(hb_edit);
hb_edit->set_v_size_flags(SIZE_EXPAND_FILL); hb_edit->set_v_size_flags(SIZE_EXPAND_FILL);
@ -1002,12 +991,5 @@ void ColorPickerButton::_bind_methods() {
} }
ColorPickerButton::ColorPickerButton() { ColorPickerButton::ColorPickerButton() {
// Initialization is now done deferred,
// this improves performance in the inspector as the color picker
// can be expensive to initialize.
picker = nullptr;
popup = nullptr;
edit_alpha = true;
set_toggle_mode(true); set_toggle_mode(true);
} }

View file

@ -46,7 +46,7 @@ class ColorPicker : public BoxContainer {
GDCLASS(ColorPicker, BoxContainer); GDCLASS(ColorPicker, BoxContainer);
private: private:
Control *screen; Control *screen = nullptr;
Control *uv_edit; Control *uv_edit;
Control *w_edit; Control *w_edit;
TextureRect *sample; TextureRect *sample;
@ -64,20 +64,22 @@ private:
Label *labels[4]; Label *labels[4];
Button *text_type; Button *text_type;
LineEdit *c_text; LineEdit *c_text;
bool edit_alpha; bool edit_alpha = true;
Size2i ms; Size2i ms;
bool text_is_constructor; bool text_is_constructor = false;
int presets_per_row; int presets_per_row = 0;
Color color; Color color;
bool raw_mode_enabled; bool raw_mode_enabled = false;
bool hsv_mode_enabled; bool hsv_mode_enabled = false;
bool deferred_mode_enabled; bool deferred_mode_enabled = false;
bool updating; bool updating = true;
bool changing_color; bool changing_color = false;
bool presets_enabled; bool presets_enabled = true;
bool presets_visible; bool presets_visible = true;
float h, s, v; float h = 0.0;
float s = 0.0;
float v = 0.0;
Color last_hsv; Color last_hsv;
void _html_entered(const String &p_html); void _html_entered(const String &p_html);
@ -139,10 +141,14 @@ public:
class ColorPickerButton : public Button { class ColorPickerButton : public Button {
GDCLASS(ColorPickerButton, Button); GDCLASS(ColorPickerButton, Button);
PopupPanel *popup; // Initialization is now done deferred,
ColorPicker *picker; // this improves performance in the inspector as the color picker
// can be expensive to initialize.
PopupPanel *popup = nullptr;
ColorPicker *picker = nullptr;
Color color; Color color;
bool edit_alpha; bool edit_alpha = true;
void _color_changed(const Color &p_color); void _color_changed(const Color &p_color);
void _modal_closed(); void _modal_closed();

View file

@ -180,7 +180,6 @@ void Container::_bind_methods() {
} }
Container::Container() { Container::Container() {
pending_sort = false;
// All containers should let mouse events pass by default. // All containers should let mouse events pass by default.
set_mouse_filter(MOUSE_FILTER_PASS); set_mouse_filter(MOUSE_FILTER_PASS);
} }

View file

@ -36,7 +36,7 @@
class Container : public Control { class Container : public Control {
GDCLASS(Container, Control); GDCLASS(Container, Control);
bool pending_sort; bool pending_sort = false;
void _sort_children(); void _sort_children();
void _child_minsize_changed(); void _child_minsize_changed();

View file

@ -179,13 +179,13 @@ private:
LayoutDirection layout_dir = LAYOUT_DIRECTION_INHERITED; LayoutDirection layout_dir = LAYOUT_DIRECTION_INHERITED;
float rotation = 0; float rotation = 0.0;
Vector2 scale = Vector2(1, 1); Vector2 scale = Vector2(1, 1);
Vector2 pivot_offset; Vector2 pivot_offset;
int h_size_flags = SIZE_FILL; int h_size_flags = SIZE_FILL;
int v_size_flags = SIZE_FILL; int v_size_flags = SIZE_FILL;
float expand = 1; float expand = 1.0;
Point2 custom_minimum_size; Point2 custom_minimum_size;
MouseFilter mouse_filter = MOUSE_FILTER_STOP; MouseFilter mouse_filter = MOUSE_FILTER_STOP;

View file

@ -292,8 +292,6 @@ void AcceptDialog::set_swap_cancel_ok(bool p_swap) {
} }
AcceptDialog::AcceptDialog() { AcceptDialog::AcceptDialog() {
parent_visible = nullptr;
set_wrap_controls(true); set_wrap_controls(true);
set_visible(false); set_visible(false);
set_transient(true); set_transient(true);
@ -325,7 +323,6 @@ AcceptDialog::AcceptDialog() {
ok->connect("pressed", callable_mp(this, &AcceptDialog::_ok_pressed)); ok->connect("pressed", callable_mp(this, &AcceptDialog::_ok_pressed));
hide_on_ok = true;
set_title(RTR("Alert!")); set_title(RTR("Alert!"));
connect("window_input", callable_mp(this, &AcceptDialog::_input_from_window)); connect("window_input", callable_mp(this, &AcceptDialog::_input_from_window));

View file

@ -44,12 +44,12 @@ class LineEdit;
class AcceptDialog : public Window { class AcceptDialog : public Window {
GDCLASS(AcceptDialog, Window); GDCLASS(AcceptDialog, Window);
Window *parent_visible; Window *parent_visible = nullptr;
Panel *bg; Panel *bg;
HBoxContainer *hbc; HBoxContainer *hbc;
Label *label; Label *label;
Button *ok; Button *ok;
bool hide_on_ok; bool hide_on_ok = true;
void _custom_action(const String &p_action); void _custom_action(const String &p_action);
void _update_child_rects(); void _update_child_rects();

View file

@ -852,8 +852,6 @@ void FileDialog::set_default_show_hidden_files(bool p_show) {
FileDialog::FileDialog() { FileDialog::FileDialog() {
show_hidden_files = default_show_hidden_files; show_hidden_files = default_show_hidden_files;
mode_overrides_title = true;
vbox = memnew(VBoxContainer); vbox = memnew(VBoxContainer);
add_child(vbox); add_child(vbox);
vbox->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed)); vbox->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed));
@ -925,7 +923,6 @@ FileDialog::FileDialog() {
vbox->add_child(file_box); vbox->add_child(file_box);
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES); dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
access = ACCESS_RESOURCES;
_update_drives(); _update_drives();
connect("confirmed", callable_mp(this, &FileDialog::_action_pressed)); connect("confirmed", callable_mp(this, &FileDialog::_action_pressed));
@ -967,7 +964,6 @@ FileDialog::FileDialog() {
set_hide_on_ok(false); set_hide_on_ok(false);
invalidated = true;
if (register_func) { if (register_func) {
register_func(this); register_func(this);
} }

View file

@ -69,7 +69,7 @@ private:
LineEdit *makedirname; LineEdit *makedirname;
Button *makedir; Button *makedir;
Access access; Access access = ACCESS_RESOURCES;
//Button *action; //Button *action;
VBoxContainer *vbox; VBoxContainer *vbox;
FileMode mode; FileMode mode;
@ -93,12 +93,12 @@ private:
Vector<String> filters; Vector<String> filters;
bool mode_overrides_title; bool mode_overrides_title = true;
static bool default_show_hidden_files; static bool default_show_hidden_files;
bool show_hidden_files; bool show_hidden_files = false;
bool invalidated; bool invalidated = true;
void update_dir(); void update_dir();
void update_file_name(); void update_file_name();

View file

@ -42,8 +42,6 @@
#endif #endif
GradientEdit::GradientEdit() { GradientEdit::GradientEdit() {
grabbed = -1;
grabbing = false;
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
popup = memnew(PopupPanel); popup = memnew(PopupPanel);

View file

@ -44,8 +44,8 @@ class GradientEdit : public Control {
Ref<ImageTexture> checker; Ref<ImageTexture> checker;
bool grabbing; bool grabbing = false;
int grabbed; int grabbed = -1;
Vector<Gradient::Point> points; Vector<Gradient::Point> points;
void _draw_checker(int x, int y, int w, int h); void _draw_checker(int x, int y, int w, int h);

View file

@ -1657,8 +1657,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 = nullptr;
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);
@ -1681,13 +1679,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);
@ -1698,8 +1689,6 @@ GraphEdit::GraphEdit() {
h_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_scroll_moved)); h_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_scroll_moved));
v_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_scroll_moved)); v_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_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));
@ -1768,7 +1757,5 @@ GraphEdit::GraphEdit() {
minimap->set_offset(Side::SIDE_BOTTOM, -MINIMAP_OFFSET); minimap->set_offset(Side::SIDE_BOTTOM, -MINIMAP_OFFSET);
minimap->connect("draw", callable_mp(this, &GraphEdit::_minimap_draw)); minimap->connect("draw", callable_mp(this, &GraphEdit::_minimap_draw));
setting_scroll_ofs = false;
just_disconnected = false;
set_clip_contents(true); set_clip_contents(true);
} }

View file

@ -99,9 +99,9 @@ public:
struct Connection { struct Connection {
StringName from; StringName from;
StringName to; StringName to;
int from_port; int from_port = 0;
int to_port; int to_port = 0;
float activity; float activity = 0.0;
}; };
private: private:
@ -121,41 +121,41 @@ private:
HScrollBar *h_scroll; HScrollBar *h_scroll;
VScrollBar *v_scroll; VScrollBar *v_scroll;
float port_grab_distance_horizontal; float port_grab_distance_horizontal = 0.0;
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 = 0;
int connecting_type; int connecting_type = 0;
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.0;
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;
float lines_thickness = 2.0f; float lines_thickness = 2.0f;
@ -194,7 +194,7 @@ private:
uint32_t type_a; uint32_t type_a;
uint32_t type_b; uint32_t type_b;
}; };
uint64_t key; uint64_t key = 0;
}; };
bool operator<(const ConnType &p_type) const { bool operator<(const ConnType &p_type) const {

View file

@ -850,12 +850,5 @@ void GraphNode::_bind_methods() {
GraphNode::GraphNode() { GraphNode::GraphNode() {
title_buf.instance(); title_buf.instance();
overlay = OVERLAY_DISABLED;
show_close = false;
connpos_dirty = true;
set_mouse_filter(MOUSE_FILTER_STOP); set_mouse_filter(MOUSE_FILTER_STOP);
comment = false;
resizable = false;
resizing = false;
selected = false;
} }

View file

@ -46,23 +46,14 @@ public:
private: private:
struct Slot { struct Slot {
bool enable_left; bool enable_left = false;
int type_left; int type_left = 0;
Color color_left; Color color_left = Color(1, 1, 1, 1);
bool enable_right; bool enable_right = false;
int type_right; int type_right = 0;
Color color_right; Color color_right = Color(1, 1, 1, 1);
Ref<Texture2D> custom_slot_left; Ref<Texture2D> custom_slot_left;
Ref<Texture2D> custom_slot_right; Ref<Texture2D> custom_slot_right;
Slot() {
enable_left = false;
type_left = 0;
color_left = Color(1, 1, 1, 1);
enable_right = false;
type_right = 0;
color_right = Color(1, 1, 1, 1);
}
}; };
String title; String title;
@ -72,12 +63,12 @@ private:
String language; String language;
TextDirection text_direction = TEXT_DIRECTION_AUTO; TextDirection text_direction = TEXT_DIRECTION_AUTO;
bool show_close; bool show_close = false;
Vector2 position_offset; Vector2 position_offset;
bool comment; bool comment = false;
bool resizable; bool resizable = false;
bool resizing; bool resizing = false;
Vector2 resizing_from; Vector2 resizing_from;
Vector2 resizing_from_size; Vector2 resizing_from_size;
@ -87,7 +78,7 @@ private:
struct ConnCache { struct ConnCache {
Vector2 pos; Vector2 pos;
int type; int type = 0;
Color color; Color color;
}; };
@ -96,16 +87,16 @@ private:
Map<int, Slot> slot_info; Map<int, Slot> slot_info;
bool connpos_dirty; bool connpos_dirty = true;
void _connpos_update(); void _connpos_update();
void _resort(); void _resort();
void _shape(); void _shape();
Vector2 drag_from; Vector2 drag_from;
bool selected; bool selected = false;
Overlay overlay; Overlay overlay = OVERLAY_DISABLED;
protected: protected:
void _gui_input(const Ref<InputEvent> &p_ev); void _gui_input(const Ref<InputEvent> &p_ev);

View file

@ -261,6 +261,4 @@ Size2 GridContainer::get_minimum_size() const {
return ms; return ms;
} }
GridContainer::GridContainer() { GridContainer::GridContainer() {}
columns = 1;
}

View file

@ -36,7 +36,7 @@
class GridContainer : public Container { class GridContainer : public Container {
GDCLASS(GridContainer, Container); GDCLASS(GridContainer, Container);
int columns; int columns = 1;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -899,7 +899,7 @@ void ItemList::_notification(int p_what) {
} }
if (shape_changed) { if (shape_changed) {
float max_column_width = 0; float max_column_width = 0.0;
//1- compute item minimum sizes //1- compute item minimum sizes
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {
@ -1615,34 +1615,12 @@ void ItemList::_bind_methods() {
} }
ItemList::ItemList() { ItemList::ItemList() {
current = -1;
select_mode = SELECT_SINGLE;
icon_mode = ICON_MODE_LEFT;
fixed_column_width = 0;
same_column_width = false;
max_text_lines = 1;
max_columns = 1;
auto_height = false;
auto_height_value = 0.0f;
scroll_bar = memnew(VScrollBar); scroll_bar = memnew(VScrollBar);
add_child(scroll_bar); add_child(scroll_bar);
shape_changed = true;
scroll_bar->connect("value_changed", callable_mp(this, &ItemList::_scroll_changed)); scroll_bar->connect("value_changed", callable_mp(this, &ItemList::_scroll_changed));
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
current_columns = 1;
search_time_msec = 0;
ensure_selected_visible = false;
defer_select_single = -1;
allow_rmb_select = false;
allow_reselect = false;
do_autoscroll_to_bottom = false;
icon_scale = 1.0f;
set_clip_contents(true); set_clip_contents(true);
} }

View file

@ -52,7 +52,7 @@ public:
private: private:
struct Item { struct Item {
Ref<Texture2D> icon; Ref<Texture2D> icon;
bool icon_transposed; bool icon_transposed = false;
Rect2i icon_region; Rect2i icon_region;
Color icon_modulate; Color icon_modulate;
Ref<Texture2D> tag_icon; Ref<Texture2D> tag_icon;
@ -62,10 +62,10 @@ private:
String language; String language;
TextDirection text_direction = TEXT_DIRECTION_AUTO; TextDirection text_direction = TEXT_DIRECTION_AUTO;
bool selectable; bool selectable = false;
bool selected; bool selected = false;
bool disabled; bool disabled = false;
bool tooltip_enabled; bool tooltip_enabled = false;
Variant metadata; Variant metadata;
String tooltip; String tooltip;
Color custom_fg; Color custom_fg;
@ -79,44 +79,44 @@ private:
bool operator<(const Item &p_another) const { return text < p_another.text; } bool operator<(const Item &p_another) const { return text < p_another.text; }
}; };
int current; int current = -1;
bool shape_changed; bool shape_changed = true;
bool ensure_selected_visible; bool ensure_selected_visible = false;
bool same_column_width; bool same_column_width = false;
bool auto_height; bool auto_height = false;
float auto_height_value; float auto_height_value = 0.0;
Vector<Item> items; Vector<Item> items;
Vector<int> separators; Vector<int> separators;
SelectMode select_mode; SelectMode select_mode = SELECT_SINGLE;
IconMode icon_mode; IconMode icon_mode = ICON_MODE_LEFT;
VScrollBar *scroll_bar; VScrollBar *scroll_bar;
uint64_t search_time_msec; uint64_t search_time_msec = 0;
String search_string; String search_string;
int current_columns; int current_columns = 1;
int fixed_column_width; int fixed_column_width = 0;
int max_text_lines; int max_text_lines = 1;
int max_columns; int max_columns = 1;
Size2 fixed_icon_size; Size2 fixed_icon_size;
Size2 max_item_size_cache; Size2 max_item_size_cache;
int defer_select_single; int defer_select_single = -1;
bool allow_rmb_select; bool allow_rmb_select = false;
bool allow_reselect; bool allow_reselect = false;
real_t icon_scale; real_t icon_scale = 1.0;
bool do_autoscroll_to_bottom; bool do_autoscroll_to_bottom = false;
Array _get_items() const; Array _get_items() const;
void _set_items(const Array &p_items); void _set_items(const Array &p_items);

View file

@ -194,7 +194,7 @@ void Label::_notification(int p_what) {
style->draw(ci, Rect2(Point2(0, 0), get_size())); style->draw(ci, Rect2(Point2(0, 0), get_size()));
float total_h = 0; float total_h = 0.0;
int lines_visible = 0; int lines_visible = 0;
// Get number of lines to fit to the height. // Get number of lines to fit to the height.
@ -391,7 +391,7 @@ int Label::get_visible_line_count() const {
Ref<StyleBox> style = get_theme_stylebox("normal"); Ref<StyleBox> style = get_theme_stylebox("normal");
int line_spacing = get_theme_constant("line_spacing"); int line_spacing = get_theme_constant("line_spacing");
int lines_visible = 0; int lines_visible = 0;
float total_h = 0; float total_h = 0.0;
for (int64_t i = lines_skipped; i < lines_rid.size(); i++) { for (int64_t i = lines_skipped; i < lines_rid.size(); i++) {
total_h += TS->shaped_text_get_size(lines_rid[i]).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM) + line_spacing; total_h += TS->shaped_text_get_size(lines_rid[i]).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM) + line_spacing;
if (total_h > (get_size().height - style->get_minimum_size().height + line_spacing)) { if (total_h > (get_size().height - style->get_minimum_size().height + line_spacing)) {

View file

@ -72,7 +72,7 @@ private:
Control::StructuredTextParser st_parser = STRUCTURED_TEXT_DEFAULT; Control::StructuredTextParser st_parser = STRUCTURED_TEXT_DEFAULT;
Array st_args; Array st_args;
float percent_visible = 1; float percent_visible = 1.0;
int visible_chars = -1; int visible_chars = -1;
int lines_skipped = 0; int lines_skipped = 0;

View file

@ -2264,9 +2264,6 @@ LineEdit::LineEdit() {
text_rid = TS->create_shaped_text(); text_rid = TS->create_shaped_text();
_create_undo_state(); _create_undo_state();
clear_button_status.press_attempt = false;
clear_button_status.pressing_inside = false;
deselect(); deselect();
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
set_default_cursor_shape(CURSOR_IBEAM); set_default_cursor_shape(CURSOR_IBEAM);

View file

@ -94,7 +94,7 @@ private:
Point2 ime_selection; Point2 ime_selection;
RID text_rid; RID text_rid;
float full_width = 0; float full_width = 0.0;
bool selecting_enabled = true; bool selecting_enabled = true;
@ -129,19 +129,19 @@ private:
Ref<Texture2D> right_icon; Ref<Texture2D> right_icon;
struct Selection { struct Selection {
int begin; int begin = 0;
int end; int end = 0;
int cursor_start; int cursor_start = 0;
bool enabled; bool enabled = false;
bool creating; bool creating = false;
bool doubleclick; bool doubleclick = false;
bool drag_attempt; bool drag_attempt = false;
} selection; } selection;
struct TextOperation { struct TextOperation {
int cursor_pos; int cursor_pos = 0;
int scroll_offset; int scroll_offset = 0;
int cached_width; int cached_width = 0;
String text; String text;
}; };
List<TextOperation> undo_stack; List<TextOperation> undo_stack;

View file

@ -294,7 +294,6 @@ void LinkButton::_bind_methods() {
LinkButton::LinkButton() { LinkButton::LinkButton() {
text_buf.instance(); text_buf.instance();
underline_mode = UNDERLINE_MODE_ALWAYS;
set_focus_mode(FOCUS_NONE); set_focus_mode(FOCUS_NONE);
set_default_cursor_shape(CURSOR_POINTING_HAND); set_default_cursor_shape(CURSOR_POINTING_HAND);
} }

View file

@ -48,7 +48,7 @@ public:
private: private:
String text; String text;
Ref<TextLine> text_buf; Ref<TextLine> text_buf;
UnderlineMode underline_mode; UnderlineMode underline_mode = UNDERLINE_MODE_ALWAYS;
Dictionary opentype_features; Dictionary opentype_features;
String language; String language;

View file

@ -118,7 +118,6 @@ void MenuButton::set_disable_shortcuts(bool p_disabled) {
} }
MenuButton::MenuButton() { MenuButton::MenuButton() {
switch_on_hover = false;
set_flat(true); set_flat(true);
set_toggle_mode(true); set_toggle_mode(true);
set_disable_shortcuts(false); set_disable_shortcuts(false);

View file

@ -37,9 +37,9 @@
class MenuButton : public Button { class MenuButton : public Button {
GDCLASS(MenuButton, Button); GDCLASS(MenuButton, Button);
bool clicked; bool clicked = false;
bool switch_on_hover; bool switch_on_hover = false;
bool disable_shortcuts; bool disable_shortcuts = false;
PopupMenu *popup; PopupMenu *popup;
Array _get_items() const; Array _get_items() const;

View file

@ -174,16 +174,7 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_v_axis_stretch_mode() const {
} }
NinePatchRect::NinePatchRect() { NinePatchRect::NinePatchRect() {
margin[SIDE_LEFT] = 0;
margin[SIDE_RIGHT] = 0;
margin[SIDE_BOTTOM] = 0;
margin[SIDE_TOP] = 0;
set_mouse_filter(MOUSE_FILTER_IGNORE); set_mouse_filter(MOUSE_FILTER_IGNORE);
draw_center = true;
axis_h = AXIS_STRETCH_MODE_STRETCH;
axis_v = AXIS_STRETCH_MODE_STRETCH;
} }
NinePatchRect::~NinePatchRect() { NinePatchRect::~NinePatchRect() {

View file

@ -43,12 +43,13 @@ public:
AXIS_STRETCH_MODE_TILE_FIT, AXIS_STRETCH_MODE_TILE_FIT,
}; };
bool draw_center; bool draw_center = true;
int margin[4]; int margin[4] = {};
Rect2 region_rect; Rect2 region_rect;
Ref<Texture2D> texture; Ref<Texture2D> texture;
AxisStretchMode axis_h, axis_v; AxisStretchMode axis_h = AXIS_STRETCH_MODE_STRETCH;
AxisStretchMode axis_v = AXIS_STRETCH_MODE_STRETCH;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -336,7 +336,6 @@ void OptionButton::_bind_methods() {
} }
OptionButton::OptionButton() { OptionButton::OptionButton() {
current = -1;
set_toggle_mode(true); set_toggle_mode(true);
set_text_align(ALIGN_LEFT); set_text_align(ALIGN_LEFT);
if (is_layout_rtl()) { if (is_layout_rtl()) {

View file

@ -38,7 +38,7 @@ class OptionButton : public Button {
GDCLASS(OptionButton, Button); GDCLASS(OptionButton, Button);
PopupMenu *popup; PopupMenu *popup;
int current; int current = -1;
void _focused(int p_which); void _focused(int p_which);
void _selected(int p_which); void _selected(int p_which);

View file

@ -52,8 +52,8 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
Size2 minsize = get_theme_stylebox("panel")->get_minimum_size(); // Accounts for margin in the margin container Size2 minsize = get_theme_stylebox("panel")->get_minimum_size(); // Accounts for margin in the margin container
minsize.x += scroll_container->get_v_scrollbar()->get_size().width * 2; // Adds a buffer so that the scrollbar does not render over the top of content minsize.x += scroll_container->get_v_scrollbar()->get_size().width * 2; // Adds a buffer so that the scrollbar does not render over the top of content
float max_w = 0; float max_w = 0.0;
float icon_w = 0; float icon_w = 0.0;
int check_w = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation; int check_w = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
int accel_max_w = 0; int accel_max_w = 0;
bool has_check = false; bool has_check = false;
@ -1656,19 +1656,6 @@ PopupMenu::PopupMenu() {
connect("window_input", callable_mp(this, &PopupMenu::_gui_input)); connect("window_input", callable_mp(this, &PopupMenu::_gui_input));
mouse_over = -1;
submenu_over = -1;
initial_button_mask = 0;
during_grabbed_click = false;
allow_search = true;
search_time_msec = 0;
search_string = "";
set_hide_on_item_selection(true);
set_hide_on_checkable_item_selection(true);
set_hide_on_multistate_item_selection(false);
submenu_timer = memnew(Timer); submenu_timer = memnew(Timer);
submenu_timer->set_wait_time(0.3); submenu_timer->set_wait_time(0.3);
submenu_timer->set_one_shot(true); submenu_timer->set_one_shot(true);

View file

@ -51,28 +51,28 @@ class PopupMenu : public Popup {
String language; String language;
Control::TextDirection text_direction = Control::TEXT_DIRECTION_AUTO; Control::TextDirection text_direction = Control::TEXT_DIRECTION_AUTO;
bool checked; bool checked = false;
enum { enum {
CHECKABLE_TYPE_NONE, CHECKABLE_TYPE_NONE,
CHECKABLE_TYPE_CHECK_BOX, CHECKABLE_TYPE_CHECK_BOX,
CHECKABLE_TYPE_RADIO_BUTTON, CHECKABLE_TYPE_RADIO_BUTTON,
} checkable_type; } checkable_type;
int max_states; int max_states = 0;
int state; int state = 0;
bool separator; bool separator = false;
bool disabled; bool disabled = false;
bool dirty; bool dirty = true;
int id; int id = 0;
Variant metadata; Variant metadata;
String submenu; String submenu;
String tooltip; String tooltip;
uint32_t accel; uint32_t accel = 0;
int _ofs_cache; int _ofs_cache = 0;
int _height_cache; int _height_cache = 0;
int h_ofs; int h_ofs = 0;
Ref<Shortcut> shortcut; Ref<Shortcut> shortcut;
bool shortcut_is_global; bool shortcut_is_global = false;
bool shortcut_is_disabled; bool shortcut_is_disabled = false;
// Returns (0,0) if icon is null. // Returns (0,0) if icon is null.
Size2 get_icon_size() const { Size2 get_icon_size() const {
@ -82,19 +82,7 @@ class PopupMenu : public Popup {
Item() { Item() {
text_buf.instance(); text_buf.instance();
accel_text_buf.instance(); accel_text_buf.instance();
dirty = true;
checked = false;
checkable_type = CHECKABLE_TYPE_NONE; checkable_type = CHECKABLE_TYPE_NONE;
separator = false;
max_states = 0;
state = 0;
accel = 0;
disabled = false;
_ofs_cache = 0;
_height_cache = 0;
h_ofs = 0;
shortcut_is_global = false;
shortcut_is_disabled = false;
} }
}; };
@ -104,10 +92,10 @@ class PopupMenu : public Popup {
Timer *submenu_timer; Timer *submenu_timer;
List<Rect2> autohide_areas; List<Rect2> autohide_areas;
Vector<Item> items; Vector<Item> items;
int initial_button_mask; int initial_button_mask = 0;
bool during_grabbed_click; bool during_grabbed_click = false;
int mouse_over; int mouse_over = -1;
int submenu_over; int submenu_over = -1;
Rect2 parent_rect; Rect2 parent_rect;
String _get_accel_text(const Item &p_item) const; String _get_accel_text(const Item &p_item) const;
int _get_mouse_over(const Point2 &p_over) const; int _get_mouse_over(const Point2 &p_over) const;
@ -123,9 +111,9 @@ class PopupMenu : public Popup {
void _submenu_timeout(); void _submenu_timeout();
uint64_t popup_time_msec = 0; uint64_t popup_time_msec = 0;
bool hide_on_item_selection; bool hide_on_item_selection = true;
bool hide_on_checkable_item_selection; bool hide_on_checkable_item_selection = true;
bool hide_on_multistate_item_selection; bool hide_on_multistate_item_selection = false;
Vector2 moved; Vector2 moved;
Array _get_items() const; Array _get_items() const;
@ -136,9 +124,9 @@ class PopupMenu : public Popup {
void _ref_shortcut(Ref<Shortcut> p_sc); void _ref_shortcut(Ref<Shortcut> p_sc);
void _unref_shortcut(Ref<Shortcut> p_sc); void _unref_shortcut(Ref<Shortcut> p_sc);
bool allow_search; bool allow_search = true;
uint64_t search_time_msec; uint64_t search_time_msec = 0;
String search_string; String search_string = "";
MarginContainer *margin_container; MarginContainer *margin_container;
ScrollContainer *scroll_container; ScrollContainer *scroll_container;

View file

@ -98,5 +98,4 @@ void ProgressBar::_bind_methods() {
ProgressBar::ProgressBar() { ProgressBar::ProgressBar() {
set_v_size_flags(0); set_v_size_flags(0);
set_step(0.01); set_step(0.01);
percent_visible = true;
} }

View file

@ -36,7 +36,7 @@
class ProgressBar : public Range { class ProgressBar : public Range {
GDCLASS(ProgressBar, Range); GDCLASS(ProgressBar, Range);
bool percent_visible; bool percent_visible = true;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -314,17 +314,7 @@ bool Range::is_lesser_allowed() const {
Range::Range() { Range::Range() {
shared = memnew(Shared); shared = memnew(Shared);
shared->min = 0;
shared->max = 100;
shared->val = 0;
shared->step = 1;
shared->page = 0;
shared->owners.insert(this); shared->owners.insert(this);
shared->exp_ratio = false;
shared->allow_greater = false;
shared->allow_lesser = false;
_rounded_values = false;
} }
Range::~Range() { Range::~Range() {

View file

@ -37,11 +37,14 @@ class Range : public Control {
GDCLASS(Range, Control); GDCLASS(Range, Control);
struct Shared { struct Shared {
double val, min, max; double val = 0.0;
double step, page; double min = 0.0;
bool exp_ratio; double max = 100.0;
bool allow_greater; double step = 1.0;
bool allow_lesser; double page = 0.0;
bool exp_ratio = false;
bool allow_greater = false;
bool allow_lesser = false;
Set<Range *> owners; Set<Range *> owners;
void emit_value_changed(); void emit_value_changed();
void emit_changed(const char *p_what = ""); void emit_changed(const char *p_what = "");
@ -62,7 +65,7 @@ protected:
static void _bind_methods(); static void _bind_methods();
bool _rounded_values; bool _rounded_values = false;
public: public:
void set_value(double p_val); void set_value(double p_val);

View file

@ -314,7 +314,7 @@ void RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font>
table->rows.clear(); table->rows.clear();
Vector2 offset; Vector2 offset;
float row_height = 0; float row_height = 0.0;
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) { for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames. ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames.
@ -553,7 +553,7 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
table->rows.clear(); table->rows.clear();
Vector2 offset; Vector2 offset;
float row_height = 0; float row_height = 0.0;
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) { for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames. ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames.
@ -1847,7 +1847,7 @@ int RichTextLabel::_find_list(Item *p_item, Vector<int> &r_index, Vector<ItemLis
int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int p_base_font_size) { int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int p_base_font_size) {
Item *item = p_item; Item *item = p_item;
float margin = 0; float margin = 0.0;
while (item) { while (item) {
if (item->type == ITEM_INDENT) { if (item->type == ITEM_INDENT) {
@ -4066,19 +4066,6 @@ RichTextLabel::RichTextLabel() {
main->first_invalid_line = 0; main->first_invalid_line = 0;
main->first_resized_line = 0; main->first_resized_line = 0;
current_frame = main; current_frame = main;
tab_size = 4;
default_align = ALIGN_LEFT;
underline_meta = true;
meta_hovering = nullptr;
override_selected_font_color = false;
scroll_visible = false;
scroll_follow = false;
scroll_following = false;
updating_scroll = false;
scroll_active = true;
scroll_w = 0;
scroll_updated = false;
vscroll = memnew(VScrollBar); vscroll = memnew(VScrollBar);
add_child(vscroll); add_child(vscroll);
@ -4090,19 +4077,6 @@ RichTextLabel::RichTextLabel() {
vscroll->connect("value_changed", callable_mp(this, &RichTextLabel::_scroll_changed)); vscroll->connect("value_changed", callable_mp(this, &RichTextLabel::_scroll_changed));
vscroll->set_step(1); vscroll->set_step(1);
vscroll->hide(); vscroll->hide();
use_bbcode = false;
selection.click_frame = nullptr;
selection.click_item = nullptr;
selection.active = false;
selection.enabled = false;
visible_characters = -1;
percent_visible = 1;
visible_line_count = 0;
fixed_width = -1;
fit_content_height = false;
set_clip_contents(true); set_clip_contents(true);
} }

View file

@ -147,9 +147,9 @@ private:
struct ItemDropcap : public Item { struct ItemDropcap : public Item {
String text; String text;
Ref<Font> font; Ref<Font> font;
int font_size; int font_size = 0;
Color color; Color color;
int ol_size; int ol_size = 0;
Color ol_color; Color ol_color;
Rect2 dropcap_margins; Rect2 dropcap_margins;
ItemDropcap() { type = ITEM_DROPCAP; } ItemDropcap() { type = ITEM_DROPCAP; }
@ -232,11 +232,11 @@ private:
struct ItemTable : public Item { struct ItemTable : public Item {
struct Column { struct Column {
bool expand; bool expand = false;
int expand_ratio; int expand_ratio = 0;
int min_width; int min_width = 0;
int max_width; int max_width = 0;
int width; int width = 0;
}; };
Vector<Column> columns; Vector<Column> columns;
@ -322,31 +322,31 @@ private:
} }
}; };
ItemFrame *main; ItemFrame *main = nullptr;
Item *current; Item *current = nullptr;
ItemFrame *current_frame; ItemFrame *current_frame = nullptr;
VScrollBar *vscroll; VScrollBar *vscroll = nullptr;
bool scroll_visible; bool scroll_visible = false;
bool scroll_follow; bool scroll_follow = false;
bool scroll_following; bool scroll_following = false;
bool scroll_active; bool scroll_active = true;
int scroll_w; int scroll_w = 0;
bool scroll_updated; bool scroll_updated = false;
bool updating_scroll; bool updating_scroll = false;
int current_idx = 1; int current_idx = 1;
int current_char_ofs = 0; int current_char_ofs = 0;
int visible_paragraph_count; int visible_paragraph_count = 0;
int visible_line_count; int visible_line_count = 0;
int tab_size; int tab_size = 4;
bool underline_meta; bool underline_meta = true;
bool override_selected_font_color; bool override_selected_font_color = false;
Align default_align; Align default_align = ALIGN_LEFT;
ItemMeta *meta_hovering; ItemMeta *meta_hovering = nullptr;
Variant current_meta; Variant current_meta;
Vector<Ref<RichTextEffect>> custom_effects; Vector<Ref<RichTextEffect>> custom_effects;
@ -363,29 +363,29 @@ private:
Array st_args; Array st_args;
struct Selection { struct Selection {
ItemFrame *click_frame; ItemFrame *click_frame = nullptr;
int click_line; int click_line = 0;
Item *click_item; Item *click_item = nullptr;
int click_char; int click_char = 0;
ItemFrame *from_frame; ItemFrame *from_frame = nullptr;
int from_line; int from_line = 0;
Item *from_item; Item *from_item = nullptr;
int from_char; int from_char = 0;
ItemFrame *to_frame; ItemFrame *to_frame = nullptr;
int to_line; int to_line = 0;
Item *to_item; Item *to_item = nullptr;
int to_char; int to_char = 0;
bool active; // anything selected? i.e. from, to, etc. valid? bool active = false; // anything selected? i.e. from, to, etc. valid?
bool enabled; // allow selections? bool enabled = false; // allow selections?
}; };
Selection selection; Selection selection;
int visible_characters; int visible_characters = -1;
float percent_visible; float percent_visible = 1.0;
void _find_click(ItemFrame *p_frame, const Point2i &p_click, ItemFrame **r_click_frame = nullptr, int *r_click_line = nullptr, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr); void _find_click(ItemFrame *p_frame, const Point2i &p_click, ItemFrame **r_click_frame = nullptr, int *r_click_line = nullptr, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr);
@ -434,12 +434,12 @@ private:
Ref<RichTextEffect> _get_custom_effect_by_code(String p_bbcode_identifier); Ref<RichTextEffect> _get_custom_effect_by_code(String p_bbcode_identifier);
virtual Dictionary parse_expressions_for_values(Vector<String> p_expressions); virtual Dictionary parse_expressions_for_values(Vector<String> p_expressions);
bool use_bbcode; bool use_bbcode = false;
String bbcode; String bbcode;
int fixed_width; int fixed_width = -1;
bool fit_content_height; bool fit_content_height = false;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -434,7 +434,7 @@ double ScrollBar::get_area_size() const {
} }
double ScrollBar::get_area_offset() const { double ScrollBar::get_area_offset() const {
double ofs = 0; double ofs = 0.0;
if (orientation == VERTICAL) { if (orientation == VERTICAL) {
ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_TOP); ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_TOP);

View file

@ -47,14 +47,14 @@ class ScrollBar : public Range {
Orientation orientation; Orientation orientation;
Size2 size; Size2 size;
float custom_step = -1; float custom_step = -1.0;
HighlightStatus highlight = HIGHLIGHT_NONE; HighlightStatus highlight = HIGHLIGHT_NONE;
struct Drag { struct Drag {
bool active = false; bool active = false;
float pos_at_click = 0; float pos_at_click = 0.0;
float value_at_click = 0; float value_at_click = 0.0;
} drag; } drag;
double get_grabber_size() const; double get_grabber_size() const;
@ -73,14 +73,14 @@ class ScrollBar : public Range {
Vector2 drag_node_accum; Vector2 drag_node_accum;
Vector2 drag_node_from; Vector2 drag_node_from;
Vector2 last_drag_node_accum; Vector2 last_drag_node_accum;
float last_drag_node_time; float last_drag_node_time = 0.0;
float time_since_motion; float time_since_motion = 0.0;
bool drag_node_touching = false; bool drag_node_touching = false;
bool drag_node_touching_deaccel = false; bool drag_node_touching_deaccel = false;
bool click_handled; bool click_handled = false;
bool scrolling = false; bool scrolling = false;
double target_scroll = 0; double target_scroll = 0.0;
bool smooth_scroll_enabled = false; bool smooth_scroll_enabled = false;
void _drag_node_exit(); void _drag_node_exit();

View file

@ -244,11 +244,11 @@ void ScrollContainer::_ensure_focused_visible(Control *p_control) {
if (is_a_parent_of(p_control)) { if (is_a_parent_of(p_control)) {
Rect2 global_rect = get_global_rect(); Rect2 global_rect = get_global_rect();
Rect2 other_rect = p_control->get_global_rect(); Rect2 other_rect = p_control->get_global_rect();
float right_margin = 0; float right_margin = 0.0;
if (v_scroll->is_visible()) { if (v_scroll->is_visible()) {
right_margin += v_scroll->get_size().x; right_margin += v_scroll->get_size().x;
} }
float bottom_margin = 0; float bottom_margin = 0.0;
if (h_scroll->is_visible()) { if (h_scroll->is_visible()) {
bottom_margin += h_scroll->get_size().y; bottom_margin += h_scroll->get_size().y;
} }
@ -624,15 +624,7 @@ ScrollContainer::ScrollContainer() {
add_child(v_scroll); add_child(v_scroll);
v_scroll->connect("value_changed", callable_mp(this, &ScrollContainer::_scroll_moved)); v_scroll->connect("value_changed", callable_mp(this, &ScrollContainer::_scroll_moved));
drag_speed = Vector2();
drag_touching = false;
drag_touching_deaccel = false;
beyond_deadzone = false;
scroll_h = true;
scroll_v = true;
deadzone = GLOBAL_GET("gui/common/default_scroll_deadzone"); deadzone = GLOBAL_GET("gui/common/default_scroll_deadzone");
follow_focus = false;
set_clip_contents(true); set_clip_contents(true);
}; };

View file

@ -50,18 +50,18 @@ class ScrollContainer : public Container {
Vector2 drag_accum; Vector2 drag_accum;
Vector2 drag_from; Vector2 drag_from;
Vector2 last_drag_accum; Vector2 last_drag_accum;
float last_drag_time; float last_drag_time = 0.0;
float time_since_motion; float time_since_motion = 0.0;
bool drag_touching; bool drag_touching = false;
bool drag_touching_deaccel; bool drag_touching_deaccel = false;
bool click_handled; bool click_handled = false;
bool beyond_deadzone; bool beyond_deadzone = false;
bool scroll_h; bool scroll_h = true;
bool scroll_v; bool scroll_v = true;
int deadzone; int deadzone = 0;
bool follow_focus; bool follow_focus = false;
void _cancel_drag(); void _cancel_drag();

View file

@ -36,7 +36,7 @@ class Separator : public Control {
GDCLASS(Separator, Control); GDCLASS(Separator, Control);
protected: protected:
Orientation orientation; Orientation orientation = Orientation::HORIZONTAL;
void _notification(int p_what); void _notification(int p_what);
public: public:

View file

@ -269,12 +269,5 @@ void Slider::_bind_methods() {
Slider::Slider(Orientation p_orientation) { Slider::Slider(Orientation p_orientation) {
orientation = p_orientation; orientation = p_orientation;
mouse_inside = false;
grab.active = false;
ticks = 0;
ticks_on_borders = false;
custom_step = -1;
editable = true;
scrollable = true;
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
} }

View file

@ -37,23 +37,23 @@ class Slider : public Range {
GDCLASS(Slider, Range); GDCLASS(Slider, Range);
struct Grab { struct Grab {
int pos; int pos = 0;
float uvalue; float uvalue = 0.0;
bool active; bool active = false;
} grab; } grab;
int ticks; int ticks = 0;
bool mouse_inside; bool mouse_inside = false;
Orientation orientation; Orientation orientation;
float custom_step; float custom_step = -1.0;
bool editable; bool editable = true;
bool scrollable; bool scrollable = true;
protected: protected:
void _gui_input(Ref<InputEvent> p_event); void _gui_input(Ref<InputEvent> p_event);
void _notification(int p_what); void _notification(int p_what);
static void _bind_methods(); static void _bind_methods();
bool ticks_on_borders; bool ticks_on_borders = false;
public: public:
virtual Size2 get_minimum_size() const override; virtual Size2 get_minimum_size() const override;

View file

@ -268,7 +268,6 @@ void SpinBox::_bind_methods() {
} }
SpinBox::SpinBox() { SpinBox::SpinBox() {
last_w = 0;
line_edit = memnew(LineEdit); line_edit = memnew(LineEdit);
add_child(line_edit); add_child(line_edit);

View file

@ -39,7 +39,7 @@ class SpinBox : public Range {
GDCLASS(SpinBox, Range); GDCLASS(SpinBox, Range);
LineEdit *line_edit; LineEdit *line_edit;
int last_w; int last_w = 0;
Timer *range_click_timer; Timer *range_click_timer;
void _range_click_timeout(); void _range_click_timeout();
@ -52,11 +52,11 @@ class SpinBox : public Range {
void _line_edit_input(const Ref<InputEvent> &p_event); void _line_edit_input(const Ref<InputEvent> &p_event);
struct Drag { struct Drag {
float base_val = 0; float base_val = 0.0;
bool allowed = false; bool allowed = false;
bool enabled = false; bool enabled = false;
Vector2 capture_pos; Vector2 capture_pos;
float diff_y = 0; float diff_y = 0.0;
} drag; } drag;
void _line_edit_focus_exit(); void _line_edit_focus_exit();

View file

@ -359,12 +359,5 @@ void SplitContainer::_bind_methods() {
} }
SplitContainer::SplitContainer(bool p_vertical) { SplitContainer::SplitContainer(bool p_vertical) {
mouse_inside = false;
split_offset = 0;
should_clamp_split_offset = false;
middle_sep = 0;
vertical = p_vertical; vertical = p_vertical;
dragging = false;
collapsed = false;
dragger_visibility = DRAGGER_VISIBLE;
} }

View file

@ -44,16 +44,16 @@ public:
}; };
private: private:
bool should_clamp_split_offset; bool should_clamp_split_offset = false;
int split_offset; int split_offset = 0;
int middle_sep; int middle_sep = 0;
bool vertical; bool vertical = false;
bool dragging; bool dragging = false;
int drag_from; int drag_from = 0;
int drag_ofs; int drag_ofs = 0;
bool collapsed; bool collapsed = false;
DraggerVisibility dragger_visibility; DraggerVisibility dragger_visibility = DRAGGER_VISIBLE;
bool mouse_inside; bool mouse_inside = false;
Control *_getch(int p_idx) const; Control *_getch(int p_idx) const;

View file

@ -203,8 +203,6 @@ void SubViewportContainer::_bind_methods() {
} }
SubViewportContainer::SubViewportContainer() { SubViewportContainer::SubViewportContainer() {
stretch = false;
shrink = 1;
set_process_input(true); set_process_input(true);
set_process_unhandled_input(true); set_process_unhandled_input(true);
} }

View file

@ -36,8 +36,8 @@
class SubViewportContainer : public Container { class SubViewportContainer : public Container {
GDCLASS(SubViewportContainer, Container); GDCLASS(SubViewportContainer, Container);
bool stretch; bool stretch = false;
int shrink; int shrink = 1;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View file

@ -1243,20 +1243,5 @@ void TabContainer::_bind_methods() {
} }
TabContainer::TabContainer() { TabContainer::TabContainer() {
first_tab_cache = 0;
last_tab_cache = 0;
buttons_visible_cache = false;
menu_hovered = false;
highlight_arrow = -1;
tabs_ofs_cache = 0;
current = 0;
previous = 0;
align = ALIGN_CENTER;
tabs_visible = true;
all_tabs_in_front = false;
drag_to_rearrange_enabled = false;
tabs_rearrange_group = -1;
use_hidden_tabs_for_min_size = false;
connect("mouse_exited", callable_mp(this, &TabContainer::_on_mouse_exited)); connect("mouse_exited", callable_mp(this, &TabContainer::_on_mouse_exited));
} }

View file

@ -46,23 +46,23 @@ public:
}; };
private: private:
int first_tab_cache; int first_tab_cache = 0;
int tabs_ofs_cache; int tabs_ofs_cache = 0;
int last_tab_cache; int last_tab_cache = 0;
int current; int current = 0;
int previous; int previous = 0;
bool tabs_visible; bool tabs_visible = true;
bool all_tabs_in_front; bool all_tabs_in_front = false;
bool buttons_visible_cache; bool buttons_visible_cache = false;
bool menu_hovered; bool menu_hovered = false;
int highlight_arrow; int highlight_arrow = -1;
TabAlign align; TabAlign align = ALIGN_CENTER;
Control *_get_tab(int p_idx) const; Control *_get_tab(int p_idx) const;
int _get_top_margin() const; int _get_top_margin() const;
mutable ObjectID popup_obj_id; mutable ObjectID popup_obj_id;
bool drag_to_rearrange_enabled; bool drag_to_rearrange_enabled = false;
bool use_hidden_tabs_for_min_size; bool use_hidden_tabs_for_min_size = false;
int tabs_rearrange_group; int tabs_rearrange_group = -1;
Vector<Ref<TextLine>> text_buf; Vector<Ref<TextLine>> text_buf;
Vector<Control *> _get_tabs() const; Vector<Control *> _get_tabs() const;

View file

@ -1137,27 +1137,5 @@ void Tabs::_bind_methods() {
} }
Tabs::Tabs() { Tabs::Tabs() {
current = 0;
previous = 0;
tab_align = ALIGN_CENTER;
rb_hover = -1;
rb_pressing = false;
highlight_arrow = -1;
cb_hover = -1;
cb_pressing = false;
cb_displaypolicy = CLOSE_BUTTON_SHOW_NEVER;
offset = 0;
max_drawn_tab = 0;
select_with_rmb = false;
min_width = 0;
scrolling_enabled = true;
buttons_visible = false;
hover = -1;
drag_to_rearrange_enabled = false;
tabs_rearrange_group = -1;
connect("mouse_exited", callable_mp(this, &Tabs::_on_mouse_exited)); connect("mouse_exited", callable_mp(this, &Tabs::_on_mouse_exited));
} }

View file

@ -63,42 +63,42 @@ private:
Ref<TextLine> text_buf; Ref<TextLine> text_buf;
Ref<Texture2D> icon; Ref<Texture2D> icon;
int ofs_cache; int ofs_cache = 0;
bool disabled; bool disabled = false;
int size_cache; int size_cache = 0;
int size_text; int size_text = 0;
int x_cache; int x_cache = 0;
int x_size_cache; int x_size_cache = 0;
Ref<Texture2D> right_button; Ref<Texture2D> right_button;
Rect2 rb_rect; Rect2 rb_rect;
Rect2 cb_rect; Rect2 cb_rect;
}; };
int offset; int offset = 0;
int max_drawn_tab; int max_drawn_tab = 0;
int highlight_arrow; int highlight_arrow = -1;
bool buttons_visible; bool buttons_visible = false;
bool missing_right; bool missing_right = false;
Vector<Tab> tabs; Vector<Tab> tabs;
int current; int current = 0;
int previous; int previous = 0;
int _get_top_margin() const; int _get_top_margin() const;
TabAlign tab_align; TabAlign tab_align = ALIGN_CENTER;
int rb_hover; int rb_hover = -1;
bool rb_pressing; bool rb_pressing = false;
bool select_with_rmb; bool select_with_rmb = false;
int cb_hover; int cb_hover = -1;
bool cb_pressing; bool cb_pressing = false;
CloseButtonDisplayPolicy cb_displaypolicy; CloseButtonDisplayPolicy cb_displaypolicy = CLOSE_BUTTON_SHOW_NEVER;
int hover; // Hovered tab. int hover = -1; // Hovered tab.
int min_width; int min_width = 0;
bool scrolling_enabled; bool scrolling_enabled = true;
bool drag_to_rearrange_enabled; bool drag_to_rearrange_enabled = false;
int tabs_rearrange_group; int tabs_rearrange_group = -1;
int get_tab_width(int p_idx) const; int get_tab_width(int p_idx) const;
void _ensure_no_over_offset(); void _ensure_no_over_offset();

View file

@ -6128,7 +6128,7 @@ double TextEdit::get_scroll_pos_for_line(int p_line, int p_wrap_index) const {
} }
// Count the number of visible lines up to this line. // Count the number of visible lines up to this line.
double new_line_scroll_pos = 0; double new_line_scroll_pos = 0.0;
int to = CLAMP(p_line, 0, text.size() - 1); int to = CLAMP(p_line, 0, text.size() - 1);
for (int i = 0; i < to; i++) { for (int i = 0; i < to; i++) {
if (!text.is_hidden(i)) { if (!text.is_hidden(i)) {
@ -7205,23 +7205,11 @@ void TextEdit::_bind_methods() {
} }
TextEdit::TextEdit() { TextEdit::TextEdit() {
setting_row = false;
draw_tabs = false;
draw_spaces = false;
override_selected_font_color = false;
draw_caret = true;
max_chars = 0;
clear(); clear();
wrap_enabled = false;
wrap_at = 0;
wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
_update_caches(); _update_caches();
cache.line_spacing = 1;
cache.font_size = 16;
set_default_cursor_shape(CURSOR_IBEAM); set_default_cursor_shape(CURSOR_IBEAM);
indent_size = 4;
text.set_indent_size(indent_size); text.set_indent_size(indent_size);
text.clear(); text.clear();
@ -7231,31 +7219,16 @@ TextEdit::TextEdit() {
add_child(h_scroll); add_child(h_scroll);
add_child(v_scroll); add_child(v_scroll);
updating_scrolls = false;
selection.active = false;
h_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved)); h_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved));
v_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved)); v_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved));
v_scroll->connect("scrolling", callable_mp(this, &TextEdit::_v_scroll_input)); v_scroll->connect("scrolling", callable_mp(this, &TextEdit::_v_scroll_input));
cursor_changed_dirty = false;
text_changed_dirty = false;
selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
selection.selecting_line = 0;
selection.selecting_column = 0;
selection.selecting_text = false;
selection.active = false;
block_caret = false;
caret_blink_enabled = false;
caret_blink_timer = memnew(Timer); caret_blink_timer = memnew(Timer);
add_child(caret_blink_timer); add_child(caret_blink_timer);
caret_blink_timer->set_wait_time(0.65); caret_blink_timer->set_wait_time(0.65);
caret_blink_timer->connect("timeout", callable_mp(this, &TextEdit::_toggle_draw_caret)); caret_blink_timer->connect("timeout", callable_mp(this, &TextEdit::_toggle_draw_caret));
cursor_set_blink_enabled(false); cursor_set_blink_enabled(false);
right_click_moves_caret = true;
idle_detect = memnew(Timer); idle_detect = memnew(Timer);
add_child(idle_detect); add_child(idle_detect);
@ -7268,54 +7241,8 @@ TextEdit::TextEdit() {
click_select_held->set_wait_time(0.05); click_select_held->set_wait_time(0.05);
click_select_held->connect("timeout", callable_mp(this, &TextEdit::_click_selection_held)); click_select_held->connect("timeout", callable_mp(this, &TextEdit::_click_selection_held));
current_op.type = TextOperation::TYPE_NONE;
undo_enabled = true;
undo_stack_max_size = GLOBAL_GET("gui/common/text_edit_undo_stack_max_size"); undo_stack_max_size = GLOBAL_GET("gui/common/text_edit_undo_stack_max_size");
undo_stack_pos = nullptr;
setting_text = false;
last_dblclk = 0;
current_op.version = 0;
version = 0;
saved_version = 0;
completion_enabled = false;
completion_active = false;
completion_line_ofs = 0;
tooltip_obj = nullptr;
line_length_guidelines = false;
line_length_guideline_soft_col = 80;
line_length_guideline_hard_col = 100;
hiding_enabled = false;
next_operation_is_complex = false;
scroll_past_end_of_file_enabled = false;
auto_brace_completion_enabled = false;
brace_matching_enabled = false;
highlight_all_occurrences = false;
highlight_current_line = false;
indent_using_spaces = false;
space_indent = " ";
auto_indent = false;
insert_mode = false;
window_has_focus = true;
select_identifiers_enabled = false;
smooth_scroll_enabled = false;
scrolling = false;
minimap_clicked = false;
dragging_minimap = false;
can_drag_minimap = false;
minimap_scroll_ratio = 0;
minimap_scroll_click_pos = 0;
dragging_selection = false;
target_v_scroll = 0;
v_scroll_speed = 80;
draw_minimap = false;
minimap_width = 80;
minimap_char_size = Point2(1, 2);
minimap_line_spacing = 1;
selecting_enabled = true;
context_menu_enabled = true;
shortcut_keys_enabled = true;
menu = memnew(PopupMenu); menu = memnew(PopupMenu);
add_child(menu); add_child(menu);
@ -7350,12 +7277,10 @@ TextEdit::TextEdit() {
menu_ctl->add_item(RTR("Soft hyphen (SHY)"), MENU_INSERT_SHY); menu_ctl->add_item(RTR("Soft hyphen (SHY)"), MENU_INSERT_SHY);
menu->add_child(menu_ctl); menu->add_child(menu_ctl);
readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly.
set_readonly(false); set_readonly(false);
menu->connect("id_pressed", callable_mp(this, &TextEdit::menu_option)); menu->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
menu_dir->connect("id_pressed", callable_mp(this, &TextEdit::menu_option)); menu_dir->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
menu_ctl->connect("id_pressed", callable_mp(this, &TextEdit::menu_option)); menu_ctl->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
first_draw = true;
} }
TextEdit::~TextEdit() { TextEdit::~TextEdit() {

View file

@ -92,14 +92,11 @@ private:
Vector<Vector2i> bidi_override; Vector<Vector2i> bidi_override;
Ref<TextParagraph> data_buf; Ref<TextParagraph> data_buf;
bool marked; bool marked = false;
bool hidden; bool hidden = false;
Line() { Line() {
data_buf.instance(); data_buf.instance();
marked = false;
hidden = false;
} }
}; };
@ -173,46 +170,31 @@ private:
}; };
struct Cursor { struct Cursor {
int last_fit_x; int last_fit_x = 0;
int line, column; ///< cursor int line = 0;
int x_ofs, line_ofs, wrap_ofs; int column = 0; ///< cursor
Cursor() { int x_ofs = 0;
last_fit_x = 0; int line_ofs = 0;
line = 0; int wrap_ofs = 0;
column = 0; ///< cursor
x_ofs = 0;
line_ofs = 0;
wrap_ofs = 0;
}
} cursor; } cursor;
struct Selection { struct Selection {
SelectionMode selecting_mode; SelectionMode selecting_mode = SelectionMode::SELECTION_MODE_NONE;
int selecting_line, selecting_column; int selecting_line = 0;
int selected_word_beg, selected_word_end, selected_word_origin; int selecting_column = 0;
bool selecting_text; int selected_word_beg = 0;
int selected_word_end = 0;
int selected_word_origin = 0;
bool selecting_text = false;
bool active; bool active = false;
int from_line, from_column; int from_line = 0;
int to_line, to_column; int from_column = 0;
int to_line = 0;
int to_column = 0;
bool shiftclick_left; bool shiftclick_left = false;
Selection() {
selecting_mode = SelectionMode::SELECTION_MODE_NONE;
selecting_line = 0;
selecting_column = 0;
selected_word_beg = 0;
selected_word_end = 0;
selected_word_origin = 0;
selecting_text = false;
active = false;
from_line = 0;
from_column = 0;
to_line = 0;
to_column = 0;
shiftclick_left = false;
}
} selection; } selection;
Map<int, Dictionary> syntax_highlighting_cache; Map<int, Dictionary> syntax_highlighting_cache;
@ -224,25 +206,16 @@ private:
TYPE_REMOVE TYPE_REMOVE
}; };
Type type; Type type = TYPE_NONE;
int from_line, from_column; int from_line = 0;
int to_line, to_column; int from_column = 0;
int to_line = 0;
int to_column = 0;
String text; String text;
uint32_t prev_version; uint32_t prev_version = 0;
uint32_t version; uint32_t version = 0;
bool chain_forward; bool chain_forward = false;
bool chain_backward; bool chain_backward = false;
TextOperation() {
type = TYPE_NONE;
from_line = 0;
from_column = 0;
to_line = 0;
to_column = 0;
prev_version = 0;
version = 0;
chain_forward = false;
chain_backward = false;
}
}; };
String ime_text; String ime_text;
@ -251,7 +224,7 @@ private:
TextOperation current_op; TextOperation current_op;
List<TextOperation> undo_stack; List<TextOperation> undo_stack;
List<TextOperation>::Element *undo_stack_pos; List<TextOperation>::Element *undo_stack_pos = nullptr;
int undo_stack_max_size; int undo_stack_max_size;
void _clear_redo(); void _clear_redo();
@ -264,20 +237,20 @@ private:
Dictionary _get_line_syntax_highlighting(int p_line); Dictionary _get_line_syntax_highlighting(int p_line);
Set<String> completion_prefixes; Set<String> completion_prefixes;
bool completion_enabled; bool completion_enabled = false;
List<ScriptCodeCompletionOption> completion_sources; List<ScriptCodeCompletionOption> completion_sources;
Vector<ScriptCodeCompletionOption> completion_options; Vector<ScriptCodeCompletionOption> completion_options;
bool completion_active; bool completion_active = false;
bool completion_forced; bool completion_forced = false;
ScriptCodeCompletionOption completion_current; ScriptCodeCompletionOption completion_current;
String completion_base; String completion_base;
int completion_index; int completion_index = 0;
Rect2i completion_rect; Rect2i completion_rect;
int completion_line_ofs; int completion_line_ofs = 0;
String completion_hint; String completion_hint;
int completion_hint_offset; int completion_hint_offset = 0;
bool setting_text; bool setting_text = false;
// data // data
Text text; Text text;
@ -290,93 +263,93 @@ private:
Array st_args; Array st_args;
bool draw_control_chars = false; bool draw_control_chars = false;
uint32_t version; uint32_t version = 0;
uint32_t saved_version; uint32_t saved_version = 0;
int max_chars; int max_chars = 0;
bool readonly; bool readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly.
bool indent_using_spaces; bool indent_using_spaces = false;
int indent_size; int indent_size = 4;
String space_indent; String space_indent = " ";
Timer *caret_blink_timer; Timer *caret_blink_timer;
bool caret_blink_enabled; bool caret_blink_enabled = false;
bool draw_caret; bool draw_caret = true;
bool window_has_focus; bool window_has_focus = true;
bool block_caret; bool block_caret = false;
bool right_click_moves_caret; bool right_click_moves_caret = true;
bool mid_grapheme_caret_enabled = false; bool mid_grapheme_caret_enabled = false;
bool wrap_enabled; bool wrap_enabled = false;
int wrap_at; int wrap_at = 0;
int wrap_right_offset; int wrap_right_offset = 10;
bool first_draw; bool first_draw = true;
bool setting_row; bool setting_row = false;
bool draw_tabs; bool draw_tabs = false;
bool draw_spaces; bool draw_spaces = false;
bool override_selected_font_color; bool override_selected_font_color = false;
bool cursor_changed_dirty; bool cursor_changed_dirty = false;
bool text_changed_dirty; bool text_changed_dirty = false;
bool undo_enabled; bool undo_enabled = true;
bool line_length_guidelines; bool line_length_guidelines = false;
int line_length_guideline_soft_col; int line_length_guideline_soft_col = 80;
int line_length_guideline_hard_col; int line_length_guideline_hard_col = 100;
bool hiding_enabled; bool hiding_enabled = false;
bool draw_minimap; bool draw_minimap = false;
int minimap_width; int minimap_width = 80;
Point2 minimap_char_size; Point2 minimap_char_size = Point2(1, 2);
int minimap_line_spacing; int minimap_line_spacing = 1;
bool highlight_all_occurrences; bool highlight_all_occurrences = false;
bool scroll_past_end_of_file_enabled; bool scroll_past_end_of_file_enabled = false;
bool auto_brace_completion_enabled; bool auto_brace_completion_enabled = false;
bool brace_matching_enabled; bool brace_matching_enabled = false;
bool highlight_current_line; bool highlight_current_line = false;
bool auto_indent; bool auto_indent = false;
String cut_copy_line; String cut_copy_line;
bool insert_mode; bool insert_mode = false;
bool select_identifiers_enabled; bool select_identifiers_enabled = false;
bool smooth_scroll_enabled; bool smooth_scroll_enabled = false;
bool scrolling; bool scrolling = false;
bool dragging_selection; bool dragging_selection = false;
bool dragging_minimap; bool dragging_minimap = false;
bool can_drag_minimap; bool can_drag_minimap = false;
bool minimap_clicked; bool minimap_clicked = false;
double minimap_scroll_ratio; double minimap_scroll_ratio = 0.0;
double minimap_scroll_click_pos; double minimap_scroll_click_pos = 0.0;
float target_v_scroll; float target_v_scroll = 0.0;
float v_scroll_speed; float v_scroll_speed = 80.0;
String highlighted_word; String highlighted_word;
uint64_t last_dblclk; uint64_t last_dblclk = 0;
Timer *idle_detect; Timer *idle_detect;
Timer *click_select_held; Timer *click_select_held;
HScrollBar *h_scroll; HScrollBar *h_scroll;
VScrollBar *v_scroll; VScrollBar *v_scroll;
bool updating_scrolls; bool updating_scrolls = false;
Object *tooltip_obj; Object *tooltip_obj = nullptr;
StringName tooltip_func; StringName tooltip_func;
Variant tooltip_ud; Variant tooltip_ud;
bool next_operation_is_complex; bool next_operation_is_complex = false;
bool callhint_below; bool callhint_below = false;
Vector2 callhint_offset; Vector2 callhint_offset;
String search_text; String search_text;
uint32_t search_flags; uint32_t search_flags = 0;
int search_result_line; int search_result_line = 0;
int search_result_col; int search_result_col = 0;
bool selecting_enabled; bool selecting_enabled = true;
bool context_menu_enabled; bool context_menu_enabled = true;
bool shortcut_keys_enabled; bool shortcut_keys_enabled = true;
bool virtual_keyboard_enabled = true; bool virtual_keyboard_enabled = true;
void _generate_context_menu(); void _generate_context_menu();
@ -477,7 +450,7 @@ protected:
Ref<StyleBox> style_focus; Ref<StyleBox> style_focus;
Ref<StyleBox> style_readonly; Ref<StyleBox> style_readonly;
Ref<Font> font; Ref<Font> font;
int font_size; int font_size = 16;
Color completion_background_color; Color completion_background_color;
Color completion_selected_color; Color completion_selected_color;
Color completion_existing_color; Color completion_existing_color;
@ -498,12 +471,8 @@ protected:
Color search_result_border_color; Color search_result_border_color;
Color background_color; Color background_color;
int line_spacing; int line_spacing = 1;
int minimap_width; int minimap_width = 0;
Cache() {
line_spacing = 0;
minimap_width = 0;
}
} cache; } cache;
virtual String get_tooltip(const Point2 &p_pos) const override; virtual String get_tooltip(const Point2 &p_pos) const override;

View file

@ -377,13 +377,4 @@ bool TextureButton::is_flipped_v() const {
return vflip; return vflip;
} }
TextureButton::TextureButton() { TextureButton::TextureButton() {}
expand = false;
stretch_mode = STRETCH_SCALE;
hflip = false;
vflip = false;
_texture_region = Rect2();
_position_rect = Rect2();
_tile = false;
}

View file

@ -54,15 +54,15 @@ private:
Ref<Texture2D> disabled; Ref<Texture2D> disabled;
Ref<Texture2D> focused; Ref<Texture2D> focused;
Ref<BitMap> click_mask; Ref<BitMap> click_mask;
bool expand; bool expand = false;
StretchMode stretch_mode; StretchMode stretch_mode = STRETCH_SCALE;
Rect2 _texture_region; Rect2 _texture_region;
Rect2 _position_rect; Rect2 _position_rect;
bool _tile; bool _tile = false;
bool hflip; bool hflip = false;
bool vflip; bool vflip = false;
protected: protected:
virtual Size2 get_minimum_size() const override; virtual Size2 get_minimum_size() const override;

View file

@ -145,9 +145,9 @@ Point2 TextureProgressBar::unit_val_to_uv(float val) {
float angle = (val * Math_TAU) - Math_PI * 0.5; float angle = (val * Math_TAU) - Math_PI * 0.5;
Point2 dir = Vector2(Math::cos(angle), Math::sin(angle)); Point2 dir = Vector2(Math::cos(angle), Math::sin(angle));
float t1 = 1.0; float t1 = 1.0;
float cp = 0; float cp = 0.0;
float cq = 0; float cq = 0.0;
float cr = 0; float cr = 0.0;
float edgeLeft = 0.0; float edgeLeft = 0.0;
float edgeRight = 1.0; float edgeRight = 1.0;
float edgeBottom = 0.0; float edgeBottom = 0.0;
@ -540,17 +540,5 @@ void TextureProgressBar::_bind_methods() {
} }
TextureProgressBar::TextureProgressBar() { TextureProgressBar::TextureProgressBar() {
mode = FILL_LEFT_TO_RIGHT;
rad_init_angle = 0;
rad_center_off = Point2();
rad_max_degrees = 360;
set_mouse_filter(MOUSE_FILTER_PASS); set_mouse_filter(MOUSE_FILTER_PASS);
nine_patch_stretch = false;
stretch_margin[SIDE_LEFT] = 0;
stretch_margin[SIDE_RIGHT] = 0;
stretch_margin[SIDE_BOTTOM] = 0;
stretch_margin[SIDE_TOP] = 0;
tint_under = tint_progress = tint_over = Color(1, 1, 1);
} }

View file

@ -98,13 +98,15 @@ public:
TextureProgressBar(); TextureProgressBar();
private: private:
FillMode mode; FillMode mode = FILL_LEFT_TO_RIGHT;
float rad_init_angle; float rad_init_angle = 0.0;
float rad_max_degrees; float rad_max_degrees = 360.0;
Point2 rad_center_off; Point2 rad_center_off;
bool nine_patch_stretch; bool nine_patch_stretch = false;
int stretch_margin[4]; int stretch_margin[4] = {};
Color tint_under, tint_progress, tint_over; Color tint_under = Color(1, 1, 1);
Color tint_progress = Color(1, 1, 1);
Color tint_over = Color(1, 1, 1);
Point2 unit_val_to_uv(float val); Point2 unit_val_to_uv(float val);
Point2 get_relative_center(); Point2 get_relative_center();

View file

@ -217,11 +217,7 @@ bool TextureRect::is_flipped_v() const {
} }
TextureRect::TextureRect() { TextureRect::TextureRect() {
expand = false;
hflip = false;
vflip = false;
set_mouse_filter(MOUSE_FILTER_PASS); set_mouse_filter(MOUSE_FILTER_PASS);
stretch_mode = STRETCH_SCALE_ON_EXPAND;
} }
TextureRect::~TextureRect() { TextureRect::~TextureRect() {

View file

@ -49,11 +49,11 @@ public:
}; };
private: private:
bool expand; bool expand = false;
bool hflip; bool hflip = false;
bool vflip; bool vflip = false;
Ref<Texture2D> texture; Ref<Texture2D> texture;
StretchMode stretch_mode; StretchMode stretch_mode = STRETCH_SCALE_ON_EXPAND;
void _texture_changed(); void _texture_changed();

View file

@ -4232,19 +4232,8 @@ void Tree::_bind_methods() {
} }
Tree::Tree() { Tree::Tree() {
selected_col = 0;
columns.resize(1); columns.resize(1);
selected_item = nullptr;
edited_item = nullptr;
selected_col = -1;
edited_col = -1;
hide_root = false;
select_mode = SELECT_SINGLE;
root = nullptr;
popup_menu = nullptr;
popup_edited_item = nullptr;
text_editor = nullptr;
set_focus_mode(FOCUS_ALL); set_focus_mode(FOCUS_ALL);
popup_menu = memnew(PopupMenu); popup_menu = memnew(PopupMenu);
@ -4288,50 +4277,9 @@ Tree::Tree() {
set_notify_transform(true); set_notify_transform(true);
updating_value_editor = false;
pressed_button = -1;
show_column_titles = false;
cache.click_type = Cache::CLICK_NONE;
cache.hover_type = Cache::CLICK_NONE;
cache.hover_index = -1;
cache.click_index = -1;
cache.click_id = -1;
cache.click_item = nullptr;
cache.click_column = 0;
cache.hover_cell = -1;
last_keypress = 0;
focus_in_id = 0;
blocked = 0;
cursor_can_exit_tree = true;
set_mouse_filter(MOUSE_FILTER_STOP); set_mouse_filter(MOUSE_FILTER_STOP);
drag_speed = 0;
drag_touching = false;
drag_touching_deaccel = false;
pressing_for_editor = false;
range_drag_enabled = false;
hide_folding = false;
drop_mode_flags = 0;
drop_mode_over = nullptr;
drop_mode_section = 0;
single_select_defer = nullptr;
scrolling = false;
allow_rmb_select = false;
force_edit_checkbox_only_on_checkbox = false;
set_clip_contents(true); set_clip_contents(true);
cache.hover_item = nullptr;
cache.hover_cell = -1;
allow_reselect = false;
propagate_mouse_activated = false;
} }
Tree::~Tree() { Tree::~Tree() {

View file

@ -62,7 +62,7 @@ private:
friend class Tree; friend class Tree;
struct Cell { struct Cell {
TreeCellMode mode; TreeCellMode mode = TreeItem::CELL_MODE_STRING;
Ref<Texture2D> icon; Ref<Texture2D> icon;
Rect2i icon_region; Rect2i icon_region;
@ -74,24 +74,27 @@ private:
Control::StructuredTextParser st_parser = Control::STRUCTURED_TEXT_DEFAULT; Control::StructuredTextParser st_parser = Control::STRUCTURED_TEXT_DEFAULT;
Array st_args; Array st_args;
Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED; Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED;
bool dirty; bool dirty = true;
double min, max, step, val; double min = 0.0;
int icon_max_w; double max = 100.0;
bool expr; double step = 1.0;
bool checked; double val = 0.0;
bool editable; int icon_max_w = 0;
bool selected; bool expr = false;
bool selectable; bool checked = false;
bool custom_color; bool editable = false;
bool selected = false;
bool selectable = true;
bool custom_color = false;
Color color; Color color;
bool custom_bg_color; bool custom_bg_color = false;
bool custom_bg_outline; bool custom_bg_outline = false;
Color bg_color; Color bg_color;
bool custom_button; bool custom_button = false;
bool expand_right; bool expand_right = false;
Color icon_color; Color icon_color = Color(1, 1, 1);
TextAlign text_align; TextAlign text_align = ALIGN_LEFT;
Variant meta; Variant meta;
String tooltip; String tooltip;
@ -100,42 +103,17 @@ private:
StringName custom_draw_callback; StringName custom_draw_callback;
struct Button { struct Button {
int id; int id = 0;
bool disabled; bool disabled = false;
Ref<Texture2D> texture; Ref<Texture2D> texture;
Color color; Color color = Color(1, 1, 1, 1);
String tooltip; String tooltip;
Button() {
id = 0;
disabled = false;
color = Color(1, 1, 1, 1);
tooltip = "";
}
}; };
Vector<Button> buttons; Vector<Button> buttons;
Cell() { Cell() {
text_buf.instance(); text_buf.instance();
dirty = true;
custom_draw_obj = ObjectID();
custom_button = false;
mode = TreeItem::CELL_MODE_STRING;
min = 0;
max = 100;
step = 1;
val = 0;
checked = false;
editable = false;
selected = false;
selectable = true;
custom_color = false;
custom_bg_color = false;
expr = false;
icon_max_w = 0;
text_align = ALIGN_LEFT;
expand_right = false;
icon_color = Color(1, 1, 1);
} }
Size2 get_icon_size() const; Size2 get_icon_size() const;
@ -332,46 +310,46 @@ public:
private: private:
friend class TreeItem; friend class TreeItem;
TreeItem *root; TreeItem *root = nullptr;
TreeItem *popup_edited_item; TreeItem *popup_edited_item = nullptr;
TreeItem *selected_item; TreeItem *selected_item = nullptr;
TreeItem *edited_item; TreeItem *edited_item = nullptr;
TreeItem *drop_mode_over; TreeItem *drop_mode_over = nullptr;
int drop_mode_section; int drop_mode_section = 0;
TreeItem *single_select_defer; TreeItem *single_select_defer = nullptr;
int single_select_defer_column; int single_select_defer_column = 0;
int pressed_button; int pressed_button = -1;
bool pressing_for_editor; bool pressing_for_editor = false;
String pressing_for_editor_text; String pressing_for_editor_text;
Vector2 pressing_pos; Vector2 pressing_pos;
Rect2 pressing_item_rect; Rect2 pressing_item_rect;
float range_drag_base; float range_drag_base = 0.0;
bool range_drag_enabled; bool range_drag_enabled = false;
Vector2 range_drag_capture_pos; Vector2 range_drag_capture_pos;
bool propagate_mouse_activated; bool propagate_mouse_activated = false;
//TreeItem *cursor_item; //TreeItem *cursor_item;
//int cursor_column; //int cursor_column;
Rect2 custom_popup_rect; Rect2 custom_popup_rect;
int edited_col; int edited_col = -1;
int selected_col; int selected_col = -1;
int popup_edited_item_col; int popup_edited_item_col = -1;
bool hide_root; bool hide_root = false;
SelectMode select_mode; SelectMode select_mode = SELECT_SINGLE;
int blocked; int blocked = 0;
int drop_mode_flags; int drop_mode_flags = 0;
struct ColumnInfo { struct ColumnInfo {
int min_width; int min_width = 1;
bool expand; bool expand = true;
String title; String title;
Ref<TextLine> text_buf; Ref<TextLine> text_buf;
Dictionary opentype_features; Dictionary opentype_features;
@ -379,27 +357,25 @@ private:
Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED; Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED;
ColumnInfo() { ColumnInfo() {
text_buf.instance(); text_buf.instance();
min_width = 1;
expand = true;
} }
}; };
bool show_column_titles; bool show_column_titles = false;
VBoxContainer *popup_editor_vb; VBoxContainer *popup_editor_vb;
Popup *popup_editor; Popup *popup_editor;
LineEdit *text_editor; LineEdit *text_editor = nullptr;
HSlider *value_editor; HSlider *value_editor;
bool updating_value_editor; bool updating_value_editor = false;
uint64_t focus_in_id; uint64_t focus_in_id = 0;
PopupMenu *popup_menu; PopupMenu *popup_menu = nullptr;
Vector<ColumnInfo> columns; Vector<ColumnInfo> columns;
Timer *range_click_timer; Timer *range_click_timer;
TreeItem *range_item_last; TreeItem *range_item_last = nullptr;
bool range_up_last; bool range_up_last = false;
void _range_click_timeout(); void _range_click_timeout();
int compute_item_height(TreeItem *p_item) const; int compute_item_height(TreeItem *p_item) const;
@ -434,8 +410,8 @@ private:
struct Cache { struct Cache {
Ref<Font> font; Ref<Font> font;
Ref<Font> tb_font; Ref<Font> tb_font;
int font_size; int font_size = 0;
int tb_font_size; int tb_font_size = 0;
Ref<StyleBox> bg; Ref<StyleBox> bg;
Ref<StyleBox> selected; Ref<StyleBox> selected;
Ref<StyleBox> selected_focus; Ref<StyleBox> selected_focus;
@ -465,15 +441,15 @@ private:
Color relationship_line_color; Color relationship_line_color;
Color custom_button_font_highlight; Color custom_button_font_highlight;
int hseparation; int hseparation = 0;
int vseparation; int vseparation = 0;
int item_margin; int item_margin = 0;
int button_margin; int button_margin = 0;
Point2 offset; Point2 offset;
int draw_relationship_lines; int draw_relationship_lines = 0;
int draw_guides; int draw_guides = 0;
int scroll_border; int scroll_border = 0;
int scroll_speed; int scroll_speed = 0;
enum ClickType { enum ClickType {
CLICK_NONE, CLICK_NONE,
@ -482,17 +458,17 @@ private:
}; };
ClickType click_type; ClickType click_type = Cache::CLICK_NONE;
ClickType hover_type; ClickType hover_type = Cache::CLICK_NONE;
int click_index; int click_index = -1;
int click_id; int click_id = -1;
TreeItem *click_item; TreeItem *click_item = nullptr;
int click_column; int click_column = 0;
int hover_index; int hover_index = -1;
Point2 click_pos; Point2 click_pos;
TreeItem *hover_item; TreeItem *hover_item = nullptr;
int hover_cell; int hover_cell = -1;
Point2i text_editor_position; Point2i text_editor_position;
@ -510,9 +486,9 @@ private:
Rect2 search_item_rect(TreeItem *p_from, TreeItem *p_item); Rect2 search_item_rect(TreeItem *p_from, TreeItem *p_item);
//Rect2 get_item_rect(TreeItem *p_item); //Rect2 get_item_rect(TreeItem *p_item);
uint64_t last_keypress; uint64_t last_keypress = 0;
String incr_search; String incr_search;
bool cursor_can_exit_tree; bool cursor_can_exit_tree = true;
void _do_incr_search(const String &p_add); void _do_incr_search(const String &p_add);
TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false); TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false);
@ -526,21 +502,21 @@ private:
float last_drag_time; float last_drag_time;
float time_since_motion;*/ float time_since_motion;*/
float drag_speed; float drag_speed = 0.0;
float drag_from; float drag_from = 0.0;
float drag_accum; float drag_accum = 0.0;
Vector2 last_speed; Vector2 last_speed;
bool drag_touching; bool drag_touching = false;
bool drag_touching_deaccel; bool drag_touching_deaccel = false;
bool click_handled; bool click_handled = false;
bool allow_rmb_select; bool allow_rmb_select = false;
bool scrolling; bool scrolling = false;
bool allow_reselect; bool allow_reselect = false;
bool force_edit_checkbox_only_on_checkbox; bool force_edit_checkbox_only_on_checkbox = false;
bool hide_folding; bool hide_folding = false;
int _count_selected_items(TreeItem *p_from) const; int _count_selected_items(TreeItem *p_from) const;
void _go_left(); void _go_left();

View file

@ -462,25 +462,7 @@ void VideoPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
} }
VideoPlayer::VideoPlayer() { VideoPlayer::VideoPlayer() {}
volume = 1;
loops = false;
paused = false;
autoplay = false;
expand = true;
audio_track = 0;
bus_index = 0;
buffering_ms = 500;
// internal_stream.player=this;
// stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream);
last_audio_time = 0;
wait_resampler = 0;
wait_resampler_limit = 2;
};
VideoPlayer::~VideoPlayer() { VideoPlayer::~VideoPlayer() {
// if (stream_rid.is_valid()) // if (stream_rid.is_valid())

View file

@ -41,8 +41,8 @@ class VideoPlayer : public Control {
struct Output { struct Output {
AudioFrame vol; AudioFrame vol;
int bus_index; int bus_index = 0;
Viewport *viewport; //pointer only used for reference to previous mix Viewport *viewport = nullptr; //pointer only used for reference to previous mix
}; };
Ref<VideoStreamPlayback> playback; Ref<VideoStreamPlayback> playback;
Ref<VideoStream> stream; Ref<VideoStream> stream;
@ -56,17 +56,18 @@ class VideoPlayer : public Control {
AudioRBResampler resampler; AudioRBResampler resampler;
Vector<AudioFrame> mix_buffer; Vector<AudioFrame> mix_buffer;
int wait_resampler, wait_resampler_limit; int wait_resampler = 0;
int wait_resampler_limit = 2;
bool paused; bool paused = false;
bool autoplay; bool autoplay = false;
float volume; float volume = 1.0;
double last_audio_time; double last_audio_time = 0.0;
bool expand; bool expand = true;
bool loops; bool loops = false;
int buffering_ms; int buffering_ms = 500;
int audio_track; int audio_track = 0;
int bus_index; int bus_index = 0;
StringName bus; StringName bus;

View file

@ -90,7 +90,7 @@ private:
struct ShaderData { struct ShaderData {
RID shader; RID shader;
int users; int users = 0;
}; };
static Map<MaterialKey, ShaderData> shader_map; static Map<MaterialKey, ShaderData> shader_map;

View file

@ -303,17 +303,7 @@ void CanvasLayer::_bind_methods() {
} }
CanvasLayer::CanvasLayer() { CanvasLayer::CanvasLayer() {
vp = nullptr;
scale = Vector2(1, 1);
rot = 0;
locrotscale_dirty = false;
layer = 1;
canvas = RS::get_singleton()->canvas_create(); canvas = RS::get_singleton()->canvas_create();
custom_viewport = nullptr;
sort_index = 0;
follow_viewport = false;
follow_viewport_scale = 1.0;
} }
CanvasLayer::~CanvasLayer() { CanvasLayer::~CanvasLayer() {

View file

@ -38,24 +38,24 @@ class Viewport;
class CanvasLayer : public Node { class CanvasLayer : public Node {
GDCLASS(CanvasLayer, Node); GDCLASS(CanvasLayer, Node);
bool locrotscale_dirty; bool locrotscale_dirty = false;
Vector2 ofs; Vector2 ofs;
Size2 scale; Size2 scale = Vector2(1, 1);
real_t rot; real_t rot = 0.0;
int layer; int layer = 1;
Transform2D transform; Transform2D transform;
RID canvas; RID canvas;
ObjectID custom_viewport_id; // to check validity ObjectID custom_viewport_id; // to check validity
Viewport *custom_viewport; Viewport *custom_viewport = nullptr;
RID viewport; RID viewport;
Viewport *vp; Viewport *vp = nullptr;
int sort_index; int sort_index = 0;
bool follow_viewport; bool follow_viewport = false;
float follow_viewport_scale; float follow_viewport_scale = 1.0;
void _update_xform(); void _update_xform();
void _update_locrotscale(); void _update_locrotscale();

View file

@ -638,29 +638,11 @@ void HTTPRequest::_bind_methods() {
} }
HTTPRequest::HTTPRequest() { HTTPRequest::HTTPRequest() {
port = 80;
redirections = 0;
max_redirects = 8;
body_len = -1;
got_response = false;
validate_ssl = false;
use_ssl = false;
accept_gzip = true;
response_code = 0;
request_sent = false;
requesting = false;
client.instance(); client.instance();
use_threads = false;
thread_done = false;
downloaded = 0;
body_size_limit = -1;
file = nullptr;
timer = memnew(Timer); timer = memnew(Timer);
timer->set_one_shot(true); timer->set_one_shot(true);
timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout)); timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout));
add_child(timer); add_child(timer);
timeout = 0;
} }
HTTPRequest::~HTTPRequest() { HTTPRequest::~HTTPRequest() {

View file

@ -60,42 +60,42 @@ public:
}; };
private: private:
bool requesting; bool requesting = false;
String request_string; String request_string;
String url; String url;
int port; int port = 80;
Vector<String> headers; Vector<String> headers;
bool validate_ssl; bool validate_ssl = false;
bool use_ssl; bool use_ssl = false;
HTTPClient::Method method; HTTPClient::Method method;
Vector<uint8_t> request_data; Vector<uint8_t> request_data;
bool request_sent; bool request_sent = false;
Ref<HTTPClient> client; Ref<HTTPClient> client;
PackedByteArray body; PackedByteArray body;
volatile bool use_threads; volatile bool use_threads = false;
bool accept_gzip; bool accept_gzip = true;
bool got_response; bool got_response = false;
int response_code; int response_code = 0;
Vector<String> response_headers; Vector<String> response_headers;
String download_to_file; String download_to_file;
FileAccess *file; FileAccess *file = nullptr;
int body_len; int body_len = -1;
volatile int downloaded; volatile int downloaded = 0;
int body_size_limit; int body_size_limit = -1;
int redirections; int redirections = 0;
bool _update_connection(); bool _update_connection();
int max_redirects; int max_redirects = 8;
int timeout; int timeout = 0;
void _redirect_request(const String &p_new_url); void _redirect_request(const String &p_new_url);
@ -107,8 +107,8 @@ private:
bool has_header(const PackedStringArray &p_headers, const String &p_header_name); bool has_header(const PackedStringArray &p_headers, const String &p_header_name);
String get_header_value(const PackedStringArray &p_headers, const String &header_name); String get_header_value(const PackedStringArray &p_headers, const String &header_name);
volatile bool thread_done; volatile bool thread_done = false;
volatile bool thread_request_quit; volatile bool thread_request_quit = false;
Thread thread; Thread thread;

View file

@ -80,7 +80,7 @@ private:
struct NetData { struct NetData {
StringName name; StringName name;
MultiplayerAPI::RPCMode mode; MultiplayerAPI::RPCMode mode = MultiplayerAPI::RPCMode::RPC_MODE_DISABLED;
}; };
struct Data { struct Data {
@ -297,7 +297,7 @@ public:
struct GroupInfo { struct GroupInfo {
StringName name; StringName name;
bool persistent; bool persistent = false;
}; };
void get_groups(List<GroupInfo> *p_groups) const; void get_groups(List<GroupInfo> *p_groups) const;

View file

@ -90,10 +90,7 @@ void SceneTreeTimer::release_connections() {
} }
} }
SceneTreeTimer::SceneTreeTimer() { SceneTreeTimer::SceneTreeTimer() {}
time_left = 0;
process_pause = true;
}
void SceneTree::tree_changed() { void SceneTree::tree_changed() {
tree_version++; tree_version++;

View file

@ -51,8 +51,8 @@ class SceneDebugger;
class SceneTreeTimer : public Reference { class SceneTreeTimer : public Reference {
GDCLASS(SceneTreeTimer, Reference); GDCLASS(SceneTreeTimer, Reference);
float time_left; float time_left = 0.0;
bool process_pause; bool process_pause = true;
protected: protected:
static void _bind_methods(); static void _bind_methods();
@ -80,8 +80,7 @@ public:
private: private:
struct Group { struct Group {
Vector<Node *> nodes; Vector<Node *> nodes;
bool changed; bool changed = false;
Group() { changed = false; };
}; };
Window *root = nullptr; Window *root = nullptr;

View file

@ -277,6 +277,4 @@ void ShaderGlobalsOverride::_bind_methods() {
ClassDB::bind_method(D_METHOD("_activate"), &ShaderGlobalsOverride::_activate); ClassDB::bind_method(D_METHOD("_activate"), &ShaderGlobalsOverride::_activate);
} }
ShaderGlobalsOverride::ShaderGlobalsOverride() { ShaderGlobalsOverride::ShaderGlobalsOverride() {}
active = false;
}

View file

@ -43,7 +43,7 @@ class ShaderGlobalsOverride : public Node {
StringName *_remap(const StringName &p_name) const; StringName *_remap(const StringName &p_name) const;
bool active; bool active = false;
mutable HashMap<StringName, Override> overrides; mutable HashMap<StringName, Override> overrides;
mutable HashMap<StringName, StringName> param_remaps; mutable HashMap<StringName, StringName> param_remaps;

View file

@ -217,12 +217,4 @@ void Timer::_bind_methods() {
BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE); BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE);
} }
Timer::Timer() { Timer::Timer() {}
timer_process_mode = TIMER_PROCESS_IDLE;
autostart = false;
wait_time = 1;
one_shot = false;
time_left = -1;
processing = false;
paused = false;
}

View file

@ -36,13 +36,13 @@
class Timer : public Node { class Timer : public Node {
GDCLASS(Timer, Node); GDCLASS(Timer, Node);
float wait_time; float wait_time = 1.0;
bool one_shot; bool one_shot = false;
bool autostart; bool autostart = false;
bool processing; bool processing = false;
bool paused; bool paused = false;
double time_left; double time_left = -1.0;
protected: protected:
void _notification(int p_what); void _notification(int p_what);
@ -78,7 +78,7 @@ public:
Timer(); Timer();
private: private:
TimerProcessMode timer_process_mode; TimerProcessMode timer_process_mode = TIMER_PROCESS_IDLE;
void _set_process(bool p_process, bool p_force = false); void _set_process(bool p_process, bool p_force = false);
}; };

View file

@ -144,7 +144,6 @@ void ViewportTexture::_bind_methods() {
} }
ViewportTexture::ViewportTexture() { ViewportTexture::ViewportTexture() {
vp = nullptr;
set_local_to_scene(true); set_local_to_scene(true);
} }
@ -184,26 +183,6 @@ public:
///////////////////////////////////// /////////////////////////////////////
Viewport::GUI::GUI() {
embed_subwindows_hint = false;
embedding_subwindows = false;
dragging = false;
mouse_focus = nullptr;
forced_mouse_focus = false;
mouse_click_grabber = nullptr;
mouse_focus_mask = 0;
key_focus = nullptr;
mouse_over = nullptr;
drag_mouse_over = nullptr;
tooltip_control = nullptr;
tooltip_popup = nullptr;
tooltip_label = nullptr;
}
/////////////////////////////////////
void Viewport::update_worlds() { void Viewport::update_worlds() {
if (!is_inside_tree()) { if (!is_inside_tree()) {
return; return;
@ -3682,26 +3661,10 @@ Viewport::Viewport() {
viewport_textures.insert(default_texture.ptr()); viewport_textures.insert(default_texture.ptr());
default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid); default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid);
audio_listener = false;
//internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create(); //internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create();
audio_listener_2d = false;
transparent_bg = false;
parent = nullptr;
listener = nullptr;
camera = nullptr;
override_canvas_transform = false;
canvas_layers.insert(nullptr); // This eases picking code (interpreted as the canvas of the Viewport) canvas_layers.insert(nullptr); // This eases picking code (interpreted as the canvas of the Viewport)
gen_mipmaps = false;
//clear=true; //clear=true;
physics_object_picking = false;
physics_has_last_mousepos = false;
physics_last_mousepos = Vector2(Math_INF, Math_INF);
shadow_atlas_16_bits = true;
shadow_atlas_size = 2048;
set_shadow_atlas_size(shadow_atlas_size); set_shadow_atlas_size(shadow_atlas_size);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@ -3720,50 +3683,11 @@ Viewport::Viewport() {
unhandled_input_group = "_vp_unhandled_input" + id; unhandled_input_group = "_vp_unhandled_input" + id;
unhandled_key_input_group = "_vp_unhandled_key_input" + id; unhandled_key_input_group = "_vp_unhandled_key_input" + id;
disable_input = false;
// Window tooltip. // Window tooltip.
gui.tooltip_timer = -1;
gui.tooltip_delay = GLOBAL_DEF("gui/timers/tooltip_delay_sec", 0.5); gui.tooltip_delay = GLOBAL_DEF("gui/timers/tooltip_delay_sec", 0.5);
ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers
gui.tooltip_control = nullptr; set_sdf_oversize(sdf_oversize); //set to server
gui.tooltip_label = nullptr;
gui.drag_preview = nullptr;
gui.drag_attempted = false;
gui.canvas_sort_index = 0;
gui.roots_order_dirty = false;
gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
gui.last_mouse_focus = nullptr;
gui.subwindow_focused = nullptr;
gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
msaa = MSAA_DISABLED;
screen_space_aa = SCREEN_SPACE_AA_DISABLED;
debug_draw = DEBUG_DRAW_DISABLED;
snap_controls_to_pixels = true;
snap_2d_transforms_to_pixel = false;
snap_2d_vertices_to_pixel = false;
physics_last_mouse_state.alt = false;
physics_last_mouse_state.control = false;
physics_last_mouse_state.shift = false;
physics_last_mouse_state.meta = false;
physics_last_mouse_state.mouse_mask = 0;
local_input_handled = false;
handle_input_locally = true;
size_allocated = false;
default_canvas_item_texture_filter = DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
default_canvas_item_texture_repeat = DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
sdf_oversize = SDF_OVERSIZE_120_PERCENT;
sdf_scale = SDF_SCALE_50_PERCENT;
set_sdf_oversize(SDF_OVERSIZE_120_PERCENT); //set to server
} }
Viewport::~Viewport() { Viewport::~Viewport() {
@ -3895,12 +3819,6 @@ void SubViewport::_bind_methods() {
BIND_ENUM_CONSTANT(UPDATE_ALWAYS); BIND_ENUM_CONSTANT(UPDATE_ALWAYS);
} }
SubViewport::SubViewport() { SubViewport::SubViewport() {}
xr = false;
size_2d_override_stretch = false;
update_mode = UPDATE_WHEN_VISIBLE;
clear_mode = CLEAR_MODE_ALWAYS;
}
SubViewport::~SubViewport() { SubViewport::~SubViewport() {}
}

View file

@ -56,7 +56,7 @@ class ViewportTexture : public Texture2D {
NodePath path; NodePath path;
friend class Viewport; friend class Viewport;
Viewport *vp; Viewport *vp = nullptr;
mutable RID proxy_ph; mutable RID proxy_ph;
mutable RID proxy; mutable RID proxy;
@ -186,9 +186,9 @@ public:
private: private:
friend class ViewportTexture; friend class ViewportTexture;
Viewport *parent; Viewport *parent = nullptr;
Listener3D *listener; Listener3D *listener = nullptr;
Set<Listener3D *> listeners; Set<Listener3D *> listeners;
struct CameraOverrideData { struct CameraOverrideData {
@ -197,11 +197,11 @@ private:
PROJECTION_PERSPECTIVE, PROJECTION_PERSPECTIVE,
PROJECTION_ORTHOGONAL PROJECTION_ORTHOGONAL
}; };
Projection projection; Projection projection = Projection::PROJECTION_PERSPECTIVE;
float fov; float fov = 0.0;
float size; float size = 0.0;
float z_near; float z_near = 0.0;
float z_far; float z_far = 0.0;
RID rid; RID rid;
operator bool() const { operator bool() const {
@ -209,7 +209,7 @@ private:
} }
} camera_override; } camera_override;
Camera3D *camera; Camera3D *camera = nullptr;
Set<Camera3D *> cameras; Set<Camera3D *> cameras;
Set<CanvasLayer *> canvas_layers; Set<CanvasLayer *> canvas_layers;
@ -217,13 +217,13 @@ private:
RID current_canvas; RID current_canvas;
RID subwindow_canvas; RID subwindow_canvas;
bool audio_listener; bool audio_listener = false;
RID internal_listener; RID internal_listener;
bool audio_listener_2d; bool audio_listener_2d = false;
RID internal_listener_2d; RID internal_listener_2d;
bool override_canvas_transform; bool override_canvas_transform = false;
Transform2D canvas_transform_override; Transform2D canvas_transform_override;
Transform2D canvas_transform; Transform2D canvas_transform;
@ -232,7 +232,7 @@ private:
Size2i size; Size2i size;
Size2i size_2d_override; Size2i size_2d_override;
bool size_allocated; bool size_allocated = false;
RID contact_2d_debug; RID contact_2d_debug;
RID contact_3d_debug_multimesh; RID contact_3d_debug_multimesh;
@ -240,36 +240,36 @@ private:
Rect2 last_vp_rect; Rect2 last_vp_rect;
bool transparent_bg; bool transparent_bg = false;
bool filter; bool filter;
bool gen_mipmaps; bool gen_mipmaps = false;
bool snap_controls_to_pixels; bool snap_controls_to_pixels = true;
bool snap_2d_transforms_to_pixel; bool snap_2d_transforms_to_pixel = false;
bool snap_2d_vertices_to_pixel; bool snap_2d_vertices_to_pixel = false;
bool physics_object_picking; bool physics_object_picking = false;
List<Ref<InputEvent>> physics_picking_events; List<Ref<InputEvent>> physics_picking_events;
ObjectID physics_object_capture; ObjectID physics_object_capture;
ObjectID physics_object_over; ObjectID physics_object_over;
Transform physics_last_object_transform; Transform physics_last_object_transform;
Transform physics_last_camera_transform; Transform physics_last_camera_transform;
ObjectID physics_last_id; ObjectID physics_last_id;
bool physics_has_last_mousepos; bool physics_has_last_mousepos = false;
Vector2 physics_last_mousepos; Vector2 physics_last_mousepos = Vector2(Math_INF, Math_INF);
struct { struct {
bool alt; bool alt = false;
bool control; bool control = false;
bool shift; bool shift = false;
bool meta; bool meta = false;
int mouse_mask; int mouse_mask = 0;
} physics_last_mouse_state; } physics_last_mouse_state;
void _collision_object_input_event(CollisionObject3D *p_object, Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape); void _collision_object_input_event(CollisionObject3D *p_object, Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape);
bool handle_input_locally; bool handle_input_locally = true;
bool local_input_handled; bool local_input_handled = false;
Map<ObjectID, uint64_t> physics_2d_mouseover; Map<ObjectID, uint64_t> physics_2d_mouseover;
@ -294,22 +294,22 @@ private:
RID texture_rid; RID texture_rid;
DebugDraw debug_draw; DebugDraw debug_draw = DEBUG_DRAW_DISABLED;
int shadow_atlas_size; int shadow_atlas_size = 2048;
bool shadow_atlas_16_bits = true; bool shadow_atlas_16_bits = true;
ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4]; ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4];
MSAA msaa; MSAA msaa = MSAA_DISABLED;
ScreenSpaceAA screen_space_aa; ScreenSpaceAA screen_space_aa = SCREEN_SPACE_AA_DISABLED;
bool use_debanding = false; bool use_debanding = false;
float lod_threshold = 1.0; float lod_threshold = 1.0;
Ref<ViewportTexture> default_texture; Ref<ViewportTexture> default_texture;
Set<ViewportTexture *> viewport_textures; Set<ViewportTexture *> viewport_textures;
SDFOversize sdf_oversize; SDFOversize sdf_oversize = SDF_OVERSIZE_120_PERCENT;
SDFScale sdf_scale; SDFScale sdf_scale = SDF_SCALE_50_PERCENT;
enum SubWindowDrag { enum SubWindowDrag {
SUB_WINDOW_DRAG_DISABLED, SUB_WINDOW_DRAG_DISABLED,
@ -332,60 +332,58 @@ private:
}; };
struct SubWindow { struct SubWindow {
Window *window; Window *window = nullptr;
RID canvas_item; RID canvas_item;
}; };
struct GUI { struct GUI {
// info used when this is a window // info used when this is a window
bool forced_mouse_focus; //used for menu buttons bool forced_mouse_focus = false; //used for menu buttons
bool key_event_accepted; bool key_event_accepted = false;
Control *mouse_focus; Control *mouse_focus = nullptr;
Control *last_mouse_focus; Control *last_mouse_focus = nullptr;
Control *mouse_click_grabber; Control *mouse_click_grabber = nullptr;
int mouse_focus_mask; int mouse_focus_mask = 0;
Control *key_focus; Control *key_focus = nullptr;
Control *mouse_over; Control *mouse_over = nullptr;
Control *drag_mouse_over; Control *drag_mouse_over = nullptr;
Vector2 drag_mouse_over_pos; Vector2 drag_mouse_over_pos;
Control *tooltip_control; Control *tooltip_control = nullptr;
Window *tooltip_popup; Window *tooltip_popup = nullptr;
Label *tooltip_label; Label *tooltip_label = nullptr;
Point2 tooltip_pos; Point2 tooltip_pos;
Point2 last_mouse_pos; Point2 last_mouse_pos;
Point2 drag_accum; Point2 drag_accum;
bool drag_attempted; bool drag_attempted = false;
Variant drag_data; Variant drag_data;
Control *drag_preview; Control *drag_preview = nullptr;
float tooltip_timer; float tooltip_timer = -1.0;
float tooltip_delay; float tooltip_delay = 0.0;
Transform2D focus_inv_xform; Transform2D focus_inv_xform;
bool roots_order_dirty; bool roots_order_dirty = false;
List<Control *> roots; List<Control *> roots;
int canvas_sort_index; //for sorting items with canvas as root int canvas_sort_index = 0; //for sorting items with canvas as root
bool dragging; bool dragging = false;
bool embed_subwindows_hint; bool embed_subwindows_hint = false;
bool embedding_subwindows; bool embedding_subwindows = false;
Window *subwindow_focused; Window *subwindow_focused = nullptr;
SubWindowDrag subwindow_drag; SubWindowDrag subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
Vector2 subwindow_drag_from; Vector2 subwindow_drag_from;
Vector2 subwindow_drag_pos; Vector2 subwindow_drag_pos;
Rect2i subwindow_drag_close_rect; Rect2i subwindow_drag_close_rect;
bool subwindow_drag_close_inside; bool subwindow_drag_close_inside = false;
SubWindowResize subwindow_resize_mode; SubWindowResize subwindow_resize_mode;
Rect2i subwindow_resize_from_rect; Rect2i subwindow_resize_from_rect;
Vector<SubWindow> sub_windows; Vector<SubWindow> sub_windows;
GUI();
} gui; } gui;
DefaultCanvasItemTextureFilter default_canvas_item_texture_filter; DefaultCanvasItemTextureFilter default_canvas_item_texture_filter = DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
DefaultCanvasItemTextureRepeat default_canvas_item_texture_repeat; DefaultCanvasItemTextureRepeat default_canvas_item_texture_repeat = DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
bool disable_input; bool disable_input = false;
void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input); void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input);
void _gui_call_notification(Control *p_control, int p_what); void _gui_call_notification(Control *p_control, int p_what);
@ -651,10 +649,10 @@ public:
}; };
private: private:
UpdateMode update_mode; UpdateMode update_mode = UPDATE_WHEN_VISIBLE;
ClearMode clear_mode; ClearMode clear_mode = CLEAR_MODE_ALWAYS;
bool xr; bool xr = false;
bool size_2d_override_stretch; bool size_2d_override_stretch = false;
protected: protected:
static void _bind_methods(); static void _bind_methods();

View file

@ -1466,11 +1466,6 @@ void Window::_bind_methods() {
} }
Window::Window() { Window::Window() {
for (int i = 0; i < FLAG_MAX; i++) {
flags[i] = false;
}
content_scale_mode = CONTENT_SCALE_MODE_DISABLED;
content_scale_aspect = CONTENT_SCALE_ASPECT_IGNORE;
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED);
} }

View file

@ -90,7 +90,7 @@ private:
mutable Size2i min_size; mutable Size2i min_size;
mutable Size2i max_size; mutable Size2i max_size;
mutable Mode mode = MODE_WINDOWED; mutable Mode mode = MODE_WINDOWED;
mutable bool flags[FLAG_MAX]; mutable bool flags[FLAG_MAX] = {};
bool visible = true; bool visible = true;
bool focused = false; bool focused = false;
@ -106,8 +106,8 @@ private:
void _update_child_controls(); void _update_child_controls();
Size2i content_scale_size; Size2i content_scale_size;
ContentScaleMode content_scale_mode; ContentScaleMode content_scale_mode = CONTENT_SCALE_MODE_DISABLED;
ContentScaleAspect content_scale_aspect; ContentScaleAspect content_scale_aspect = CONTENT_SCALE_ASPECT_IGNORE;
void _make_window(); void _make_window();
void _clear_window(); void _clear_window();

Some files were not shown because too many files have changed in this diff Show more