|
@@ -370,13 +370,13 @@ void TileSetEditor::_set_source_sort(int p_sort) {
|
|
|
|
|
|
void TileSetEditor::_notification(int p_what) {
|
|
|
switch (p_what) {
|
|
|
- case NOTIFICATION_ENTER_TREE:
|
|
|
case NOTIFICATION_THEME_CHANGED: {
|
|
|
sources_delete_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
|
|
|
sources_add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
|
|
source_sort_button->set_icon(get_theme_icon(SNAME("Sort"), SNAME("EditorIcons")));
|
|
|
sources_advanced_menu_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
|
|
missing_texture_texture = get_theme_icon(SNAME("TileSet"), SNAME("EditorIcons"));
|
|
|
+ expanded_area->add_theme_style_override("panel", get_theme_stylebox("panel", "Tree"));
|
|
|
_update_sources_list();
|
|
|
} break;
|
|
|
|
|
@@ -401,6 +401,12 @@ void TileSetEditor::_notification(int p_what) {
|
|
|
tile_set_changed_needs_update = false;
|
|
|
}
|
|
|
} break;
|
|
|
+
|
|
|
+ case NOTIFICATION_VISIBILITY_CHANGED: {
|
|
|
+ if (!is_visible_in_tree()) {
|
|
|
+ remove_expanded_editor();
|
|
|
+ }
|
|
|
+ } break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -749,11 +755,70 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void TileSetEditor::add_expanded_editor(Control *p_editor) {
|
|
|
+ expanded_editor = p_editor;
|
|
|
+ expanded_editor_parent = p_editor->get_parent()->get_instance_id();
|
|
|
+
|
|
|
+ // Find the scrollable control this node belongs to.
|
|
|
+ Node *check_parent = expanded_editor->get_parent();
|
|
|
+ Control *parent_container = nullptr;
|
|
|
+ while (check_parent) {
|
|
|
+ parent_container = Object::cast_to<EditorInspector>(check_parent);
|
|
|
+ if (parent_container) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ parent_container = Object::cast_to<ScrollContainer>(check_parent);
|
|
|
+ if (parent_container) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ check_parent = check_parent->get_parent();
|
|
|
+ }
|
|
|
+ ERR_FAIL_NULL(parent_container);
|
|
|
+
|
|
|
+ expanded_editor->set_meta("reparented", true);
|
|
|
+ expanded_editor->reparent(expanded_area);
|
|
|
+ expanded_area->show();
|
|
|
+ expanded_area->set_size(Vector2(parent_container->get_global_rect().get_end().x - expanded_area->get_global_position().x, expanded_area->get_size().y));
|
|
|
+
|
|
|
+ for (SplitContainer *split : disable_on_expand) {
|
|
|
+ split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TileSetEditor::remove_expanded_editor() {
|
|
|
+ if (!expanded_editor) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Node *original_parent = Object::cast_to<Node>(ObjectDB::get_instance(expanded_editor_parent));
|
|
|
+ if (original_parent) {
|
|
|
+ expanded_editor->remove_meta("reparented");
|
|
|
+ expanded_editor->reparent(original_parent);
|
|
|
+ } else {
|
|
|
+ expanded_editor->queue_free();
|
|
|
+ }
|
|
|
+ expanded_editor = nullptr;
|
|
|
+ expanded_editor_parent = ObjectID();
|
|
|
+ expanded_area->hide();
|
|
|
+
|
|
|
+ for (SplitContainer *split : disable_on_expand) {
|
|
|
+ split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TileSetEditor::register_split(SplitContainer *p_split) {
|
|
|
+ disable_on_expand.push_back(p_split);
|
|
|
+}
|
|
|
+
|
|
|
TileSetEditor::TileSetEditor() {
|
|
|
singleton = this;
|
|
|
|
|
|
set_process_internal(true);
|
|
|
|
|
|
+ VBoxContainer *main_vb = memnew(VBoxContainer);
|
|
|
+ add_child(main_vb);
|
|
|
+ main_vb->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
|
|
|
+
|
|
|
// TabBar.
|
|
|
tabs_bar = memnew(TabBar);
|
|
|
tabs_bar->set_tab_alignment(TabBar::ALIGNMENT_CENTER);
|
|
@@ -765,7 +830,7 @@ TileSetEditor::TileSetEditor() {
|
|
|
tile_set_toolbar = memnew(HBoxContainer);
|
|
|
tile_set_toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
tile_set_toolbar->add_child(tabs_bar);
|
|
|
- add_child(tile_set_toolbar);
|
|
|
+ main_vb->add_child(tile_set_toolbar);
|
|
|
|
|
|
//// Tiles ////
|
|
|
// Split container.
|
|
@@ -773,7 +838,7 @@ TileSetEditor::TileSetEditor() {
|
|
|
split_container->set_name(TTR("Tiles"));
|
|
|
split_container->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
split_container->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
- add_child(split_container);
|
|
|
+ main_vb->add_child(split_container);
|
|
|
|
|
|
// Sources list.
|
|
|
VBoxContainer *split_container_left_side = memnew(VBoxContainer);
|
|
@@ -880,7 +945,7 @@ TileSetEditor::TileSetEditor() {
|
|
|
patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
|
|
patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
patterns_item_list->connect("gui_input", callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input));
|
|
|
- add_child(patterns_item_list);
|
|
|
+ main_vb->add_child(patterns_item_list);
|
|
|
patterns_item_list->hide();
|
|
|
|
|
|
patterns_help_label = memnew(Label);
|
|
@@ -889,6 +954,12 @@ TileSetEditor::TileSetEditor() {
|
|
|
patterns_help_label->set_anchors_and_offsets_preset(Control::PRESET_CENTER);
|
|
|
patterns_item_list->add_child(patterns_help_label);
|
|
|
|
|
|
+ // Expanded editor
|
|
|
+ expanded_area = memnew(PanelContainer);
|
|
|
+ add_child(expanded_area);
|
|
|
+ expanded_area->set_anchors_and_offsets_preset(PRESET_LEFT_WIDE);
|
|
|
+ expanded_area->hide();
|
|
|
+
|
|
|
// Registers UndoRedo inspector callback.
|
|
|
EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(SNAME("TileSet"), callable_mp(this, &TileSetEditor::_move_tile_set_array_element));
|
|
|
EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &TileSetEditor::_undo_redo_inspector_callback));
|