diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-03-10 22:51:31 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-03-10 22:51:31 +0100 |
commit | c6e57bf514cb3cfd12f5eae9a96b0e0cef3af923 (patch) | |
tree | e3a409be658744b597003a8ca084bc9bfc0b1b1e | |
parent | aaad24e6fb1528fc6c773c0225ed9500c3fdd2bb (diff) | |
parent | bac875be66073d3f36adc3f03c391e724986888e (diff) |
Merge pull request #4007 from bojidar-bg/PR-fix-controls
Fix a crash when running a game with Controls with a tools build
-rw-r--r-- | scene/gui/control.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 0364f73275..d7befd6e11 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1175,7 +1175,12 @@ void Control::set_anchor(Margin p_margin,AnchorType p_anchor, bool p_keep_margin void Control::_set_anchor(Margin p_margin,AnchorType p_anchor) { #ifdef TOOLS_ENABLED - set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false)); + SceneTree *st=OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); + if (st && st->is_editor_hint()) { + set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false)); + } else { + set_anchor(p_margin, p_anchor); + } #else set_anchor(p_margin, p_anchor); #endif |