summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahn Sahir <ibrahn.sahir@gmail.com>2018-11-11 17:32:47 +0000
committerIbrahn Sahir <ibrahn.sahir@gmail.com>2018-11-11 17:32:47 +0000
commited337085cf0a211619688467d7a90222f23eff58 (patch)
tree41f583103c1117ef70584c220052a296c4a65f0a
parentd16ce4a8edb26fb4730c51405662479f7ebf6617 (diff)
Fixed various uninitialised member variables in editor plugins.
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp78
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h5
-rw-r--r--editor/plugins/particles_editor_plugin.cpp1
-rw-r--r--editor/plugins/skeleton_editor_plugin.cpp1
-rw-r--r--scene/gui/popup_menu.cpp1
5 files changed, 47 insertions, 39 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index a0763e03f1..1add99bdcc 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4504,6 +4504,46 @@ void CanvasItemEditor::focus_selection() {
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
+ key_pos = true;
+ key_rot = true;
+ key_scale = false;
+
+ show_grid = false;
+ show_origin = true;
+ show_viewport = true;
+ show_helpers = false;
+ show_rulers = true;
+ show_guides = true;
+ show_edit_locks = true;
+ zoom = 1;
+ view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
+ previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
+ grid_offset = Point2();
+ grid_step = Point2(10, 10);
+ grid_step_multiplier = 0;
+ snap_rotation_offset = 0;
+ snap_rotation_step = 15 / (180 / Math_PI);
+ snap_active = false;
+ snap_node_parent = true;
+ snap_node_anchors = true;
+ snap_node_sides = true;
+ snap_node_center = true;
+ snap_other_nodes = true;
+ snap_grid = true;
+ snap_guides = true;
+ snap_rotation = false;
+ snap_pixel = false;
+
+ skeleton_show_bones = true;
+
+ drag_type = DRAG_NONE;
+ drag_from = Vector2();
+ drag_to = Vector2();
+ dragged_guide_pos = Point2();
+ dragged_guide_index = -1;
+
+ bone_last_frame = 0;
+
bone_list_dirty = false;
tool = TOOL_SELECT;
undo_redo = p_editor->get_undo_redo();
@@ -4826,49 +4866,11 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY);
divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE);
- key_pos = true;
- key_rot = true;
- key_scale = false;
-
- show_grid = false;
- show_origin = true;
- show_viewport = true;
- show_helpers = false;
- show_rulers = true;
- show_guides = true;
- show_edit_locks = true;
- zoom = 1;
- view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
- previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
- grid_offset = Point2();
- grid_step = Point2(10, 10);
- grid_step_multiplier = 0;
- snap_rotation_offset = 0;
- snap_rotation_step = 15 / (180 / Math_PI);
- snap_active = false;
- snap_node_parent = true;
- snap_node_anchors = true;
- snap_node_sides = true;
- snap_node_center = true;
- snap_other_nodes = true;
- snap_grid = true;
- snap_guides = true;
- snap_rotation = false;
- snap_pixel = false;
- skeleton_show_bones = true;
skeleton_menu->get_popup()->set_item_checked(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES), true);
singleton = this;
set_process_unhandled_key_input(true);
- drag_type = DRAG_NONE;
- drag_from = Vector2();
- drag_to = Vector2();
- dragged_guide_pos = Point2();
- dragged_guide_index = -1;
-
- bone_last_frame = 0;
-
// Update the menus' checkboxes
call_deferred("set_state", get_state());
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 59777fb085..f71eb1b605 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -64,7 +64,10 @@ public:
Dictionary undo_state;
- CanvasItemEditorSelectedItem() { prev_rot = 0; }
+ CanvasItemEditorSelectedItem() :
+ prev_anchors() {
+ prev_rot = 0;
+ }
};
class CanvasItemEditor : public VBoxContainer {
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 6b41946918..f2dfae7a9f 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -453,6 +453,7 @@ void ParticlesEditor::_bind_methods() {
ParticlesEditor::ParticlesEditor() {
+ node = NULL;
particles_editor_hb = memnew(HBoxContainer);
SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
options = memnew(MenuButton);
diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp
index e7d9f1b702..8b0beefb3e 100644
--- a/editor/plugins/skeleton_editor_plugin.cpp
+++ b/editor/plugins/skeleton_editor_plugin.cpp
@@ -151,6 +151,7 @@ void SkeletonEditor::_bind_methods() {
}
SkeletonEditor::SkeletonEditor() {
+ skeleton = NULL;
options = memnew(MenuButton);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 004455c6a9..f621522102 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1425,6 +1425,7 @@ PopupMenu::PopupMenu() {
set_hide_on_item_selection(true);
set_hide_on_checkable_item_selection(true);
set_hide_on_multistate_item_selection(false);
+ set_hide_on_window_lose_focus(true);
submenu_timer = memnew(Timer);
submenu_timer->set_wait_time(0.3);