Remove unnecessary fail conditions when loading SpatialEditor state
This commit is contained in:
parent
f25897527e
commit
aa9c2e68c6
1 changed files with 22 additions and 28 deletions
|
@ -2677,15 +2677,6 @@ void SpatialEditor::set_state(const Dictionary& p_state) {
|
||||||
|
|
||||||
Dictionary d = p_state;
|
Dictionary d = p_state;
|
||||||
|
|
||||||
ERR_FAIL_COND(!d.has("viewport_mode"));
|
|
||||||
ERR_FAIL_COND(!d.has("viewports"));
|
|
||||||
ERR_FAIL_COND(!d.has("default_light"));
|
|
||||||
ERR_FAIL_COND(!d.has("show_grid"));
|
|
||||||
ERR_FAIL_COND(!d.has("show_origin"));
|
|
||||||
ERR_FAIL_COND(!d.has("fov"));
|
|
||||||
ERR_FAIL_COND(!d.has("znear"));
|
|
||||||
ERR_FAIL_COND(!d.has("zfar"));
|
|
||||||
|
|
||||||
if (d.has("snap_enabled")) {
|
if (d.has("snap_enabled")) {
|
||||||
snap_enabled=d["snap_enabled"];
|
snap_enabled=d["snap_enabled"];
|
||||||
int snap_enabled_idx=transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_USE_SNAP);
|
int snap_enabled_idx=transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_USE_SNAP);
|
||||||
|
@ -2707,28 +2698,31 @@ void SpatialEditor::set_state(const Dictionary& p_state) {
|
||||||
update_transform_gizmo();
|
update_transform_gizmo();
|
||||||
}
|
}
|
||||||
|
|
||||||
int vc = d["viewport_mode"];
|
if (d.has("viewport_mode")) {
|
||||||
|
int vc = d["viewport_mode"];
|
||||||
|
|
||||||
if (vc==1)
|
if (vc==1)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
|
_menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
|
||||||
else if (vc==2)
|
else if (vc==2)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS);
|
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS);
|
||||||
else if (vc==3)
|
else if (vc==3)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS);
|
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS);
|
||||||
else if (vc==4)
|
else if (vc==4)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS);
|
_menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS);
|
||||||
else if (vc==5)
|
else if (vc==5)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT);
|
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT);
|
||||||
else if (vc==6)
|
else if (vc==6)
|
||||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT);
|
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT);
|
||||||
|
|
||||||
Array vp = d["viewports"];
|
|
||||||
ERR_FAIL_COND(vp.size()>4);
|
|
||||||
|
|
||||||
for(int i=0;i<4;i++) {
|
|
||||||
viewports[i]->set_state(vp[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d.has("viewports")) {
|
||||||
|
Array vp = d["viewports"];
|
||||||
|
ERR_FAIL_COND(vp.size()>4);
|
||||||
|
|
||||||
|
for(int i=0;i<4;i++) {
|
||||||
|
viewports[i]->set_state(vp[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (d.has("zfar"))
|
if (d.has("zfar"))
|
||||||
settings_zfar->set_val(float(d["zfar"]));
|
settings_zfar->set_val(float(d["zfar"]));
|
||||||
|
|
Loading…
Reference in a new issue