Skip to content

Commit

Permalink
Use 8×8 default grid size for TextureRegion and 2D polygon editors
Browse files Browse the repository at this point in the history
Power-of-two grid sizes are more suited to most game assets.
  • Loading branch information
Calinou committed Feb 21, 2023
1 parent 7e79aea commit 0f73ef1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion editor/plugins/canvas_item_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ class CanvasItemEditor : public VBoxContainer {
bool selected_from_canvas = false;

Point2 grid_offset;
Point2 grid_step = Point2(8, 8); // A power-of-two value works better as a default.
// A power-of-two value works better as a default grid size.
Point2 grid_step = Point2(8, 8);
int primary_grid_steps = 8;
int grid_step_multiplier = 0;

Expand Down
3 changes: 2 additions & 1 deletion editor/plugins/polygon_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,8 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const {

Polygon2DEditor::Polygon2DEditor() {
snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2());
snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(10, 10));
// A power-of-two value works better as a default grid size.
snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(8, 8));
use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false);
snap_show_grid = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "show_grid", false);

Expand Down
3 changes: 2 additions & 1 deletion editor/plugins/texture_region_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,8 @@ TextureRegionEditor::TextureRegionEditor() {

preview_tex = Ref<CanvasTexture>(memnew(CanvasTexture));

snap_step = Vector2(10, 10);
// A power-of-two value works better as a default grid size.
snap_step = Vector2(8, 8);
snap_separation = Vector2(0, 0);
snap_mode = SNAP_NONE;
edited_margin = -1;
Expand Down

0 comments on commit 0f73ef1

Please sign in to comment.