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);
}
EditorFeatureProfile::EditorFeatureProfile() {
for (int i = 0; i < FEATURE_MAX; i++) {
features_disabled[i] = false;
}
}
EditorFeatureProfile::EditorFeatureProfile() {}
//////////////////////////

View file

@ -87,7 +87,7 @@ class VehicleWheel3D : public Node3D {
Vector3 m_wheelDirectionWS; //direction in worldspace
Vector3 m_wheelAxleWS; // axle in worldspace
bool m_isInContact = false;
PhysicsBody3D *m_groundObject; //could be general void* ptr
PhysicsBody3D *m_groundObject = nullptr; //could be general void* ptr
} m_raycastInfo;
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);
int closest = get_parameter(this->closest);
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 (triangles.size() == 0) {
@ -529,7 +529,7 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
}
if (new_closest != closest && new_closest != -1) {
float from = 0;
float from = 0.0;
if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
//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;

View file

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

View file

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

View file

@ -1132,7 +1132,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
Playback &c = playback;
if (c.current.from) {
float blend_time = 0;
float blend_time = 0.0;
// find if it can blend
BlendKey bk;
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);
//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);
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 {
// We want to grab the position of the furthest along tween
pending_update++;
real_t pos = 0;
real_t pos = 0.0;
// For each interpolation...
for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
@ -1122,7 +1122,7 @@ real_t Tween::get_runtime() const {
pending_update++;
// For each interpolation...
real_t runtime = 0;
real_t runtime = 0.0;
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
const InterpolateData &data = E->get();

View file

@ -448,18 +448,7 @@ void BaseButton::_bind_methods() {
}
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);
action_mode = ACTION_MODE_BUTTON_RELEASE;
button_mask = BUTTON_MASK_LEFT;
shortcut_context = ObjectID();
}
BaseButton::~BaseButton() {

View file

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

View file

@ -33,9 +33,9 @@
#include "margin_container.h"
struct _MinSizeCache {
int min_size;
bool will_stretch;
int final_size;
int min_size = 0;
bool will_stretch = false;
int final_size = 0;
};
void BoxContainer::_resort() {
@ -50,7 +50,7 @@ void BoxContainer::_resort() {
int children_count = 0;
int stretch_min = 0;
int stretch_avail = 0;
float stretch_ratio_total = 0;
float stretch_ratio_total = 0.0;
Map<Control *, _MinSizeCache> min_size_cache;
for (int i = 0; i < get_child_count(); i++) {
@ -105,7 +105,7 @@ void BoxContainer::_resort() {
has_stretched = true;
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++) {
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) {
vertical = p_vertical;
align = ALIGN_BEGIN;
}
void BoxContainer::_bind_methods() {

View file

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

View file

@ -203,7 +203,7 @@ void Button::_notification(int p_what) {
color_icon.a = 0.4;
}
float icon_ofs_region = 0;
float icon_ofs_region = 0.0;
if (rtl) {
if (_internal_margin[SIDE_RIGHT] > 0) {
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->set_flags(TextServer::BREAK_MANDATORY);
flat = false;
clip_text = false;
expand_icon = false;
set_mouse_filter(MOUSE_FILTER_STOP);
set_text(p_text);
align = ALIGN_CENTER;
for (int i = 0; i < 4; i++) {
_internal_margin[i] = 0;
}
}
Button::~Button() {

View file

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

View file

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

View file

@ -719,17 +719,6 @@ void ColorPicker::_bind_methods() {
ColorPicker::ColorPicker() :
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);
add_child(hb_edit);
hb_edit->set_v_size_flags(SIZE_EXPAND_FILL);
@ -1002,12 +991,5 @@ void ColorPickerButton::_bind_methods() {
}
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);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -69,7 +69,7 @@ private:
LineEdit *makedirname;
Button *makedir;
Access access;
Access access = ACCESS_RESOURCES;
//Button *action;
VBoxContainer *vbox;
FileMode mode;
@ -93,12 +93,12 @@ private:
Vector<String> filters;
bool mode_overrides_title;
bool mode_overrides_title = true;
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_file_name();

View file

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

View file

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

View file

@ -1657,8 +1657,6 @@ void GraphEdit::_bind_methods() {
GraphEdit::GraphEdit() {
set_focus_mode(FOCUS_ALL);
awaiting_scroll_offset_update = false;
top_layer = nullptr;
top_layer = memnew(GraphEditFilter(this));
add_child(top_layer);
top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
@ -1681,13 +1679,6 @@ GraphEdit::GraphEdit() {
v_scroll->set_name("_v_scroll");
top_layer->add_child(v_scroll);
updating = false;
connecting = false;
right_disconnects = false;
box_selecting = false;
dragging = false;
//set large minmax so it can scroll even if not resized yet
h_scroll->set_min(-10000);
h_scroll->set_max(10000);
@ -1698,8 +1689,6 @@ GraphEdit::GraphEdit() {
h_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);
top_layer->add_child(zoom_hb);
zoom_hb->set_position(Vector2(10, 10));
@ -1768,7 +1757,5 @@ GraphEdit::GraphEdit() {
minimap->set_offset(Side::SIDE_BOTTOM, -MINIMAP_OFFSET);
minimap->connect("draw", callable_mp(this, &GraphEdit::_minimap_draw));
setting_scroll_ofs = false;
just_disconnected = false;
set_clip_contents(true);
}

View file

@ -99,9 +99,9 @@ public:
struct Connection {
StringName from;
StringName to;
int from_port;
int to_port;
float activity;
int from_port = 0;
int to_port = 0;
float activity = 0.0;
};
private:
@ -121,41 +121,41 @@ private:
HScrollBar *h_scroll;
VScrollBar *v_scroll;
float port_grab_distance_horizontal;
float port_grab_distance_horizontal = 0.0;
float port_grab_distance_vertical;
bool connecting;
bool connecting = false;
String connecting_from;
bool connecting_out;
int connecting_index;
int connecting_type;
bool connecting_out = false;
int connecting_index = 0;
int connecting_type = 0;
Color connecting_color;
bool connecting_target;
bool connecting_target = false;
Vector2 connecting_to;
String connecting_target_to;
int connecting_target_index;
bool just_disconnected;
bool connecting_valid;
bool just_disconnected = false;
bool connecting_valid = false;
Vector2 click_pos;
bool dragging;
bool just_selected;
bool moving_selection;
bool dragging = false;
bool just_selected = false;
bool moving_selection = false;
Vector2 drag_accum;
float zoom;
float zoom = 1.0;
bool box_selecting;
bool box_selection_mode_additive;
bool box_selecting = false;
bool box_selection_mode_additive = false;
Point2 box_selecting_from;
Point2 box_selecting_to;
Rect2 box_selecting_rect;
List<GraphNode *> previus_selected;
bool setting_scroll_ofs;
bool right_disconnects;
bool updating;
bool awaiting_scroll_offset_update;
bool setting_scroll_ofs = false;
bool right_disconnects = false;
bool updating = false;
bool awaiting_scroll_offset_update = false;
List<Connection> connections;
float lines_thickness = 2.0f;
@ -194,7 +194,7 @@ private:
uint32_t type_a;
uint32_t type_b;
};
uint64_t key;
uint64_t key = 0;
};
bool operator<(const ConnType &p_type) const {

View file

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

View file

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

View file

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

View file

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

View file

@ -899,7 +899,7 @@ void ItemList::_notification(int p_what) {
}
if (shape_changed) {
float max_column_width = 0;
float max_column_width = 0.0;
//1- compute item minimum sizes
for (int i = 0; i < items.size(); i++) {
@ -1615,34 +1615,12 @@ void ItemList::_bind_methods() {
}
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);
add_child(scroll_bar);
shape_changed = true;
scroll_bar->connect("value_changed", callable_mp(this, &ItemList::_scroll_changed));
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);
}

View file

@ -52,7 +52,7 @@ public:
private:
struct Item {
Ref<Texture2D> icon;
bool icon_transposed;
bool icon_transposed = false;
Rect2i icon_region;
Color icon_modulate;
Ref<Texture2D> tag_icon;
@ -62,10 +62,10 @@ private:
String language;
TextDirection text_direction = TEXT_DIRECTION_AUTO;
bool selectable;
bool selected;
bool disabled;
bool tooltip_enabled;
bool selectable = false;
bool selected = false;
bool disabled = false;
bool tooltip_enabled = false;
Variant metadata;
String tooltip;
Color custom_fg;
@ -79,44 +79,44 @@ private:
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 same_column_width;
bool ensure_selected_visible = false;
bool same_column_width = false;
bool auto_height;
float auto_height_value;
bool auto_height = false;
float auto_height_value = 0.0;
Vector<Item> items;
Vector<int> separators;
SelectMode select_mode;
IconMode icon_mode;
SelectMode select_mode = SELECT_SINGLE;
IconMode icon_mode = ICON_MODE_LEFT;
VScrollBar *scroll_bar;
uint64_t search_time_msec;
uint64_t search_time_msec = 0;
String search_string;
int current_columns;
int fixed_column_width;
int max_text_lines;
int max_columns;
int current_columns = 1;
int fixed_column_width = 0;
int max_text_lines = 1;
int max_columns = 1;
Size2 fixed_icon_size;
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;
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()));
float total_h = 0;
float total_h = 0.0;
int lines_visible = 0;
// 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");
int line_spacing = get_theme_constant("line_spacing");
int lines_visible = 0;
float total_h = 0;
float total_h = 0.0;
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;
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;
Array st_args;
float percent_visible = 1;
float percent_visible = 1.0;
int visible_chars = -1;
int lines_skipped = 0;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -38,7 +38,7 @@ class OptionButton : public Button {
GDCLASS(OptionButton, Button);
PopupMenu *popup;
int current;
int current = -1;
void _focused(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
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 icon_w = 0;
float max_w = 0.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 accel_max_w = 0;
bool has_check = false;
@ -1656,19 +1656,6 @@ PopupMenu::PopupMenu() {
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->set_wait_time(0.3);
submenu_timer->set_one_shot(true);

View file

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

View file

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

View file

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

View file

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

View file

@ -37,11 +37,14 @@ class Range : public Control {
GDCLASS(Range, Control);
struct Shared {
double val, min, max;
double step, page;
bool exp_ratio;
bool allow_greater;
bool allow_lesser;
double val = 0.0;
double min = 0.0;
double max = 100.0;
double step = 1.0;
double page = 0.0;
bool exp_ratio = false;
bool allow_greater = false;
bool allow_lesser = false;
Set<Range *> owners;
void emit_value_changed();
void emit_changed(const char *p_what = "");
@ -62,7 +65,7 @@ protected:
static void _bind_methods();
bool _rounded_values;
bool _rounded_values = false;
public:
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();
Vector2 offset;
float row_height = 0;
float row_height = 0.0;
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
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();
Vector2 offset;
float row_height = 0;
float row_height = 0.0;
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
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) {
Item *item = p_item;
float margin = 0;
float margin = 0.0;
while (item) {
if (item->type == ITEM_INDENT) {
@ -4066,19 +4066,6 @@ RichTextLabel::RichTextLabel() {
main->first_invalid_line = 0;
main->first_resized_line = 0;
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);
add_child(vscroll);
@ -4090,19 +4077,6 @@ RichTextLabel::RichTextLabel() {
vscroll->connect("value_changed", callable_mp(this, &RichTextLabel::_scroll_changed));
vscroll->set_step(1);
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);
}

View file

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

View file

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

View file

@ -47,14 +47,14 @@ class ScrollBar : public Range {
Orientation orientation;
Size2 size;
float custom_step = -1;
float custom_step = -1.0;
HighlightStatus highlight = HIGHLIGHT_NONE;
struct Drag {
bool active = false;
float pos_at_click = 0;
float value_at_click = 0;
float pos_at_click = 0.0;
float value_at_click = 0.0;
} drag;
double get_grabber_size() const;
@ -73,14 +73,14 @@ class ScrollBar : public Range {
Vector2 drag_node_accum;
Vector2 drag_node_from;
Vector2 last_drag_node_accum;
float last_drag_node_time;
float time_since_motion;
float last_drag_node_time = 0.0;
float time_since_motion = 0.0;
bool drag_node_touching = false;
bool drag_node_touching_deaccel = false;
bool click_handled;
bool click_handled = false;
bool scrolling = false;
double target_scroll = 0;
double target_scroll = 0.0;
bool smooth_scroll_enabled = false;
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)) {
Rect2 global_rect = 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()) {
right_margin += v_scroll->get_size().x;
}
float bottom_margin = 0;
float bottom_margin = 0.0;
if (h_scroll->is_visible()) {
bottom_margin += h_scroll->get_size().y;
}
@ -624,15 +624,7 @@ ScrollContainer::ScrollContainer() {
add_child(v_scroll);
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");
follow_focus = false;
set_clip_contents(true);
};

View file

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

View file

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

View file

@ -269,12 +269,5 @@ void Slider::_bind_methods() {
Slider::Slider(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);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1243,20 +1243,5 @@ void TabContainer::_bind_methods() {
}
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));
}

View file

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

View file

@ -1137,27 +1137,5 @@ void Tabs::_bind_methods() {
}
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));
}

View file

@ -63,42 +63,42 @@ private:
Ref<TextLine> text_buf;
Ref<Texture2D> icon;
int ofs_cache;
bool disabled;
int size_cache;
int size_text;
int x_cache;
int x_size_cache;
int ofs_cache = 0;
bool disabled = false;
int size_cache = 0;
int size_text = 0;
int x_cache = 0;
int x_size_cache = 0;
Ref<Texture2D> right_button;
Rect2 rb_rect;
Rect2 cb_rect;
};
int offset;
int max_drawn_tab;
int highlight_arrow;
bool buttons_visible;
bool missing_right;
int offset = 0;
int max_drawn_tab = 0;
int highlight_arrow = -1;
bool buttons_visible = false;
bool missing_right = false;
Vector<Tab> tabs;
int current;
int previous;
int current = 0;
int previous = 0;
int _get_top_margin() const;
TabAlign tab_align;
int rb_hover;
bool rb_pressing;
TabAlign tab_align = ALIGN_CENTER;
int rb_hover = -1;
bool rb_pressing = false;
bool select_with_rmb;
bool select_with_rmb = false;
int cb_hover;
bool cb_pressing;
CloseButtonDisplayPolicy cb_displaypolicy;
int cb_hover = -1;
bool cb_pressing = false;
CloseButtonDisplayPolicy cb_displaypolicy = CLOSE_BUTTON_SHOW_NEVER;
int hover; // Hovered tab.
int min_width;
bool scrolling_enabled;
bool drag_to_rearrange_enabled;
int tabs_rearrange_group;
int hover = -1; // Hovered tab.
int min_width = 0;
bool scrolling_enabled = true;
bool drag_to_rearrange_enabled = false;
int tabs_rearrange_group = -1;
int get_tab_width(int p_idx) const;
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.
double new_line_scroll_pos = 0;
double new_line_scroll_pos = 0.0;
int to = CLAMP(p_line, 0, text.size() - 1);
for (int i = 0; i < to; i++) {
if (!text.is_hidden(i)) {
@ -7205,23 +7205,11 @@ void TextEdit::_bind_methods() {
}
TextEdit::TextEdit() {
setting_row = false;
draw_tabs = false;
draw_spaces = false;
override_selected_font_color = false;
draw_caret = true;
max_chars = 0;
clear();
wrap_enabled = false;
wrap_at = 0;
wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL);
_update_caches();
cache.line_spacing = 1;
cache.font_size = 16;
set_default_cursor_shape(CURSOR_IBEAM);
indent_size = 4;
text.set_indent_size(indent_size);
text.clear();
@ -7231,31 +7219,16 @@ TextEdit::TextEdit() {
add_child(h_scroll);
add_child(v_scroll);
updating_scrolls = false;
selection.active = false;
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("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);
add_child(caret_blink_timer);
caret_blink_timer->set_wait_time(0.65);
caret_blink_timer->connect("timeout", callable_mp(this, &TextEdit::_toggle_draw_caret));
cursor_set_blink_enabled(false);
right_click_moves_caret = true;
idle_detect = memnew(Timer);
add_child(idle_detect);
@ -7268,54 +7241,8 @@ TextEdit::TextEdit() {
click_select_held->set_wait_time(0.05);
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_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);
add_child(menu);
@ -7350,12 +7277,10 @@ TextEdit::TextEdit() {
menu_ctl->add_item(RTR("Soft hyphen (SHY)"), MENU_INSERT_SHY);
menu->add_child(menu_ctl);
readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly.
set_readonly(false);
menu->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));
first_draw = true;
}
TextEdit::~TextEdit() {

View file

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

View file

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

View file

@ -54,15 +54,15 @@ private:
Ref<Texture2D> disabled;
Ref<Texture2D> focused;
Ref<BitMap> click_mask;
bool expand;
StretchMode stretch_mode;
bool expand = false;
StretchMode stretch_mode = STRETCH_SCALE;
Rect2 _texture_region;
Rect2 _position_rect;
bool _tile;
bool _tile = false;
bool hflip;
bool vflip;
bool hflip = false;
bool vflip = false;
protected:
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;
Point2 dir = Vector2(Math::cos(angle), Math::sin(angle));
float t1 = 1.0;
float cp = 0;
float cq = 0;
float cr = 0;
float cp = 0.0;
float cq = 0.0;
float cr = 0.0;
float edgeLeft = 0.0;
float edgeRight = 1.0;
float edgeBottom = 0.0;
@ -540,17 +540,5 @@ void TextureProgressBar::_bind_methods() {
}
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);
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();
private:
FillMode mode;
float rad_init_angle;
float rad_max_degrees;
FillMode mode = FILL_LEFT_TO_RIGHT;
float rad_init_angle = 0.0;
float rad_max_degrees = 360.0;
Point2 rad_center_off;
bool nine_patch_stretch;
int stretch_margin[4];
Color tint_under, tint_progress, tint_over;
bool nine_patch_stretch = false;
int stretch_margin[4] = {};
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 get_relative_center();

View file

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

View file

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

View file

@ -4232,19 +4232,8 @@ void Tree::_bind_methods() {
}
Tree::Tree() {
selected_col = 0;
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);
popup_menu = memnew(PopupMenu);
@ -4288,50 +4277,9 @@ Tree::Tree() {
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);
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);
cache.hover_item = nullptr;
cache.hover_cell = -1;
allow_reselect = false;
propagate_mouse_activated = false;
}
Tree::~Tree() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -638,29 +638,11 @@ void HTTPRequest::_bind_methods() {
}
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();
use_threads = false;
thread_done = false;
downloaded = 0;
body_size_limit = -1;
file = nullptr;
timer = memnew(Timer);
timer->set_one_shot(true);
timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout));
add_child(timer);
timeout = 0;
}
HTTPRequest::~HTTPRequest() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -144,7 +144,6 @@ void ViewportTexture::_bind_methods() {
}
ViewportTexture::ViewportTexture() {
vp = nullptr;
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() {
if (!is_inside_tree()) {
return;
@ -3682,26 +3661,10 @@ Viewport::Viewport() {
viewport_textures.insert(default_texture.ptr());
default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid);
audio_listener = false;
//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)
gen_mipmaps = false;
//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);
for (int i = 0; i < 4; i++) {
@ -3720,50 +3683,11 @@ Viewport::Viewport() {
unhandled_input_group = "_vp_unhandled_input" + id;
unhandled_key_input_group = "_vp_unhandled_key_input" + id;
disable_input = false;
// Window tooltip.
gui.tooltip_timer = -1;
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
gui.tooltip_control = nullptr;
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
set_sdf_oversize(sdf_oversize); //set to server
}
Viewport::~Viewport() {
@ -3895,12 +3819,6 @@ void SubViewport::_bind_methods() {
BIND_ENUM_CONSTANT(UPDATE_ALWAYS);
}
SubViewport::SubViewport() {
xr = false;
size_2d_override_stretch = false;
update_mode = UPDATE_WHEN_VISIBLE;
clear_mode = CLEAR_MODE_ALWAYS;
}
SubViewport::SubViewport() {}
SubViewport::~SubViewport() {
}
SubViewport::~SubViewport() {}

View file

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

View file

@ -1466,11 +1466,6 @@ void Window::_bind_methods() {
}
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);
}

View file

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

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