1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Merge pull request #113574 from YeldhamDev/take_the_hint

Enable scroll hints for several parts of the editor
This commit is contained in:
Rémi Verschelde
2025-12-09 19:32:11 +01:00
35 changed files with 334 additions and 93 deletions

View File

@@ -1719,16 +1719,21 @@ ConnectionsDock::ConnectionsDock() {
search_box->connect(SceneStringName(text_changed), callable_mp(this, &ConnectionsDock::_filter_changed));
holder->add_child(search_box);
MarginContainer *mc = memnew(MarginContainer);
mc->set_theme_type_variation("NoBorderHorizontal");
mc->set_v_size_flags(SIZE_EXPAND_FILL);
holder->add_child(mc);
tree = memnew(ConnectionsDockTree);
tree->set_accessibility_name(TTRC("Connections"));
tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
tree->set_columns(1);
tree->set_select_mode(Tree::SELECT_ROW);
tree->set_hide_root(true);
tree->set_column_clip_content(0, true);
holder->add_child(tree);
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tree->set_allow_rmb_select(true);
tree->set_column_clip_content(0, true);
tree->set_scroll_hint_mode(Tree::SCROLL_HINT_MODE_BOTH);
mc->add_child(tree);
connect_button = memnew(Button);
connect_button->set_accessibility_name(TTRC("Connect"));

View File

@@ -339,6 +339,22 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant
}
}
void ResourcePreloaderEditor::update_layout(EditorDock::DockLayout p_layout) {
bool new_horizontal = (p_layout == EditorDock::DOCK_LAYOUT_HORIZONTAL);
if (horizontal == new_horizontal) {
return;
}
horizontal = new_horizontal;
if (horizontal) {
mc->set_theme_type_variation("NoBorderHorizontal");
tree->set_scroll_hint_mode(Tree::SCROLL_HINT_MODE_BOTH);
} else {
mc->set_theme_type_variation("NoBorderHorizontalBottom");
tree->set_scroll_hint_mode(Tree::SCROLL_HINT_MODE_TOP);
}
}
void ResourcePreloaderEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library);
ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource);
@@ -372,6 +388,10 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
file = memnew(EditorFileDialog);
add_child(file);
mc = memnew(MarginContainer);
mc->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->add_child(mc);
tree = memnew(Tree);
tree->connect("button_clicked", callable_mp(this, &ResourcePreloaderEditor::_cell_button_pressed));
tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
@@ -381,10 +401,9 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
tree->set_column_clip_content(0, true);
tree->set_column_expand_ratio(1, 3);
tree->set_column_clip_content(1, true);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
SET_DRAG_FORWARDING_GCD(tree, ResourcePreloaderEditor);
vbc->add_child(tree);
mc->add_child(tree);
dialog = memnew(AcceptDialog);
dialog->set_title(TTRC("Error!"));

View File

@@ -50,8 +50,11 @@ class ResourcePreloaderEditor : public EditorDock {
Button *load = nullptr;
Button *paste = nullptr;
MarginContainer *mc = nullptr;
Tree *tree = nullptr;
bool loading_scene;
bool horizontal = false;
bool loading_scene = false;
EditorFileDialog *file = nullptr;
@@ -73,9 +76,10 @@ class ResourcePreloaderEditor : public EditorDock {
protected:
void _notification(int p_what);
static void _bind_methods();
virtual void update_layout(EditorDock::DockLayout p_layout) override;
public:
void edit(ResourcePreloader *p_preloader);
ResourcePreloaderEditor();