summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/AudioEffectPitchShift.xml16
-rw-r--r--doc/classes/ColorPicker.xml8
-rw-r--r--doc/classes/String.xml12
-rw-r--r--doc/classes/TextEdit.xml6
-rw-r--r--doc/classes/VisualShaderNodeGroupBase.xml8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp6
-rw-r--r--editor/animation_track_editor.cpp81
-rw-r--r--editor/animation_track_editor.h14
-rw-r--r--editor/code_editor.cpp5
-rw-r--r--editor/code_editor.h1
-rw-r--r--editor/editor_autoload_settings.cpp2
-rw-r--r--editor/editor_layouts_dialog.cpp (renamed from editor/editor_name_dialog.cpp)75
-rw-r--r--editor/editor_layouts_dialog.h (renamed from editor/editor_name_dialog.h)23
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_node.h5
-rw-r--r--editor/icons/icon_key_valid.svg5
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.cpp8
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.h1
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp10
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/particles_editor_plugin.cpp11
-rw-r--r--editor/plugins/particles_editor_plugin.h1
-rw-r--r--editor/plugins/script_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_text_editor.cpp7
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.cpp2
-rw-r--r--scene/2d/cpu_particles_2d.cpp2
-rw-r--r--scene/2d/particles_2d.cpp1
-rw-r--r--scene/3d/cpu_particles.cpp2
-rw-r--r--scene/3d/particles.cpp1
-rw-r--r--scene/3d/sprite_3d.cpp1
-rw-r--r--scene/gui/text_edit.cpp15
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/resources/texture.cpp1
-rw-r--r--scene/resources/tile_set.cpp29
-rw-r--r--scene/resources/visual_shader.cpp38
-rw-r--r--scene/resources/visual_shader.h2
42 files changed, 310 insertions, 120 deletions
diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml
index 7d6c5f2b20..8c22afb40f 100644
--- a/doc/classes/AudioEffectPitchShift.xml
+++ b/doc/classes/AudioEffectPitchShift.xml
@@ -12,10 +12,26 @@
<methods>
</methods>
<members>
+ <member name="fft_size" type="int" setter="set_fft_size" getter="get_fft_size" enum="AudioEffectPitchShift.FFT_Size">
+ </member>
+ <member name="oversampling" type="int" setter="set_oversampling" getter="get_oversampling">
+ </member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
Pitch value. Can range from 0 (-1 octave) to 16 (+16 octaves).
</member>
</members>
<constants>
+ <constant name="FFT_SIZE_256" value="0" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_512" value="1" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_1024" value="2" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_2048" value="3" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_4096" value="4" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_MAX" value="5" enum="FFT_Size">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index 1fefc719b7..0ab91e9621 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -45,14 +45,14 @@
<member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha">
If [code]true[/code], shows an alpha channel slider (transparency).
</member>
- <member name="presets_enabled" type="bool" setter="set_presets_enabled" getter="are_presets_enabled">
- </member>
- <member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible">
- </member>
<member name="hsv_mode" type="bool" setter="set_hsv_mode" getter="is_hsv_mode">
If [code]true[/code], allows to edit color with Hue/Saturation/Value sliders.
[b]Note:[/b] Cannot be enabled if raw mode is on.
</member>
+ <member name="presets_enabled" type="bool" setter="set_presets_enabled" getter="are_presets_enabled">
+ </member>
+ <member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible">
+ </member>
<member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode">
If [code]true[/code], allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR).
[b]Note:[/b] Cannot be enabled if hsv mode is on.
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index ff0572f384..6395fe2ce8 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -388,6 +388,18 @@
Converts a string containing a hexadecimal number into an integer.
</description>
</method>
+ <method name="http_escape">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="http_unescape">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="insert">
<return type="String">
</return>
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 8139da3a4c..e818d753d8 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -44,6 +44,12 @@
Returns if the given line is foldable, that is, it has indented lines right below it.
</description>
</method>
+ <method name="center_viewport_to_cursor">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="clear_colors">
<return type="void">
</return>
diff --git a/doc/classes/VisualShaderNodeGroupBase.xml b/doc/classes/VisualShaderNodeGroupBase.xml
index 37d48956f6..c2e9b9503b 100644
--- a/doc/classes/VisualShaderNodeGroupBase.xml
+++ b/doc/classes/VisualShaderNodeGroupBase.xml
@@ -109,6 +109,14 @@
<description>
</description>
</method>
+ <method name="is_valid_port_name" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="remove_input_port">
<return type="void">
</return>
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 0840717d68..96094dd0ad 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -6074,10 +6074,7 @@ void RasterizerStorageGLES3::particles_set_emitting(RID p_particles, bool p_emit
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
- if (p_emitting != particles->emitting) {
- // Restart is overridden by set_emitting
- particles->restart_request = false;
- }
+
particles->emitting = p_emitting;
}
@@ -6475,7 +6472,6 @@ void RasterizerStorageGLES3::update_particles() {
Particles *particles = particle_update_list.first()->self();
if (particles->restart_request) {
- particles->emitting = true; //restart from zero
particles->prev_ticks = 0;
particles->phase = 0;
particles->prev_phase = 0;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 6e47fadb20..1bed5a9524 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1203,7 +1203,9 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
////////////////////////////////////
void AnimationTrackEdit::_notification(int p_what) {
+
if (p_what == NOTIFICATION_DRAW) {
+
if (animation.is_null())
return;
ERR_FAIL_INDEX(track, animation->get_track_count());
@@ -1240,20 +1242,15 @@ void AnimationTrackEdit::_notification(int p_what) {
int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but..
check_rect = Rect2(Point2(ofs, int(get_size().height - check->get_height()) / 2), check->get_size());
-
draw_texture(check, check_rect.position);
-
ofs += check->get_width() + hsep;
Ref<Texture> type_icon = type_icons[animation->track_get_type(track)];
-
draw_texture(type_icon, Point2(ofs, int(get_size().height - type_icon->get_height()) / 2));
ofs += type_icon->get_width() + hsep;
NodePath path = animation->track_get_path(track);
-
Node *node = NULL;
-
if (root && root->has_node(path)) {
node = root->get_node(path);
}
@@ -1308,12 +1305,11 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
}
- // KEYFAMES //
+ // KEYFRAMES //
draw_bg(limit, get_size().width - timeline->get_buttons_width());
{
-
float scale = timeline->get_zoom_scale();
int limit_end = get_size().width - timeline->get_buttons_width();
@@ -1342,6 +1338,7 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_fg(limit, get_size().width - timeline->get_buttons_width());
// BUTTONS //
+
{
Ref<Texture> wrap_icon[2] = {
@@ -1566,7 +1563,18 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
if (p_x < p_clip_left || p_x > p_clip_right)
return;
- Vector2 ofs(p_x - type_icon->get_width() / 2, int(get_size().height - type_icon->get_height()) / 2);
+ Ref<Texture> icon_to_draw = p_selected ? selected_icon : type_icon;
+
+ // Override type icon for invalid value keys, unless selected.
+ if (!p_selected && animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ const Variant &v = animation->track_get_key_value(track, p_index);
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
+ icon_to_draw = get_icon("KeyInvalid", "EditorIcons");
+ }
+ }
+
+ Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
Ref<Font> font = get_font("font", "Label");
@@ -1590,16 +1598,13 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
}
text += ")";
- int limit = MAX(0, p_clip_right - p_x - type_icon->get_width());
+ int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width());
if (limit > 0) {
- draw_string(font, Vector2(p_x + type_icon->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
+ draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
}
}
- if (p_selected) {
- draw_texture(selected_icon, ofs);
- } else {
- draw_texture(type_icon, ofs);
- }
+
+ draw_texture(icon_to_draw, ofs);
}
//helper
@@ -1764,6 +1769,27 @@ void AnimationTrackEdit::_path_entered(const String &p_text) {
undo_redo->commit_action();
}
+bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const {
+
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
+
+ Object *obj = NULL;
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
+
+ bool prop_exists = false;
+ if (obj) {
+ r_valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
+ }
+
+ return (!prop_exists || Variant::can_convert(p_key_value.get_type(), r_valid_type));
+}
+
String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
if (check_rect.has_point(p_pos)) {
@@ -1834,29 +1860,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
} break;
case Animation::TYPE_VALUE: {
- Variant v = animation->track_get_key_value(track, key_idx);
- //text+="value: "+String(v)+"\n";
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
- Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj) {
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
+ const Variant &v = animation->track_get_key_value(track, key_idx);
text += "Type: " + Variant::get_type_name(v.get_type()) + "\n";
- if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
text += "Value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
} else {
text += "Value: " + String(v) + "\n";
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 1452d5519c..5f05c1de8c 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -31,6 +31,11 @@
#ifndef ANIMATION_TRACK_EDITOR_H
#define ANIMATION_TRACK_EDITOR_H
+#include "editor/editor_data.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_editor.h"
+#include "editor/property_selector.h"
+#include "scene/animation/animation_cache.h"
#include "scene/gui/control.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/menu_button.h"
@@ -40,12 +45,6 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
-
-#include "editor/property_selector.h"
-#include "editor_data.h"
-#include "editor_spin_slider.h"
-#include "property_editor.h"
-#include "scene/animation/animation_cache.h"
#include "scene/resources/animation.h"
#include "scene_tree_editor.h"
@@ -175,8 +174,9 @@ class AnimationTrackEdit : public Control {
void _path_entered(const String &p_text);
void _play_position_draw();
- mutable int dropping_at;
+ bool _is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const;
+ mutable int dropping_at;
float insert_at_pos;
bool moving_selection_attempt;
int select_single_attempt;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 8b3c537fe3..848921d870 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1217,6 +1217,11 @@ void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
text_editor->select(p_line, p_begin, p_line, p_end);
}
+void CodeTextEditor::goto_line_centered(int p_line) {
+ goto_line(p_line);
+ text_editor->call_deferred("center_viewport_to_cursor");
+}
+
void CodeTextEditor::set_executing_line(int p_line) {
text_editor->set_executing_line(p_line);
}
diff --git a/editor/code_editor.h b/editor/code_editor.h
index ce219f340c..c0989f9704 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -219,6 +219,7 @@ public:
void goto_line(int p_line);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
void set_executing_line(int p_line);
void clear_executing_line();
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 913eb35f8a..9f0b4250a3 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -789,7 +789,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
}
- if (!info.is_singleton && !info.in_editor) {
+ if (!info.is_singleton && !info.in_editor && info.node != NULL) {
memdelete(info.node);
info.node = NULL;
}
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 63a91a594c..01e4762196 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.cpp */
+/* editor_layouts_dialog.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,13 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "editor_name_dialog.h"
-
+#include "editor_layouts_dialog.h"
#include "core/class_db.h"
+#include "core/io/config_file.h"
#include "core/os/keyboard.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/line_edit.h"
-void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
-
+void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
@@ -60,34 +62,77 @@ void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
}
}
-void EditorNameDialog::_post_popup() {
+void EditorLayoutsDialog::_bind_methods() {
+ ClassDB::bind_method("_line_gui_input", &EditorLayoutsDialog::_line_gui_input);
- ConfirmationDialog::_post_popup();
- name->clear();
- name->grab_focus();
+ ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
}
-void EditorNameDialog::ok_pressed() {
+void EditorLayoutsDialog::ok_pressed() {
+
+ if (layout_names->is_anything_selected()) {
+
+ Vector<int> const selected_items = layout_names->get_selected_items();
+ for (int i = 0; i < selected_items.size(); ++i) {
+
+ emit_signal("name_confirmed", layout_names->get_item_text(selected_items[i]));
+ }
+ } else if (name->is_visible() && name->get_text() != "") {
- if (name->get_text() != "") {
emit_signal("name_confirmed", name->get_text());
}
}
-void EditorNameDialog::_bind_methods() {
+void EditorLayoutsDialog::_post_popup() {
- ClassDB::bind_method("_line_gui_input", &EditorNameDialog::_line_gui_input);
+ ConfirmationDialog::_post_popup();
+ name->clear();
+ layout_names->clear();
- ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(EditorSettings::get_singleton()->get_editor_layouts_config());
+ if (err != OK) {
+
+ return;
+ }
+
+ List<String> layouts;
+ config.ptr()->get_sections(&layouts);
+
+ for (List<String>::Element *E = layouts.front(); E; E = E->next()) {
+
+ layout_names->add_item(**E);
+ }
}
-EditorNameDialog::EditorNameDialog() {
+EditorLayoutsDialog::EditorLayoutsDialog() {
+
makevb = memnew(VBoxContainer);
add_child(makevb);
+ makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+
+ layout_names = memnew(ItemList);
+ makevb->add_child(layout_names);
+ layout_names->set_visible(true);
+ layout_names->set_margin(MARGIN_TOP, 5);
+ layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+ layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ layout_names->set_select_mode(ItemList::SelectMode::SELECT_MULTI);
+ layout_names->set_allow_rmb_select(true);
+
name = memnew(LineEdit);
makevb->add_child(name);
name->set_margin(MARGIN_TOP, 5);
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
name->connect("gui_input", this, "_line_gui_input");
+ name->connect("focus_entered", layout_names, "unselect_all");
+}
+
+void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
+
+ name->set_visible(p_enabled);
}
diff --git a/editor/editor_name_dialog.h b/editor/editor_layouts_dialog.h
index 314fc27124..5e3a1d5a46 100644
--- a/editor/editor_name_dialog.h
+++ b/editor/editor_layouts_dialog.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.h */
+/* editor_layouts_dialog.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,18 +28,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_NAME_DIALOG_H
-#define EDITOR_NAME_DIALOG_H
+#ifndef EDITOR_LAYOUTS_DIALOG_H
+#define EDITOR_LAYOUTS_DIALOG_H
#include "scene/gui/dialogs.h"
-#include "scene/gui/line_edit.h"
-class EditorNameDialog : public ConfirmationDialog {
+class LineEdit;
+class ItemList;
- GDCLASS(EditorNameDialog, ConfirmationDialog);
+class EditorLayoutsDialog : public ConfirmationDialog {
+
+ GDCLASS(EditorLayoutsDialog, ConfirmationDialog);
- VBoxContainer *makevb;
LineEdit *name;
+ ItemList *layout_names;
+ VBoxContainer *makevb;
void _line_gui_input(const Ref<InputEvent> &p_event);
@@ -49,9 +52,9 @@ protected:
virtual void _post_popup();
public:
- LineEdit *get_line_edit() { return name; }
+ EditorLayoutsDialog();
- EditorNameDialog();
+ void set_name_line_enabled(bool p_enabled);
};
-#endif // EDITOR_NAME_DIALOG_H
+#endif // EDITOR_LAYOUTS_DIALOG_H
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 21ed478159..1f08f3d787 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4256,6 +4256,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Save Layout"));
layout_dialog->get_ok()->set_text(TTR("Save"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(true);
} break;
case SETTINGS_LAYOUT_DELETE: {
@@ -4263,6 +4264,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Delete Layout"));
layout_dialog->get_ok()->set_text(TTR("Delete"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(false);
} break;
case SETTINGS_LAYOUT_DEFAULT: {
@@ -6029,10 +6031,10 @@ EditorNode::EditorNode() {
progress_hb = memnew(BackgroundProgress);
- layout_dialog = memnew(EditorNameDialog);
+ layout_dialog = memnew(EditorLayoutsDialog);
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
- layout_dialog->set_size(Size2(175, 70) * EDSCALE);
+ layout_dialog->set_size(Size2(225, 270) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
update_menu = memnew(MenuButton);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 366d9c2770..46b9befcd6 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -41,8 +41,8 @@
#include "editor/editor_feature_profile.h"
#include "editor/editor_folding.h"
#include "editor/editor_inspector.h"
+#include "editor/editor_layouts_dialog.h"
#include "editor/editor_log.h"
-#include "editor/editor_name_dialog.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
@@ -85,6 +85,7 @@
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/viewport_container.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -308,7 +309,7 @@ private:
int overridden_default_layout;
Ref<ConfigFile> default_layout;
PopupMenu *editor_layouts;
- EditorNameDialog *layout_dialog;
+ EditorLayoutsDialog *layout_dialog;
ConfirmationDialog *custom_build_manage_templates;
ConfirmationDialog *install_android_build_template;
diff --git a/editor/icons/icon_key_valid.svg b/editor/icons/icon_key_valid.svg
deleted file mode 100644
index 4a3fab4754..0000000000
--- a/editor/icons/icon_key_valid.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#fff"/>
-</g>
-</svg>
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 1622ce17b2..7c2116f06b 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -75,6 +75,10 @@ void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
emission_mask->popup_centered_minsize();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -265,6 +269,8 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
menu = memnew(MenuButton);
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.h b/editor/plugins/cpu_particles_2d_editor_plugin.h
index f715abd87b..84bbfff095 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.h
@@ -44,7 +44,8 @@ class CPUParticles2DEditorPlugin : public EditorPlugin {
enum {
MENU_LOAD_EMISSION_MASK,
- MENU_CLEAR_EMISSION_MASK
+ MENU_CLEAR_EMISSION_MASK,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp
index 70be9b95bb..93ffce41fa 100644
--- a/editor/plugins/cpu_particles_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_editor_plugin.cpp
@@ -62,6 +62,12 @@ void CPUParticlesEditor::_menu_option(int p_option) {
emission_tree_dialog->popup_centered_ratio();
} break;
+
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -108,6 +114,8 @@ CPUParticlesEditor::CPUParticlesEditor() {
options->set_text(TTR("CPUParticles"));
options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
}
diff --git a/editor/plugins/cpu_particles_editor_plugin.h b/editor/plugins/cpu_particles_editor_plugin.h
index 09b0adbe5d..674f00dc9f 100644
--- a/editor/plugins/cpu_particles_editor_plugin.h
+++ b/editor/plugins/cpu_particles_editor_plugin.h
@@ -43,6 +43,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
+ MENU_OPTION_RESTART
};
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 6fabdc93c6..e68bca55cb 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -96,12 +96,16 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
- ur->add_do_reference(particles);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(particles);
ur->commit_action();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -380,6 +384,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->get_popup()->add_separator();
menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
toolbar->add_child(menu);
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index 35b874fb25..0f092aaa4f 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -47,7 +47,8 @@ class Particles2DEditorPlugin : public EditorPlugin {
MENU_GENERATE_VISIBILITY_RECT,
MENU_LOAD_EMISSION_MASK,
MENU_CLEAR_EMISSION_MASK,
- MENU_OPTION_CONVERT_TO_CPU_PARTICLES
+ MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 3f4f66a26d..f05e7d65d3 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -315,12 +315,17 @@ void ParticlesEditor::_menu_option(int p_option) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
- ur->add_do_reference(node);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(node);
ur->commit_action();
} break;
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -471,6 +476,8 @@ ParticlesEditor::ParticlesEditor() {
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index b1c53dcf94..5d05fbd4ac 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -86,6 +86,7 @@ class ParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_OPTION_RESTART,
};
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d5e21321c3..1b00889e9a 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -306,8 +306,11 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
editor->push_item(p_script.ptr());
ScriptEditorBase *current = _get_current_editor();
- if (current)
+ if (ScriptTextEditor *script_text_editor = Object::cast_to<ScriptTextEditor>(current)) {
+ script_text_editor->goto_line_centered(p_line);
+ } else if (current) {
current->goto_line(p_line, true);
+ }
}
}
}
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index ce0859a1f6..9bf3a9f0eb 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -237,7 +237,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("safe_line_number_color", safe_line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
@@ -487,6 +487,11 @@ void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
code_editor->goto_line_selection(p_line, p_begin, p_end);
}
+void ScriptTextEditor::goto_line_centered(int p_line) {
+
+ code_editor->goto_line_centered(p_line);
+}
+
void ScriptTextEditor::set_executing_line(int p_line) {
code_editor->set_executing_line(p_line);
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 24d40a5eec..89975e061e 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -201,6 +201,7 @@ public:
virtual void goto_line(int p_line, bool p_with_error = false);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
virtual void set_executing_line(int p_line);
virtual void clear_executing_line();
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index f9ca38b919..d02817f6e8 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -124,7 +124,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("line_number_color", line_number_color);
get_text_edit()->add_color_override("caret_color", caret_color);
get_text_edit()->add_color_override("caret_background_color", caret_background_color);
- get_text_edit()->add_color_override("font_selected_color", text_selected_color);
+ get_text_edit()->add_color_override("font_color_selected", text_selected_color);
get_text_edit()->add_color_override("selection_color", selection_color);
get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color);
get_text_edit()->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index eeef3397d2..787813336d 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -116,7 +116,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_color_override("line_number_color", line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index b417414ae0..04e8d65155 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef TILE_SET_EDITOR_PLUGIN_H
#define TILE_SET_EDITOR_PLUGIN_H
-#include "editor/editor_name_dialog.h"
#include "editor/editor_node.h"
#include "scene/2d/sprite.h"
#include "scene/resources/concave_polygon_shape_2d.h"
diff --git a/modules/mbedtls/stream_peer_mbed_tls.cpp b/modules/mbedtls/stream_peer_mbed_tls.cpp
index 45d3b86919..3541eff25a 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.cpp
+++ b/modules/mbedtls/stream_peer_mbed_tls.cpp
@@ -122,6 +122,8 @@ Error StreamPeerMbedTLS::_do_handshake() {
Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) {
+ ERR_FAIL_COND_V(p_base.is_null(), ERR_INVALID_PARAMETER);
+
base = p_base;
int ret = 0;
int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 2396faa84b..fba1c26d1c 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -250,6 +250,8 @@ void CPUParticles2D::restart() {
frame_remainder = 0;
cycle = 0;
+ set_emitting(true);
+
{
int pc = particles.size();
PoolVector<Particle>::Write w = particles.write();
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 9701998f5d..823794c3ba 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -278,6 +278,7 @@ void Particles2D::_validate_property(PropertyInfo &property) const {
void Particles2D::restart() {
VS::get_singleton()->particles_restart(particles);
+ VS::get_singleton()->particles_set_emitting(particles, true);
}
void Particles2D::_notification(int p_what) {
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 6dc1b93576..ee5d416930 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -225,6 +225,8 @@ void CPUParticles::restart() {
frame_remainder = 0;
cycle = 0;
+ set_emitting(true);
+
{
int pc = particles.size();
PoolVector<Particle>::Write w = particles.write();
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 156560f802..949de110f5 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -278,6 +278,7 @@ String Particles::get_configuration_warning() const {
void Particles::restart() {
VisualServer::get_singleton()->particles_restart(particles);
+ VisualServer::get_singleton()->particles_set_emitting(particles, true);
}
AABB Particles::capture_aabb() const {
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 6b70eef662..9f73484b6a 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -163,6 +163,7 @@ float SpriteBase3D::get_opacity() const {
void SpriteBase3D::set_axis(Vector3::Axis p_axis) {
+ ERR_FAIL_INDEX(p_axis, 3);
axis = p_axis;
_queue_update();
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 36d7dad1d3..4e86e4bb1e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1178,7 +1178,7 @@ void TextEdit::_notification(int p_what) {
if (brace_open_mismatch)
color = cache.brace_mismatch_color;
- drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
if ((brace_close_match_line == line && brace_close_match_column == last_wrap_column + j) ||
@@ -1186,7 +1186,7 @@ void TextEdit::_notification(int p_what) {
if (brace_close_mismatch)
color = cache.brace_mismatch_color;
- drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
}
@@ -1258,23 +1258,23 @@ void TextEdit::_notification(int p_what) {
if (str[j] >= 32) {
int yofs = ofs_y + (get_row_height() - cache.font->get_height()) / 2;
- int w = drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ int w = drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
if (underlined) {
float line_width = 1.0;
#ifdef TOOLS_ENABLED
line_width *= EDSCALE;
#endif
- draw_rect(Rect2(char_ofs + char_margin + ofs_x, yofs + ascent + 2, w, line_width), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ draw_rect(Rect2(char_ofs + char_margin + ofs_x, yofs + ascent + 2, w, line_width), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
} else if (draw_tabs && str[j] == '\t') {
int yofs = (get_row_height() - cache.tab_icon->get_height()) / 2;
- cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
if (draw_spaces && str[j] == ' ') {
int yofs = (get_row_height() - cache.space_icon->get_height()) / 2;
- cache.space_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ cache.space_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
char_ofs += char_w;
@@ -4554,7 +4554,7 @@ void TextEdit::_update_caches() {
cache.line_number_color = get_color("line_number_color");
cache.safe_line_number_color = get_color("safe_line_number_color");
cache.font_color = get_color("font_color");
- cache.font_selected_color = get_color("font_selected_color");
+ cache.font_color_selected = get_color("font_color_selected");
cache.keyword_color = get_color("keyword_color");
cache.function_color = get_color("function_color");
cache.member_variable_color = get_color("member_variable_color");
@@ -6452,6 +6452,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_text"), &TextEdit::get_text);
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
+ ClassDB::bind_method(D_METHOD("center_viewport_to_cursor"), &TextEdit::center_viewport_to_cursor);
ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport", "can_be_hidden", "wrap_index"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true), DEFVAL(0));
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 3e852deda6..c721cf992e 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -184,7 +184,7 @@ private:
Color line_number_color;
Color safe_line_number_color;
Color font_color;
- Color font_selected_color;
+ Color font_color_selected;
Color keyword_color;
Color number_color;
Color function_color;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6e0bc43296..3a0144849a 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1502,6 +1502,7 @@ void CubeMap::set_side(Side p_side, const Ref<Image> &p_image) {
Ref<Image> CubeMap::get_side(Side p_side) const {
+ ERR_FAIL_INDEX_V(p_side, 6, Ref<Image>());
if (!valid[p_side])
return Ref<Image>();
return VS::get_singleton()->texture_get_data(cubemap, VS::CubeMapSide(p_side));
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index f577a2e144..899abfc9f9 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -721,7 +721,7 @@ void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_sha
ERR_FAIL_COND(!tile_map.has(p_id));
ERR_FAIL_COND(p_shape_id < 0);
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].shape = p_shape;
_decompose_convex_shape(p_shape);
@@ -731,17 +731,17 @@ void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_sha
Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
- ERR_FAIL_INDEX_V(p_shape_id, tile_map[p_id].shapes_data.size(), Ref<Shape2D>());
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
+ return tile_map[p_id].shapes_data[p_shape_id].shape;
- return tile_map[p_id].shapes_data[p_shape_id].shape;
+ return Ref<Shape2D>();
}
void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
ERR_FAIL_COND(!tile_map.has(p_id));
- ERR_FAIL_INDEX(p_shape_id, tile_map[p_id].shapes_data.size());
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].shape_transform = p_offset;
emit_changed();
@@ -750,9 +750,10 @@ void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform
Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), Transform2D());
- ERR_FAIL_INDEX_V(p_shape_id, tile_map[p_id].shapes_data.size(), Transform2D());
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
+ return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
- return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
+ return Transform2D();
}
void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
@@ -770,7 +771,7 @@ void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_
ERR_FAIL_COND(!tile_map.has(p_id));
ERR_FAIL_COND(p_shape_id < 0);
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision = p_one_way;
emit_changed();
@@ -779,9 +780,10 @@ void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_
bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), false);
- ERR_FAIL_INDEX_V(p_shape_id, tile_map[p_id].shapes_data.size(), false);
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
+ return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
- return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
+ return false;
}
void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) {
@@ -789,7 +791,7 @@ void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_ma
ERR_FAIL_COND(!tile_map.has(p_id));
ERR_FAIL_COND(p_shape_id < 0);
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision_margin = p_margin;
emit_changed();
@@ -798,9 +800,10 @@ void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_ma
float TileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
- ERR_FAIL_INDEX_V(p_shape_id, tile_map[p_id].shapes_data.size(), 0.0);
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
+ return tile_map[p_id].shapes_data[p_shape_id].one_way_collision_margin;
- return tile_map[p_id].shapes_data[p_shape_id].one_way_collision_margin;
+ return 0;
}
void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index dd595d9ff8..a3813f8fc6 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1762,6 +1762,7 @@ void VisualShaderNodeGroupBase::set_inputs(const String &p_inputs) {
for (int i = 0; i < input_port_count; i++) {
Vector<String> arr = input_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
int port_idx = arr[0].to_int();
int port_type = arr[1].to_int();
@@ -1794,6 +1795,7 @@ void VisualShaderNodeGroupBase::set_outputs(const String &p_outputs) {
for (int i = 0; i < output_port_count; i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
int port_idx = arr[0].to_int();
int port_type = arr[1].to_int();
@@ -1810,6 +1812,23 @@ String VisualShaderNodeGroupBase::get_outputs() const {
return outputs;
}
+bool VisualShaderNodeGroupBase::is_valid_port_name(const String &p_name) const {
+ if (!p_name.is_valid_identifier()) {
+ return false;
+ }
+ for (int i = 0; i < get_input_port_count(); i++) {
+ if (get_input_port_name(i) == p_name) {
+ return false;
+ }
+ }
+ for (int i = 0; i < get_output_port_count(); i++) {
+ if (get_output_port_name(i) == p_name) {
+ return false;
+ }
+ }
+ return true;
+}
+
void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const String &p_name) {
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
@@ -1849,6 +1868,8 @@ void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const Strin
void VisualShaderNodeGroupBase::remove_input_port(int p_id) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+
Vector<String> inputs_strings = inputs.split(";", false);
int count = 0;
int index = 0;
@@ -1917,6 +1938,8 @@ void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const Stri
void VisualShaderNodeGroupBase::remove_output_port(int p_id) {
+ ERR_FAIL_COND(!has_output_port(p_id));
+
Vector<String> outputs_strings = outputs.split(";", false);
int count = 0;
int index = 0;
@@ -1956,6 +1979,9 @@ void VisualShaderNodeGroupBase::clear_output_ports() {
void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+ ERR_FAIL_COND(p_type < 0 || p_type > PORT_TYPE_TRANSFORM);
+
if (input_ports[p_id].type == p_type)
return;
@@ -1986,6 +2012,9 @@ VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_input_port_ty
void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_name) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
if (input_ports[p_id].name == p_name)
return;
@@ -2016,6 +2045,9 @@ String VisualShaderNodeGroupBase::get_input_port_name(int p_id) const {
void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
+ ERR_FAIL_COND(!has_output_port(p_id));
+ ERR_FAIL_COND(p_type < 0 || p_type > PORT_TYPE_TRANSFORM);
+
if (output_ports[p_id].type == p_type)
return;
@@ -2045,6 +2077,10 @@ VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_output_port_t
}
void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_name) {
+
+ ERR_FAIL_COND(!has_output_port(p_id));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
if (output_ports[p_id].name == p_name)
return;
@@ -2125,6 +2161,8 @@ void VisualShaderNodeGroupBase::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_outputs", "outputs"), &VisualShaderNodeGroupBase::set_outputs);
ClassDB::bind_method(D_METHOD("get_outputs"), &VisualShaderNodeGroupBase::get_outputs);
+ ClassDB::bind_method(D_METHOD("is_valid_port_name", "name"), &VisualShaderNodeGroupBase::is_valid_port_name);
+
ClassDB::bind_method(D_METHOD("add_input_port", "id", "type", "name"), &VisualShaderNodeGroupBase::add_input_port);
ClassDB::bind_method(D_METHOD("remove_input_port", "id"), &VisualShaderNodeGroupBase::remove_input_port);
ClassDB::bind_method(D_METHOD("get_input_port_count"), &VisualShaderNodeGroupBase::get_input_port_count);
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 1ab3c0c9cc..a36776e701 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -355,6 +355,8 @@ public:
void set_outputs(const String &p_outputs);
String get_outputs() const;
+ bool is_valid_port_name(const String &p_name) const;
+
void add_input_port(int p_id, int p_type, const String &p_name);
void remove_input_port(int p_id);
virtual int get_input_port_count() const;