1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Hide Scattering label and controls within TileMap editor window when "Place Random Tile" is disabled

This commit is contained in:
henrlin24
2022-12-10 21:35:55 -05:00
parent a4131b61b1
commit afa38bd030
2 changed files with 8 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ void TileMapEditorTilesPlugin::tile_set_changed() {
} }
void TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { 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) { void TileMapEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) {
@@ -2124,10 +2124,12 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
tools_settings->add_child(random_tile_toggle); tools_settings->add_child(random_tile_toggle);
// Random tile scattering. // Random tile scattering.
scatter_controls_container = memnew(HBoxContainer);
scatter_label = memnew(Label); 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_tooltip_text(TTR("Defines the probability of painting nothing instead of a randomly selected tile."));
scatter_label->set_text(TTR("Scattering:")); 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 = memnew(SpinBox);
scatter_spinbox->set_min(0.0); 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->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->get_line_edit()->add_theme_constant_override("minimum_character_width", 4);
scatter_spinbox->connect("value_changed", callable_mp(this, &TileMapEditorTilesPlugin::_on_scattering_spinbox_changed)); 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); _on_random_tile_checkbox_toggled(false);

View File

@@ -91,6 +91,8 @@ private:
VSeparator *tools_settings_vsep_2 = nullptr; VSeparator *tools_settings_vsep_2 = nullptr;
CheckBox *bucket_contiguous_checkbox = nullptr; CheckBox *bucket_contiguous_checkbox = nullptr;
Button *random_tile_toggle = nullptr; Button *random_tile_toggle = nullptr;
HBoxContainer *scatter_controls_container = nullptr;
float scattering = 0.0; float scattering = 0.0;
Label *scatter_label = nullptr; Label *scatter_label = nullptr;
SpinBox *scatter_spinbox = nullptr; SpinBox *scatter_spinbox = nullptr;