You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
@@ -13,7 +13,9 @@
|
|||||||
<return type="void" />
|
<return type="void" />
|
||||||
<argument index="0" name="filter" type="String" />
|
<argument index="0" name="filter" type="String" />
|
||||||
<description>
|
<description>
|
||||||
Adds [code]filter[/code] as a custom filter; [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code]. For example, [code]"*.png ; PNG Images"[/code].
|
Adds [code]filter[/code] to the list of filters, which restricts what files can be picked.
|
||||||
|
A [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed.
|
||||||
|
Example filters: [code]"*.png ; PNG Images"[/code], [code]"project.godot ; Godot Project"[/code].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="clear_filters">
|
<method name="clear_filters">
|
||||||
|
|||||||
@@ -567,6 +567,7 @@ void FileDialog::clear_filters() {
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
void FileDialog::add_filter(const String &p_filter) {
|
void FileDialog::add_filter(const String &p_filter) {
|
||||||
|
ERR_FAIL_COND_MSG(p_filter.begins_with("."), "Filter must be \"filename.extension\", can't start with dot.");
|
||||||
filters.push_back(p_filter);
|
filters.push_back(p_filter);
|
||||||
update_filters();
|
update_filters();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user