summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-13 10:10:28 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-13 10:10:28 +0100
commita720a8c136bb33a8cdf0be775346151c33755790 (patch)
tree7ba81448bf62168d41a8d71c943256141062dbd8 /editor
parentfcbbda25fec85fed8c7396db75373623792f8027 (diff)
parentafa38bd030f1052cd1793da6d53bed9336a7e0f5 (diff)
Merge pull request #69893 from henrlin24/hide-scattering
Hide Scattering label and controls within TileMap editor window when "Place Random Tile" option is disabled
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp9
-rw-r--r--editor/plugins/tiles/tile_map_editor.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 0331e3f69e..4131c06745 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -55,7 +55,7 @@ void TileMapEditorTilesPlugin::tile_set_changed() {
}
void TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) {
- scatter_spinbox->set_editable(p_pressed);
+ scatter_controls_container->set_visible(p_pressed);
}
void TileMapEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) {
@@ -2124,10 +2124,12 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
tools_settings->add_child(random_tile_toggle);
// Random tile scattering.
+ scatter_controls_container = memnew(HBoxContainer);
+
scatter_label = memnew(Label);
scatter_label->set_tooltip_text(TTR("Defines the probability of painting nothing instead of a randomly selected tile."));
scatter_label->set_text(TTR("Scattering:"));
- tools_settings->add_child(scatter_label);
+ scatter_controls_container->add_child(scatter_label);
scatter_spinbox = memnew(SpinBox);
scatter_spinbox->set_min(0.0);
@@ -2136,7 +2138,8 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
scatter_spinbox->set_tooltip_text(TTR("Defines the probability of painting nothing instead of a randomly selected tile."));
scatter_spinbox->get_line_edit()->add_theme_constant_override("minimum_character_width", 4);
scatter_spinbox->connect("value_changed", callable_mp(this, &TileMapEditorTilesPlugin::_on_scattering_spinbox_changed));
- tools_settings->add_child(scatter_spinbox);
+ scatter_controls_container->add_child(scatter_spinbox);
+ tools_settings->add_child(scatter_controls_container);
_on_random_tile_checkbox_toggled(false);
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index ad27795437..9700e26e01 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -91,6 +91,8 @@ private:
VSeparator *tools_settings_vsep_2 = nullptr;
CheckBox *bucket_contiguous_checkbox = nullptr;
Button *random_tile_toggle = nullptr;
+
+ HBoxContainer *scatter_controls_container = nullptr;
float scattering = 0.0;
Label *scatter_label = nullptr;
SpinBox *scatter_spinbox = nullptr;