Merge pull request #70006 from timothyqiu/atlas-source-paint-scroll

Add scroll container for tile data editors
This commit is contained in:
Rémi Verschelde 2022-12-13 10:12:53 +01:00
commit 05aba48354
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 14 additions and 6 deletions

View file

@ -807,9 +807,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
} else { } else {
tile_data_editor_dropdown_button->set_text(TTR("Select a property editor")); tile_data_editor_dropdown_button->set_text(TTR("Select a property editor"));
} }
tile_data_editors_label->set_visible(is_visible); tile_data_editors_scroll->set_visible(is_visible);
tile_data_editors_tree->set_visible(is_visible);
tile_data_painting_editor_container->set_visible(is_visible);
} }
void TileSetAtlasSourceEditor::_update_current_tile_data_editor() { void TileSetAtlasSourceEditor::_update_current_tile_data_editor() {
@ -2428,17 +2426,26 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
middle_vbox_container->add_child(tile_inspector_no_tile_selected_label); middle_vbox_container->add_child(tile_inspector_no_tile_selected_label);
// Property values palette. // Property values palette.
tile_data_editors_scroll = memnew(ScrollContainer);
tile_data_editors_scroll->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
tile_data_editors_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
middle_vbox_container->add_child(tile_data_editors_scroll);
VBoxContainer *tile_data_editors_vbox = memnew(VBoxContainer);
tile_data_editors_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
tile_data_editors_scroll->add_child(tile_data_editors_vbox);
tile_data_editors_popup = memnew(Popup); tile_data_editors_popup = memnew(Popup);
tile_data_editors_label = memnew(Label); tile_data_editors_label = memnew(Label);
tile_data_editors_label->set_text(TTR("Paint Properties:")); tile_data_editors_label->set_text(TTR("Paint Properties:"));
tile_data_editors_label->set_theme_type_variation("HeaderSmall"); tile_data_editors_label->set_theme_type_variation("HeaderSmall");
middle_vbox_container->add_child(tile_data_editors_label); tile_data_editors_vbox->add_child(tile_data_editors_label);
tile_data_editor_dropdown_button = memnew(Button); tile_data_editor_dropdown_button = memnew(Button);
tile_data_editor_dropdown_button->connect("draw", callable_mp(this, &TileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_draw)); tile_data_editor_dropdown_button->connect("draw", callable_mp(this, &TileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_draw));
tile_data_editor_dropdown_button->connect("pressed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_pressed)); tile_data_editor_dropdown_button->connect("pressed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_pressed));
middle_vbox_container->add_child(tile_data_editor_dropdown_button); tile_data_editors_vbox->add_child(tile_data_editor_dropdown_button);
tile_data_editor_dropdown_button->add_child(tile_data_editors_popup); tile_data_editor_dropdown_button->add_child(tile_data_editors_popup);
tile_data_editors_tree = memnew(Tree); tile_data_editors_tree = memnew(Tree);
@ -2451,7 +2458,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tile_data_painting_editor_container = memnew(VBoxContainer); tile_data_painting_editor_container = memnew(VBoxContainer);
tile_data_painting_editor_container->set_h_size_flags(SIZE_EXPAND_FILL); tile_data_painting_editor_container->set_h_size_flags(SIZE_EXPAND_FILL);
middle_vbox_container->add_child(tile_data_painting_editor_container); tile_data_editors_vbox->add_child(tile_data_painting_editor_container);
// Atlas source inspector. // Atlas source inspector.
atlas_source_proxy_object = memnew(TileSetAtlasSourceProxyObject()); atlas_source_proxy_object = memnew(TileSetAtlasSourceProxyObject());

View file

@ -120,6 +120,7 @@ private:
bool tile_set_changed_needs_update = false; bool tile_set_changed_needs_update = false;
// -- Properties painting -- // -- Properties painting --
ScrollContainer *tile_data_editors_scroll = nullptr;
VBoxContainer *tile_data_painting_editor_container = nullptr; VBoxContainer *tile_data_painting_editor_container = nullptr;
Label *tile_data_editors_label = nullptr; Label *tile_data_editors_label = nullptr;
Button *tile_data_editor_dropdown_button = nullptr; Button *tile_data_editor_dropdown_button = nullptr;