diff options
-rw-r--r-- | tools/editor/plugins/sample_library_editor_plugin.cpp | 76 | ||||
-rw-r--r-- | tools/editor/plugins/sample_library_editor_plugin.h | 6 |
2 files changed, 3 insertions, 79 deletions
diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 8e4890471b..f15a2834ca 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -52,14 +52,8 @@ void SampleLibraryEditor::_notification(int p_what) { } if (p_what==NOTIFICATION_ENTER_TREE) { - play->set_icon( get_icon("Play","EditorIcons") ); - play->set_tooltip("Play Sample"); - stop->set_icon( get_icon("Stop","EditorIcons") ); - stop->set_tooltip("Stop Sample"); load->set_icon( get_icon("Folder","EditorIcons") ); load->set_tooltip("Open Sample File(s)"); - _delete->set_icon( get_icon("Del","EditorIcons") ); - _delete->set_tooltip("Remove Sample"); } if (p_what==NOTIFICATION_READY) { @@ -72,23 +66,6 @@ void SampleLibraryEditor::_notification(int p_what) { } } -void SampleLibraryEditor::_play_pressed() { - - if (!tree->get_selected()) - return; - - String to_play = tree->get_selected()->get_text(0); - - player->play(to_play,true); - play->set_pressed(false); - stop->set_pressed(false); -} -void SampleLibraryEditor::_stop_pressed() { - - player->stop_all(); - play->set_pressed(false); -} - void SampleLibraryEditor::_file_load_request(const DVector<String>& p_path) { @@ -142,7 +119,7 @@ void SampleLibraryEditor::_button_pressed(Object *p_item,int p_column, int p_id) last_sample_playing = p_item; set_process(true); } else { - _stop_pressed(); + player->stop_all(); if(last_sample_playing != p_item){ TreeItem *tl=last_sample_playing->cast_to<TreeItem>(); tl->set_button(p_column,0,get_icon("Play","EditorIcons")); @@ -216,7 +193,7 @@ void SampleLibraryEditor::_item_edited() { } -void SampleLibraryEditor::_delete_confirm_pressed() { +void SampleLibraryEditor::_delete_pressed() { if (!tree->get_selected()) return; @@ -231,24 +208,6 @@ void SampleLibraryEditor::_delete_confirm_pressed() { } -void SampleLibraryEditor::_delete_pressed() { - - - if (!tree->get_selected()) - return; - - _delete_confirm_pressed(); //it has undo.. why bother with a dialog.. - /* - dialog->set_title("Confirm..."); - dialog->set_text("Remove Sample '"+tree->get_selected()->get_text(0)+"' ?"); - //dialog->get_cancel()->set_text("Cancel"); - //dialog->get_ok()->show(); - dialog->get_ok()->set_text("Remove"); - dialog->popup_centered(Size2(300,60));*/ - -} - - void SampleLibraryEditor::_update_library() { player->stop_all(); @@ -336,12 +295,9 @@ void SampleLibraryEditor::edit(Ref<SampleLibrary> p_sample_library) { void SampleLibraryEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&SampleLibraryEditor::_input_event); - ObjectTypeDB::bind_method(_MD("_play_pressed"),&SampleLibraryEditor::_play_pressed); - ObjectTypeDB::bind_method(_MD("_stop_pressed"),&SampleLibraryEditor::_stop_pressed); ObjectTypeDB::bind_method(_MD("_load_pressed"),&SampleLibraryEditor::_load_pressed); ObjectTypeDB::bind_method(_MD("_item_edited"),&SampleLibraryEditor::_item_edited); ObjectTypeDB::bind_method(_MD("_delete_pressed"),&SampleLibraryEditor::_delete_pressed); - ObjectTypeDB::bind_method(_MD("_delete_confirm_pressed"),&SampleLibraryEditor::_delete_confirm_pressed); ObjectTypeDB::bind_method(_MD("_file_load_request"),&SampleLibraryEditor::_file_load_request); ObjectTypeDB::bind_method(_MD("_update_library"),&SampleLibraryEditor::_update_library); ObjectTypeDB::bind_method(_MD("_button_pressed"),&SampleLibraryEditor::_button_pressed); @@ -354,29 +310,11 @@ SampleLibraryEditor::SampleLibraryEditor() { add_style_override("panel", get_stylebox("panel","Panel")); - play = memnew( Button ); - - play->set_pos(Point2( 5, 5 )); - play->set_size( Size2(1,1 ) ); - play->set_toggle_mode(true); - add_child(play); - play->hide(); - - stop = memnew( Button ); - - stop->set_pos(Point2( 5, 5 )); - stop->set_size( Size2(1,1 ) ); - //stop->set_toggle_mode(true); - add_child(stop); - load = memnew( Button ); - - load->set_pos(Point2( 35, 5 )); + load->set_pos(Point2( 5, 5 )); load->set_size( Size2(1,1 ) ); add_child(load); - _delete = memnew( Button ); - file = memnew( EditorFileDialog ); add_child(file); List<String> extensions; @@ -385,10 +323,6 @@ SampleLibraryEditor::SampleLibraryEditor() { file->add_filter("*."+extensions[i]); file->set_mode(EditorFileDialog::MODE_OPEN_FILES); - _delete->set_pos(Point2( 65, 5 )); - _delete->set_size( Size2(1,1 ) ); - add_child(_delete); - tree = memnew( Tree ); tree->set_columns(6); add_child(tree); @@ -419,12 +353,8 @@ SampleLibraryEditor::SampleLibraryEditor() { add_child( dialog ); tree->connect("button_pressed",this,"_button_pressed"); - play->connect("pressed", this,"_play_pressed"); - stop->connect("pressed", this,"_stop_pressed"); load->connect("pressed", this,"_load_pressed"); - _delete->connect("pressed", this,"_delete_pressed"); file->connect("files_selected", this,"_file_load_request"); - //dialog->connect("confirmed", this,"_delete_confirm_pressed"); tree->connect("item_edited", this,"_item_edited"); diff --git a/tools/editor/plugins/sample_library_editor_plugin.h b/tools/editor/plugins/sample_library_editor_plugin.h index 0dba00e642..b46b9a7f3d 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.h +++ b/tools/editor/plugins/sample_library_editor_plugin.h @@ -48,10 +48,7 @@ class SampleLibraryEditor : public Panel { SamplePlayer *player; Ref<SampleLibrary> sample_library; - Button *stop; - Button *play; Button *load; - Button *_delete; Tree *tree; bool is_playing; Object *last_sample_playing; @@ -61,12 +58,9 @@ class SampleLibraryEditor : public Panel { ConfirmationDialog *dialog; - void _play_pressed(); - void _stop_pressed(); void _load_pressed(); void _file_load_request(const DVector<String>& p_path); void _delete_pressed(); - void _delete_confirm_pressed(); void _update_library(); void _item_edited(); |