Browse Source

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.
Hugo Locurcio 9 months ago
parent
commit
80b8d6dbe6
2 changed files with 6 additions and 4 deletions
  1. 3 4
      editor/editor_settings.cpp
  2. 3 0
      modules/gridmap/editor/grid_map_editor_plugin.cpp

+ 3 - 4
editor/editor_settings.cpp

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

+ 3 - 0
modules/gridmap/editor/grid_map_editor_plugin.cpp

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