summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/android/detect.py16
-rw-r--r--platform/android/export/export.cpp1
-rw-r--r--tools/editor/plugins/sample_library_editor_plugin.cpp162
-rw-r--r--tools/editor/plugins/sample_library_editor_plugin.h9
4 files changed, 70 insertions, 118 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 15ef478e19..d4038f6584 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -22,14 +22,15 @@ def get_opts():
return [
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('NDK_TOOLCHAIN', 'toolchain to use for the NDK',"arm-eabi-4.4.0"),
- ('NDK_TARGET', 'toolchain to use for the NDK',"arm-linux-androideabi-4.8"),
- ('NDK_TARGET_X86', 'toolchain to use for the NDK x86',"x86-4.8"),
+ ('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
+ ('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")),
('ndk_platform', 'compile for platform: (android-<api> , example: android-15)',"android-15"),
('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"),
('android_neon','enable neon (armv7 only)',"yes"),
('android_stl','enable STL support in android port (for modules)',"no")
]
+
def get_flags():
return [
@@ -232,17 +233,18 @@ def configure(env):
#env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
else:
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/include"])
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
if env['android_arch']=='x86':
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/x86"])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
elif env["android_arch"]=="armv6":
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/armeabi"])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
elif env["android_arch"]=="armv7":
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gabi++/libs/armeabi-v7a"])
- env.Append(LIBS=['gabi++_static'])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
+ env.Append(LIBS=['gnustl_static'])
env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST'])
+
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index de1a9a29d9..60f4e61c68 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1567,6 +1567,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
args.push_back("-s");
args.push_back(devices[p_device].id);
args.push_back("install");
+ args.push_back("-r");
args.push_back(export_to);
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp
index a28fbb2ec8..f15a2834ca 100644
--- a/tools/editor/plugins/sample_library_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_library_editor_plugin.cpp
@@ -35,7 +35,6 @@
#include "sample_editor_plugin.h"
-
void SampleLibraryEditor::_input_event(InputEvent p_event) {
@@ -43,19 +42,18 @@ void SampleLibraryEditor::_input_event(InputEvent p_event) {
void SampleLibraryEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_FIXED_PROCESS) {
-
+ if (p_what==NOTIFICATION_PROCESS) {
+ if (is_playing && !player->is_active()) {
+ TreeItem *tl=last_sample_playing->cast_to<TreeItem>();
+ tl->set_button(0,0,get_icon("Play","EditorIcons"));
+ is_playing = false;
+ set_process(false);
+ }
}
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) {
@@ -68,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) {
@@ -128,13 +109,36 @@ void SampleLibraryEditor::_button_pressed(Object *p_item,int p_column, int p_id)
TreeItem *ti=p_item->cast_to<TreeItem>();
String name = ti->get_text(0);
- if (p_column==0) {
-
- player->play(name,true);
- } else if (p_column==1) {
+ if (p_column==0) { // Play/Stop
+
+ String btn_type;
+ if(!is_playing) {
+ is_playing = true;
+ btn_type = "Stop";
+ player->play(name,true);
+ last_sample_playing = p_item;
+ set_process(true);
+ } else {
+ 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"));
+ btn_type = "Stop";
+ player->play(name,true);
+ last_sample_playing = p_item;
+ } else {
+ btn_type = "Play";
+ is_playing = false;
+ }
+ }
+ ti->set_button(p_column,0,get_icon(btn_type,"EditorIcons"));
+ } else if (p_column==1) { // Edit
get_tree()->get_root()->get_child(0)->call("_resource_selected",sample_library->get_sample(name));
+ } else if (p_column==5) { // Delete
+ ti->select(0);
+ _delete_pressed();
}
@@ -151,7 +155,7 @@ void SampleLibraryEditor::_item_edited() {
TreeItem *s = tree->get_selected();
- if (tree->get_selected_column()==0) {
+ if (tree->get_selected_column()==0) { // Name
// renamed
String old_name=s->get_metadata(0);
String new_name=s->get_text(0);
@@ -174,29 +178,22 @@ void SampleLibraryEditor::_item_edited() {
undo_redo->add_undo_method(this,"_update_library");
undo_redo->commit_action();
- } else if (tree->get_selected_column()==3) {
+ } else if (tree->get_selected_column()==3) { // Volume dB
StringName n = s->get_text(0);
sample_library->sample_set_volume_db(n,s->get_range(3));
- } else if (tree->get_selected_column()==4) {
+ } else if (tree->get_selected_column()==4) { // Pitch scale
StringName n = s->get_text(0);
sample_library->sample_set_pitch_scale(n,s->get_range(4));
- } else if (tree->get_selected_column()==5) {
-
- //edit
-
- Ref<Sample> samp = sample_library->get_sample(tree->get_selected()->get_metadata(0));
-
- get_tree()->get_root()->get_child(0)->call("_resource_selected",samp);
}
}
-void SampleLibraryEditor::_delete_confirm_pressed() {
+void SampleLibraryEditor::_delete_pressed() {
if (!tree->get_selected())
return;
@@ -211,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();
@@ -244,16 +223,18 @@ void SampleLibraryEditor::_update_library() {
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
TreeItem *ti = tree->create_item(root);
+
+ // Name + Play/Stop
ti->set_cell_mode(0,TreeItem::CELL_MODE_STRING);
ti->set_editable(0,true);
ti->set_selectable(0,true);
ti->set_text(0,E->get());
ti->set_metadata(0,E->get());
- ti->add_button(0,get_icon("Play","EditorIcons"),0);
- ti->add_button(1,get_icon("Edit","EditorIcons"),1);
+ ti->add_button(0,get_icon("Play","EditorIcons"));
Ref<Sample> smp = sample_library->get_sample(E->get());
+ // Preview/edit
Ref<ImageTexture> preview( memnew( ImageTexture ));
preview->create(128,16,Image::FORMAT_RGB);
SampleEditor::generate_preview_texture(smp,preview);
@@ -261,30 +242,32 @@ void SampleLibraryEditor::_update_library() {
ti->set_selectable(1,false);
ti->set_editable(1,false);
ti->set_icon(1,preview);
+ ti->add_button(1,get_icon("Edit","EditorIcons"));
-
+ // Format
ti->set_cell_mode(2,TreeItem::CELL_MODE_STRING);
ti->set_editable(2,false);
ti->set_selectable(2,false);
- Ref<Sample> s = sample_library->get_sample(E->get());
- ti->set_text(2,String()+/*itos(s->get_length())+" frames ("+String::num(s->get_length()/(float)s->get_mix_rate(),2)+" s), "+*/(s->get_format()==Sample::FORMAT_PCM16?"16 Bits, ":(s->get_format()==Sample::FORMAT_PCM8?"8 bits, ":"IMA-ADPCM,"))+(s->is_stereo()?"Stereo":"Mono"));
+ ti->set_text(2,String()+/*itos(smp->get_length())+" frames ("+String::num(smp->get_length()/(float)smp->get_mix_rate(),2)+" smp), "+*/(smp->get_format()==Sample::FORMAT_PCM16?"16 Bits, ":(smp->get_format()==Sample::FORMAT_PCM8?"8 bits, ":"IMA-ADPCM,"))+(smp->is_stereo()?"Stereo":"Mono"));
+ // Volume dB
ti->set_cell_mode(3,TreeItem::CELL_MODE_RANGE);
ti->set_range_config(3,-60,24,0.01);
ti->set_selectable(3,true);
ti->set_editable(3,true);
ti->set_range(3,sample_library->sample_get_volume_db(E->get()));
+ // Pitch scale
ti->set_cell_mode(4,TreeItem::CELL_MODE_RANGE);
ti->set_range_config(4,0.01,100,0.01);
ti->set_selectable(4,true);
ti->set_editable(4,true);
ti->set_range(4,sample_library->sample_get_pitch_scale(E->get()));
- //ti->set_cell_mode(5,TreeItem::CELL_MODE_CUSTOM);
- //ti->set_text(5,"Edit..");
- //ti->set_selectable(5,true);
- //ti->set_editable(5,true);
+ // Delete
+ ti->set_cell_mode(5,TreeItem::CELL_MODE_STRING);
+ ti->add_button(5,get_icon("Remove","EditorIcons"));
+
}
//player->add_sample("default",sample);
@@ -303,7 +286,6 @@ void SampleLibraryEditor::edit(Ref<SampleLibrary> p_sample_library) {
} else {
hide();
- set_fixed_process(false);
}
}
@@ -313,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);
@@ -331,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;
@@ -362,12 +323,8 @@ 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(5);
+ tree->set_columns(6);
add_child(tree);
tree->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
@@ -375,30 +332,29 @@ SampleLibraryEditor::SampleLibraryEditor() {
tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5);
tree->set_column_titles_visible(true);
tree->set_column_title(0,"Name");
-
tree->set_column_title(1,"Preview");
tree->set_column_title(2,"Format");
tree->set_column_title(3,"dB");
- tree->set_column_title(4,"PScale");
+ tree->set_column_title(4,"Pitch");
+ tree->set_column_title(5,"");
+
tree->set_column_min_width(1,150);
tree->set_column_min_width(2,100);
tree->set_column_min_width(3,50);
tree->set_column_min_width(4,50);
+ tree->set_column_min_width(5,32);
tree->set_column_expand(1,false);
tree->set_column_expand(2,false);
tree->set_column_expand(3,false);
tree->set_column_expand(4,false);
+ tree->set_column_expand(5,false);
dialog = memnew( ConfirmationDialog );
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");
@@ -461,5 +417,3 @@ SampleLibraryEditorPlugin::SampleLibraryEditorPlugin(EditorNode *p_node) {
SampleLibraryEditorPlugin::~SampleLibraryEditorPlugin()
{
}
-
-
diff --git a/tools/editor/plugins/sample_library_editor_plugin.h b/tools/editor/plugins/sample_library_editor_plugin.h
index cbdcf5fc3f..b46b9a7f3d 100644
--- a/tools/editor/plugins/sample_library_editor_plugin.h
+++ b/tools/editor/plugins/sample_library_editor_plugin.h
@@ -48,23 +48,19 @@ 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;
EditorFileDialog *file;
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();
@@ -79,7 +75,6 @@ protected:
public:
void set_undo_redo(UndoRedo *p_undo_redo) {undo_redo=p_undo_redo; }
-
void edit(Ref<SampleLibrary> p_sample);
SampleLibraryEditor();
};