Add some missing EditorFileDialog methods and properties.
This commit is contained in:
parent
ba5a70ccc9
commit
4593ad23fd
3 changed files with 29 additions and 0 deletions
|
@ -25,6 +25,13 @@
|
|||
Removes all filters except for "All Files (*)".
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_line_edit">
|
||||
<return type="LineEdit" />
|
||||
<description>
|
||||
Returns the LineEdit for the selected file.
|
||||
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_vbox">
|
||||
<return type="VBoxContainer" />
|
||||
<description>
|
||||
|
@ -62,6 +69,9 @@
|
|||
<member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="EditorFileDialog.FileMode" default="4">
|
||||
The dialog's open or save mode, which affects the selection behavior. See [enum FileMode]
|
||||
</member>
|
||||
<member name="filters" type="PackedStringArray" setter="set_filters" getter="get_filters" default="PackedStringArray()">
|
||||
The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. Multiple file types can also be specified in a single filter. [code]"*.png, *.jpg, *.jpeg ; Supported Images"[/code] will show both PNG and JPEG files when selected.
|
||||
</member>
|
||||
<member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
|
||||
If [code]true[/code], hidden files and directories will be visible in the [EditorFileDialog]. This property is synchronized with [member EditorSettings.filesystem/file_dialog/show_hidden_files].
|
||||
</member>
|
||||
|
|
|
@ -1015,6 +1015,19 @@ void EditorFileDialog::add_filter(const String &p_filter, const String &p_descri
|
|||
invalidate();
|
||||
}
|
||||
|
||||
void EditorFileDialog::set_filters(const Vector<String> &p_filters) {
|
||||
if (filters == p_filters) {
|
||||
return;
|
||||
}
|
||||
filters = p_filters;
|
||||
update_filters();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Vector<String> EditorFileDialog::get_filters() const {
|
||||
return filters;
|
||||
}
|
||||
|
||||
String EditorFileDialog::get_current_dir() const {
|
||||
return dir_access->get_current_dir();
|
||||
}
|
||||
|
@ -1570,6 +1583,8 @@ void EditorFileDialog::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("clear_filters"), &EditorFileDialog::clear_filters);
|
||||
ClassDB::bind_method(D_METHOD("add_filter", "filter", "description"), &EditorFileDialog::add_filter, DEFVAL(""));
|
||||
ClassDB::bind_method(D_METHOD("set_filters", "filters"), &EditorFileDialog::set_filters);
|
||||
ClassDB::bind_method(D_METHOD("get_filters"), &EditorFileDialog::get_filters);
|
||||
ClassDB::bind_method(D_METHOD("get_current_dir"), &EditorFileDialog::get_current_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_current_file"), &EditorFileDialog::get_current_file);
|
||||
ClassDB::bind_method(D_METHOD("get_current_path"), &EditorFileDialog::get_current_path);
|
||||
|
@ -1579,6 +1594,7 @@ void EditorFileDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &EditorFileDialog::set_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_file_mode"), &EditorFileDialog::get_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox);
|
||||
ClassDB::bind_method(D_METHOD("get_line_edit"), &EditorFileDialog::get_line_edit);
|
||||
ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access);
|
||||
ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access);
|
||||
ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &EditorFileDialog::set_show_hidden_files);
|
||||
|
@ -1605,6 +1621,7 @@ void EditorFileDialog::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR, "", PROPERTY_USAGE_NONE), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*", PROPERTY_USAGE_NONE), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "filters"), "set_filters", "get_filters");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled");
|
||||
|
||||
|
|
|
@ -242,6 +242,8 @@ public:
|
|||
void popup_file_dialog();
|
||||
void clear_filters();
|
||||
void add_filter(const String &p_filter, const String &p_description = "");
|
||||
void set_filters(const Vector<String> &p_filters);
|
||||
Vector<String> get_filters() const;
|
||||
|
||||
void set_enable_multiple_selection(bool p_enable);
|
||||
Vector<String> get_selected_files() const;
|
||||
|
|
Loading…
Reference in a new issue