Fix a crash when running a game with Controls with a tools build
Regression from #3997 TOOLS_ENABLED is defined, even when running from editor, but EDITOR_DEF SEGFAULTs
This commit is contained in:
parent
aaad24e6fb
commit
bac875be66
@ -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) {
|
void Control::_set_anchor(Margin p_margin,AnchorType p_anchor) {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
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));
|
set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false));
|
||||||
|
} else {
|
||||||
|
set_anchor(p_margin, p_anchor);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
set_anchor(p_margin, p_anchor);
|
set_anchor(p_margin, p_anchor);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user