summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2023-02-21 17:02:24 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-27 18:04:25 +0200
commit6fedc728f608f90cf645dbd542c378620beb6692 (patch)
tree4a992636df941a8cda45ad825983ad21dd576fc4
parent4750b77d2d52a2ba0b6fe79ddb5f27bdc051cbe1 (diff)
Use 8×8 default grid size for TextureRegion and 2D polygon editors
Power-of-two grid sizes are more suited to most game assets. (cherry picked from commit 0f73ef1df9c092a8d2dea2861960e708d90fbd46)
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h3
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp3
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp3
3 files changed, 6 insertions, 3 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index c5b9bf9e0b..5ad8318ca0 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -212,7 +212,8 @@ private:
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;
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index fb35668310..e5e77be7aa 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -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);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 7fa16e6cc6..96e9005850 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -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;