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.
This commit is contained in:
parent
31f88a7006
commit
56718eb31e
|
@ -85,8 +85,10 @@ Dictionary CanvasItemEditor::get_state() const {
|
||||||
Dictionary state;
|
Dictionary state;
|
||||||
state["zoom"]=zoom;
|
state["zoom"]=zoom;
|
||||||
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
|
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
|
||||||
state["pixel_snap"]=pixel_snap;
|
|
||||||
// state["ofs"]=-transform.get_origin();
|
// state["ofs"]=-transform.get_origin();
|
||||||
|
state["use_snap"]=is_snap_active();
|
||||||
|
state["snap"]=snap;
|
||||||
|
state["pixel_snap"]=pixel_snap;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
void CanvasItemEditor::set_state(const Dictionary& p_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);
|
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")) {
|
if (state.has("pixel_snap")) {
|
||||||
pixel_snap=state["pixel_snap"];
|
pixel_snap=state["pixel_snap"];
|
||||||
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
|
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
|
||||||
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
|
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue