Merge pull request #318 from adolson/scene-snap-settings-save
2D scene snap settings save
This commit is contained in:
commit
7fadc2f93a
1 changed files with 12 additions and 3 deletions
|
@ -85,8 +85,10 @@ Dictionary CanvasItemEditor::get_state() const {
|
|||
Dictionary state;
|
||||
state["zoom"]=zoom;
|
||||
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
|
||||
state["pixel_snap"]=pixel_snap;
|
||||
// state["ofs"]=-transform.get_origin();
|
||||
state["use_snap"]=is_snap_active();
|
||||
state["snap"]=snap;
|
||||
state["pixel_snap"]=pixel_snap;
|
||||
return state;
|
||||
}
|
||||
void CanvasItemEditor::set_state(const Dictionary& p_state){
|
||||
|
@ -103,12 +105,19 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){
|
|||
v_scroll->set_val(ofs.y);
|
||||
}
|
||||
|
||||
if (state.has("use_snap")) {
|
||||
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
|
||||
edit_menu->get_popup()->set_item_checked(idx,state["use_snap"]);
|
||||
}
|
||||
|
||||
if (state.has("snap")) {
|
||||
snap=state["snap"];
|
||||
}
|
||||
|
||||
if (state.has("pixel_snap")) {
|
||||
pixel_snap=state["pixel_snap"];
|
||||
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
|
||||
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue