summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/connections_dialog.cpp3
-rw-r--r--editor/editor_help.cpp132
-rw-r--r--editor/editor_properties.cpp13
-rw-r--r--editor/editor_properties.h4
-rw-r--r--editor/filesystem_dock.cpp1
-rw-r--r--editor/icons/icon_audio_stream_o_g_g_vorbis.svg1
-rw-r--r--editor/icons/icon_crosshair.svg1
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp4
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp15
-rw-r--r--editor/plugins/spatial_editor_plugin.h1
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp1
13 files changed, 98 insertions, 81 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index fa713349d4..4f684c7bdc 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1184,7 +1184,7 @@ void CodeTextEditor::move_lines_down() {
void CodeTextEditor::_delete_line(int p_line) {
// this is currently intended to be called within delete_lines()
- // so `begin_complex_operation` is ommitted here
+ // so `begin_complex_operation` is omitted here
text_editor->set_line(p_line, "");
if (p_line == 0 && text_editor->get_line_count() > 1) {
text_editor->cursor_set_line(1);
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 078ef62a5d..2ef5097345 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -127,6 +127,7 @@ void ConnectDialog::ok_pressed() {
}
}
emit_signal("connected");
+ hide();
}
void ConnectDialog::_cancel_pressed() {
@@ -291,6 +292,8 @@ bool ConnectDialog::is_editing() const {
*/
void ConnectDialog::init(Connection c, bool bEdit) {
+ set_hide_on_ok(false);
+
source = static_cast<Node *>(c.source);
signal = c.signal;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index a0c106441a..53c1d334d2 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -418,10 +418,10 @@ void EditorHelp::_update_doc() {
}
}
- if (found)
+ if (found) {
class_desc->pop();
-
- class_desc->add_newline();
+ class_desc->add_newline();
+ }
}
class_desc->add_newline();
@@ -430,9 +430,26 @@ void EditorHelp::_update_doc() {
// Brief description
if (cd.brief_description != "") {
+ class_desc->push_color(text_color);
+ class_desc->push_font(doc_bold_font);
+ class_desc->push_indent(1);
+ _add_text(cd.brief_description);
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ }
+
+ // Class description
+ if (cd.description != "") {
+
+ section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2));
+ description_line = class_desc->get_line_count() - 2;
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Brief Description"));
+ class_desc->add_text(TTR("Description"));
class_desc->pop();
class_desc->pop();
@@ -441,11 +458,51 @@ void EditorHelp::_update_doc() {
class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
- _add_text(cd.brief_description);
+ _add_text(cd.description);
+ class_desc->pop();
class_desc->pop();
class_desc->pop();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ class_desc->add_newline();
+ }
+
+ // Online tutorials
+ {
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Online Tutorials"));
+ class_desc->pop();
class_desc->pop();
+ class_desc->push_indent(1);
+
+ class_desc->push_font(doc_code_font);
+
class_desc->add_newline();
+ // class_desc->add_newline();
+
+ if (cd.tutorials.size() != 0) {
+
+ for (int i = 0; i < cd.tutorials.size(); i++) {
+ String link = cd.tutorials[i];
+ String linktxt = link;
+ int seppos = linktxt.find("//");
+ if (seppos != -1) {
+ linktxt = link.right(seppos + 2);
+ }
+
+ class_desc->push_color(symbol_color);
+ class_desc->append_bbcode("[url=" + link + "]" + linktxt + "[/url]");
+ class_desc->pop();
+ class_desc->add_newline();
+ }
+ } else {
+ class_desc->push_color(comment_color);
+ class_desc->append_bbcode(TTR("There are currently no tutorials for this class, you can [color=$color][url=$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/url][/color].").replace("$url2", REQUEST_URL).replace("$url", CONTRIBUTE2_URL).replace("$color", link_color_text));
+ class_desc->pop();
+ }
+ class_desc->pop();
+ class_desc->pop();
class_desc->add_newline();
class_desc->add_newline();
}
@@ -922,71 +979,6 @@ void EditorHelp::_update_doc() {
}
}
- // Class description
- if (cd.description != "") {
-
- section_line.push_back(Pair<String, int>(TTR("Class Description"), class_desc->get_line_count() - 2));
- description_line = class_desc->get_line_count() - 2;
- class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Class Description"));
- class_desc->pop();
- class_desc->pop();
-
- class_desc->add_newline();
- class_desc->add_newline();
- class_desc->push_color(text_color);
- class_desc->push_font(doc_font);
- class_desc->push_indent(1);
- _add_text(cd.description);
- class_desc->pop();
- class_desc->pop();
- class_desc->pop();
- class_desc->add_newline();
- class_desc->add_newline();
- class_desc->add_newline();
- }
-
- // Online tutorials
- {
- class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Online Tutorials"));
- class_desc->pop();
- class_desc->pop();
- class_desc->push_indent(1);
-
- class_desc->push_font(doc_code_font);
-
- class_desc->add_newline();
- // class_desc->add_newline();
-
- if (cd.tutorials.size() != 0) {
-
- for (int i = 0; i < cd.tutorials.size(); i++) {
- String link = cd.tutorials[i];
- String linktxt = link;
- int seppos = linktxt.find("//");
- if (seppos != -1) {
- linktxt = link.right(seppos + 2);
- }
-
- class_desc->push_color(symbol_color);
- class_desc->append_bbcode("[url=" + link + "]" + linktxt + "[/url]");
- class_desc->pop();
- class_desc->add_newline();
- }
- } else {
- class_desc->push_color(comment_color);
- class_desc->append_bbcode(TTR("There are currently no tutorials for this class, you can [color=$color][url=$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/url][/color].").replace("$url2", REQUEST_URL).replace("$url", CONTRIBUTE2_URL).replace("$color", link_color_text));
- class_desc->pop();
- }
- class_desc->pop();
- class_desc->pop();
- class_desc->add_newline();
- class_desc->add_newline();
- }
-
// Property descriptions
if (property_descr) {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index c049096c35..c134786b89 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -805,10 +805,10 @@ EditorPropertyLayers::EditorPropertyLayers() {
///////////////////// INT /////////////////////////
-void EditorPropertyInteger::_value_changed(double val) {
+void EditorPropertyInteger::_value_changed(int64_t val) {
if (setting)
return;
- emit_changed(get_edited_property(), (int64_t)val);
+ emit_changed(get_edited_property(), val);
}
void EditorPropertyInteger::update_property() {
@@ -816,14 +816,19 @@ void EditorPropertyInteger::update_property() {
setting = true;
spin->set_value(val);
setting = false;
+#ifdef DEBUG_ENABLED
+ // If spin (currently EditorSplinSlider : Range) is changed so that it can use int64_t, then the below warning wouldn't be a problem.
+ if (val != (int64_t)(double)(val)) {
+ WARN_PRINT("Cannot reliably represent '" + itos(val) + "' in the inspector, value is too large.");
+ }
+#endif
}
void EditorPropertyInteger::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyInteger::_value_changed);
}
-void EditorPropertyInteger::setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser) {
+void EditorPropertyInteger::setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser) {
spin->set_min(p_min);
spin->set_max(p_max);
spin->set_step(p_step);
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 4c7358597e..1853a6b6e1 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -263,14 +263,14 @@ class EditorPropertyInteger : public EditorProperty {
GDCLASS(EditorPropertyInteger, EditorProperty);
EditorSpinSlider *spin;
bool setting;
- void _value_changed(double p_val);
+ void _value_changed(int64_t p_val);
protected:
static void _bind_methods();
public:
virtual void update_property();
- void setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser);
+ void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser);
EditorPropertyInteger();
};
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 93e9cc58fb..62effb406d 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -140,6 +140,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
subdirectory_item->set_collapsed(false);
} else if (dname != "res://") {
subdirectory_item->get_parent()->remove_child(subdirectory_item);
+ memdelete(subdirectory_item);
}
}
diff --git a/editor/icons/icon_audio_stream_o_g_g_vorbis.svg b/editor/icons/icon_audio_stream_o_g_g_vorbis.svg
new file mode 100644
index 0000000000..a8d6fb6bf1
--- /dev/null
+++ b/editor/icons/icon_audio_stream_o_g_g_vorbis.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="8" x2="8" y1="1" y2="15"><stop offset="0" stop-color="#ff7a7a"/><stop offset=".5" stop-color="#e1dc7a"/><stop offset="1" stop-color="#66ff9e"/></linearGradient><path d="m11.971 1.002c-.08326.00207-.16593.014541-.24609.037109l-7 2c-.42881.12287-.7244.51487-.72461.96094v5.5508c-.16454-.033679-.33205-.050692-.5-.050781-1.3807 0-2.5 1.1193-2.5 2.5-.00000475 1.3807 1.1193 2.5 2.5 2.5 1.3456-.0013 2.4488-1.0674 2.4961-2.4121.0025906-.029226.003894-.058551.0039062-.087891v-7.2441l5-1.4277v3.1719l2-1v-3.5c-.000916-.56314-.4664-1.0145-1.0293-.99805zm-1.4707 6.998c-.277 0-.5.223-.5.5v5c0 .277.223.5.5.5s.5-.223.5-.5v-5c0-.277-.223-.5-.5-.5zm2 1c-.277 0-.5.223-.5.5v3c0 .277.223.5.5.5s.5-.223.5-.5v-3c0-.277-.223-.5-.5-.5zm-4 1c-.277 0-.5.223-.5.5v1c0 .277.223.5.5.5s.5-.223.5-.5v-1c0-.277-.223-.5-.5-.5zm6 0c-.277 0-.5.223-.5.5v1c0 .277.223.5.5.5s.5-.223.5-.5v-1c0-.277-.223-.5-.5-.5z" fill="url(#a)"/></svg> \ No newline at end of file
diff --git a/editor/icons/icon_crosshair.svg b/editor/icons/icon_crosshair.svg
new file mode 100644
index 0000000000..b6fa5ec654
--- /dev/null
+++ b/editor/icons/icon_crosshair.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m6 1v5h-5v1 3h5v5h4v-5h5v-4h-5v-5z" fill-opacity=".627451"/><path d="m2 7v2l5.0000803.0000197-.0000803 4.9999803h2l-.0000803-4.9999803 5.0000803-.0000197v-2l-5.0000803.0001803.0000803-5.0001803h-2l.0000803 5.0001803z" fill="#fefefe" fill-opacity=".862745"/></svg> \ No newline at end of file
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 5d73ffa209..bdef108ef2 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -726,9 +726,9 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
uint8_t jpg_signature[3] = { 255, 216, 255 };
if (r.ptr()) {
- if (memcmp(&r[0], &png_signature[0], 8) == 0) {
+ if ((memcmp(&r[0], &png_signature[0], 8) == 0) && Image::_png_mem_loader_func) {
image->copy_internals_from(Image::_png_mem_loader_func(r.ptr(), len));
- } else if (memcmp(&r[0], &jpg_signature[0], 3) == 0) {
+ } else if ((memcmp(&r[0], &jpg_signature[0], 3) == 0) && Image::_jpg_mem_loader_func) {
image->copy_internals_from(Image::_jpg_mem_loader_func(r.ptr(), len));
}
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index dbb2934ffb..04d595461d 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -1477,7 +1477,6 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_hscroll->set_step(0.001);
uv_edit_draw->add_child(uv_hscroll);
uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
- uv_hscroll->set_margin(MARGIN_RIGHT, -uv_vscroll->get_size().x * EDSCALE);
uv_hscroll->connect("value_changed", this, "_uv_scroll_changed");
bone_scroll_main_vb = memnew(VBoxContainer);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 252f067eb1..31dce720db 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2135,6 +2135,13 @@ void SpatialEditorViewport::_notification(int p_what) {
call_deferred("update_transform_gizmo_view");
}
+ if (p_what == NOTIFICATION_READY) {
+ // The crosshair icon doesn't depend on the editor theme.
+ crosshair->set_texture(get_icon("Crosshair", "EditorIcons"));
+ // Set the anchors and margins after changing the icon to ensure it's centered correctly.
+ crosshair->set_anchors_and_margins_preset(PRESET_CENTER);
+ }
+
if (p_what == NOTIFICATION_PROCESS) {
real_t delta = get_process_delta_time();
@@ -2255,6 +2262,10 @@ void SpatialEditorViewport::_notification(int p_what) {
current_camera = camera;
}
+ // Display the crosshair only while freelooking. Hide it otherwise,
+ // as the crosshair can be distracting.
+ crosshair->set_visible(freelook_active);
+
if (show_info) {
String text;
text += "X: " + rtos(current_camera->get_translation().x).pad_decimals(1) + "\n";
@@ -3546,6 +3557,10 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
camera->make_current();
surface->set_focus_mode(FOCUS_ALL);
+ crosshair = memnew(TextureRect);
+ crosshair->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ surface->add_child(crosshair);
+
VBoxContainer *vbox = memnew(VBoxContainer);
surface->add_child(vbox);
vbox->set_position(Point2(10, 10) * EDSCALE);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 356646221e..5cc2b24cbb 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -217,6 +217,7 @@ private:
bool freelook_active;
real_t freelook_speed;
+ TextureRect *crosshair;
Label *info_label;
Label *fps_label;
Label *cinema_label;
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 8672e936e0..f9b1e3b43a 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -1028,7 +1028,6 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
hscroll->set_step(0.001);
edit_draw->add_child(hscroll);
hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
- hscroll->set_margin(MARGIN_RIGHT, -vscroll->get_size().x * EDSCALE);
hscroll->connect("value_changed", this, "_scroll_changed");
updating_scroll = false;