diff options
author | reduz <reduzio@gmail.com> | 2014-04-28 21:51:41 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2014-04-28 21:51:41 -0300 |
commit | 7fadc2f93a18f2b5487fbcd6e90bcde781c53fec (patch) | |
tree | bfb4f2148690d52737520667c057237d3aaacafc | |
parent | 02669e95a4975898d97aeaedc913b16f60688a01 (diff) | |
parent | 56718eb31e1fd5594bfc04f17050d9cea09e5de2 (diff) |
Merge pull request #318 from adolson/scene-snap-settings-save
2D scene snap settings save
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 1a365d7f32..7914ecfd95 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -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); - - } } |