summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/connections_dialog.cpp31
-rw-r--r--editor/connections_dialog.h1
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp4
-rw-r--r--editor/plugins/script_text_editor.cpp14
4 files changed, 42 insertions, 8 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 2ef5097345..1853133bc7 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -146,7 +146,7 @@ void ConnectDialog::_tree_node_selected() {
return;
dst_path = source->get_path_to(current);
- get_ok()->set_disabled(false);
+ _update_ok_enabled();
}
/*
@@ -210,6 +210,27 @@ void ConnectDialog::_remove_bind() {
cdbinds->notify_changed();
}
+/*
+ * Enables or disables the connect button. The connect button is enabled if a
+ * node is selected and valid in the selected mode.
+ */
+void ConnectDialog::_update_ok_enabled() {
+
+ Node *target = tree->get_selected();
+
+ if (target == nullptr) {
+ get_ok()->set_disabled(true);
+ return;
+ }
+
+ if (!advanced->is_pressed() && target->get_script().is_null()) {
+ get_ok()->set_disabled(true);
+ return;
+ }
+
+ get_ok()->set_disabled(false);
+}
+
void ConnectDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -225,6 +246,7 @@ void ConnectDialog::_bind_methods() {
ClassDB::bind_method("_tree_item_activated", &ConnectDialog::_tree_item_activated);
ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
+ ClassDB::bind_method("_update_ok_enabled", &ConnectDialog::_update_ok_enabled);
ADD_SIGNAL(MethodInfo("connected"));
}
@@ -301,13 +323,12 @@ void ConnectDialog::init(Connection c, bool bEdit) {
tree->set_marked(source, true);
if (c.target) {
- get_ok()->set_disabled(false);
set_dst_node(static_cast<Node *>(c.target));
set_dst_method(c.method);
- } else {
- get_ok()->set_disabled(true);
}
+ _update_ok_enabled();
+
bool bDeferred = (c.flags & CONNECT_DEFERRED) == CONNECT_DEFERRED;
bool bOneshot = (c.flags & CONNECT_ONESHOT) == CONNECT_ONESHOT;
@@ -350,6 +371,8 @@ void ConnectDialog::_advanced_pressed() {
error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root()));
}
+ _update_ok_enabled();
+
set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2);
}
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 4f46e145e1..c30413953a 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -80,6 +80,7 @@ class ConnectDialog : public ConfirmationDialog {
void _add_bind();
void _remove_bind();
void _advanced_pressed();
+ void _update_ok_enabled();
protected:
void _notification(int p_what);
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 7de6db7add..a418915830 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1302,6 +1302,8 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
if (mimetype.findn("png") != -1) {
//is a png
+ ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, ERR_UNAVAILABLE);
+
const Ref<Image> img = Image::_png_mem_loader_func(data_ptr, data_size);
ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT);
@@ -1316,6 +1318,8 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
if (mimetype.findn("jpeg") != -1) {
//is a jpg
+ ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, ERR_UNAVAILABLE);
+
const Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size);
ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index f0e4a4bfdc..1432c3fc63 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -691,13 +691,16 @@ void ScriptTextEditor::_update_bookmark_list() {
bookmarks_menu->add_separator();
for (int i = 0; i < bookmark_list.size(); i++) {
- String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).strip_edges();
+ // Strip edges to remove spaces or tabs.
+ // Also replace any tabs by spaces, since we can't print tabs in the menu.
+ String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).replace("\t", " ").strip_edges();
+
// Limit the size of the line if too big.
if (line.length() > 50) {
line = line.substr(0, 50);
}
- bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\"");
+ bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - `" + line + "`");
bookmarks_menu->set_item_metadata(bookmarks_menu->get_item_count() - 1, bookmark_list[i]);
}
}
@@ -841,13 +844,16 @@ void ScriptTextEditor::_update_breakpoint_list() {
breakpoints_menu->add_separator();
for (int i = 0; i < breakpoint_list.size(); i++) {
- String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).strip_edges();
+ // Strip edges to remove spaces or tabs.
+ // Also replace any tabs by spaces, since we can't print tabs in the menu.
+ String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).replace("\t", " ").strip_edges();
+
// Limit the size of the line if too big.
if (line.length() > 50) {
line = line.substr(0, 50);
}
- breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - \"" + line + "\"");
+ breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - `" + line + "`");
breakpoints_menu->set_item_metadata(breakpoints_menu->get_item_count() - 1, breakpoint_list[i]);
}
}