Merge pull request #4077 from sanikoyes/Pr-resourcepreloader-multiple-select
Allow select multiple files in ResourcePreloaderEditor
This commit is contained in:
commit
15ba4d34c5
|
@ -60,12 +60,14 @@ void ResourcePreloaderEditor::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_file_load_request(const String& p_path) {
|
||||
void ResourcePreloaderEditor::_files_load_request(const Vector<String>& p_paths) {
|
||||
|
||||
for(int i=0;i<p_paths.size();i++) {
|
||||
|
||||
String path = p_paths[i];
|
||||
|
||||
RES resource;
|
||||
|
||||
resource = ResourceLoader::load(p_path);
|
||||
resource = ResourceLoader::load(path);
|
||||
|
||||
if (resource.is_null()) {
|
||||
dialog->set_text("ERROR: Couldn't load resource!");
|
||||
|
@ -76,7 +78,8 @@ void ResourcePreloaderEditor::_file_load_request(const String& p_path) {
|
|||
return; ///beh should show an error i guess
|
||||
}
|
||||
|
||||
String basename = p_path.get_file().basename();
|
||||
|
||||
String basename = path.get_file().basename();
|
||||
String name=basename;
|
||||
int counter=1;
|
||||
while(preloader->has_resource(name)) {
|
||||
|
@ -91,6 +94,7 @@ void ResourcePreloaderEditor::_file_load_request(const String& p_path) {
|
|||
undo_redo->add_undo_method(this,"_update_library");
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_load_pressed() {
|
||||
|
||||
|
@ -102,7 +106,7 @@ void ResourcePreloaderEditor::_load_pressed() {
|
|||
for(int i=0;i<extensions.size();i++)
|
||||
file->add_filter("*."+extensions[i]);
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
|
||||
file->popup_centered_ratio();
|
||||
|
||||
|
@ -283,7 +287,7 @@ void ResourcePreloaderEditor::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("_delete_pressed"),&ResourcePreloaderEditor::_delete_pressed);
|
||||
ObjectTypeDB::bind_method(_MD("_paste_pressed"),&ResourcePreloaderEditor::_paste_pressed);
|
||||
ObjectTypeDB::bind_method(_MD("_delete_confirm_pressed"),&ResourcePreloaderEditor::_delete_confirm_pressed);
|
||||
ObjectTypeDB::bind_method(_MD("_file_load_request"),&ResourcePreloaderEditor::_file_load_request);
|
||||
ObjectTypeDB::bind_method(_MD("_files_load_request"),&ResourcePreloaderEditor::_files_load_request);
|
||||
ObjectTypeDB::bind_method(_MD("_update_library"),&ResourcePreloaderEditor::_update_library);
|
||||
}
|
||||
|
||||
|
@ -330,7 +334,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
|
|||
load->connect("pressed", this,"_load_pressed");
|
||||
_delete->connect("pressed", this,"_delete_pressed");
|
||||
paste->connect("pressed", this,"_paste_pressed");
|
||||
file->connect("file_selected", this,"_file_load_request");
|
||||
file->connect("files_selected", this,"_files_load_request");
|
||||
//dialog->connect("confirmed", this,"_delete_confirm_pressed");
|
||||
tree->connect("item_edited", this,"_item_edited");
|
||||
loading_scene=false;
|
||||
|
|
|
@ -58,7 +58,7 @@ class ResourcePreloaderEditor : public PanelContainer {
|
|||
|
||||
void _load_pressed();
|
||||
void _load_scene_pressed();
|
||||
void _file_load_request(const String& p_path);
|
||||
void _files_load_request(const Vector<String>& p_paths);
|
||||
void _paste_pressed();
|
||||
void _delete_pressed();
|
||||
void _delete_confirm_pressed();
|
||||
|
|
Loading…
Reference in New Issue