aboutsummaryrefslogtreecommitdiff
path: root/editor/plugins/texture_region_editor_plugin.cpp
diff options
context:
space:
mode:
authorHein-Pieter van Braam2017-09-01 22:33:39 +0200
committerHein-Pieter van Braam2017-09-02 01:59:26 +0200
commit9c63ab99f0a505b0f60079bb30cc453b4415fddc (patch)
tree7014cb6e8c2e71a0583656f76d3d37d719a74fb0 /editor/plugins/texture_region_editor_plugin.cpp
parentdac150108ab3c1f41d5fd86cc6853f883064caaf (diff)
downloadgodot-9c63ab99f0a505b0f60079bb30cc453b4415fddc.tar.gz
godot-9c63ab99f0a505b0f60079bb30cc453b4415fddc.tar.zst
godot-9c63ab99f0a505b0f60079bb30cc453b4415fddc.zip
Fix use of unitialized variables
The second in my quest to make Godot 3.x compile with -Werror on GCC7
Diffstat (limited to 'editor/plugins/texture_region_editor_plugin.cpp')
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 82b507bd4..38d1350b0 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -67,7 +67,7 @@ void TextureRegionEditor::_region_draw() {
if (snap_mode == SNAP_GRID) {
Size2 s = edit_draw->get_size();
- int last_cell;
+ int last_cell = 0;
if (snap_step.x != 0) {
if (snap_separation.x == 0)
@@ -406,7 +406,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
} else if (drag) {
if (edited_margin >= 0) {
- float new_margin;
+ float new_margin = 0;
if (edited_margin == 0)
new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 1)
@@ -415,6 +415,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom;
else if (edited_margin == 3)
new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom;
+ else
+ ERR_PRINT("Unexpected edited_margin");
+
if (new_margin < 0)
new_margin = 0;
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };