Make GridMap editor Preview Size setting take effect immediately after change

Previously, you had to interact with the zoom widget after changing
the editor setting for the preview size to update.

This also adds property hints for the GridMap editor settings.
This commit is contained in:
Hugo Locurcio 2025-01-12 01:56:28 +01:00
parent 5b52b4b5c4
commit 80b8d6dbe6
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
2 changed files with 6 additions and 4 deletions

View file

@ -761,10 +761,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// GridMap // GridMap
// GridMapEditor // GridMapEditor
_initial_set("editors/grid_map/pick_distance", 5000.0); EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/grid_map/pick_distance", 5000.0, "1,8192,0.1,or_greater");
_initial_set("editors/grid_map/palette_min_width", 230); EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_RANGE, "editors/grid_map/palette_min_width", 230, "100,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set_restart_if_changed("editors/grid_map/palette_min_width", true); EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_RANGE, "editors/grid_map/preview_size", 64, "16,128,1")
_initial_set("editors/grid_map/preview_size", 64);
// 3D // 3D
EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56, 0.5), "") EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56, 0.5), "")

View file

@ -1254,6 +1254,9 @@ void GridMapEditor::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
indicator_mat->set_albedo(EDITOR_GET("editors/3d_gizmos/gizmo_colors/gridmap_grid")); indicator_mat->set_albedo(EDITOR_GET("editors/3d_gizmos/gizmo_colors/gridmap_grid"));
// Take Preview Size changes into account.
update_palette();
} break; } break;
} }
} }