summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/area_2d.cpp2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp14
-rw-r--r--scene/2d/audio_stream_player_2d.h4
-rw-r--r--scene/2d/joints_2d.cpp3
-rw-r--r--scene/3d/audio_stream_player_3d.cpp22
-rw-r--r--scene/3d/audio_stream_player_3d.h4
-rw-r--r--scene/3d/camera.h2
-rw-r--r--scene/3d/physics_joint.cpp3
-rw-r--r--scene/audio/audio_player.cpp16
-rw-r--r--scene/audio/audio_player.h4
-rw-r--r--scene/gui/base_button.cpp4
-rw-r--r--scene/gui/graph_edit.cpp9
-rw-r--r--scene/gui/item_list.cpp22
-rw-r--r--scene/gui/item_list.h5
-rw-r--r--scene/gui/line_edit.cpp18
-rw-r--r--scene/gui/line_edit.h1
-rw-r--r--scene/gui/spin_box.cpp16
-rw-r--r--scene/gui/spin_box.h2
-rw-r--r--scene/gui/text_edit.cpp14
-rw-r--r--scene/resources/animation.cpp22
-rw-r--r--scene/resources/audio_stream_sample.cpp34
-rw-r--r--scene/resources/audio_stream_sample.h4
-rw-r--r--scene/resources/color_ramp.cpp4
-rw-r--r--scene/resources/scene_format_text.cpp2
-rw-r--r--scene/resources/scene_format_text.h4
-rw-r--r--scene/resources/style_box.cpp4
-rw-r--r--scene/resources/texture.cpp2
27 files changed, 171 insertions, 70 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 6fff7ac0a4..bb914b90fc 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -399,7 +399,7 @@ void Area2D::set_monitoring(bool p_enable) {
if (p_enable == monitoring)
return;
if (locked) {
- ERR_EXPLAIN("Function blocked during in/out signal. Use call_deferred(\"set_enable_monitoring\",true/false)");
+ ERR_EXPLAIN("Function blocked during in/out signal. Use call_deferred(\"set_monitoring\",true/false)");
}
ERR_FAIL_COND(locked);
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index b11deb08fd..fc67d28a29 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -54,7 +54,7 @@ void AudioStreamPlayer2D::_mix_audio() {
int buffer_size = mix_buffer.size();
//mix
- stream_playback->mix(buffer, 1.0, buffer_size);
+ stream_playback->mix(buffer, pitch_scale, buffer_size);
//write all outputs
for (int i = 0; i < output_count; i++) {
@@ -279,6 +279,13 @@ float AudioStreamPlayer2D::get_volume_db() const {
return volume_db;
}
+void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) {
+ pitch_scale = p_pitch_scale;
+}
+float AudioStreamPlayer2D::get_pitch_scale() const {
+ return pitch_scale;
+}
+
void AudioStreamPlayer2D::play(float p_from_pos) {
if (stream_playback.is_valid()) {
@@ -419,6 +426,9 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer2D::get_volume_db);
+ ClassDB::bind_method(D_METHOD("set_pitch_scale", "pitch_scale"), &AudioStreamPlayer2D::set_pitch_scale);
+ ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioStreamPlayer2D::get_pitch_scale);
+
ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer2D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer2D::stop);
@@ -448,6 +458,7 @@ void AudioStreamPlayer2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "1,65536,1"), "set_max_distance", "get_max_distance");
@@ -461,6 +472,7 @@ void AudioStreamPlayer2D::_bind_methods() {
AudioStreamPlayer2D::AudioStreamPlayer2D() {
volume_db = 0;
+ pitch_scale = 1.0;
autoplay = false;
setseek = -1;
active = false;
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index 39bc985f58..9ae8e3a518 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -70,6 +70,7 @@ private:
volatile float setplay;
float volume_db;
+ float pitch_scale;
bool autoplay;
StringName bus;
@@ -98,6 +99,9 @@ public:
void set_volume_db(float p_volume);
float get_volume_db() const;
+ void set_pitch_scale(float p_pitch_scale);
+ float get_pitch_scale() const;
+
void play(float p_from_pos = 0.0);
void seek(float p_seconds);
void stop();
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 7a96a54854..329382c034 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -75,8 +75,7 @@ void Joint2D::_update_joint(bool p_only_free) {
ba = body_a->get_rid();
bb = body_b->get_rid();
- if (exclude_from_collision)
- Physics2DServer::get_singleton()->body_add_collision_exception(body_a->get_rid(), body_b->get_rid());
+ Physics2DServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
void Joint2D::set_node_a(const NodePath &p_node_a) {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index bf3bc42e4e..d448ef024d 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -57,18 +57,18 @@ void AudioStreamPlayer3D::_mix_audio() {
//mix
if (output_count > 0 || out_of_range_mode == OUT_OF_RANGE_MIX) {
- float pitch_scale = 0.0;
+ float output_pitch_scale = 0.0;
if (output_count) {
//used for doppler, not realistic but good enough
for (int i = 0; i < output_count; i++) {
- pitch_scale += outputs[i].pitch_scale;
+ output_pitch_scale += outputs[i].pitch_scale;
}
- pitch_scale /= float(output_count);
+ output_pitch_scale /= float(output_count);
} else {
- pitch_scale = 1.0;
+ output_pitch_scale = 1.0;
}
- stream_playback->mix(buffer, pitch_scale, buffer_size);
+ stream_playback->mix(buffer, pitch_scale * output_pitch_scale, buffer_size);
}
//write all outputs
@@ -607,6 +607,13 @@ float AudioStreamPlayer3D::get_max_db() const {
return max_db;
}
+void AudioStreamPlayer3D::set_pitch_scale(float p_pitch_scale) {
+ pitch_scale = p_pitch_scale;
+}
+float AudioStreamPlayer3D::get_pitch_scale() const {
+ return pitch_scale;
+}
+
void AudioStreamPlayer3D::play(float p_from_pos) {
if (stream_playback.is_valid()) {
@@ -832,6 +839,9 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_max_db", "max_db"), &AudioStreamPlayer3D::set_max_db);
ClassDB::bind_method(D_METHOD("get_max_db"), &AudioStreamPlayer3D::get_max_db);
+ ClassDB::bind_method(D_METHOD("set_pitch_scale", "pitch_scale"), &AudioStreamPlayer3D::set_pitch_scale);
+ ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioStreamPlayer3D::get_pitch_scale);
+
ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer3D::play, DEFVAL(0.0));
ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer3D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer3D::stop);
@@ -885,6 +895,7 @@ void AudioStreamPlayer3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_db", PROPERTY_HINT_RANGE, "-80,80"), "set_unit_db", "get_unit_db");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.1"), "set_unit_size", "get_unit_size");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_db", PROPERTY_HINT_RANGE, "-24,6"), "set_max_db", "get_max_db");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "0,65536,1"), "set_max_distance", "get_max_distance");
@@ -921,6 +932,7 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() {
unit_size = 1;
attenuation_model = ATTENUATION_INVERSE_DISTANCE;
max_db = 3;
+ pitch_scale = 1.0;
autoplay = false;
setseek = -1;
active = false;
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 9a1f369da2..1fcb83cf21 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -106,6 +106,7 @@ private:
float unit_db;
float unit_size;
float max_db;
+ float pitch_scale;
bool autoplay;
StringName bus;
@@ -153,6 +154,9 @@ public:
void set_max_db(float p_boost);
float get_max_db() const;
+ void set_pitch_scale(float p_pitch_scale);
+ float get_pitch_scale() const;
+
void play(float p_from_pos = 0.0);
void seek(float p_seconds);
void stop();
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 3fd3303a25..e2679870de 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -97,7 +97,7 @@ protected:
void _update_camera_mode();
void _notification(int p_what);
- virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _validate_property(PropertyInfo &p_property) const;
static void _bind_methods();
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index fed6d76f65..2e9f1a241a 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -71,8 +71,7 @@ void Joint::_update_joint(bool p_only_free) {
ba = body_a->get_rid();
bb = body_b->get_rid();
- if (exclude_from_collision)
- PhysicsServer::get_singleton()->body_add_collision_exception(body_a->get_rid(), body_b->get_rid());
+ PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
void Joint::set_node_a(const NodePath &p_node_a) {
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index cf070c2235..408c00334a 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -45,7 +45,7 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
}
//mix
- stream_playback->mix(buffer, 1.0, buffer_size);
+ stream_playback->mix(buffer, pitch_scale, buffer_size);
//multiply volume interpolating to avoid clicks if this changes
float target_volume = p_fadeout ? -80.0 : volume_db;
@@ -126,8 +126,8 @@ void AudioStreamPlayer::_notification(int p_what) {
if (!active || (setseek < 0 && !stream_playback->is_playing())) {
active = false;
- emit_signal("finished");
set_process_internal(false);
+ emit_signal("finished");
}
}
@@ -177,6 +177,13 @@ float AudioStreamPlayer::get_volume_db() const {
return volume_db;
}
+void AudioStreamPlayer::set_pitch_scale(float p_pitch_scale) {
+ pitch_scale = p_pitch_scale;
+}
+float AudioStreamPlayer::get_pitch_scale() const {
+ return pitch_scale;
+}
+
void AudioStreamPlayer::play(float p_from_pos) {
if (stream_playback.is_valid()) {
@@ -297,6 +304,9 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db);
+ ClassDB::bind_method(D_METHOD("set_pitch_scale", "pitch_scale"), &AudioStreamPlayer::set_pitch_scale);
+ ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioStreamPlayer::get_pitch_scale);
+
ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer::play, DEFVAL(0.0));
ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer::stop);
@@ -320,6 +330,7 @@ void AudioStreamPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_target", PROPERTY_HINT_ENUM, "Stereo,Surround,Center"), "set_mix_target", "get_mix_target");
@@ -335,6 +346,7 @@ void AudioStreamPlayer::_bind_methods() {
AudioStreamPlayer::AudioStreamPlayer() {
mix_volume_db = 0;
+ pitch_scale = 1.0;
volume_db = 0;
autoplay = false;
setseek = -1;
diff --git a/scene/audio/audio_player.h b/scene/audio/audio_player.h
index 4fee30c0c2..21189aea6d 100644
--- a/scene/audio/audio_player.h
+++ b/scene/audio/audio_player.h
@@ -54,6 +54,7 @@ private:
volatile bool active;
float mix_volume_db;
+ float pitch_scale;
float volume_db;
bool autoplay;
StringName bus;
@@ -81,6 +82,9 @@ public:
void set_volume_db(float p_volume);
float get_volume_db() const;
+ void set_pitch_scale(float p_pitch_scale);
+ float get_pitch_scale() const;
+
void play(float p_from_pos = 0.0);
void seek(float p_seconds);
void stop();
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 8b9469021c..9dfd388c3d 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -311,10 +311,6 @@ void BaseButton::set_disabled(bool p_disabled) {
status.disabled = p_disabled;
update();
_change_notify("disabled");
- if (p_disabled)
- set_focus_mode(FOCUS_NONE);
- else
- set_focus_mode(enabled_focus_mode);
}
bool BaseButton::is_disabled() const {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 1b5014367b..38ce91a4df 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -1147,9 +1147,18 @@ void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected);
ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node);
ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list);
+ ClassDB::bind_method(D_METHOD("clear_connections"), &GraphEdit::clear_connections);
ClassDB::bind_method(D_METHOD("get_scroll_ofs"), &GraphEdit::get_scroll_ofs);
ClassDB::bind_method(D_METHOD("set_scroll_ofs", "ofs"), &GraphEdit::set_scroll_ofs);
+ ClassDB::bind_method(D_METHOD("add_valid_right_disconnect_type", "type"), &GraphEdit::add_valid_right_disconnect_type);
+ ClassDB::bind_method(D_METHOD("remove_valid_right_disconnect_type", "type"), &GraphEdit::remove_valid_right_disconnect_type);
+ ClassDB::bind_method(D_METHOD("add_valid_left_disconnect_type", "type"), &GraphEdit::add_valid_left_disconnect_type);
+ ClassDB::bind_method(D_METHOD("remove_valid_left_disconnect_type", "type"), &GraphEdit::remove_valid_left_disconnect_type);
+ ClassDB::bind_method(D_METHOD("add_valid_connection_type", "from_type", "to_type"), &GraphEdit::add_valid_connection_type);
+ ClassDB::bind_method(D_METHOD("remove_valid_connection_type", "from_type", "to_type"), &GraphEdit::remove_valid_connection_type);
+ ClassDB::bind_method(D_METHOD("is_valid_connection_type", "from_type", "to_type"), &GraphEdit::is_valid_connection_type);
+
ClassDB::bind_method(D_METHOD("set_zoom", "p_zoom"), &GraphEdit::set_zoom);
ClassDB::bind_method(D_METHOD("get_zoom"), &GraphEdit::get_zoom);
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 77d3a34c66..fe85d04003 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -517,11 +517,11 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("item_rmb_selected", i, get_local_mouse_position());
} else {
- bool selected = !items[i].selected;
+ bool selected = items[i].selected;
select(i, select_mode == SELECT_SINGLE || !mb->get_command());
- if (selected) {
+ if (!selected || allow_reselect) {
if (select_mode == SELECT_SINGLE) {
emit_signal("item_selected", i);
} else
@@ -1241,6 +1241,7 @@ int ItemList::find_metadata(const Variant &p_metadata) const {
}
void ItemList::set_allow_rmb_select(bool p_allow) {
+
allow_rmb_select = p_allow;
}
@@ -1249,6 +1250,16 @@ bool ItemList::get_allow_rmb_select() const {
return allow_rmb_select;
}
+void ItemList::set_allow_reselect(bool p_allow) {
+
+ allow_reselect = p_allow;
+}
+
+bool ItemList::get_allow_reselect() const {
+
+ return allow_reselect;
+}
+
void ItemList::set_icon_scale(real_t p_scale) {
icon_scale = p_scale;
}
@@ -1404,6 +1415,9 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &ItemList::set_allow_rmb_select);
ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &ItemList::get_allow_rmb_select);
+ ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &ItemList::set_allow_reselect);
+ ClassDB::bind_method(D_METHOD("get_allow_reselect"), &ItemList::get_allow_reselect);
+
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
@@ -1422,6 +1436,7 @@ void ItemList::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_text_lines"), "set_max_text_lines", "get_max_text_lines");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height");
@@ -1432,7 +1447,7 @@ void ItemList::_bind_methods() {
ADD_GROUP("Icon", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_mode", PROPERTY_HINT_ENUM, "Top,Left"), "set_icon_mode", "get_icon_mode");
ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "icon_scale"), "set_icon_scale", "get_icon_scale");
- ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size");
+ ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size");
BIND_ENUM_CONSTANT(ICON_MODE_TOP);
BIND_ENUM_CONSTANT(ICON_MODE_LEFT);
@@ -1476,6 +1491,7 @@ ItemList::ItemList() {
ensure_selected_visible = false;
defer_select_single = -1;
allow_rmb_select = false;
+ allow_reselect = false;
do_autoscroll_to_bottom = false;
icon_scale = 1.0f;
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 24e9498044..7f34a250bd 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -106,6 +106,8 @@ private:
bool allow_rmb_select;
+ bool allow_reselect;
+
real_t icon_scale;
bool do_autoscroll_to_bottom;
@@ -198,6 +200,9 @@ public:
void set_allow_rmb_select(bool p_allow);
bool get_allow_rmb_select() const;
+ void set_allow_reselect(bool p_allow);
+ bool get_allow_reselect() const;
+
void ensure_current_is_visible();
void sort_items_by_text();
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 524a68a116..03dc6686b8 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -30,6 +30,7 @@
#include "line_edit.h"
#include "label.h"
+#include "message_queue.h"
#include "os/keyboard.h"
#include "os/os.h"
#include "print_string.h"
@@ -800,7 +801,12 @@ void LineEdit::paste_text() {
if (selection.enabled) selection_delete();
append_at_cursor(paste_buffer);
- _text_changed();
+ if (!text_changed_dirty) {
+ if (is_inside_tree()) {
+ MessageQueue::get_singleton()->push_call(this, "_text_changed");
+ }
+ text_changed_dirty = true;
+ }
}
}
@@ -974,7 +980,12 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
window_pos = cursor_pos;
}
- _text_changed();
+ if (!text_changed_dirty) {
+ if (is_inside_tree()) {
+ MessageQueue::get_singleton()->push_call(this, "_text_changed");
+ }
+ text_changed_dirty = true;
+ }
}
void LineEdit::set_text(String p_text) {
@@ -1341,6 +1352,7 @@ void LineEdit::_text_changed() {
void LineEdit::_emit_text_change() {
emit_signal("text_changed", text);
_change_notify("text");
+ text_changed_dirty = false;
}
void LineEdit::_clear_redo() {
@@ -1373,6 +1385,7 @@ void LineEdit::_create_undo_state() {
void LineEdit::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret);
#ifdef TOOLS_ENABLED
@@ -1458,6 +1471,7 @@ LineEdit::LineEdit() {
window_has_focus = true;
max_length = 0;
pass = false;
+ text_changed_dirty = false;
placeholder_alpha = 0.6;
deselect();
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index e15980d3c4..e3ad3b17f1 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -67,6 +67,7 @@ private:
bool editable;
bool pass;
+ bool text_changed_dirty;
String undo_text;
String text;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3c5d524d80..145981d498 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -185,17 +185,22 @@ void SpinBox::_line_edit_focus_exit() {
_text_entered(line_edit->get_text());
}
+inline void SpinBox::_adjust_width_for_icon(const Ref<Texture> icon) {
+
+ int w = icon->get_width();
+ if (w != last_w) {
+ line_edit->set_margin(MARGIN_RIGHT, -w);
+ last_w = w;
+ }
+}
+
void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
Ref<Texture> updown = get_icon("updown");
- int w = updown->get_width();
- if (w != last_w) {
- line_edit->set_margin(MARGIN_RIGHT, -w);
- last_w = w;
- }
+ _adjust_width_for_icon(updown);
RID ci = get_canvas_item();
Size2i size = get_size();
@@ -207,6 +212,7 @@ void SpinBox::_notification(int p_what) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
+ _adjust_width_for_icon(get_icon("updown"));
_value_changed(0);
}
}
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index b8565ec082..8863f44bef 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -62,6 +62,8 @@ class SpinBox : public Range {
void _line_edit_focus_exit();
+ inline void _adjust_width_for_icon(const Ref<Texture> icon);
+
protected:
void _gui_input(const Ref<InputEvent> &p_event);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 95bd676a08..f728490136 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -890,7 +890,7 @@ void TextEdit::_notification(int p_what) {
} else {
// if it has text, then draw current line marker in the margin, as line number etc will draw over it, draw the rest of line marker later.
if (line == cursor.line && highlight_current_line) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg, get_row_height()), cache.current_line_color);
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg + ofs_x, get_row_height()), cache.current_line_color);
}
}
@@ -1122,14 +1122,14 @@ void TextEdit::_notification(int p_what) {
// line highlighting handle horizontal clipping
if (line == cursor.line && highlight_current_line) {
- // char next to margin is skipped
- if ((char_ofs + char_margin) > xmargin_beg) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color);
- }
- // end of line when last char is skipped
if (j == str.length() - 1) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color);
+ // end of line when last char is skipped
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color);
+
+ } else if ((char_ofs + char_margin) > xmargin_beg) {
+ // char next to margin is skipped
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - xmargin_beg, get_row_height()), cache.current_line_color);
}
}
continue;
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 6e58bc88d7..7a1fffaa26 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1603,19 +1603,19 @@ float Animation::get_step() const {
return step;
}
-void Animation::copy_track(int src_track, Ref<Animation> p_to_animation) {
+void Animation::copy_track(int p_track, Ref<Animation> p_to_animation) {
ERR_FAIL_COND(p_to_animation.is_null());
- ERR_FAIL_INDEX(src_track, get_track_count());
+ ERR_FAIL_INDEX(p_track, get_track_count());
int dst_track = p_to_animation->get_track_count();
- p_to_animation->add_track(track_get_type(src_track));
-
- p_to_animation->track_set_path(dst_track, track_get_path(src_track));
- p_to_animation->track_set_imported(dst_track, track_is_imported(src_track));
- p_to_animation->track_set_enabled(dst_track, track_is_enabled(src_track));
- p_to_animation->track_set_interpolation_type(dst_track, track_get_interpolation_type(src_track));
- p_to_animation->track_set_interpolation_loop_wrap(dst_track, track_get_interpolation_loop_wrap(src_track));
- for (int i = 0; i < track_get_key_count(src_track); i++) {
- p_to_animation->track_insert_key(dst_track, track_get_key_time(src_track, i), track_get_key_value(src_track, i), track_get_key_transition(src_track, i));
+ p_to_animation->add_track(track_get_type(p_track));
+
+ p_to_animation->track_set_path(dst_track, track_get_path(p_track));
+ p_to_animation->track_set_imported(dst_track, track_is_imported(p_track));
+ p_to_animation->track_set_enabled(dst_track, track_is_enabled(p_track));
+ p_to_animation->track_set_interpolation_type(dst_track, track_get_interpolation_type(p_track));
+ p_to_animation->track_set_interpolation_loop_wrap(dst_track, track_get_interpolation_loop_wrap(p_track));
+ for (int i = 0; i < track_get_key_count(p_track); i++) {
+ p_to_animation->track_insert_key(dst_track, track_get_key_time(p_track, i), track_get_key_value(p_track, i), track_get_key_transition(p_track, i));
}
}
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 93ed700482..b77143cd9d 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -77,7 +77,7 @@ void AudioStreamPlaybackSample::seek(float p_time) {
if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM)
return; //no seeking in ima-adpcm
- float max = get_length();
+ float max = base->get_length();
if (p_time < 0) {
p_time = 0;
} else if (p_time >= max) {
@@ -390,22 +390,6 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
}
}
-float AudioStreamPlaybackSample::get_length() const {
-
- int len = base->data_bytes;
- switch (base->format) {
- case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
- case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
- case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
- }
-
- if (base->stereo) {
- len /= 2;
- }
-
- return float(len) / base->mix_rate;
-}
-
AudioStreamPlaybackSample::AudioStreamPlaybackSample() {
active = false;
@@ -469,6 +453,22 @@ bool AudioStreamSample::is_stereo() const {
return stereo;
}
+float AudioStreamSample::get_length() const {
+
+ int len = data_bytes;
+ switch (format) {
+ case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
+ case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
+ case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
+ }
+
+ if (stereo) {
+ len /= 2;
+ }
+
+ return float(len) / mix_rate;
+}
+
void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) {
AudioServer::get_singleton()->lock();
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index 41754301eb..5fe65c194e 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -77,8 +77,6 @@ public:
virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
- virtual float get_length() const; //if supported, otherwise return 0
-
AudioStreamPlaybackSample();
};
@@ -137,6 +135,8 @@ public:
void set_stereo(bool p_enable);
bool is_stereo() const;
+ virtual float get_length() const; //if supported, otherwise return 0
+
void set_data(const PoolVector<uint8_t> &p_data);
PoolVector<uint8_t> get_data() const;
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp
index 8c09130873..b2f586d02d 100644
--- a/scene/resources/color_ramp.cpp
+++ b/scene/resources/color_ramp.cpp
@@ -71,8 +71,8 @@ void Gradient::_bind_methods() {
ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &Gradient::set_colors);
ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &Gradient::get_colors);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
}
Vector<float> Gradient::get_offsets() const {
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 0faa0dc770..91c801c016 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -1312,6 +1312,8 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const
return ria->rename_dependencies(f, p_path, p_map);
}
+ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = NULL;
+
Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, const String &p_dst_path) {
Error err;
diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h
index c014b9bfae..c28ded3d77 100644
--- a/scene/resources/scene_format_text.h
+++ b/scene/resources/scene_format_text.h
@@ -128,7 +128,9 @@ public:
};
class ResourceFormatLoaderText : public ResourceFormatLoader {
+
public:
+ static ResourceFormatLoaderText *singleton;
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -138,6 +140,8 @@ public:
virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
static Error convert_file_to_binary(const String &p_src_path, const String &p_dst_path);
+
+ ResourceFormatLoaderText() { singleton = this; }
};
class ResourceFormatSaverTextInstance {
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 6811517ead..de75bb3976 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -651,8 +651,8 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
}
//adapt borders (prevent weired overlapping/glitchy drawings)
- int width = style_rect.size.width;
- int height = style_rect.size.height;
+ int width = MAX(style_rect.size.width, 0);
+ int height = MAX(style_rect.size.height, 0);
int adapted_border[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
adapt_values(MARGIN_TOP, MARGIN_BOTTOM, adapted_border, border_width, height, height, height);
adapt_values(MARGIN_LEFT, MARGIN_RIGHT, adapted_border, border_width, width, width, width);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 067d123b83..c0f6756fd1 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -76,7 +76,7 @@ void Texture::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Ansiotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags");
BIND_ENUM_CONSTANT(FLAGS_DEFAULT);
BIND_ENUM_CONSTANT(FLAG_MIPMAPS);