summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/resource_format_binary.cpp3
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/collada/collada.h4
-rw-r--r--editor/editor_inspector.cpp12
-rw-r--r--editor/editor_plugin_settings.cpp88
-rw-r--r--editor/editor_properties.cpp3
-rw-r--r--editor/editor_properties_array_dict.cpp6
-rw-r--r--editor/plugins/editor_preview_plugins.cpp1
-rw-r--r--editor/plugins/script_text_editor.cpp10
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp8
-rw-r--r--scene/2d/collision_object_2d.cpp7
-rw-r--r--scene/3d/collision_object.cpp3
-rw-r--r--scene/gui/graph_edit.cpp10
-rw-r--r--scene/gui/rich_text_label.cpp5
-rw-r--r--scene/gui/spin_box.cpp3
-rw-r--r--scene/gui/text_edit.cpp16
-rw-r--r--scene/gui/viewport_container.cpp1
-rw-r--r--scene/main/http_request.cpp4
18 files changed, 85 insertions, 103 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index de10fe1376..0ad2479b05 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1786,6 +1786,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
f->close();
+ memdelete(f);
return ERR_CANT_CREATE;
}
@@ -1938,10 +1939,12 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
f->close();
+ memdelete(f);
return ERR_CANT_CREATE;
}
f->close();
+ memdelete(f);
return OK;
}
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index aea7f461f1..1bb49a4167 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef TOOLS_ENABLED
-
#include "collada.h"
#include <stdio.h>
@@ -2576,5 +2574,3 @@ Error Collada::load(const String &p_path, int p_flags) {
Collada::Collada() {
}
-
-#endif
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index 9ed62b46b7..317c3f1d37 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef TOOLS_ENABLED
-
#ifndef COLLADA_H
#define COLLADA_H
@@ -647,5 +645,3 @@ private: // private stuff
};
#endif // COLLADA_H
-
-#endif
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 8b3e108690..a76d34e122 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1044,7 +1044,6 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Font> font = get_font("font", "Tree");
Ref<Texture> arrow;
-#ifdef TOOLS_ENABLED
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
arrow = get_icon("arrow_up", "Tree");
@@ -1052,7 +1051,6 @@ void EditorInspectorSection::_notification(int p_what) {
arrow = get_icon("arrow", "Tree");
}
}
-#endif
Size2 size = get_size();
Point2 offset;
@@ -1087,7 +1085,6 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Texture> arrow;
-#ifdef TOOLS_ENABLED
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
arrow = get_icon("arrow_up", "Tree");
@@ -1095,7 +1092,6 @@ void EditorInspectorSection::_notification(int p_what) {
arrow = get_icon("arrow", "Tree");
}
}
-#endif
Ref<Font> font = get_font("font", "Tree");
@@ -1155,7 +1151,6 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
vbox_added = true;
}
-#ifdef TOOLS_ENABLED
if (foldable) {
_test_unfold();
if (object->editor_is_section_unfolded(section)) {
@@ -1164,7 +1159,6 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
vbox->hide();
}
}
-#endif
}
void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
@@ -1172,7 +1166,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
if (!foldable)
return;
-#ifdef TOOLS_ENABLED
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -1191,7 +1184,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
vbox->hide();
}
}
-#endif
}
VBoxContainer *EditorInspectorSection::get_vbox() {
@@ -1205,11 +1197,9 @@ void EditorInspectorSection::unfold() {
_test_unfold();
-#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, true);
vbox->show();
update();
-#endif
}
void EditorInspectorSection::fold() {
@@ -1219,11 +1209,9 @@ void EditorInspectorSection::fold() {
if (!vbox_added)
return; //kinda pointless
-#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, false);
vbox->hide();
update();
-#endif
}
void EditorInspectorSection::_bind_methods() {
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 09577e39e1..514b3ff5d2 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -96,45 +96,59 @@ void EditorPluginSettings::update_plugins() {
if (err2 != OK) {
WARN_PRINTS("Can't load plugin config: " + path);
- } else if (!cf->has_section_key("plugin", "name")) {
- WARN_PRINTS("Plugin misses plugin/name: " + path);
- } else if (!cf->has_section_key("plugin", "author")) {
- WARN_PRINTS("Plugin misses plugin/author: " + path);
- } else if (!cf->has_section_key("plugin", "version")) {
- WARN_PRINTS("Plugin misses plugin/version: " + path);
- } else if (!cf->has_section_key("plugin", "description")) {
- WARN_PRINTS("Plugin misses plugin/description: " + path);
- } else if (!cf->has_section_key("plugin", "script")) {
- WARN_PRINTS("Plugin misses plugin/script: " + path);
} else {
+ bool key_missing = false;
- String d2 = plugins[i];
- String name = cf->get_value("plugin", "name");
- String author = cf->get_value("plugin", "author");
- String version = cf->get_value("plugin", "version");
- String description = cf->get_value("plugin", "description");
- String script = cf->get_value("plugin", "script");
-
- TreeItem *item = plugin_list->create_item(root);
- item->set_text(0, name);
- item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script + "\nDescription: " + description);
- item->set_metadata(0, d2);
- item->set_text(1, version);
- item->set_metadata(1, script);
- item->set_text(2, author);
- item->set_metadata(2, description);
- item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE);
- item->set_range_config(3, 0, 1, 1);
- item->set_text(3, "Inactive,Active");
- item->set_editable(3, true);
- item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
-
- if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) {
- item->set_custom_color(3, get_color("success_color", "Editor"));
- item->set_range(3, 1);
- } else {
- item->set_custom_color(3, get_color("disabled_font_color", "Editor"));
- item->set_range(3, 0);
+ if (!cf->has_section_key("plugin", "name")) {
+ WARN_PRINTS("Plugin config misses \"plugin/name\" key: " + path);
+ key_missing = true;
+ }
+ if (!cf->has_section_key("plugin", "author")) {
+ WARN_PRINTS("Plugin config misses \"plugin/author\" key: " + path);
+ key_missing = true;
+ }
+ if (!cf->has_section_key("plugin", "version")) {
+ WARN_PRINTS("Plugin config misses \"plugin/version\" key: " + path);
+ key_missing = true;
+ }
+ if (!cf->has_section_key("plugin", "description")) {
+ WARN_PRINTS("Plugin config misses \"plugin/description\" key: " + path);
+ key_missing = true;
+ }
+ if (!cf->has_section_key("plugin", "script")) {
+ WARN_PRINTS("Plugin config misses \"plugin/script\" key: " + path);
+ key_missing = true;
+ }
+
+ if (!key_missing) {
+ String d2 = plugins[i];
+ String name = cf->get_value("plugin", "name");
+ String author = cf->get_value("plugin", "author");
+ String version = cf->get_value("plugin", "version");
+ String description = cf->get_value("plugin", "description");
+ String script = cf->get_value("plugin", "script");
+
+ TreeItem *item = plugin_list->create_item(root);
+ item->set_text(0, name);
+ item->set_tooltip(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + script + "\n" + TTR("Description:") + " " + description);
+ item->set_metadata(0, d2);
+ item->set_text(1, version);
+ item->set_metadata(1, script);
+ item->set_text(2, author);
+ item->set_metadata(2, description);
+ item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE);
+ item->set_range_config(3, 0, 1, 1);
+ item->set_text(3, "Inactive,Active");
+ item->set_editable(3, true);
+ item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
+
+ if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) {
+ item->set_custom_color(3, get_color("success_color", "Editor"));
+ item->set_range(3, 1);
+ } else {
+ item->set_custom_color(3, get_color("disabled_font_color", "Editor"));
+ item->set_range(3, 0);
+ }
}
}
}
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 378dd34e39..d7b3c7733b 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2540,7 +2540,7 @@ void EditorPropertyResource::update_property() {
if (res.is_valid() != assign->is_toggle_mode()) {
assign->set_toggle_mode(res.is_valid());
}
-#ifdef TOOLS_ENABLED
+
if (res.is_valid() && get_edited_object()->editor_is_section_unfolded(get_edited_property())) {
if (!sub_inspector) {
@@ -2609,7 +2609,6 @@ void EditorPropertyResource::update_property() {
}
}
}
-#endif
}
preview->set_texture(Ref<Texture>());
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index d1371a04b1..ff19be8bd5 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -271,8 +271,6 @@ void EditorPropertyArray::update_property() {
edit->set_text(arrtype + " (size " + itos(array.call("size")) + ")");
-#ifdef TOOLS_ENABLED
-
bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
if (edit->is_pressed() != unfolded) {
edit->set_pressed(unfolded);
@@ -397,7 +395,6 @@ void EditorPropertyArray::update_property() {
vbox = NULL;
}
}
-#endif
}
void EditorPropertyArray::_remove_pressed(int p_index) {
@@ -643,8 +640,6 @@ void EditorPropertyDictionary::update_property() {
edit->set_text("Dictionary (size " + itos(dict.size()) + ")");
-#ifdef TOOLS_ENABLED
-
bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
if (edit->is_pressed() != unfolded) {
edit->set_pressed(unfolded);
@@ -959,7 +954,6 @@ void EditorPropertyDictionary::update_property() {
vbox = NULL;
}
}
-#endif
}
void EditorPropertyDictionary::_object_id_selected(const String &p_property, ObjectID p_id) {
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index c8ffc2744a..8acc41a2c7 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -624,6 +624,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S
uint8_t *imgw = imgdata.ptr();
Ref<AudioStreamPlayback> playback = stream->instance_playback();
+ ERR_FAIL_COND_V(playback.is_null(), Ref<Texture>());
float len_s = stream->get_length();
if (len_s == 0) {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index bded590351..edc454ad1c 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1436,8 +1436,6 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
return false;
}
-#ifdef TOOLS_ENABLED
-
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
@@ -1457,14 +1455,6 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return NULL;
}
-#else
-
-static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
-
- return NULL;
-}
-#endif
-
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
Dictionary d = p_data;
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 85ddcb8b9d..ecc631d045 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -74,14 +74,6 @@
#define MIN_FOV 0.01
#define MAX_FOV 179
-#ifdef TOOLS_ENABLED
-#define get_global_gizmo_transform get_global_gizmo_transform
-#define get_local_gizmo_transform get_local_gizmo_transform
-#else
-#define get_global_gizmo_transform get_global_transform
-#define get_local_gizmo_transform get_transform
-#endif
-
void SpatialEditorViewport::_update_camera(float p_interp_delta) {
bool is_orthogonal = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 202c7c9cf2..228b67990c 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -376,11 +376,12 @@ void CollisionObject2D::set_only_update_transform_changes(bool p_enable) {
void CollisionObject2D::_update_pickable() {
if (!is_inside_tree())
return;
- bool pickable = this->pickable && is_inside_tree() && is_visible_in_tree();
+
+ bool is_pickable = pickable && is_visible_in_tree();
if (area)
- Physics2DServer::get_singleton()->area_set_pickable(rid, pickable);
+ Physics2DServer::get_singleton()->area_set_pickable(rid, is_pickable);
else
- Physics2DServer::get_singleton()->body_set_pickable(rid, pickable);
+ Physics2DServer::get_singleton()->body_set_pickable(rid, is_pickable);
}
String CollisionObject2D::get_configuration_warning() const {
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 63301fc226..735b393171 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -105,7 +105,8 @@ void CollisionObject::_mouse_exit() {
void CollisionObject::_update_pickable() {
if (!is_inside_tree())
return;
- bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree();
+
+ bool pickable = ray_pickable && is_visible_in_tree();
if (area)
PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable);
else
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index fdffb26cb5..7827c66841 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -276,6 +276,11 @@ void GraphEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
port_grab_distance_horizontal = get_constant("port_grab_distance_horizontal");
port_grab_distance_vertical = get_constant("port_grab_distance_vertical");
+
+ zoom_minus->set_icon(get_icon("minus"));
+ zoom_reset->set_icon(get_icon("reset"));
+ zoom_plus->set_icon(get_icon("more"));
+ snap_button->set_icon(get_icon("snap"));
}
if (p_what == NOTIFICATION_READY) {
Size2 hmin = h_scroll->get_combined_minimum_size();
@@ -290,11 +295,6 @@ void GraphEdit::_notification(int p_what) {
h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
-
- zoom_minus->set_icon(get_icon("minus"));
- zoom_reset->set_icon(get_icon("reset"));
- zoom_plus->set_icon(get_icon("more"));
- snap_button->set_icon(get_icon("snap"));
}
if (p_what == NOTIFICATION_DRAW) {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 8223ea6d1e..1aed858c94 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -916,9 +916,12 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const {
- if (!underline_meta || selection.click)
+ if (!underline_meta)
return CURSOR_ARROW;
+ if (selection.click)
+ return CURSOR_IBEAM;
+
if (main->first_invalid_line < main->lines.size())
return CURSOR_ARROW; //invalid
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3c63f6b2c7..172c366c41 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -53,7 +53,8 @@ void SpinBox::_text_entered(const String &p_string) {
Ref<Expression> expr;
expr.instance();
- Error err = expr->parse(p_string);
+ // Ignore the prefix and suffix in the expression
+ Error err = expr->parse(p_string.trim_prefix(prefix + " ").trim_suffix(" " + suffix));
if (err != OK) {
return;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 1d434e5a2a..65554b1f5e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2194,12 +2194,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int row, col;
_get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col);
- if (mb->get_command() && highlighted_word != String()) {
-
- emit_signal("symbol_lookup", highlighted_word, row, col);
- return;
- }
-
// Toggle breakpoint on gutter click.
if (draw_breakpoint_gutter) {
int gutter = cache.style_normal->get_margin(MARGIN_LEFT);
@@ -2368,6 +2362,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
} else {
if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->get_command() && highlighted_word != String()) {
+ int row, col;
+ _get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col);
+
+ emit_signal("symbol_lookup", highlighted_word, row, col);
+ return;
+ }
+
dragging_minimap = false;
dragging_selection = false;
can_drag_minimap = false;
@@ -4613,7 +4615,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
return CURSOR_ARROW;
} else {
int xmargin_end = get_size().width - cache.style_normal->get_margin(MARGIN_RIGHT);
- if (p_pos.x > xmargin_end - minimap_width && p_pos.x <= xmargin_end) {
+ if (draw_minimap && p_pos.x > xmargin_end - minimap_width && p_pos.x <= xmargin_end) {
return CURSOR_ARROW;
}
diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp
index 3f7a110c1b..35696a0459 100644
--- a/scene/gui/viewport_container.cpp
+++ b/scene/gui/viewport_container.cpp
@@ -211,4 +211,5 @@ ViewportContainer::ViewportContainer() {
stretch = false;
shrink = 1;
set_process_input(true);
+ set_process_unhandled_input(true);
}
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index e21e47f8a8..6c922adbd2 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -60,10 +60,10 @@ Error HTTPRequest::_parse_url(const String &p_url) {
use_ssl = true;
port = 443;
} else {
- ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Malformed URL.");
+ ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Malformed URL: " + url + ".");
}
- ERR_FAIL_COND_V_MSG(url.length() < 1, ERR_INVALID_PARAMETER, "URL too short.");
+ ERR_FAIL_COND_V_MSG(url.length() < 1, ERR_INVALID_PARAMETER, "URL too short: " + url + ".");
int slash_pos = url.find("/");