aboutsummaryrefslogtreecommitdiff
path: root/editor/plugins/sample_library_editor_plugin.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez2017-04-06 19:00:19 +0200
committerPedro J. Estébanez2017-04-06 23:59:49 +0200
commit9f8f8efa6726a65dfafec37aa072d3598675ffc9 (patch)
treed276f050160e54aa6d2e0daf0802c7704dff34e5 /editor/plugins/sample_library_editor_plugin.cpp
parent3916d964de9f8697fb129c08fcee2d72b4696880 (diff)
downloadgodot-9f8f8efa6726a65dfafec37aa072d3598675ffc9.tar.gz
godot-9f8f8efa6726a65dfafec37aa072d3598675ffc9.tar.zst
godot-9f8f8efa6726a65dfafec37aa072d3598675ffc9.zip
Add priority to samples in a library
Diffstat (limited to 'editor/plugins/sample_library_editor_plugin.cpp')
-rw-r--r--editor/plugins/sample_library_editor_plugin.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp
index 08231d6eb..f626b4d33 100644
--- a/editor/plugins/sample_library_editor_plugin.cpp
+++ b/editor/plugins/sample_library_editor_plugin.cpp
@@ -175,6 +175,11 @@ void SampleLibraryEditor::_item_edited() {
StringName n = s->get_text(0);
sample_library->sample_set_pitch_scale(n, s->get_range(4));
+
+ } else if (tree->get_selected_column() == 5) { // Priority
+
+ StringName n = s->get_text(0);
+ sample_library->sample_set_priority(n, s->get_range(5));
}
}
@@ -248,9 +253,16 @@ void SampleLibraryEditor::_update_library() {
ti->set_editable(4, true);
ti->set_range(4, sample_library->sample_get_pitch_scale(E->get()));
+ // Priority
+ ti->set_cell_mode(5, TreeItem::CELL_MODE_RANGE);
+ ti->set_range_config(5, 0, 100, 1);
+ ti->set_selectable(5, true);
+ ti->set_editable(5, true);
+ ti->set_range(5, sample_library->sample_get_priority(E->get()));
+
// Delete
- ti->set_cell_mode(5, TreeItem::CELL_MODE_STRING);
- ti->add_button(5, get_icon("Remove", "EditorIcons"));
+ ti->set_cell_mode(6, TreeItem::CELL_MODE_STRING);
+ ti->add_button(6, get_icon("Remove", "EditorIcons"));
}
//player->add_sample("default",sample);
@@ -411,7 +423,7 @@ SampleLibraryEditor::SampleLibraryEditor() {
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
tree = memnew(Tree);
- tree->set_columns(6);
+ tree->set_columns(7);
add_child(tree);
tree->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
tree->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5);
@@ -423,18 +435,21 @@ SampleLibraryEditor::SampleLibraryEditor() {
tree->set_column_title(2, TTR("Format"));
tree->set_column_title(3, "dB");
tree->set_column_title(4, TTR("Pitch"));
- tree->set_column_title(5, "");
+ tree->set_column_title(5, TTR("Priority"));
+ tree->set_column_title(6, "");
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_min_width(5, 60);
+ tree->set_column_min_width(6, 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);
+ tree->set_column_expand(6, false);
tree->set_drag_forwarding(this);