You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #74682 from KoBeWi/snappy_snapping
Properly remember snapping options per-project
This commit is contained in:
@@ -895,6 +895,14 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite
|
||||
|
||||
void CanvasItemEditor::_snap_changed() {
|
||||
static_cast<SnapDialog *>(snap_dialog)->get_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step);
|
||||
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "grid_offset", grid_offset);
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "grid_step", grid_step);
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "primary_grid_steps", primary_grid_steps);
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "snap_rotation_offset", snap_rotation_offset);
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "snap_rotation_step", snap_rotation_step);
|
||||
EditorSettings::get_singleton()->set_project_metadata("2d_editor", "snap_scale_step", snap_scale_step);
|
||||
|
||||
grid_step_multiplier = 0;
|
||||
viewport->queue_redraw();
|
||||
}
|
||||
@@ -4896,6 +4904,15 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
|
||||
viewport->queue_redraw();
|
||||
}
|
||||
|
||||
void CanvasItemEditor::clear() {
|
||||
grid_offset = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "grid_offset", Vector2());
|
||||
grid_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "grid_step", Vector2(8, 8));
|
||||
primary_grid_steps = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "primary_grid_steps", 8);
|
||||
snap_rotation_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_rotation_step", Math::deg_to_rad(15.0));
|
||||
snap_rotation_offset = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_rotation_offset", 0.0);
|
||||
snap_scale_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_scale_step", 0.1);
|
||||
}
|
||||
|
||||
void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
|
||||
ERR_FAIL_COND(!p_control);
|
||||
|
||||
@@ -5426,6 +5443,10 @@ void CanvasItemEditorPlugin::set_state(const Dictionary &p_state) {
|
||||
canvas_item_editor->set_state(p_state);
|
||||
}
|
||||
|
||||
void CanvasItemEditorPlugin::clear() {
|
||||
canvas_item_editor->clear();
|
||||
}
|
||||
|
||||
void CanvasItemEditorPlugin::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
||||
Reference in New Issue
Block a user