summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/text_edit.cpp34
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/resources/audio_stream_sample.cpp2
-rw-r--r--scene/resources/mesh.cpp16
-rw-r--r--scene/resources/primitive_meshes.cpp2
5 files changed, 32 insertions, 23 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 5e925bf37f..06691d09be 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1856,6 +1856,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
bool in_single_quote = false;
bool in_double_quote = false;
+ bool found_comment = false;
int c = 0;
while (c < line.length()) {
@@ -1865,6 +1866,9 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
if (cursor.column == c) {
break;
}
+ } else if (!in_single_quote && !in_double_quote && line[c] == '#') {
+ found_comment = true;
+ break;
} else {
if (line[c] == '\'' && !in_double_quote) {
in_single_quote = !in_single_quote;
@@ -1880,7 +1884,15 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
}
}
- // Disallow inserting duplicated quotes while already in string
+ // Do not need to duplicate quotes while in comments
+ if (found_comment) {
+ insert_text_at_cursor(ch_single);
+ cursor_set_column(cursor_position_to_move);
+
+ return;
+ }
+
+ // Disallow inserting duplicated quotes while already in string
if ((in_single_quote || in_double_quote) && (ch == '"' || ch == '\'')) {
insert_text_at_cursor(ch_single);
cursor_set_column(cursor_position_to_move);
@@ -2517,13 +2529,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
String new_word = get_word_at_pos(mm->get_position());
if (new_word != highlighted_word) {
- highlighted_word = new_word;
- update();
+ emit_signal("symbol_validate", new_word);
}
} else {
if (highlighted_word != String()) {
- highlighted_word = String();
- update();
+ set_highlighted_word(String());
}
}
}
@@ -2572,13 +2582,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (select_identifiers_enabled) {
if (k->is_pressed() && !dragging_minimap && !dragging_selection) {
-
- highlighted_word = get_word_at_pos(get_local_mouse_position());
- update();
-
+ emit_signal("symbol_validate", get_word_at_pos(get_local_mouse_position()));
} else {
- highlighted_word = String();
- update();
+ set_highlighted_word(String());
}
}
}
@@ -6996,6 +7002,11 @@ void TextEdit::menu_option(int p_option) {
}
}
+void TextEdit::set_highlighted_word(const String &new_word) {
+ highlighted_word = new_word;
+ update();
+}
+
void TextEdit::set_select_identifiers_on_hover(bool p_enable) {
select_identifiers_enabled = p_enable;
@@ -7213,6 +7224,7 @@ void TextEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo(Variant::INT, "row")));
ADD_SIGNAL(MethodInfo("symbol_lookup", PropertyInfo(Variant::STRING, "symbol"), PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::INT, "column")));
ADD_SIGNAL(MethodInfo("info_clicked", PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::STRING, "info")));
+ ADD_SIGNAL(MethodInfo("symbol_validate", PropertyInfo(Variant::STRING, "symbol")));
BIND_ENUM_CONSTANT(MENU_CUT);
BIND_ENUM_CONSTANT(MENU_COPY);
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 6e267f5a47..3c9d1a5c85 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -585,6 +585,7 @@ public:
bool is_insert_text_operation();
+ void set_highlighted_word(const String &new_word);
void set_text(String p_text);
void insert_text_at_cursor(const String &p_text);
void insert_at(const String &p_text, int at);
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index ed25729c40..a68b750b31 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -258,7 +258,7 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
float srate = base->mix_rate;
srate *= p_rate_scale;
float fincrement = srate / base_rate;
- int32_t increment = int32_t(fincrement * MIX_FRAC_LEN);
+ int32_t increment = int32_t(MAX(fincrement * MIX_FRAC_LEN, 1));
increment *= sign;
//looping
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index a063b7f74f..5e032c41bf 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -252,10 +252,12 @@ Ref<Shape> Mesh::create_trimesh_shape() const {
Vector<Vector3> face_points;
face_points.resize(faces.size() * 3);
- for (int i = 0; i < face_points.size(); i++) {
+ for (int i = 0; i < face_points.size(); i += 3) {
Face3 f = faces.get(i / 3);
- face_points.set(i, f.vertex[i % 3]);
+ face_points.set(i, f.vertex[0]);
+ face_points.set(i + 1, f.vertex[1]);
+ face_points.set(i + 2, f.vertex[2]);
}
Ref<ConcavePolygonShape> shape = memnew(ConcavePolygonShape);
@@ -543,15 +545,9 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const {
ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape> >());
- Vector<Face3> faces = get_faces();
- Vector<Face3> f3;
- f3.resize(faces.size());
- const Face3 *f = faces.ptr();
- for (int i = 0; i < f3.size(); i++) {
- f3.write[i] = f[i];
- }
+ const Vector<Face3> faces = get_faces();
- Vector<Vector<Face3> > decomposed = convex_composition_function(f3);
+ Vector<Vector<Face3> > decomposed = convex_composition_function(faces);
Vector<Ref<Shape> > ret;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 00fc016ca1..959ee214a2 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -150,7 +150,7 @@ Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const {
uint32_t PrimitiveMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, 1, 0);
- return VS::ARRAY_COMPRESS_DEFAULT;
+ return VS::ARRAY_FORMAT_VERTEX | VS::ARRAY_FORMAT_NORMAL | VS::ARRAY_FORMAT_TANGENT | VS::ARRAY_FORMAT_TEX_UV | VS::ARRAY_FORMAT_INDEX | VS::ARRAY_COMPRESS_DEFAULT;
}
Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const {