问题描述
我需要存储/恢复设置面板的值。我该怎么做?
我使用了以下方法,但没有成功。
在我的场景中,我更改了 String[] pieces = line.split("\\s+");
和 Ghost hidden objects
,然后:
display Unit
之后,我又将 Ghost 隐藏对象和显示单元更改为其他一些,然后:
let current_profile = nop_VIEWER.profileManager.getProfileOrDefault();
let profile = new Autodesk.Viewing.Profile(current_profile);
解决方法
解决方案是使用 viewer.getState()
:
存储设置:
let current_state = NOP_VIEWER.getState();
let render_options = current_state.renderOptions;
恢复设置:
let state = {renderOptions: render_options}
NOP_VIEWER.restoreState(state);
更多信息:https://autodeskviewer.com/viewers/latest/docs/tutorial-viewer_state.html