summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Olson <dana@shineuponthee.com>2014-04-23 21:43:02 -0400
committerDana Olson <dana@shineuponthee.com>2014-04-23 21:43:02 -0400
commit56718eb31e1fd5594bfc04f17050d9cea09e5de2 (patch)
treecc3535325867e1f02782201a26608a5d593cac1e
parent31f88a700656fc89877864e864d27b70e9aff70f (diff)
use Snap / Snap (Pixels) now save to scene file
Previously, only Use Pixel Snap would save to the scene. Tested and working for me, on Linux.
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp15
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);
-
-
}
}