summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.md29
-rw-r--r--DONORS.md32
-rw-r--r--core/ustring.cpp40
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp284
-rw-r--r--editor/plugins/audio_stream_editor_plugin.h93
-rw-r--r--scene/gui/label.cpp2
-rw-r--r--scene/resources/visual_shader_nodes.cpp17
8 files changed, 448 insertions, 53 deletions
diff --git a/AUTHORS.md b/AUTHORS.md
index 12494a487d..d3f0592c89 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -40,14 +40,15 @@ name is available.
Ben Brookshire (sheepandshepherd)
Benjamin (Nallebeorn)
Bernard Liebl (poke1024)
- Bojidar Marinov (bojidar-bg)
Błażej Szczygieł (zaps166)
+ Bojidar Marinov (bojidar-bg)
+ bruvzg
Carl Olsson (not-surt)
Dana Olson (adolson)
Daniel J. Ramirez (djrm)
Dmitry Koteroff (Krakean)
- Дмитрий Сальников (DmitriySalnikov)
Emmanuel Leblond (touilleMan)
+ est31
Fabio Alessandrelli (Faless)
Ferenc Arn (tagcup)
Franklin Sobrinho (TheHX)
@@ -68,6 +69,7 @@ name is available.
J08nY
Jakub Grzesik (kubecz3k)
Jérôme GULLY (Nutriz)
+ JFonS
Johan Manuel (29jm)
Joshua Grams (JoshuaGrams)
Juan Linietsky (reduz)
@@ -76,15 +78,18 @@ name is available.
Kelly Thomas (KellyThomas)
Kostadin Damyanov (Max-Might)
Leon Krause (eska014)
- Marc Gilleron (Zylann)
+ m4nu3lf
Marcelo Fernandez (marcelofg55)
+ Marc Gilleron (Zylann)
Mariano Javier Suligoy (MarianoGnu)
Mario Schlack (hurikhan)
Martin Sjursen (binbitten)
+ marynate
Masoud BH (masoudbh3)
Matthias Hölzl (hoelzl)
Max Hilbrunner (mhilbrunner)
Michael Alexsander Silva Dias (YeldhamDev)
+ mrezai
Nathan Warden (NathanWarden)
Nuno Donato (nunodonato)
Ovnuniarchos
@@ -102,28 +107,24 @@ name is available.
Ray Koopa (RayKoopa)
Rémi Verschelde (akien-mga)
Roberto F. Arroyo (robfram)
+ romulox-x
+ rraallvv
Ruslan Mustakov (endragor)
Saniko (sanikoyes)
SaracenOne
+ sersoong
Theo Hallenius (TheoXD)
Thomas Herzog (karroffel)
Timo (toger5)
- V. Vamsi Krishna (vkbsb)
Vinzenz Feenstra (vinzenz)
+ 박한얼 (volzhs)
+ V. Vamsi Krishna (vkbsb)
Wilhem Barbier (nounoursheureux)
Will Nations (willnationsdev)
Wilson E. Alvarez (Rubonnek)
Xavier Cho (mysticfall)
+ yg2f (SuperUserNameMan)
Yuri Roubinski (Chaosus)
Zher Huei Lee (leezh)
ZuBsPaCe
- 박한얼 (volzhs)
- bruvzg
- est31
- m4nu3lf
- marynate
- mrezai
- romulox-x
- rraallvv
- sersoong
- yg2f (SuperUserNameMan)
+ Дмитрий Сальников (DmitriySalnikov)
diff --git a/DONORS.md b/DONORS.md
index da0f5bca75..cb7f6e7471 100644
--- a/DONORS.md
+++ b/DONORS.md
@@ -70,6 +70,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Johannes Wuensch
Josep G. Camarasa
Joshua Lesperance
+ Kyle Szklenski
Libre-Dépanne
Matthew Bennett
Olafur Gislason
@@ -87,21 +88,21 @@ generous deed immortalized in the next stable release of Godot Engine.
David Churchill
Dean Harmon
Dexter Miguel
- Guilherme Felipe de C. G. da Silva
John
Justo Delgado Baudí
KTL
Laurence Bannister
+ paul gruenbacher
Rami
Robert Willes
Robin Arys
+ Rodrigo Loli
Ronnie Ashlock
Rufus Xavier Sarsaparilla
ScottMakesGames
Thomas Bjarnelöf
William Connell
Wojciech Chojnacki
- Xavier Tan
Zaq Poi
Alessandra Pereyra
@@ -113,13 +114,15 @@ generous deed immortalized in the next stable release of Godot Engine.
Cody Parker
Corey Auger
D
- Daniel Eliasinski
E.G.
+ Eric
Eric Monson
flesk
+ floopf
G Barnes
GGGames.org
Giovanni Solimeno
+ Guilherme Felipe de C. G. da Silva
Hasen Judy
Heath Hayes
Jay Horton
@@ -133,31 +136,32 @@ generous deed immortalized in the next stable release of Godot Engine.
Markus Wiesner
Marvin
Mohammad Taleb
+ Neal Barry
Nick Nikitin
Pablo Cholaky
Patrick Schnorbus
Pete Goodwin
Phyronnaz
Ruben Soares Luis
+ Sindre Sømme
Sofox
Stoned Xander
- Ted
Tim Dalporto
Trent McPheron
- Vladimir
## Silver donors
1D_Inc
Adam Carr
Adam Smeltzer
+ Adisibio
Alder Stefano
Alessandro Senese
- Álvaro Domínguez López
Anders Jensen-Urstad
Anthony Bongiovanni
Arda Erol
Arthur S. Muszynski
+ Artur Barichello
Aubrey Falconer
Avencherus
Bailey
@@ -168,6 +172,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Blair Allen
Brandon
Bryan Stevenson
+ Carl Winder
Carwyn Edwards
Casey Foote
Chris Chapin
@@ -175,7 +180,6 @@ generous deed immortalized in the next stable release of Godot Engine.
Christian Winter
Christopher Schmitt
Collin Shooltz
- Daniel Delgado Corona
Daniel Johnson
Daniel Kaplan
DanielMaximiano
@@ -186,6 +190,7 @@ generous deed immortalized in the next stable release of Godot Engine.
Dominik Wetzel
Duy Kevin Nguyen
Edward Herbert
+ Edwin Acosta
Eric Martini
Fabian Becker
fengjiongmax
@@ -194,10 +199,10 @@ generous deed immortalized in the next stable release of Godot Engine.
Gerrit Großkopf
Gerrit Procee
Gilberto K. Otubo
+ Guillaume Laforte
Guldoman
Gumichan01
Heribert Hirth
- hubert jenkins
Hunter Jones
ialex32x
Ivan Vodopiviz
@@ -222,16 +227,15 @@ generous deed immortalized in the next stable release of Godot Engine.
Kevin Kamper Meejach Petersen
Klavdij Voncina
Krzysztof Jankowski
- Lars pfeffer
Linus Lind Lundgren
Luis Moraes
Macil
magodev
Martin Eigel
Martins Odabi
- Matthew Fitzpatrick
Max R.R. Collada
Maxwell
+ Mertcan Mermerkaya
mhilbrunner
Michael Dürwald
Michael Gringauz
@@ -246,10 +250,8 @@ generous deed immortalized in the next stable release of Godot Engine.
Niclas Eriksen
Nicolas SAN AGUSTIN
Niko Leopold
- nivardus
Noi Sek
Oleg Tyshchenko
- Oleksandr Yemets
Pablo Seibelt
Pan Ip
Pat LaBine
@@ -260,28 +262,28 @@ generous deed immortalized in the next stable release of Godot Engine.
Pierre-Igor Berthet
Pietro Vertechi
Piotr Kaczmarski
- Rea
Rémi Verschelde
Richman Stewart
Roger Burgess
Roger Smith
Roman Tinkov
Ryan Whited
- Samuel El-Borai
Sasori Olkof
Sootstone
Stefan Butucea
Theo Cranmore
Thibault Barbaroux
Thomas Bell
+ Thomas Hermansen
+ Thomas Holmes
Thomas Kurz
- Tomasz Wacławek
Tom Larrow
Tyler Stafos
UltyX
Victor
Victor Gonzalez Fernandez
Viktor Ferenczi
+ waka nya
werner mendizabal
Wout Standaert
Yu He
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 51f05468e2..bee5f5ffdb 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -757,36 +757,32 @@ Vector<String> String::rsplit(const String &p_splitter, bool p_allow_empty, int
Vector<String> ret;
const int len = length();
- int from = len;
+ int remaining_len = len;
while (true) {
- int end = rfind(p_splitter, from);
- if (end < 0)
- end = 0;
-
- if (p_allow_empty || (end < from)) {
- const String str = substr(end > 0 ? end + p_splitter.length() : end, end > 0 ? from - end : from + 2);
-
- if (p_maxsplit <= 0) {
- ret.push_back(str);
- } else if (p_maxsplit > 0) {
-
- // Put rest of the string and leave cycle.
- if (p_maxsplit == ret.size()) {
- ret.push_back(substr(0, from + 2));
- break;
- }
-
- // Otherwise, push items until positive limit is reached.
- ret.push_back(str);
+ if (remaining_len < p_splitter.length() || (p_maxsplit > 0 && p_maxsplit == ret.size())) {
+ // no room for another splitter or hit max splits, push what's left and we're done
+ if (p_allow_empty || remaining_len > 0) {
+ ret.push_back(substr(0, remaining_len));
}
+ break;
}
- if (end == 0)
+ int left_edge = rfind(p_splitter, remaining_len - p_splitter.length());
+
+ if (left_edge < 0) {
+ // no more splitters, we're done
+ ret.push_back(substr(0, remaining_len));
break;
+ }
+
+ int substr_start = left_edge + p_splitter.length();
+ if (p_allow_empty || substr_start < remaining_len) {
+ ret.push_back(substr(substr_start, remaining_len - substr_start));
+ }
- from = end - p_splitter.length();
+ remaining_len = left_edge;
}
ret.invert();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 70bc090bc4..37f1626704 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -73,6 +73,7 @@
#include "editor/plugins/animation_state_machine_editor.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/asset_library_editor_plugin.h"
+#include "editor/plugins/audio_stream_editor_plugin.h"
#include "editor/plugins/baked_lightmap_editor_plugin.h"
#include "editor/plugins/camera_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
@@ -4189,7 +4190,7 @@ void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) {
for (int i = 0; i < p_files.size(); i++) {
String from = p_files[i];
- if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) != -1)) {
+ if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) == -1)) {
continue;
}
String to = to_path.plus_file(from.get_file());
@@ -5445,6 +5446,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(CollisionShape2DEditorPlugin(this)));
add_editor_plugin(memnew(CurveEditorPlugin(this)));
add_editor_plugin(memnew(TextureEditorPlugin(this)));
+ add_editor_plugin(memnew(AudioStreamEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
add_editor_plugin(memnew(SkeletonEditorPlugin(this)));
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
new file mode 100644
index 0000000000..ddb03d0250
--- /dev/null
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -0,0 +1,284 @@
+/*************************************************************************/
+/* audio_stream_editor_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "audio_stream_editor_plugin.h"
+
+#include "editor/editor_settings.h"
+#include "io/resource_loader.h"
+#include "project_settings.h"
+
+void AudioStreamEditor::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_READY) {
+ AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed");
+ }
+
+ if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
+ _play_button->set_icon(get_icon("MainPlay", "EditorIcons"));
+ _stop_button->set_icon(get_icon("Stop", "EditorIcons"));
+ _preview->set_frame_color(get_color("dark_color_2", "Editor"));
+ set_frame_color(get_color("dark_color_1", "Editor"));
+
+ _indicator->update();
+ _preview->update();
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+ _current = _player->get_playback_position();
+ _indicator->update();
+ _preview->update();
+ }
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ if (!is_visible_in_tree()) {
+ _stop();
+ }
+ }
+}
+
+void AudioStreamEditor::_draw_preview() {
+ Rect2 rect = _preview->get_rect();
+ Size2 size = get_size();
+
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+ float preview_len = preview->get_length();
+
+ Vector<Vector2> lines;
+ lines.resize(size.width * 2);
+
+ for (int i = 0; i < size.width; i++) {
+
+ float ofs = i * preview_len / size.width;
+ float ofs_n = (i + 1) * preview_len / size.width;
+ float max = preview->get_max(ofs, ofs_n) * 0.5 + 0.5;
+ float min = preview->get_min(ofs, ofs_n) * 0.5 + 0.5;
+
+ int idx = i;
+ lines[idx * 2 + 0] = Vector2(i + 1, rect.position.y + min * rect.size.y);
+ lines[idx * 2 + 1] = Vector2(i + 1, rect.position.y + max * rect.size.y);
+ }
+
+ Vector<Color> color;
+ color.push_back(get_color("contrast_color_2", "Editor"));
+
+ VS::get_singleton()->canvas_item_add_multiline(_preview->get_canvas_item(), lines, color);
+}
+
+void AudioStreamEditor::_preview_changed(ObjectID p_which) {
+
+ if (stream.is_valid() && stream->get_instance_id() == p_which) {
+ _preview->update();
+ }
+}
+
+void AudioStreamEditor::_changed_callback(Object *p_changed, const char *p_prop) {
+
+ if (!is_visible())
+ return;
+ update();
+}
+
+void AudioStreamEditor::_play() {
+
+ if (_player->is_playing()) {
+ _player->stop();
+ _play_button->set_icon(get_icon("MainPlay", "EditorIcons"));
+ set_process(false);
+ } else {
+ _player->play(_current);
+ _play_button->set_icon(get_icon("Pause", "EditorIcons"));
+ set_process(true);
+ }
+}
+
+void AudioStreamEditor::_stop() {
+
+ _player->stop();
+ _on_finished();
+}
+
+void AudioStreamEditor::_on_finished() {
+
+ _play_button->set_icon(get_icon("MainPlay", "EditorIcons"));
+ _current = 0;
+ _indicator->update();
+ set_process(false);
+}
+
+void AudioStreamEditor::_draw_indicator() {
+
+ if (!stream.is_valid()) {
+ return;
+ }
+
+ Rect2 rect = _preview->get_rect();
+ float len = stream->get_length();
+ float ofs_x = _current / len * rect.size.width;
+ _indicator->draw_line(Point2(ofs_x, 0), Point2(ofs_x, rect.size.height), get_color("accent_color", "Editor"), 1);
+
+ _current_label->set_text(String::num(_current, 2).pad_decimals(2) + " /");
+}
+
+void AudioStreamEditor::_on_input_indicator(Ref<InputEvent> p_event) {
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid()) {
+ if (mb->is_pressed()) {
+ _seek_to(mb->get_position().x);
+ }
+ _dragging = mb->is_pressed();
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+ if (_dragging) {
+ _seek_to(mm->get_position().x);
+ }
+ }
+}
+
+void AudioStreamEditor::_seek_to(real_t p_x) {
+ _current = p_x / _preview->get_rect().size.x * stream->get_length();
+ _current = CLAMP(_current, 0, stream->get_length());
+ _player->seek(_current);
+ _indicator->update();
+}
+
+void AudioStreamEditor::edit(Ref<AudioStream> p_stream) {
+
+ if (!stream.is_null())
+ stream->remove_change_receptor(this);
+
+ stream = p_stream;
+ _player->set_stream(stream);
+ _current = 0;
+ String text = String::num(stream->get_length(), 2).pad_decimals(2) + "s";
+ _duration_label->set_text(text);
+
+ if (!stream.is_null()) {
+ stream->add_change_receptor(this);
+ update();
+ } else {
+ hide();
+ }
+}
+
+void AudioStreamEditor::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_preview_changed"), &AudioStreamEditor::_preview_changed);
+ ClassDB::bind_method(D_METHOD("_play"), &AudioStreamEditor::_play);
+ ClassDB::bind_method(D_METHOD("_stop"), &AudioStreamEditor::_stop);
+ ClassDB::bind_method(D_METHOD("_on_finished"), &AudioStreamEditor::_on_finished);
+ ClassDB::bind_method(D_METHOD("_draw_preview"), &AudioStreamEditor::_draw_preview);
+ ClassDB::bind_method(D_METHOD("_draw_indicator"), &AudioStreamEditor::_draw_indicator);
+ ClassDB::bind_method(D_METHOD("_on_input_indicator"), &AudioStreamEditor::_on_input_indicator);
+}
+
+AudioStreamEditor::AudioStreamEditor() {
+
+ set_custom_minimum_size(Size2(1, 100));
+ _current = 0;
+ _dragging = false;
+
+ _player = memnew(AudioStreamPlayer);
+ _player->connect("finished", this, "_on_finished");
+ add_child(_player);
+
+ VBoxContainer *vbox = memnew(VBoxContainer);
+ vbox->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_MINSIZE, 0);
+ add_child(vbox);
+
+ _preview = memnew(ColorRect);
+ _preview->set_v_size_flags(SIZE_EXPAND_FILL);
+ _preview->connect("draw", this, "_draw_preview");
+ vbox->add_child(_preview);
+
+ _indicator = memnew(Control);
+ _indicator->set_anchors_and_margins_preset(PRESET_WIDE);
+ _indicator->connect("draw", this, "_draw_indicator");
+ _indicator->connect("gui_input", this, "_on_input_indicator");
+ _preview->add_child(_indicator);
+
+ HBoxContainer *hbox = memnew(HBoxContainer);
+ hbox->add_constant_override("separation", 0);
+ vbox->add_child(hbox);
+
+ _play_button = memnew(ToolButton);
+ hbox->add_child(_play_button);
+ _play_button->set_focus_mode(Control::FOCUS_NONE);
+ _play_button->connect("pressed", this, "_play");
+
+ _stop_button = memnew(ToolButton);
+ hbox->add_child(_stop_button);
+ _stop_button->set_focus_mode(Control::FOCUS_NONE);
+ _stop_button->connect("pressed", this, "_stop");
+
+ _current_label = memnew(Label);
+ _current_label->set_align(Label::ALIGN_RIGHT);
+ _current_label->set_h_size_flags(SIZE_EXPAND_FILL);
+ _current_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
+ _current_label->set_modulate(Color(1, 1, 1, 0.5));
+ hbox->add_child(_current_label);
+
+ _duration_label = memnew(Label);
+ _duration_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
+ hbox->add_child(_duration_label);
+}
+
+void AudioStreamEditorPlugin::edit(Object *p_object) {
+
+ AudioStream *s = Object::cast_to<AudioStream>(p_object);
+ if (!s)
+ return;
+
+ audio_editor->edit(Ref<AudioStream>(s));
+}
+
+bool AudioStreamEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_class("AudioStream");
+}
+
+void AudioStreamEditorPlugin::make_visible(bool p_visible) {
+
+ audio_editor->set_visible(p_visible);
+}
+
+AudioStreamEditorPlugin::AudioStreamEditorPlugin(EditorNode *p_node) {
+
+ editor = p_node;
+ audio_editor = memnew(AudioStreamEditor);
+ add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, audio_editor);
+ audio_editor->hide();
+}
+
+AudioStreamEditorPlugin::~AudioStreamEditorPlugin() {
+}
diff --git a/editor/plugins/audio_stream_editor_plugin.h b/editor/plugins/audio_stream_editor_plugin.h
new file mode 100644
index 0000000000..1887874b74
--- /dev/null
+++ b/editor/plugins/audio_stream_editor_plugin.h
@@ -0,0 +1,93 @@
+/*************************************************************************/
+/* audio_stream_editor_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef AUDIO_STREAM_EDITOR_PLUGIN_H
+#define AUDIO_STREAM_EDITOR_PLUGIN_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "scene/audio/audio_player.h"
+#include "scene/gui/color_rect.h"
+#include "scene/resources/texture.h"
+
+class AudioStreamEditor : public ColorRect {
+
+ GDCLASS(AudioStreamEditor, ColorRect);
+
+ Ref<AudioStream> stream;
+ AudioStreamPlayer *_player;
+ ColorRect *_preview;
+ Control *_indicator;
+ Label *_current_label;
+ Label *_duration_label;
+
+ ToolButton *_play_button;
+ ToolButton *_stop_button;
+
+ float _current;
+ bool _dragging;
+
+protected:
+ void _notification(int p_what);
+ void _preview_changed(ObjectID p_which);
+ void _play();
+ void _stop();
+ void _on_finished();
+ void _draw_preview();
+ void _draw_indicator();
+ void _on_input_indicator(Ref<InputEvent> p_event);
+ void _seek_to(real_t p_x);
+ void _changed_callback(Object *p_changed, const char *p_prop);
+ static void _bind_methods();
+
+public:
+ void edit(Ref<AudioStream> p_stream);
+ AudioStreamEditor();
+};
+
+class AudioStreamEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AudioStreamEditorPlugin, EditorPlugin);
+
+ AudioStreamEditor *audio_editor;
+ EditorNode *editor;
+
+public:
+ virtual String get_name() const { return "Audio"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AudioStreamEditorPlugin(EditorNode *p_node);
+ ~AudioStreamEditorPlugin();
+};
+
+#endif // AUDIO_STREAM_EDITOR_PLUGIN_H
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 9af479c1cc..0b36e1663c 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -75,7 +75,7 @@ void Label::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- if (clip || autowrap) {
+ if (clip) {
VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
}
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index e850aaa44c..98ecdbdf30 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -587,6 +587,10 @@ void VisualShaderNodeCubeMap::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "cube_map", PROPERTY_HINT_RESOURCE_TYPE, "CubeMap"), "set_cube_map", "get_cube_map");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_type", PROPERTY_HINT_ENUM, "Data,Color,Normalmap"), "set_texture_type", "get_texture_type");
+
+ BIND_ENUM_CONSTANT(TYPE_DATA);
+ BIND_ENUM_CONSTANT(TYPE_COLOR);
+ BIND_ENUM_CONSTANT(TYPE_NORMALMAP);
}
VisualShaderNodeCubeMap::VisualShaderNodeCubeMap() {
@@ -894,6 +898,16 @@ void VisualShaderNodeColorOp::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_operator"), &VisualShaderNodeColorOp::get_operator);
ADD_PROPERTY(PropertyInfo(Variant::INT, "operator", PROPERTY_HINT_ENUM, "Screen,Difference,Darken,Lighten,Overlay,Dodge,Burn,SoftLight,HardLight"), "set_operator", "get_operator");
+
+ BIND_ENUM_CONSTANT(OP_SCREEN);
+ BIND_ENUM_CONSTANT(OP_DIFFERENCE);
+ BIND_ENUM_CONSTANT(OP_DARKEN);
+ BIND_ENUM_CONSTANT(OP_LIGHTEN);
+ BIND_ENUM_CONSTANT(OP_OVERLAY);
+ BIND_ENUM_CONSTANT(OP_DODGE);
+ BIND_ENUM_CONSTANT(OP_BURN);
+ BIND_ENUM_CONSTANT(OP_SOFT_LIGHT);
+ BIND_ENUM_CONSTANT(OP_HARD_LIGHT);
}
VisualShaderNodeColorOp::VisualShaderNodeColorOp() {
@@ -960,6 +974,9 @@ void VisualShaderNodeTransformMult::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_operator"), &VisualShaderNodeTransformMult::get_operator);
ADD_PROPERTY(PropertyInfo(Variant::INT, "operator", PROPERTY_HINT_ENUM, "A x B,B x A"), "set_operator", "get_operator");
+
+ BIND_ENUM_CONSTANT(OP_AxB);
+ BIND_ENUM_CONSTANT(OP_BxA);
}
VisualShaderNodeTransformMult::VisualShaderNodeTransformMult() {