diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-03-13 20:11:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 20:11:24 +0100 |
commit | cad371dd85f0b7a7f7717759a36aa477092a269c (patch) | |
tree | 02baa4947ff347507116334aa3567e90fcc0327c | |
parent | e065bb5c3b5ca5a854fd59d043f6d5f8f0c81644 (diff) | |
parent | 7bab7fd7773854e136c7d2c31b83498fd35a4b2d (diff) |
Merge pull request #26945 from shartte/allow-fewer-viewports-in-editor-state
Be more tolerant about under-defined spatial viewport state
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 776110b3b2..ad945d7916 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4170,9 +4170,13 @@ void SpatialEditor::set_state(const Dictionary &p_state) { if (d.has("viewports")) { Array vp = d["viewports"]; - ERR_FAIL_COND(vp.size() > 4); + uint32_t vp_size = static_cast<uint32_t>(vp.size()); + if (vp_size > VIEWPORTS_COUNT) { + WARN_PRINT("Ignoring superfluous viewport settings from spatial editor state.") + vp_size = VIEWPORTS_COUNT; + } - for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < vp_size; i++) { viewports[i]->set_state(vp[i]); } } |