summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/SCsub7
-rw-r--r--editor/animation_track_editor.cpp8
-rw-r--r--editor/code_editor.cpp18
-rw-r--r--editor/collada/SCsub2
-rw-r--r--editor/doc/SCsub2
-rw-r--r--editor/editor_export.h2
-rw-r--r--editor/editor_file_dialog.cpp9
-rw-r--r--editor/editor_fonts.cpp27
-rw-r--r--editor/editor_inspector.cpp13
-rw-r--r--editor/editor_log.cpp36
-rw-r--r--editor/editor_node.cpp19
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_plugin.cpp3
-rw-r--r--editor/editor_properties.cpp53
-rw-r--r--editor/editor_properties.h2
-rw-r--r--editor/editor_properties_array_dict.cpp8
-rw-r--r--editor/editor_themes.cpp29
-rw-r--r--editor/fileserver/SCsub2
-rw-r--r--editor/filesystem_dock.cpp324
-rw-r--r--editor/filesystem_dock.h4
-rw-r--r--editor/find_in_files.cpp36
-rw-r--r--editor/find_in_files.h7
-rw-r--r--editor/icons/SCsub4
-rw-r--r--editor/icons/icon_GUI_viewport_hdiagsplitter.svg64
-rw-r--r--editor/icons/icon_GUI_viewport_vdiagsplitter.svg68
-rw-r--r--editor/icons/icon_GUI_viewport_vhsplitter.svg63
-rw-r--r--editor/import/SCsub2
-rw-r--r--editor/import/editor_import_collada.cpp114
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp12
-rw-r--r--editor/inspector_dock.cpp2
-rw-r--r--editor/plugins/SCsub2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp13
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h2
-rw-r--r--editor/plugins/baked_lightmap_editor_plugin.cpp1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp75
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h1
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/curve_editor_plugin.cpp4
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp8
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp19
-rw-r--r--editor/plugins/script_text_editor.cpp14
-rw-r--r--editor/plugins/shader_editor_plugin.cpp21
-rw-r--r--editor/plugins/skeleton_editor_plugin.cpp3
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp195
-rw-r--r--editor/plugins/spatial_editor_plugin.h7
-rw-r--r--editor/plugins/sprite_editor_plugin.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/pvrtc_compress.cpp6
-rw-r--r--editor/scene_tree_dock.cpp118
-rw-r--r--editor/scene_tree_dock.h3
-rw-r--r--editor/script_editor_debugger.cpp35
-rw-r--r--editor/settings_config_dialog.cpp2
-rw-r--r--editor/spatial_editor_gizmos.cpp1
54 files changed, 825 insertions, 654 deletions
diff --git a/editor/SCsub b/editor/SCsub
index 82b982eef2..82a4ecb6c0 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -1,6 +1,7 @@
#!/usr/bin/env python
Import('env')
+
env.editor_sources = []
import os
@@ -78,7 +79,9 @@ if env['tools']:
env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header))
env.add_source_files(env.editor_sources, "*.cpp")
- env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
+ env_thirdparty = env.Clone()
+ env_thirdparty.disable_warnings()
+ env_thirdparty.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
SConscript('collada/SCsub')
SConscript('doc/SCsub')
@@ -89,5 +92,3 @@ if env['tools']:
lib = env.add_library("editor", env.editor_sources)
env.Prepend(LIBS=[lib])
-
- Export('env')
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index ac28fb9b99..77be561477 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_track_editor.h"
+
#include "animation_track_editor_plugins.h"
#include "core/os/keyboard.h"
#include "editor/animation_bezier_editor.h"
@@ -772,9 +773,6 @@ void AnimationTimelineEdit::_notification(int p_what) {
hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
draw_texture(hsize_icon, hsize_rect.position);
- float keys_from = get_value();
- float keys_to = keys_from + zoomw / scale;
-
{
float time_min = 0;
float time_max = animation->get_length();
@@ -4923,8 +4921,8 @@ AnimationTrackEditor::AnimationTrackEditor() {
//this shortcut will be checked from the track itself. so no need to enable it here (will conflict with scenetree dock)
edit->get_popup()->add_separator();
- edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Goto Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
- edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTR("Goto Prev Step"), KEY_MASK_CMD | KEY_LEFT), EDIT_GOTO_PREV_STEP);
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Go to Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTR("Go to Previous Step"), KEY_MASK_CMD | KEY_LEFT), EDIT_GOTO_PREV_STEP);
edit->get_popup()->add_separator();
edit->get_popup()->add_item(TTR("Optimize Animation"), EDIT_OPTIMIZE_ANIMATION);
edit->get_popup()->add_item(TTR("Clean-Up Animation"), EDIT_CLEAN_UP_ANIMATION);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 33d36e5e9c..79c22f667a 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -44,7 +44,7 @@ void GotoLineDialog::popup_find_line(TextEdit *p_edit) {
line->set_text(itos(text_editor->cursor_get_line()));
line->select_all();
- popup_centered(Size2(180, 80));
+ popup_centered(Size2(180, 80) * EDSCALE);
line->grab_focus();
}
@@ -65,16 +65,20 @@ void GotoLineDialog::ok_pressed() {
GotoLineDialog::GotoLineDialog() {
set_title(TTR("Go to Line"));
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
+ add_child(vbc);
+
Label *l = memnew(Label);
l->set_text(TTR("Line Number:"));
- l->set_position(Point2(5, 5));
- add_child(l);
+ vbc->add_child(l);
line = memnew(LineEdit);
- line->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- line->set_begin(Point2(15, 22));
- line->set_end(Point2(-15, 35));
- add_child(line);
+ vbc->add_child(line);
register_text_enter(line);
text_editor = NULL;
diff --git a/editor/collada/SCsub b/editor/collada/SCsub
index 04c9a827ef..2b1e889fb0 100644
--- a/editor/collada/SCsub
+++ b/editor/collada/SCsub
@@ -3,5 +3,3 @@
Import('env')
env.add_source_files(env.editor_sources, "*.cpp")
-
-Export('env')
diff --git a/editor/doc/SCsub b/editor/doc/SCsub
index 04c9a827ef..2b1e889fb0 100644
--- a/editor/doc/SCsub
+++ b/editor/doc/SCsub
@@ -3,5 +3,3 @@
Import('env')
env.add_source_files(env.editor_sources, "*.cpp")
-
-Export('env')
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 420f383f95..b4ee5b89e7 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -37,10 +37,10 @@
#include "scene/main/timer.h"
#include "scene/resources/texture.h"
-class EditorProgress;
class FileAccess;
class EditorExportPlatform;
class EditorFileSystemDirectory;
+struct EditorProgress;
class EditorExportPreset : public Reference {
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 08fd8a1319..38bdba31ea 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -209,6 +209,10 @@ void EditorFileDialog::update_dir() {
case MODE_OPEN_DIR:
get_ok()->set_text(TTR("Select Current Folder"));
break;
+ case MODE_OPEN_ANY:
+ case MODE_SAVE_FILE:
+ // FIXME: Implement, or refactor to avoid duplication with set_mode
+ break;
}
}
@@ -504,6 +508,11 @@ void EditorFileDialog::_items_clear_selection() {
get_ok()->set_disabled(false);
get_ok()->set_text(TTR("Select Current Folder"));
break;
+
+ case MODE_OPEN_ANY:
+ case MODE_SAVE_FILE:
+ // FIXME: Implement, or refactor to avoid duplication with set_mode
+ break;
}
}
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index ea99c882e4..8b1818b595 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -37,33 +37,6 @@
#include "scene/resources/default_theme/default_theme.h"
#include "scene/resources/dynamic_font.h"
-static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p_charcount, const int *p_chars, const Ref<Texture> &p_texture) {
-
- Ref<BitmapFont> font(memnew(BitmapFont));
- font->add_texture(p_texture);
-
- for (int i = 0; i < p_charcount; i++) {
-
- const int *c = &p_chars[i * 8];
-
- int chr = c[0];
- Rect2 frect;
- frect.position.x = c[1];
- frect.position.y = c[2];
- frect.size.x = c[3];
- frect.size.y = c[4];
- Point2 align(c[5], c[6] + p_valign);
- int advance = c[7];
-
- font->add_char(chr, 0, frect, align, advance);
- }
-
- font->set_height(p_height);
- font->set_ascent(p_ascent);
-
- return font;
-}
-
#define MAKE_FALLBACKS(m_name) \
m_name->add_fallback(FontArabic); \
m_name->add_fallback(FontHebrew); \
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 36c3102840..2c4168f1a0 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -36,9 +36,6 @@
#include "multi_node_edit.h"
#include "scene/resources/packed_scene.h"
-// TODO:
-// arrays and dictionary
-
Size2 EditorProperty::get_minimum_size() const {
Size2 ms;
@@ -267,11 +264,6 @@ void EditorProperty::_notification(int p_what) {
} else {
keying_rect = Rect2();
}
-
- //int vs = get_constant("vseparation", "Tree");
- Color guide_color = get_color("guide_color", "Tree");
- int vs_height = get_size().height; // vs / 2;
- // draw_line(Point2(0, vs_height), Point2(get_size().width, vs_height), guide_color);
}
}
@@ -1454,6 +1446,9 @@ void EditorInspector::update_tree() {
} else if (!(p.usage & PROPERTY_USAGE_EDITOR))
continue;
+ if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && VS::get_singleton()->is_low_end())
+ continue; //do not show this property in low end gfx
+
if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
continue;
}
@@ -1986,7 +1981,7 @@ void EditorInspector::_property_keyed(const String &p_path) {
if (!object)
return;
- emit_signal("property_keyed", p_path, object->get(p_path), false); //second param is deprecated
+ emit_signal("property_keyed", p_path, object->get(p_path), true); //second param is deprecated
}
void EditorInspector::_property_keyed_with_value(const String &p_path, const Variant &p_value) {
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 3fc35810df..5f5c46f4a7 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -49,11 +49,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
err_str = String(p_file) + ":" + itos(p_line) + " - " + String(p_error);
}
- /*
- if (!self->is_visible_in_tree())
- self->emit_signal("show_request");
- */
-
if (p_type == ERR_HANDLER_WARNING) {
self->add_message(err_str, MSG_TYPE_WARNING);
} else {
@@ -76,17 +71,6 @@ void EditorLog::_notification(int p_what) {
}
}
}
-
- /*if (p_what==NOTIFICATION_DRAW) {
-
- RID ci = get_canvas_item();
- get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
- int top_ofs = 20;
- int border_ofs=4;
- Ref<StyleBox> style = get_stylebox("normal","TextEdit");
-
- style->draw(ci,Rect2( Point2(border_ofs,top_ofs),get_size()-Size2(border_ofs*2,top_ofs+border_ofs)));
- }*/
}
void EditorLog::_clear_request() {
@@ -105,6 +89,8 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
bool restore = p_type != MSG_TYPE_STD;
switch (p_type) {
+ case MSG_TYPE_STD: {
+ } break;
case MSG_TYPE_ERROR: {
log->push_color(get_color("error_color", "Editor"));
Ref<Texture> icon = get_icon("Error", "EditorIcons");
@@ -122,7 +108,6 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
}
log->add_text(p_msg);
- //button->set_text(p_msg);
if (restore)
log->pop();
@@ -132,21 +117,6 @@ void EditorLog::set_tool_button(ToolButton *p_tool_button) {
tool_button = p_tool_button;
}
-/*
-void EditorLog::_dragged(const Point2& p_ofs) {
-
- int ofs = ec->get_minsize().height;
- ofs = ofs-p_ofs.y;
- if (ofs<50)
- ofs=50;
- if (ofs>300)
- ofs=300;
- ec->set_minsize(Size2(ec->get_minsize().width,ofs));
- minimum_size_changed();
-
-}
-*/
-
void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) {
EditorLog *self = (EditorLog *)p_self;
@@ -156,7 +126,6 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) {
void EditorLog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request);
- //ClassDB::bind_method(D_METHOD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL(MethodInfo("clear_request"));
}
@@ -187,7 +156,6 @@ EditorLog::EditorLog() {
log->set_h_size_flags(SIZE_EXPAND_FILL);
vb->add_child(log);
add_message(VERSION_FULL_NAME " (c) 2007-2018 Juan Linietsky, Ariel Manzur & Godot Contributors.");
- //log->add_text("Initialization Complete.\n"); //because it looks cool.
eh.errfunc = _error_handler;
eh.userdata = this;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 03746fb8b7..ea063fa798 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -36,7 +36,6 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/stream_peer_ssl.h"
-#include "core/io/zip_io.h"
#include "core/message_queue.h"
#include "core/os/file_access.h"
#include "core/os/input.h"
@@ -3202,7 +3201,7 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
}
}
- if (p_fallback.length())
+ if (p_fallback.length() && gui_base->has_icon(p_fallback, "EditorIcons"))
return gui_base->get_icon(p_fallback, "EditorIcons");
return NULL;
@@ -4523,6 +4522,16 @@ void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
}
}
+void EditorNode::_update_video_driver_color() {
+
+ //todo probably should de-harcode this and add to editor settings
+ if (video_driver->get_text() == "GLES2") {
+ video_driver->add_color_override("font_color", Color::hex(0x5586a4ff));
+ } else if (video_driver->get_text() == "GLES3") {
+ video_driver->add_color_override("font_color", Color::hex(0xa5557dff));
+ }
+}
+
void EditorNode::_video_driver_selected(int p_which) {
String driver = video_driver->get_item_metadata(p_which);
@@ -4536,6 +4545,7 @@ void EditorNode::_video_driver_selected(int p_which) {
video_driver_request = driver;
video_restart_dialog->popup_centered_minsize();
video_driver->select(video_driver_current);
+ _update_video_driver_color();
}
void EditorNode::_bind_methods() {
@@ -4839,7 +4849,7 @@ EditorNode::EditorNode() {
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
- EDITOR_DEF("interface/inspector/horizontal_vector3_editing", true);
+ EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial,Script");
EDITOR_DEF("run/auto_save/save_before_running", true);
@@ -5398,6 +5408,7 @@ EditorNode::EditorNode() {
video_driver->set_focus_mode(Control::FOCUS_NONE);
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
video_driver->connect("item_selected", this, "_video_driver_selected");
+ video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts"));
menu_hb->add_child(video_driver);
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
@@ -5414,6 +5425,8 @@ EditorNode::EditorNode() {
}
}
+ _update_video_driver_color();
+
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index bdbe0a245b..0096748ed1 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -208,6 +208,7 @@ private:
int video_driver_current;
String video_driver_request;
void _video_driver_selected(int);
+ void _update_video_driver_color();
// Split containers
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 1ad23963a9..dd3a8aa307 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -39,6 +39,7 @@
#include "scene/3d/camera.h"
#include "scene/gui/popup_menu.h"
#include "servers/visual_server.h"
+
Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) {
Vector<Ref<Mesh> > meshes;
@@ -522,7 +523,7 @@ int EditorPlugin::update_overlays() const {
if (SpatialEditor::get_singleton()->is_visible()) {
int count = 0;
- for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *vp = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (vp->is_visible()) {
vp->update_surface();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 3439133809..c5c78b2590 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -108,6 +108,7 @@ void EditorPropertyMultilineText::_open_big_text() {
if (!big_text_dialog) {
big_text = memnew(TextEdit);
big_text->connect("text_changed", this, "_big_text_changed");
+ big_text->set_wrap_enabled(true);
big_text_dialog = memnew(AcceptDialog);
big_text_dialog->add_child(big_text);
big_text_dialog->set_title("Edit Text:");
@@ -152,6 +153,7 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() {
set_bottom_editor(hb);
text = memnew(TextEdit);
text->connect("text_changed", this, "_text_changed");
+ text->set_wrap_enabled(true);
add_focusable(text);
hb->add_child(text);
text->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -817,10 +819,10 @@ void EditorPropertyInteger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyInteger::_value_changed);
}
-void EditorPropertyInteger::setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser) {
+void EditorPropertyInteger::setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser) {
spin->set_min(p_min);
spin->set_max(p_max);
- spin->set_step(1);
+ spin->set_step(p_step);
spin->set_allow_greater(p_allow_greater);
spin->set_allow_lesser(p_allow_lesser);
}
@@ -1183,21 +1185,39 @@ void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool
}
EditorPropertyRect2::EditorPropertyRect2() {
- VBoxContainer *vb = memnew(VBoxContainer);
- add_child(vb);
+
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
+
+ BoxContainer *bc;
+
+ if (horizontal) {
+ bc = memnew(HBoxContainer);
+ add_child(bc);
+ set_bottom_editor(bc);
+ } else {
+ bc = memnew(VBoxContainer);
+ add_child(bc);
+ }
+
static const char *desc[4] = { "x", "y", "w", "h" };
for (int i = 0; i < 4; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
spin[i]->set_flat(true);
-
- vb->add_child(spin[i]);
+ bc->add_child(spin[i]);
add_focusable(spin[i]);
spin[i]->connect("value_changed", this, "_value_changed");
+ if (horizontal) {
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ }
+ }
+
+ if (!horizontal) {
+ set_label_reference(spin[0]); //show text and buttons around this
}
- set_label_reference(spin[0]); //show text and buttons around this
setting = false;
}
+
///////////////////// VECTOR3 /////////////////////////
void EditorPropertyVector3::_value_changed(double val) {
@@ -1245,7 +1265,7 @@ void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, boo
}
EditorPropertyVector3::EditorPropertyVector3() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1326,7 +1346,7 @@ void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool
EditorPropertyPlane::EditorPropertyPlane() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1407,7 +1427,7 @@ void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p
}
EditorPropertyQuat::EditorPropertyQuat() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1759,7 +1779,7 @@ void EditorPropertyColor::_color_changed(const Color &p_color) {
void EditorPropertyColor::_popup_closed() {
- emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), false);
+ emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), true);
}
void EditorPropertyColor::_bind_methods() {
@@ -2636,7 +2656,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} else if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_2D_RENDER || p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
- EditorPropertyLayers::LayerType lt;
+ EditorPropertyLayers::LayerType lt = EditorPropertyLayers::LAYER_RENDER_2D;
switch (p_hint) {
case PROPERTY_HINT_LAYERS_2D_RENDER:
lt = EditorPropertyLayers::LAYER_RENDER_2D;
@@ -2663,7 +2683,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} else {
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
- int min = 0, max = 65535;
+ int min = 0, max = 65535, step = 1;
bool greater = true, lesser = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
@@ -2671,6 +2691,11 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
lesser = false;
min = p_hint_text.get_slice(",", 0).to_int();
max = p_hint_text.get_slice(",", 1).to_int();
+
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_int();
+ }
+
for (int i = 2; i < p_hint_text.get_slice_count(","); i++) {
String slice = p_hint_text.get_slice(",", i).strip_edges();
if (slice == "or_greater") {
@@ -2682,7 +2707,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
}
}
- editor->setup(min, max, greater, lesser);
+ editor->setup(min, max, step, greater, lesser);
add_property_editor(p_path, editor);
}
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index cfc433b880..18e70345aa 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -265,7 +265,7 @@ protected:
public:
virtual void update_property();
- void setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser);
+ void setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser);
EditorPropertyInteger();
};
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 808a8ac2f8..24360813a2 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -337,7 +337,7 @@ void EditorPropertyArray::update_property() {
} break;
case Variant::INT: {
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
- editor->setup(-100000, 100000, true, true);
+ editor->setup(-100000, 100000, 1, true, true);
prop = editor;
} break;
@@ -744,7 +744,7 @@ void EditorPropertyDictionary::update_property() {
page->connect("value_changed", this, "_page_changed");
} else {
// Queue childs for deletion, delete immediately might cause errors.
- for (size_t i = 1; i < vbox->get_child_count(); i++) {
+ for (int i = 1; i < vbox->get_child_count(); i++) {
vbox->get_child(i)->queue_delete();
}
}
@@ -800,7 +800,7 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::INT: {
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
- editor->setup(-100000, 100000, true, true);
+ editor->setup(-100000, 100000, 1, true, true);
prop = editor;
} break;
@@ -969,7 +969,7 @@ void EditorPropertyDictionary::update_property() {
pc->add_child(add_vbox);
}
prop->set_object_and_property(object.ptr(), prop_name);
- int change_index;
+ int change_index = 0;
if (i < amount) {
String cs = key.get_construct_string();
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 7ed7b920d9..9e81051dc2 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -36,7 +36,6 @@
#include "editor_scale.h"
#include "editor_settings.h"
#include "modules/svg/image_loader_svg.h"
-#include "time.h"
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
@@ -82,12 +81,6 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1,
return style;
}
-static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
- Ref<StyleBoxFlat> style = p_style->duplicate();
- style->set_border_color_all(p_color);
- return style;
-}
-
Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) {
Ref<ImageTexture> icon = memnew(ImageTexture);
@@ -199,8 +192,6 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
exceptions.push_back("StatusWarning");
exceptions.push_back("NodeWarning");
- clock_t begin_time = clock();
-
ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
// generate icons
@@ -235,8 +226,6 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
}
ImageLoaderSVG::set_convert_colors(NULL);
-
- clock_t end_time = clock();
#else
print_line("SVG support disabled, editor icons won't be rendered.");
#endif
@@ -260,8 +249,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
bool use_gn_headers = EDITOR_DEF("interface/theme/use_graph_node_headers", false);
- Color script_bg_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
-
Color preset_accent_color;
Color preset_base_color;
float preset_contrast;
@@ -491,8 +478,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tab_selected->set_bg_color(tab_color);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate();
- style_tab_unselected->set_draw_center(false);
- style_tab_unselected->set_border_width_all(0);
+ style_tab_unselected->set_bg_color(dark_color_1);
+ style_tab_unselected->set_border_color_all(dark_color_2);
// Editor background
theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size));
@@ -945,6 +932,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
+ float v = MAX(border_size * EDSCALE, 1.0);
+ style_tooltip->set_default_margin(MARGIN_LEFT, v);
+ style_tooltip->set_default_margin(MARGIN_TOP, v);
+ style_tooltip->set_default_margin(MARGIN_RIGHT, v);
+ style_tooltip->set_default_margin(MARGIN_BOTTOM, v);
style_tooltip->set_bg_color(Color(mono_color.r, mono_color.g, mono_color.b, 0.9));
style_tooltip->set_border_width_all(border_width);
style_tooltip->set_border_color_all(mono_color);
@@ -1064,8 +1056,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float mono_value = mono_color.r;
const Color alpha1 = Color(mono_value, mono_value, mono_value, 0.07);
const Color alpha2 = Color(mono_value, mono_value, mono_value, 0.14);
- const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.5);
- const Color alpha4 = Color(mono_value, mono_value, mono_value, 0.7);
+ const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.7);
// editor main color
const Color main_color = Color::html(dark_theme ? "#57b3ff" : "#0480ff");
@@ -1099,9 +1090,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6);
const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
const Color breakpoint_color = error_color;
- const Color code_folding_color = alpha4;
+ const Color code_folding_color = alpha3;
const Color search_result_color = alpha1;
- const Color search_result_border_color = alpha4;
+ const Color search_result_border_color = alpha3;
EditorSettings *setting = EditorSettings::get_singleton();
String text_editor_color_theme = setting->get("text_editor/theme/color_theme");
diff --git a/editor/fileserver/SCsub b/editor/fileserver/SCsub
index f1fa50148f..2b1e889fb0 100644
--- a/editor/fileserver/SCsub
+++ b/editor/fileserver/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
Import('env')
-Export('env')
+
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 607ced4573..2c69909f23 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -73,14 +73,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
if ((path.begins_with(lpath) && path != lpath)) {
subdirectory_item->set_collapsed(false);
} else {
- bool is_collapsed = true;
- for (int i = 0; i < uncollapsed_paths.size(); i++) {
- if (lpath == uncollapsed_paths[i]) {
- is_collapsed = false;
- break;
- }
- }
- subdirectory_item->set_collapsed(is_collapsed);
+ subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0);
}
if (searched_string.length() > 0 && dname.to_lower().find(searched_string) >= 0) {
parent_should_expand = true;
@@ -137,6 +130,11 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() {
Vector<String> uncollapsed_paths;
TreeItem *root = tree->get_root();
if (root) {
+ TreeItem *favorites_item = root->get_children();
+ if (!favorites_item->is_collapsed()) {
+ uncollapsed_paths.push_back(favorites_item->get_metadata(0));
+ }
+
TreeItem *resTree = root->get_children()->get_next();
if (resTree) {
Vector<TreeItem *> needs_check;
@@ -170,15 +168,14 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool
TreeItem *favorites = tree->create_item(root);
favorites->set_icon(0, get_icon("Favorites", "EditorIcons"));
favorites->set_text(0, TTR("Favorites:"));
- favorites->set_selectable(0, false);
+ favorites->set_metadata(0, "Favorites");
+ favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < favorite_paths.size(); i++) {
String fave = favorite_paths[i];
if (!fave.begins_with("res://"))
continue;
- if (display_mode_setting == DISPLAY_MODE_SETTING_SPLIT && !fave.ends_with("/"))
- continue;
Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
@@ -208,6 +205,12 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool
ti->set_tooltip(0, fave);
ti->set_selectable(0, true);
ti->set_metadata(0, fave);
+ if (!fave.ends_with("/")) {
+ Array udata;
+ udata.push_back(tree_update_id);
+ udata.push_back(ti);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(fave, this, "_tree_thumbnail_done", udata);
+ }
}
}
@@ -255,7 +258,7 @@ void FileSystemDock::_update_display_mode() {
button_tree->show();
file_list_vb->show();
- _update_files(true);
+ _update_file_list(true);
break;
case DISPLAY_MODE_SPLIT:
@@ -267,7 +270,7 @@ void FileSystemDock::_update_display_mode() {
_update_tree(_compute_uncollapsed_paths());
file_list_vb->show();
- _update_files(true);
+ _update_file_list(true);
break;
}
}
@@ -384,7 +387,7 @@ void FileSystemDock::_notification(int p_what) {
}
if (should_update_files) {
- _update_files(true);
+ _update_file_list(true);
}
// Change full tree mode
@@ -404,18 +407,26 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s
return;
// Tree item selected
- TreeItem *sel = tree->get_selected();
- if (!sel)
+ TreeItem *selected = tree->get_selected();
+ if (!selected)
return;
- path = sel->get_metadata(0);
+
+ TreeItem *favorites_item = tree->get_root()->get_children();
+ if (selected->get_parent() == favorites_item) {
+ // Go to the favorites if we click in the favorites and the path has changed
+ path = "Favorites";
+ } else {
+ path = selected->get_metadata(0);
+ // Note: the "Favorites" item also leads to this path
+ }
// Set the current path
- current_path->set_text(path);
+ _set_current_path_text(path);
_push_to_history();
// Update the file list
if (!updating_tree && display_mode == DISPLAY_MODE_SPLIT) {
- _update_files(false);
+ _update_file_list(false);
}
}
@@ -431,37 +442,52 @@ String FileSystemDock::get_current_path() const {
return path;
}
+void FileSystemDock::_set_current_path_text(const String &p_path) {
+ if (p_path == "Favorites") {
+ current_path->set_text(TTR("Favorites"));
+ } else {
+ current_path->set_text(path);
+ }
+}
+
void FileSystemDock::navigate_to_path(const String &p_path) {
- String target_path = p_path;
- // If the path is a file, do not only go to the directory in the tree, also select the file in the file list.
- if (target_path.ends_with("/")) {
- target_path = target_path.substr(0, target_path.length() - 1);
- }
- DirAccess *dirAccess = DirAccess::open("res://");
- if (dirAccess->file_exists(p_path)) {
- path = target_path;
- } else if (dirAccess->dir_exists(p_path)) {
- path = target_path + "/";
+ if (p_path == "Favorites") {
+ path = p_path;
} else {
- ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
- ERR_FAIL();
+ String target_path = p_path;
+ // If the path is a file, do not only go to the directory in the tree, also select the file in the file list.
+ if (target_path.ends_with("/")) {
+ target_path = target_path.substr(0, target_path.length() - 1);
+ }
+ DirAccess *dirAccess = DirAccess::open("res://");
+ if (dirAccess->file_exists(p_path)) {
+ path = target_path;
+ } else if (dirAccess->dir_exists(p_path)) {
+ path = target_path + "/";
+ } else {
+ ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
+ ERR_FAIL();
+ }
}
- current_path->set_text(path);
+ _set_current_path_text(path);
_push_to_history();
if (display_mode == DISPLAY_MODE_SPLIT) {
+ if (path.ends_with("/") || path == "Favorites") {
+ _go_to_file_list();
+ }
_update_tree(_compute_uncollapsed_paths());
- _update_files(false);
+ _update_file_list(false);
} else if (display_mode == DISPLAY_MODE_TREE_ONLY) {
- if (path.ends_with("/")) {
+ if (path.ends_with("/") || path == "Favorites") {
_go_to_file_list();
} else {
_update_tree(_compute_uncollapsed_paths());
}
} else { // DISPLAY_MODE_FILE_LIST_ONLY
- _update_files(true);
+ _update_file_list(true);
}
String file_name = p_path.get_file();
@@ -482,8 +508,14 @@ void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<T
Array uarr = p_udata;
int idx = uarr[0];
String file = uarr[1];
- if (idx < files->get_item_count() && files->get_item_text(idx) == file && files->get_item_metadata(idx) == p_path)
- files->set_item_icon(idx, p_preview);
+ if (idx < files->get_item_count() && files->get_item_text(idx) == file && files->get_item_metadata(idx) == p_path) {
+ if (file_list_display_mode == FILE_LIST_DISPLAY_LIST) {
+ if (p_small_preview.is_valid())
+ files->set_item_icon(idx, p_small_preview);
+ } else {
+ files->set_item_icon(idx, p_preview);
+ }
+ }
}
}
@@ -494,15 +526,6 @@ void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Textur
TreeItem *file_item = Object::cast_to<TreeItem>(uarr[1]);
if (file_item) {
file_item->set_icon(0, p_small_preview);
-
- // Update the favorite icon if needed
- TreeItem *favorite = tree->get_root()->get_children()->get_children();
- while (favorite) {
- if (favorite->get_metadata(0) == file_item->get_metadata(0)) {
- favorite->set_icon(0, p_small_preview);
- }
- favorite = favorite->get_next();
- }
}
}
}
@@ -527,7 +550,7 @@ void FileSystemDock::_change_file_display() {
EditorSettings::get_singleton()->set("docks/filesystem/files_display_mode", file_list_display_mode);
- _update_files(true);
+ _update_file_list(true);
}
void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List<FileInfo> *matches, int p_max_items) {
@@ -558,7 +581,7 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List<FileInfo> *
}
}
-void FileSystemDock::_update_files(bool p_keep_selection) {
+void FileSystemDock::_update_file_list(bool p_keep_selection) {
// Register the previously selected items
Set<String> cselection;
@@ -571,21 +594,10 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
files->clear();
- current_path->set_text(path);
+ _set_current_path_text(path);
String directory = path;
- if (directory.ends_with("/") && directory != "res://") {
- directory = directory.substr(0, directory.length() - 1);
- }
String file = "";
- EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
- if (!efd) {
- directory = path.get_base_dir();
- file = path.get_file();
- efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
- }
- if (!efd)
- return;
String ei = "EditorIcons";
int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size");
@@ -595,10 +607,9 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
Ref<Texture> file_thumbnail_broken;
bool use_thumbnails = (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS);
- bool use_folders = searched_string.length() == 0 && ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders);
if (use_thumbnails) {
-
+ // Thumbnails mode
files->set_max_columns(0);
files->set_icon_mode(ItemList::ICON_MODE_TOP);
files->set_fixed_column_width(thumbnail_size * 3 / 2);
@@ -616,6 +627,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
}
} else {
+ // No thumbnails
files->set_icon_mode(ItemList::ICON_MODE_LEFT);
files->set_max_columns(1);
files->set_max_text_lines(1);
@@ -623,57 +635,117 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
files->set_fixed_icon_size(Size2());
}
- if (use_folders) {
- Ref<Texture> folderIcon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
+ Ref<Texture> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
- if (directory != "res://") {
- files->add_item("..", folderIcon, true);
+ // Build the FileInfo list
+ List<FileInfo> filelist;
+ if (path == "Favorites") {
+ // Display the favorites
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ for (int i = 0; i < favorites.size(); i++) {
+ String favorite = favorites[i];
+ String text;
+ Ref<Texture> icon;
+ if (favorite == "res://") {
+ text = "/";
+ icon = folder_icon;
+ if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
+ files->add_item(text, icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, favorite);
+ }
+ } else if (favorite.ends_with("/")) {
+ text = favorite.substr(0, favorite.length() - 1).get_file();
+ icon = folder_icon;
+ if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
+ files->add_item(text, icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, favorite);
+ }
+ } else {
+ int index;
+ EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->find_file(favorite, &index);
+
+ FileInfo fi;
+ fi.name = favorite.get_file();
+ fi.path = favorite;
+ if (efd) {
+ fi.type = efd->get_file_type(index);
+ fi.import_broken = !efd->get_file_import_is_valid(index);
+ } else {
+ fi.type = "";
+ fi.import_broken = true;
+ }
+ fi.import_status = 0;
- String bd = directory.get_base_dir();
- if (bd != "res://" && !bd.ends_with("/"))
- bd += "/";
+ if (searched_string.length() == 0 || fi.name.to_lower().find(searched_string) >= 0) {
+ filelist.push_back(fi);
+ }
+ }
+ }
+ } else {
- files->set_item_metadata(files->get_item_count() - 1, bd);
- files->set_item_selectable(files->get_item_count() - 1, false);
+ // Get infos on the directory + file
+ if (directory.ends_with("/") && directory != "res://") {
+ directory = directory.substr(0, directory.length() - 1);
+ }
+ EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
+ if (!efd) {
+ directory = path.get_base_dir();
+ file = path.get_file();
+ efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
}
+ if (!efd)
+ return;
- for (int i = 0; i < efd->get_subdir_count(); i++) {
+ if (searched_string.length() > 0) {
+ // Display the search results
+ _search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
+ } else {
- String dname = efd->get_subdir(i)->get_name();
+ if ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders) {
+ // Display folders in the list
- files->add_item(dname, folderIcon, true);
- files->set_item_metadata(files->get_item_count() - 1, directory.plus_file(dname) + "/");
+ if (directory != "res://") {
+ files->add_item("..", folder_icon, true);
- if (cselection.has(dname)) {
- files->select(files->get_item_count() - 1, false);
- }
- }
- }
+ String bd = directory.get_base_dir();
+ if (bd != "res://" && !bd.ends_with("/"))
+ bd += "/";
- List<FileInfo> filelist;
+ files->set_item_metadata(files->get_item_count() - 1, bd);
+ files->set_item_selectable(files->get_item_count() - 1, false);
+ }
- if (searched_string.length() > 0) {
+ for (int i = 0; i < efd->get_subdir_count(); i++) {
- _search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
- filelist.sort();
- } else {
+ String dname = efd->get_subdir(i)->get_name();
- for (int i = 0; i < efd->get_file_count(); i++) {
+ files->add_item(dname, folder_icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, directory.plus_file(dname) + "/");
- FileInfo fi;
- fi.name = efd->get_file(i);
- fi.path = directory.plus_file(fi.name);
- fi.type = efd->get_file_type(i);
- fi.import_broken = !efd->get_file_import_is_valid(i);
- fi.import_status = 0;
+ if (cselection.has(dname)) {
+ files->select(files->get_item_count() - 1, false);
+ }
+ }
+ }
+
+ // Display the folder content
+ for (int i = 0; i < efd->get_file_count(); i++) {
+
+ FileInfo fi;
+ fi.name = efd->get_file(i);
+ fi.path = directory.plus_file(fi.name);
+ fi.type = efd->get_file_type(i);
+ fi.import_broken = !efd->get_file_import_is_valid(i);
+ fi.import_status = 0;
- filelist.push_back(fi);
+ filelist.push_back(fi);
+ }
}
filelist.sort();
}
+ // Fills the ItemList control node from the FileInfos
String oi = "Object";
-
for (List<FileInfo>::Element *E = filelist.front(); E; E = E->next()) {
FileInfo *finfo = &(E->get());
String fname = finfo->name;
@@ -685,6 +757,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
String tooltip = fname;
+ // Select the icons
if (!finfo->import_broken) {
type_icon = (has_icon(ftype, ei)) ? get_icon(ftype, ei) : get_icon(oi, ei);
big_icon = file_thumbnail;
@@ -694,25 +767,30 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
tooltip += "\n" + TTR("Status: Import of file failed. Please fix file and reimport manually.");
}
+ // Add the item to the ItemList
int item_index;
if (use_thumbnails) {
files->add_item(fname, big_icon, true);
item_index = files->get_item_count() - 1;
files->set_item_metadata(item_index, fpath);
files->set_item_tag_icon(item_index, type_icon);
- if (!finfo->import_broken) {
- Array udata;
- udata.resize(2);
- udata[0] = item_index;
- udata[1] = fname;
- EditorResourcePreview::get_singleton()->queue_resource_preview(fpath, this, "_file_list_thumbnail_done", udata);
- }
+
} else {
files->add_item(fname, type_icon, true);
item_index = files->get_item_count() - 1;
files->set_item_metadata(item_index, fpath);
}
+ // Generate the preview
+ if (!finfo->import_broken) {
+ Array udata;
+ udata.resize(2);
+ udata[0] = item_index;
+ udata[1] = fname;
+ EditorResourcePreview::get_singleton()->queue_resource_preview(fpath, this, "_file_list_thumbnail_done", udata);
+ }
+
+ // Select the items
if (cselection.has(fname))
files->select(item_index, false);
@@ -721,6 +799,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
files->ensure_current_is_visible();
}
+ // Tooltip
if (finfo->sources.size()) {
for (int j = 0; j < finfo->sources.size(); j++) {
tooltip += "\nSource: " + finfo->sources[j];
@@ -736,14 +815,14 @@ void FileSystemDock::_select_file(const String p_path) {
if (fpath != "res://") {
fpath = fpath.substr(0, fpath.length() - 1);
}
- navigate_to_path(fpath);
- } else {
+ } else if (fpath != "Favorites") {
if (ResourceLoader::get_resource_type(fpath) == "PackedScene") {
editor->open_request(fpath);
} else {
editor->load_resource(fpath);
}
}
+ navigate_to_path(fpath);
}
void FileSystemDock::_tree_activate_file() {
@@ -764,9 +843,12 @@ void FileSystemDock::_go_to_file_list() {
file_list_view = true;
_update_display_mode();
} else {
- bool collapsed = tree->get_selected()->is_collapsed();
- tree->get_selected()->set_collapsed(!collapsed);
- _update_files(false);
+ TreeItem *selected = tree->get_selected();
+ if (selected) {
+ bool collapsed = selected->is_collapsed();
+ selected->set_collapsed(!collapsed);
+ }
+ _update_file_list(false);
}
}
@@ -809,7 +891,7 @@ void FileSystemDock::_fs_changed() {
}
if (file_list_vb->is_visible()) {
- _update_files(true);
+ _update_file_list(true);
}
set_process(false);
@@ -846,7 +928,7 @@ void FileSystemDock::_bw_history() {
void FileSystemDock::_update_history() {
path = history[history_pos];
- current_path->set_text(path);
+ _set_current_path_text(path);
if (tree->is_visible()) {
_update_tree(_compute_uncollapsed_paths());
@@ -855,7 +937,7 @@ void FileSystemDock::_update_history() {
}
if (file_list_vb->is_visible()) {
- _update_files(false);
+ _update_file_list(false);
}
button_hist_prev->set_disabled(history_pos == 0);
@@ -1284,15 +1366,16 @@ Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) {
// Build a list of selected items with the active one at the first position
Vector<String> selected_strings;
+ TreeItem *favorites_item = tree->get_root()->get_children();
TreeItem *active_selected = tree->get_selected();
- if (active_selected) {
+ if (active_selected && active_selected != favorites_item) {
selected_strings.push_back(active_selected->get_metadata(0));
}
TreeItem *selected = tree->get_root();
selected = tree->get_next_selected(selected);
while (selected) {
- if (selected != active_selected) {
+ if (selected != active_selected && selected != favorites_item) {
selected_strings.push_back(selected->get_metadata(0));
}
selected = tree->get_next_selected(selected);
@@ -1413,6 +1496,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected)
}
EditorSettings::get_singleton()->set_favorites(favorites);
_update_tree(_compute_uncollapsed_paths());
+ if (path == "Favorites")
+ _update_file_list(true);
} break;
case FILE_DEPENDENCIES: {
@@ -1592,13 +1677,13 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
switch (display_mode) {
case DISPLAY_MODE_FILE_LIST_ONLY: {
- _update_files(false);
+ _update_file_list(false);
} break;
case DISPLAY_MODE_TREE_ONLY: {
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
} break;
case DISPLAY_MODE_SPLIT: {
- _update_files(false);
+ _update_file_list(false);
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
} break;
}
@@ -1650,6 +1735,12 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from)
// Check if the first selected is in favorite
TreeItem *selected = tree->get_next_selected(tree->get_root());
while (selected) {
+ TreeItem *favorites_item = tree->get_root()->get_children();
+ if (selected == favorites_item) {
+ // The "Favorites" item is not draggable
+ return Variant();
+ }
+
bool is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent();
all_favorites &= is_favorite;
all_not_favorites &= !is_favorite;
@@ -1805,6 +1896,9 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
EditorSettings::get_singleton()->set_favorites(dirs);
_update_tree(_compute_uncollapsed_paths());
+
+ if (display_mode == DISPLAY_MODE_SPLIT && path == "Favorites")
+ _update_file_list(true);
return;
}
@@ -1859,7 +1953,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
}
String ltarget = files->get_item_metadata(pos);
- target = ltarget.ends_with("/") ? target : path;
+ target = ltarget.ends_with("/") ? ltarget : path;
return;
}
@@ -2268,7 +2362,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
current_path = memnew(LineEdit);
current_path->set_h_size_flags(SIZE_EXPAND_FILL);
- current_path->set_text(path);
+ _set_current_path_text(path);
toolbar_hbc->add_child(current_path);
button_reload = memnew(Button);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 51c8791b25..d964515572 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -188,7 +188,7 @@ private:
void _file_list_gui_input(Ref<InputEvent> p_event);
void _tree_gui_input(Ref<InputEvent> p_event);
- void _update_files(bool p_keep_selection);
+ void _update_file_list(bool p_keep_selection);
void _update_file_list_display_mode_button();
void _change_file_display();
void _fs_changed();
@@ -257,6 +257,8 @@ private:
void _search(EditorFileSystemDirectory *p_path, List<FileInfo> *matches, int p_max_items);
+ void _set_current_path_text(const String &p_path);
+
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 11d0b67bd6..2af81b8ac7 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -302,7 +302,7 @@ FindInFilesDialog::FindInFilesDialog() {
set_custom_minimum_size(Size2(400, 190));
set_resizable(true);
- set_title(TTR("Find in files"));
+ set_title(TTR("Find in Files"));
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
@@ -406,11 +406,8 @@ FindInFilesDialog::FindInFilesDialog() {
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_alignment(HBoxContainer::ALIGN_CENTER);
- _find_button = memnew(Button);
- _find_button->set_text(TTR("Find..."));
- _find_button->connect("pressed", this, "_on_find_button_pressed");
+ _find_button = add_button(TTR("Find..."), false, "find");
_find_button->set_disabled(true);
- hbc->add_child(_find_button);
{
Control *placeholder = memnew(Control);
@@ -418,11 +415,8 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(placeholder);
}
- _replace_button = memnew(Button);
- _replace_button->set_text(TTR("Replace..."));
- _replace_button->connect("pressed", this, "_on_replace_button_pressed");
+ _replace_button = add_button(TTR("Replace..."), false, "replace");
_replace_button->set_disabled(true);
- hbc->add_child(_replace_button);
{
Control *placeholder = memnew(Control);
@@ -430,10 +424,8 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(placeholder);
}
- Button *cancel_button = memnew(Button);
+ Button *cancel_button = get_ok();
cancel_button->set_text(TTR("Cancel"));
- cancel_button->connect("pressed", this, "hide");
- hbc->add_child(cancel_button);
vbc->add_child(hbc);
}
@@ -487,14 +479,14 @@ void FindInFilesDialog::_on_folder_button_pressed() {
_folder_dialog->popup_centered_ratio();
}
-void FindInFilesDialog::_on_find_button_pressed() {
- emit_signal(SIGNAL_FIND_REQUESTED);
- hide();
-}
-
-void FindInFilesDialog::_on_replace_button_pressed() {
- emit_signal(SIGNAL_REPLACE_REQUESTED);
- hide();
+void FindInFilesDialog::custom_action(const String &p_action) {
+ if (p_action == "find") {
+ emit_signal(SIGNAL_FIND_REQUESTED);
+ hide();
+ } else if (p_action == "replace") {
+ emit_signal(SIGNAL_REPLACE_REQUESTED);
+ hide();
+ }
}
void FindInFilesDialog::_on_search_text_modified(String text) {
@@ -509,7 +501,7 @@ void FindInFilesDialog::_on_search_text_modified(String text) {
void FindInFilesDialog::_on_search_text_entered(String text) {
// This allows to trigger a global search without leaving the keyboard
if (!_find_button->is_disabled())
- _on_find_button_pressed();
+ custom_action("find");
}
void FindInFilesDialog::_on_folder_selected(String path) {
@@ -522,8 +514,6 @@ void FindInFilesDialog::_on_folder_selected(String path) {
void FindInFilesDialog::_bind_methods() {
ClassDB::bind_method("_on_folder_button_pressed", &FindInFilesDialog::_on_folder_button_pressed);
- ClassDB::bind_method("_on_find_button_pressed", &FindInFilesDialog::_on_find_button_pressed);
- ClassDB::bind_method("_on_replace_button_pressed", &FindInFilesDialog::_on_replace_button_pressed);
ClassDB::bind_method("_on_folder_selected", &FindInFilesDialog::_on_folder_selected);
ClassDB::bind_method("_on_search_text_modified", &FindInFilesDialog::_on_search_text_modified);
ClassDB::bind_method("_on_search_text_entered", &FindInFilesDialog::_on_search_text_entered);
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 75ea1c3161..7f37123430 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -91,8 +91,8 @@ class CheckBox;
class FileDialog;
// Prompts search parameters
-class FindInFilesDialog : public WindowDialog {
- GDCLASS(FindInFilesDialog, WindowDialog)
+class FindInFilesDialog : public AcceptDialog {
+ GDCLASS(FindInFilesDialog, AcceptDialog)
public:
static const char *SIGNAL_FIND_REQUESTED;
static const char *SIGNAL_REPLACE_REQUESTED;
@@ -111,11 +111,10 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+ void custom_action(const String &p_action);
private:
void _on_folder_button_pressed();
- void _on_find_button_pressed();
- void _on_replace_button_pressed();
void _on_folder_selected(String path);
void _on_search_text_modified(String text);
void _on_search_text_entered(String text);
diff --git a/editor/icons/SCsub b/editor/icons/SCsub
index 31bf8f116a..109e1aa83b 100644
--- a/editor/icons/SCsub
+++ b/editor/icons/SCsub
@@ -1,15 +1,13 @@
#!/usr/bin/env python
Import('env')
+
from platform_methods import run_in_subprocess
import editor_icons_builders
-
make_editor_icons_builder = Builder(action=run_in_subprocess(editor_icons_builders.make_editor_icons_action),
suffix='.h',
src_suffix='.svg')
env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder
env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#editor/editor_icons.gen.h', Glob("*.svg"))])
-
-Export('env')
diff --git a/editor/icons/icon_GUI_viewport_hdiagsplitter.svg b/editor/icons/icon_GUI_viewport_hdiagsplitter.svg
new file mode 100644
index 0000000000..36769768fd
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_hdiagsplitter.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="34"
+ version="1.1"
+ viewBox="0 0 64 34"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter1.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="5.6568543"
+ inkscape:cx="37.006499"
+ inkscape:cy="15.680715"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-1018.4)"
+ id="g4" />
+ <g
+ transform="rotate(90,541.2,539.2)"
+ id="g4-3">
+ <path
+ id="path2-6"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ d="M 4.0306826,1048.4 H 34 m -30,30 v -60"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_GUI_viewport_vdiagsplitter.svg b/editor/icons/icon_GUI_viewport_vdiagsplitter.svg
new file mode 100644
index 0000000000..f23b4a0a74
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_vdiagsplitter.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="34"
+ height="64"
+ version="1.1"
+ viewBox="0 0 34 64"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter2.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="4"
+ inkscape:cx="32.245723"
+ inkscape:cy="44.255214"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-988.4)"
+ id="g4" />
+ <g
+ id="g839"
+ transform="rotate(90,32.003536,32.003535)">
+ <g
+ id="g4-3"
+ transform="rotate(90,526.2,554.2)">
+ <path
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0"
+ d="M 4.0306826,1048.4 H 34 m -30,30 v -60"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ id="path2-6" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_GUI_viewport_vhsplitter.svg b/editor/icons/icon_GUI_viewport_vhsplitter.svg
new file mode 100644
index 0000000000..429cf909ae
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_vhsplitter.svg
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ version="1.1"
+ viewBox="0 0 64 64"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="4.65625"
+ inkscape:cx="9.8488117"
+ inkscape:cy="20.04653"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-988.4)"
+ id="g4" />
+ <g
+ transform="rotate(90,526.2,554.2)"
+ id="g4-3">
+ <path
+ id="path2-6"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ d="m -26,1048.4 h 60 m -30,30 v -60"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/import/SCsub b/editor/import/SCsub
index f1fa50148f..2b1e889fb0 100644
--- a/editor/import/SCsub
+++ b/editor/import/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
Import('env')
-Export('env')
+
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 31c1886d32..60ca66e464 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -490,120 +490,6 @@ Error ColladaImport::_create_material(const String &p_target) {
return OK;
}
-static void _generate_normals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, PoolVector<Vector3> &r_normals) {
-
- r_normals.resize(p_vertices.size());
- PoolVector<Vector3>::Write narrayw = r_normals.write();
-
- int iacount = p_indices.size() / 3;
- PoolVector<int>::Read index_arrayr = p_indices.read();
- PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read();
-
- for (int idx = 0; idx < iacount; idx++) {
-
- Vector3 v[3] = {
- vertex_arrayr[index_arrayr[idx * 3 + 0]],
- vertex_arrayr[index_arrayr[idx * 3 + 1]],
- vertex_arrayr[index_arrayr[idx * 3 + 2]]
- };
-
- Vector3 normal = Plane(v[0], v[1], v[2]).normal;
-
- narrayw[index_arrayr[idx * 3 + 0]] += normal;
- narrayw[index_arrayr[idx * 3 + 1]] += normal;
- narrayw[index_arrayr[idx * 3 + 2]] += normal;
- }
-
- int vlen = p_vertices.size();
-
- for (int idx = 0; idx < vlen; idx++) {
- narrayw[idx].normalize();
- }
-}
-
-static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, const PoolVector<Vector3> &p_uvs, const PoolVector<Vector3> &p_normals, PoolVector<real_t> &r_tangents) {
-
- int vlen = p_vertices.size();
-
- Vector<Vector3> tangents;
- tangents.resize(vlen);
- Vector<Vector3> binormals;
- binormals.resize(vlen);
-
- int iacount = p_indices.size() / 3;
-
- PoolVector<int>::Read index_arrayr = p_indices.read();
- PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read();
- PoolVector<Vector3>::Read narrayr = p_normals.read();
- PoolVector<Vector3>::Read uvarrayr = p_uvs.read();
-
- for (int idx = 0; idx < iacount; idx++) {
-
- Vector3 v1 = vertex_arrayr[index_arrayr[idx * 3 + 0]];
- Vector3 v2 = vertex_arrayr[index_arrayr[idx * 3 + 1]];
- Vector3 v3 = vertex_arrayr[index_arrayr[idx * 3 + 2]];
-
- Vector3 w1 = uvarrayr[index_arrayr[idx * 3 + 0]];
- Vector3 w2 = uvarrayr[index_arrayr[idx * 3 + 1]];
- Vector3 w3 = uvarrayr[index_arrayr[idx * 3 + 2]];
-
- real_t x1 = v2.x - v1.x;
- real_t x2 = v3.x - v1.x;
- real_t y1 = v2.y - v1.y;
- real_t y2 = v3.y - v1.y;
- real_t z1 = v2.z - v1.z;
- real_t z2 = v3.z - v1.z;
-
- real_t s1 = w2.x - w1.x;
- real_t s2 = w3.x - w1.x;
- real_t t1 = w2.y - w1.y;
- real_t t2 = w3.y - w1.y;
-
- real_t r = (s1 * t2 - s2 * t1);
-
- Vector3 tangent;
- Vector3 binormal;
-
- if (r == 0) {
-
- binormal = Vector3();
- tangent = Vector3();
- } else {
- tangent = Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
- (t2 * z1 - t1 * z2) * r)
- .normalized();
- binormal = Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r,
- (s1 * z2 - s2 * z1) * r)
- .normalized();
- }
-
- tangents.write[index_arrayr[idx * 3 + 0]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 0]] += binormal;
- tangents.write[index_arrayr[idx * 3 + 1]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 1]] += binormal;
- tangents.write[index_arrayr[idx * 3 + 2]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 2]] += binormal;
- }
-
- r_tangents.resize(vlen * 4);
- PoolVector<real_t>::Write tarrayw = r_tangents.write();
-
- for (int idx = 0; idx < vlen; idx++) {
- Vector3 tangent = tangents[idx];
- Vector3 bingen = narrayr[idx].cross(tangent);
- float dir;
- if (bingen.dot(binormals[idx]) < 0)
- dir = -1.0;
- else
- dir = +1.0;
-
- tarrayw[idx * 4 + 0] = tangent.x;
- tarrayw[idx * 4 + 1] = tangent.y;
- tarrayw[idx * 4 + 2] = tangent.z;
- tarrayw[idx * 4 + 3] = dir;
- }
-}
-
Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) {
bool local_xform_mirror = p_local_xform.basis.determinant() < 0;
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 85383fd69d..a6b754de3b 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1910,15 +1910,15 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
NodePath node_path;
GLTFNode *node = state.nodes[E->key()];
- for (int i = 0; i < node->godot_nodes.size(); i++) {
+ for (int n = 0; n < node->godot_nodes.size(); n++) {
if (node->joints.size()) {
- Skeleton *sk = (Skeleton *)node->godot_nodes[i];
+ Skeleton *sk = (Skeleton *)node->godot_nodes[n];
String path = ap->get_parent()->get_path_to(sk);
- String bone = sk->get_bone_name(node->joints[i].godot_bone_index);
+ String bone = sk->get_bone_name(node->joints[n].godot_bone_index);
node_path = path + ":" + bone;
} else {
- node_path = ap->get_parent()->get_path_to(node->godot_nodes[i]);
+ node_path = ap->get_parent()->get_path_to(node->godot_nodes[n]);
}
for (int i = 0; i < track.rotation_track.times.size(); i++) {
@@ -1993,8 +1993,8 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
xform.basis.set_quat_scale(rot, scale);
xform.origin = pos;
- Skeleton *skeleton = skeletons[node->joints[i].skin];
- int bone = node->joints[i].godot_bone_index;
+ Skeleton *skeleton = skeletons[node->joints[n].skin];
+ int bone = node->joints[n].godot_bone_index;
xform = skeleton->get_bone_rest(bone).affine_inverse() * xform;
rot = xform.basis.get_rotation_quat();
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 81a798f0b6..4f4980d83c 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -259,6 +259,8 @@ void InspectorDock::_prepare_history() {
}
history_menu->get_popup()->add_icon_item(icon, text, i);
}
+
+ editor_path->update_path();
}
void InspectorDock::_select_history(int p_idx) const {
diff --git a/editor/plugins/SCsub b/editor/plugins/SCsub
index f1fa50148f..2b1e889fb0 100644
--- a/editor/plugins/SCsub
+++ b/editor/plugins/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
Import('env')
-Export('env')
+
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 19d5243776..205458fb1d 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -131,10 +131,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
- if (!agnode->is_connected("changed", this, "_node_changed")) {
- agnode->connect("changed", this, "_node_changed", varray(agnode->get_instance_id()), CONNECT_DEFERRED);
- }
-
node->set_offset(blend_tree->get_node_position(E->get()) * EDSCALE);
node->set_title(agnode->get_caption());
@@ -721,14 +717,6 @@ void AnimationNodeBlendTreeEditor::_scroll_changed(const Vector2 &p_scroll) {
updating = false;
}
-void AnimationNodeBlendTreeEditor::_node_changed(ObjectID p_node) {
-
- AnimationNode *an = Object::cast_to<AnimationNode>(ObjectDB::get_instance(p_node));
- //if (an && an->get_parent() == blend_tree) {
- _update_graph();
- //}
-}
-
void AnimationNodeBlendTreeEditor::_bind_methods() {
ClassDB::bind_method("_update_graph", &AnimationNodeBlendTreeEditor::_update_graph);
@@ -746,7 +734,6 @@ void AnimationNodeBlendTreeEditor::_bind_methods() {
ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters);
ClassDB::bind_method("_filter_edited", &AnimationNodeBlendTreeEditor::_filter_edited);
ClassDB::bind_method("_filter_toggled", &AnimationNodeBlendTreeEditor::_filter_toggled);
- ClassDB::bind_method("_node_changed", &AnimationNodeBlendTreeEditor::_node_changed);
ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendTreeEditor::_removed_from_graph);
ClassDB::bind_method("_property_changed", &AnimationNodeBlendTreeEditor::_property_changed);
ClassDB::bind_method("_file_opened", &AnimationNodeBlendTreeEditor::_file_opened);
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index 9616e8b5da..e2daefdec6 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -104,8 +104,6 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
void _filter_toggled();
Ref<AnimationNode> _filter_edit;
- void _node_changed(ObjectID p_node);
-
void _property_changed(const StringName &p_property, const Variant &p_value);
void _removed_from_graph();
diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp
index 59b79bd070..e65a697857 100644
--- a/editor/plugins/baked_lightmap_editor_plugin.cpp
+++ b/editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -50,6 +50,7 @@ void BakedLightmapEditorPlugin::_bake() {
case BakedLightmap::BAKE_ERROR_CANT_CREATE_IMAGE:
EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable."));
break;
+ default: {}
}
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 72451cfcb7..f65c8cbd0d 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1654,6 +1654,8 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+ drag_type = DRAG_SCALE_BOTH;
+
Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE);
Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
if (x_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) {
@@ -1663,18 +1665,17 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
if (y_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) {
drag_type = DRAG_SCALE_Y;
}
- if (drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
- drag_from = transform.affine_inverse().xform(b->get_position());
- drag_selection = List<CanvasItem *>();
- drag_selection.push_back(canvas_item);
- _save_canvas_item_state(drag_selection);
- return true;
- }
+
+ drag_from = transform.affine_inverse().xform(b->get_position());
+ drag_selection = List<CanvasItem *>();
+ drag_selection.push_back(canvas_item);
+ _save_canvas_item_state(drag_selection);
+ return true;
}
}
}
- if (drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
+ if (drag_type == DRAG_SCALE_BOTH || drag_type == DRAG_SCALE_X || drag_type == DRAG_SCALE_Y) {
// Resize the node
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection);
@@ -1682,24 +1683,49 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
drag_to = transform.affine_inverse().xform(m->get_position());
+ Transform2D parent_xform = canvas_item->get_global_transform_with_canvas() * canvas_item->get_transform().affine_inverse();
+ Transform2D unscaled_transform = (transform * parent_xform * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform;
+
bool uniform = m->get_shift();
- Point2 offset = drag_to - drag_from;
+
+ Point2 drag_from_local = simple_xform.xform(drag_from);
+ Point2 drag_to_local = simple_xform.xform(drag_to);
+ Point2 offset = drag_to_local - drag_from_local;
+
Size2 scale = canvas_item->call("get_scale");
float ratio = scale.y / scale.x;
- if (drag_type == DRAG_SCALE_X) {
- scale.x += offset.x / SCALE_HANDLE_DISTANCE;
+ if (drag_type == DRAG_SCALE_BOTH) {
+ Size2 scale_factor = drag_to_local / drag_from_local;
if (uniform) {
- scale.y = scale.x * ratio;
+ if (ABS(offset.x) > ABS(offset.y)) {
+ scale.x *= scale_factor.x;
+ scale.y = scale.x * ratio;
+ } else {
+ scale.y *= scale_factor.y;
+ scale.x = scale.y / ratio;
+ }
+ } else {
+ scale *= scale_factor;
}
- canvas_item->call("set_scale", scale);
-
- } else if (drag_type == DRAG_SCALE_Y) {
- scale.y -= offset.y / SCALE_HANDLE_DISTANCE;
- if (uniform) {
- scale.x = scale.y / ratio;
+ } else {
+ Size2 scale_factor = Vector2(offset.x, -offset.y) / SCALE_HANDLE_DISTANCE;
+ Size2 parent_scale = parent_xform.get_scale();
+ scale_factor *= Vector2(1.0 / parent_scale.x, 1.0 / parent_scale.y);
+ if (drag_type == DRAG_SCALE_X) {
+ scale.x += scale_factor.x;
+ if (uniform) {
+ scale.y = scale.x * ratio;
+ }
+ } else if (drag_type == DRAG_SCALE_Y) {
+ scale.y += scale_factor.y;
+ if (uniform) {
+ scale.x = scale.y / ratio;
+ }
}
- canvas_item->call("set_scale", scale);
}
+ canvas_item->call("set_scale", scale);
+ return true;
}
// Confirm resize
@@ -2352,7 +2378,7 @@ void CanvasItemEditor::_draw_rulers() {
if (i % minor_subdivision == 0) {
viewport->draw_line(Point2(position.x, RULER_WIDTH * 0.33), Point2(position.x, RULER_WIDTH), graduation_color);
} else {
- viewport->draw_line(Point2(position.x, RULER_WIDTH * 0.66), Point2(position.x, RULER_WIDTH), graduation_color);
+ viewport->draw_line(Point2(position.x, RULER_WIDTH * 0.75), Point2(position.x, RULER_WIDTH), graduation_color);
}
}
}
@@ -2364,12 +2390,17 @@ void CanvasItemEditor::_draw_rulers() {
if (i % (major_subdivision * minor_subdivision) == 0) {
viewport->draw_line(Point2(0, position.y), Point2(RULER_WIDTH, position.y), graduation_color);
float val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(0, i)).y;
- viewport->draw_string(font, Point2(2, position.y + 2 + font->get_height()), vformat(((int)val == val) ? "%d" : "%.1f", val), font_color);
+
+ Transform2D text_xform = Transform2D(-Math_PI / 2.0, Point2(font->get_height(), position.y - 2));
+ viewport->draw_set_transform_matrix(viewport->get_transform() * text_xform);
+ viewport->draw_string(font, Point2(), vformat(((int)val == val) ? "%d" : "%.1f", val), font_color);
+ viewport->draw_set_transform_matrix(viewport->get_transform());
+
} else {
if (i % minor_subdivision == 0) {
viewport->draw_line(Point2(RULER_WIDTH * 0.33, position.y), Point2(RULER_WIDTH, position.y), graduation_color);
} else {
- viewport->draw_line(Point2(RULER_WIDTH * 0.66, position.y), Point2(RULER_WIDTH, position.y), graduation_color);
+ viewport->draw_line(Point2(RULER_WIDTH * 0.75, position.y), Point2(RULER_WIDTH, position.y), graduation_color);
}
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 2d539d6727..c788a63d56 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -195,6 +195,7 @@ private:
DRAG_MOVE,
DRAG_SCALE_X,
DRAG_SCALE_Y,
+ DRAG_SCALE_BOTH,
DRAG_ROTATE,
DRAG_PIVOT,
DRAG_V_GUIDE,
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index e3f364790a..d1a94f5b49 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -323,7 +323,6 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
if (mb.is_valid()) {
Vector2 gpoint = mb->get_position();
- Vector2 cpoint = node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
if (mb->get_button_index() == BUTTON_LEFT) {
if (mb->is_pressed()) {
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 79169d3183..8b7156dcee 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -205,13 +205,13 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
curve.set_point_left_tangent(_selected_point, tangent);
// Note: if a tangent is set to linear, it shouldn't be linked to the other
- if (link && _selected_point != curve.get_point_count() - 1 && !curve.get_point_right_mode(_selected_point) != Curve::TANGENT_FREE)
+ if (link && _selected_point != (curve.get_point_count() - 1) && curve.get_point_right_mode(_selected_point) != Curve::TANGENT_LINEAR)
curve.set_point_right_tangent(_selected_point, tangent);
} else {
curve.set_point_right_tangent(_selected_point, tangent);
- if (link && _selected_point != 0 && !curve.get_point_left_mode(_selected_point) != Curve::TANGENT_FREE)
+ if (link && _selected_point != 0 && curve.get_point_left_mode(_selected_point) != Curve::TANGENT_LINEAR)
curve.set_point_left_tangent(_selected_point, tangent);
}
}
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index 7b7e23531a..73a216e96f 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -65,14 +65,6 @@ void MeshEditor::_notification(int p_what) {
first_enter = false;
}
}
-
- if (p_what == NOTIFICATION_DRAW) {
-
- Ref<Texture> checkerboard = get_icon("Checkerboard", "EditorIcons");
- Size2 size = get_size();
-
- //draw_texture_rect(checkerboard, Rect2(Point2(), size), true);
- }
}
void MeshEditor::_update_rotation() {
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index e0c8cf41ff..f937744d45 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -767,6 +767,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
node->set_polygon(uv_new);
}
} break;
+ default: {}
}
if (bone_painting) {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index c8e7bfb74b..d2a9830fe0 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1414,21 +1414,6 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
emit_signal("editor_script_changed", p_script);
}
-static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
-
- if (p_node->get_script() == p_script)
- return p_node;
-
- for (int i = 0; i < p_node->get_child_count(); i++) {
-
- const Node *result = _find_node_with_script(p_node->get_child(i), p_script);
- if (result)
- return result;
- }
-
- return NULL;
-}
-
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
for (int i = 0; i < tab_container->get_child_count(); i++) {
@@ -3013,7 +2998,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTR("Show In File System")), SHOW_IN_FILE_SYSTEM);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_ALT | KEY_LEFT), WINDOW_PREV);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Previous"), KEY_MASK_ALT | KEY_LEFT), WINDOW_PREV);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_ALT | KEY_RIGHT), WINDOW_NEXT);
file_menu->get_popup()->add_separator();
@@ -3060,7 +3045,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
debug_menu->get_popup()->add_separator();
//debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW);
debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_SHOW_KEEP_OPEN);
- debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/debug_with_exteral_editor", TTR("Debug with external editor")), DEBUG_WITH_EXTERNAL_EDITOR);
+ debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/debug_with_external_editor", TTR("Debug with External Editor")), DEBUG_WITH_EXTERNAL_EDITOR);
debug_menu->get_popup()->connect("id_pressed", this, "_menu_option");
debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index d4ddaf274f..23babdf07b 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -941,6 +941,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
case SEARCH_LOCATE_FUNCTION: {
quick_open->popup(get_functions());
+ quick_open->set_title(TTR("Go to Function"));
} break;
case SEARCH_GOTO_LINE: {
@@ -1275,7 +1276,6 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
word_at_mouse = tx->get_selection_text();
bool has_color = (word_at_mouse == "Color");
- int fold_state = 0;
bool foldable = tx->can_fold(row) || tx->is_folded(row);
bool open_docs = false;
bool goto_definition = false;
@@ -1567,8 +1567,8 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
#endif
ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F9);
- ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Goto Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
- ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Goto Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
+ ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Go to Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
+ ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Go to Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
ED_SHORTCUT("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
#ifdef OSX_ENABLED
@@ -1581,14 +1581,14 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
#endif
- ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
+ ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
#ifdef OSX_ENABLED
- ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function..."), KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
+ ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
#else
- ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
+ ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
#endif
- ED_SHORTCUT("script_text_editor/goto_line", TTR("Goto Line..."), KEY_MASK_CMD | KEY_L);
+ ED_SHORTCUT("script_text_editor/goto_line", TTR("Go to Line..."), KEY_MASK_CMD | KEY_L);
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 361271af89..17f93b55a1 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -86,10 +86,7 @@ void ShaderTextEditor::_load_theme_settings() {
Color search_result_border_color = EDITOR_GET("text_editor/highlighting/search_result_border_color");
Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
- Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
- Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
- Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
get_text_edit()->add_color_override("background_color", background_color);
get_text_edit()->add_color_override("completion_background_color", completion_background_color);
@@ -140,26 +137,9 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_keyword_color(E->get(), keyword_color);
}
- //colorize core types
- //Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0));
-
//colorize comments
get_text_edit()->add_color_region("/*", "*/", comment_color, false);
get_text_edit()->add_color_region("//", "", comment_color, false);
-
- /*//colorize strings
- Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff));
-
- List<String> strings;
- shader->get_shader_mode()->get_string_delimiters(&strings);
-
- for (List<String>::Element *E=strings.front();E;E=E->next()) {
-
- String string = E->get();
- String beg = string.get_slice(" ",0);
- String end = string.get_slice_count(" ")>1?string.get_slice(" ",1):String();
- get_text_edit()->add_color_region(beg,end,string_color,end=="");
- }*/
}
void ShaderTextEditor::_check_shader_mode() {
@@ -468,7 +448,6 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int col, row;
TextEdit *tx = shader_editor->get_text_edit();
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
- Vector2 mpos = mb->get_global_position() - tx->get_global_position();
tx->set_right_click_moves_caret(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_right_click_moving_caret()) {
diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp
index 50deb80668..e7d9f1b702 100644
--- a/editor/plugins/skeleton_editor_plugin.cpp
+++ b/editor/plugins/skeleton_editor_plugin.cpp
@@ -29,9 +29,10 @@
/*************************************************************************/
#include "skeleton_editor_plugin.h"
+
#include "scene/3d/collision_shape.h"
#include "scene/3d/physics_body.h"
-#include "scene/3d/physics_joint.h";
+#include "scene/3d/physics_joint.h"
#include "scene/resources/capsule_shape.h"
#include "scene/resources/sphere_shape.h"
#include "spatial_editor_plugin.h"
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 3e6a0ae81a..114610c562 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -531,12 +531,12 @@ void SpatialEditorViewport::_select_region() {
void SpatialEditorViewport::_update_name() {
- String ortho = orthogonal ? TTR("Orthogonal") : TTR("Perspective");
+ String view_mode = orthogonal ? TTR("Orthogonal") : TTR("Perspective");
if (name != "")
- view_menu->set_text("[ " + name + " " + ortho + " ]");
+ view_menu->set_text("[ " + name + " " + view_mode + " ]");
else
- view_menu->set_text("[ " + ortho + " ]");
+ view_menu->set_text("[ " + view_mode + " ]");
view_menu->set_size(Vector2(0, 0)); // resets the button size
}
@@ -997,6 +997,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
set_message(TTR("View Plane Transform."), 2);
} break;
+ case TRANSFORM_YZ:
+ case TRANSFORM_XZ:
+ case TRANSFORM_XY: {
+ } break;
}
}
} break;
@@ -1545,6 +1549,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(2));
axis = Vector3(0, 0, 1);
break;
+ case TRANSFORM_YZ:
+ case TRANSFORM_XZ:
+ case TRANSFORM_XY:
+ break;
}
Vector3 intersection;
@@ -1904,7 +1912,7 @@ void SpatialEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, con
void SpatialEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative) {
// Freelook only works properly in perspective.
- // It technically works too in ortho, but it's awful for a user due to fov being near zero
+ // It could technically work in ortho, but it's terrible for a user due to FOV being a fixed width.
if (!orthogonal) {
real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
@@ -2075,7 +2083,7 @@ void SpatialEditorViewport::set_message(String p_message, float p_time) {
}
void SpatialEditorPlugin::edited_scene_changed() {
- for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *viewport = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (viewport->is_visible()) {
viewport->notification(Control::NOTIFICATION_VISIBILITY_CHANGED);
@@ -2199,7 +2207,7 @@ void SpatialEditorViewport::_notification(int p_what) {
bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION));
- if (shrink != viewport_container->get_stretch_shrink() > 1) {
+ if (shrink != (viewport_container->get_stretch_shrink() > 1)) {
viewport_container->set_stretch_shrink(shrink ? 2 : 1);
}
@@ -3535,69 +3543,77 @@ void SpatialEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event)
Ref<InputEventMouseButton> mb = p_event;
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
-
- Vector2 size = get_size();
-
- int h_sep = get_constant("separation", "HSplitContainer");
- int v_sep = get_constant("separation", "VSplitContainer");
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
- int mid_w = size.width * ratio_h;
- int mid_h = size.height * ratio_v;
+ if (mb->is_pressed()) {
+ Vector2 size = get_size();
- dragging_h = mb->get_position().x > (mid_w - h_sep / 2) && mb->get_position().x < (mid_w + h_sep / 2);
- dragging_v = mb->get_position().y > (mid_h - v_sep / 2) && mb->get_position().y < (mid_h + v_sep / 2);
+ int h_sep = get_constant("separation", "HSplitContainer");
+ int v_sep = get_constant("separation", "VSplitContainer");
- drag_begin_pos = mb->get_position();
- drag_begin_ratio.x = ratio_h;
- drag_begin_ratio.y = ratio_v;
+ int mid_w = size.width * ratio_h;
+ int mid_h = size.height * ratio_v;
- switch (view) {
- case VIEW_USE_1_VIEWPORT: {
+ dragging_h = mb->get_position().x > (mid_w - h_sep / 2) && mb->get_position().x < (mid_w + h_sep / 2);
+ dragging_v = mb->get_position().y > (mid_h - v_sep / 2) && mb->get_position().y < (mid_h + v_sep / 2);
- dragging_h = false;
- dragging_v = false;
+ drag_begin_pos = mb->get_position();
+ drag_begin_ratio.x = ratio_h;
+ drag_begin_ratio.y = ratio_v;
- } break;
- case VIEW_USE_2_VIEWPORTS: {
+ switch (view) {
+ case VIEW_USE_1_VIEWPORT: {
- dragging_h = false;
+ dragging_h = false;
+ dragging_v = false;
- } break;
- case VIEW_USE_2_VIEWPORTS_ALT: {
+ } break;
+ case VIEW_USE_2_VIEWPORTS: {
- dragging_v = false;
+ dragging_h = false;
- } break;
- case VIEW_USE_3_VIEWPORTS: {
+ } break;
+ case VIEW_USE_2_VIEWPORTS_ALT: {
- if (dragging_v)
- dragging_h = false;
- else
dragging_v = false;
- } break;
- case VIEW_USE_3_VIEWPORTS_ALT: {
+ } break;
+ case VIEW_USE_3_VIEWPORTS:
+ case VIEW_USE_3_VIEWPORTS_ALT:
+ case VIEW_USE_4_VIEWPORTS: {
- if (dragging_h)
- dragging_v = false;
- else
- dragging_h = false;
- } break;
- case VIEW_USE_4_VIEWPORTS: {
+ // Do nothing.
- } break;
+ } break;
+ }
+ } else {
+ dragging_h = false;
+ dragging_v = false;
}
}
- if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
- dragging_h = false;
- dragging_v = false;
- }
-
Ref<InputEventMouseMotion> mm = p_event;
- if (mm.is_valid() && (dragging_h || dragging_v)) {
+ if (mm.is_valid()) {
+
+ if (view == VIEW_USE_3_VIEWPORTS || view == VIEW_USE_3_VIEWPORTS_ALT || view == VIEW_USE_4_VIEWPORTS) {
+ Vector2 size = get_size();
+
+ int h_sep = get_constant("separation", "HSplitContainer");
+ int v_sep = get_constant("separation", "VSplitContainer");
+
+ int mid_w = size.width * ratio_h;
+ int mid_h = size.height * ratio_v;
+
+ bool was_hovering_h = hovering_h;
+ bool was_hovering_v = hovering_v;
+ hovering_h = mm->get_position().x > (mid_w - h_sep / 2) && mm->get_position().x < (mid_w + h_sep / 2);
+ hovering_v = mm->get_position().y > (mid_h - v_sep / 2) && mm->get_position().y < (mid_h + v_sep / 2);
+
+ if (was_hovering_h != hovering_h || was_hovering_v != hovering_v) {
+ update();
+ }
+ }
if (dragging_h) {
float new_ratio = drag_begin_ratio.x + (mm->get_position().x - drag_begin_pos.x) / get_size().width;
@@ -3627,9 +3643,12 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW && mouseover) {
Ref<Texture> h_grabber = get_icon("grabber", "HSplitContainer");
-
Ref<Texture> v_grabber = get_icon("grabber", "VSplitContainer");
+ Ref<Texture> hdiag_grabber = get_icon("GuiViewportHdiagsplitter", "EditorIcons");
+ Ref<Texture> vdiag_grabber = get_icon("GuiViewportVdiagsplitter", "EditorIcons");
+ Ref<Texture> vh_grabber = get_icon("GuiViewportVhsplitter", "EditorIcons");
+
Vector2 size = get_size();
int h_sep = get_constant("separation", "HSplitContainer");
@@ -3646,35 +3665,62 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
case VIEW_USE_1_VIEWPORT: {
- //nothing to show
+ // Nothing to show.
} break;
case VIEW_USE_2_VIEWPORTS: {
draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
} break;
case VIEW_USE_2_VIEWPORTS_ALT: {
draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
} break;
case VIEW_USE_3_VIEWPORTS: {
- draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
- draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2));
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(hdiag_grabber, Vector2(mid_w - hdiag_grabber->get_width() / 2, mid_h - v_grabber->get_height() / 4));
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
} break;
case VIEW_USE_3_VIEWPORTS_ALT: {
- draw_texture(v_grabber, Vector2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
- draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(vdiag_grabber, Vector2(mid_w - vdiag_grabber->get_width() + v_grabber->get_height() / 4, mid_h - vdiag_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, Vector2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
+
} break;
case VIEW_USE_4_VIEWPORTS: {
Vector2 half(mid_w, mid_h);
- draw_texture(v_grabber, half - v_grabber->get_size() / 2.0);
- draw_texture(h_grabber, half - h_grabber->get_size() / 2.0);
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(vh_grabber, half - vh_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, half - v_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, half - h_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
} break;
}
@@ -3718,6 +3764,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
case VIEW_USE_1_VIEWPORT: {
+ viewports[0]->show();
for (int i = 1; i < 4; i++) {
viewports[i]->hide();
@@ -3728,7 +3775,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_2_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1 || i == 3)
viewports[i]->hide();
@@ -3742,7 +3789,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_2_VIEWPORTS_ALT: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1 || i == 3)
viewports[i]->hide();
@@ -3755,7 +3802,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_3_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1)
viewports[i]->hide();
@@ -3770,7 +3817,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_3_VIEWPORTS_ALT: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1)
viewports[i]->hide();
@@ -3785,7 +3832,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_4_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
viewports[i]->show();
}
@@ -3818,10 +3865,13 @@ void SpatialEditorViewportContainer::_bind_methods() {
SpatialEditorViewportContainer::SpatialEditorViewportContainer() {
+ set_clip_contents(true);
view = VIEW_USE_1_VIEWPORT;
mouseover = false;
ratio_h = 0.5;
ratio_v = 0.5;
+ hovering_v = false;
+ hovering_h = false;
dragging_v = false;
dragging_h = false;
}
@@ -4093,7 +4143,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
for (int j = 0; j < gizmo_plugins.size(); ++j) {
if (!gizmo_plugins[j]->can_be_hidden()) continue;
int state = EditorSpatialGizmoPlugin::ON_TOP;
- for (uint32_t i = 0; i < keys.size(); i++) {
+ for (int i = 0; i < keys.size(); i++) {
if (gizmo_plugins.write[j]->get_name() == keys[i]) {
state = gizmos_status[keys[i]];
}
@@ -4979,32 +5029,29 @@ void SpatialEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
if (!k->is_pressed())
return;
- if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event))
+ if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event)) {
_menu_item_pressed(MENU_TOOL_SELECT);
-
- else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event)) {
_menu_item_pressed(MENU_TOOL_MOVE);
-
- else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event)) {
_menu_item_pressed(MENU_TOOL_ROTATE);
-
- else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event)) {
_menu_item_pressed(MENU_TOOL_SCALE);
- else if (ED_IS_SHORTCUT("spatial_editor/snap_to_floor", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/snap_to_floor", p_event)) {
snap_selected_nodes_to_floor();
-
- else if (ED_IS_SHORTCUT("spatial_editor/local_coords", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/local_coords", p_event)) {
if (are_local_coords_enabled()) {
_menu_item_toggled(false, MENU_TOOL_LOCAL_COORDS);
} else {
_menu_item_toggled(true, MENU_TOOL_LOCAL_COORDS);
}
- else if (ED_IS_SHORTCUT("spatial_editor/snap", p_event))
+ } else if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
if (is_snap_enabled()) {
_menu_item_toggled(false, MENU_TOOL_USE_SNAP);
} else {
_menu_item_toggled(true, MENU_TOOL_USE_SNAP);
}
+ }
}
}
}
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index b7317cd593..c552f21e39 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -86,7 +86,7 @@ public:
Vector<Vector3> handles;
Vector<Vector3> secondary_handles;
- float selectable_icon_size = -1.0f;
+ float selectable_icon_size;
bool billboard_handle;
bool valid;
@@ -404,6 +404,7 @@ public:
AcceptDialog *p_accept);
Viewport *get_viewport_node() { return viewport; }
+ Camera *get_camera() { return camera; } // return the default camera object.
SpatialEditorViewport(SpatialEditor *p_spatial_editor, EditorNode *p_editor, int p_index);
};
@@ -443,6 +444,9 @@ private:
float ratio_h;
float ratio_v;
+ bool hovering_v;
+ bool hovering_h;
+
bool dragging_v;
bool dragging_h;
Vector2 drag_begin_pos;
@@ -707,7 +711,6 @@ public:
void register_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> ref);
- Camera *get_camera() { return NULL; }
void edit(Spatial *p_spatial);
void clear();
diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp
index 58a1835e68..c574b5e8ba 100644
--- a/editor/plugins/sprite_editor_plugin.cpp
+++ b/editor/plugins/sprite_editor_plugin.cpp
@@ -97,7 +97,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
int lasti = p2->Contour.size() - 1;
Vector2 prev = Vector2(p2->Contour[lasti].X / PRECISION, p2->Contour[lasti].Y / PRECISION);
- for (int i = 0; i < p2->Contour.size(); i++) {
+ for (unsigned int i = 0; i < p2->Contour.size(); i++) {
Vector2 cur = Vector2(p2->Contour[i].X / PRECISION, p2->Contour[i].Y / PRECISION);
if (cur.distance_to(prev) > 0.5) {
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index a6a256f0d6..3de2284cea 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -795,6 +795,7 @@ void TileSetEditor::_on_workspace_draw() {
spin_priority->set_suffix(" / " + String::num(total, 0));
draw_highlight_subtile(edited_shape_coord, queue_others);
} break;
+ default: {}
}
draw_tile_subdivision(get_current_tile(), Color(0.347214, 0.722656, 0.617063));
@@ -1365,6 +1366,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
}
}
} break;
+ default: {}
}
}
}
@@ -1434,6 +1436,7 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
workspace->update();
}
} break;
+ default: {}
}
}
} else if (p_tool == ZOOM_OUT) {
@@ -1862,6 +1865,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
}
} break;
+ default: {}
}
if (creating_shape) {
for (int j = 0; j < current_shape.size() - 1; j++) {
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index b1c847570c..30e78aa32b 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -115,11 +115,6 @@ static void _compress_pvrtc4(Image *p_image) {
_compress_image(Image::COMPRESS_PVRTC4, p_image);
}
-static void _compress_etc(Image *p_image) {
-
- _compress_image(Image::COMPRESS_ETC, p_image);
-}
-
void _pvrtc_register_compressors() {
_base_image_compress_pvrtc2_func = Image::_image_compress_pvrtc2_func;
@@ -127,5 +122,4 @@ void _pvrtc_register_compressors() {
Image::_image_compress_pvrtc2_func = _compress_pvrtc2;
Image::_image_compress_pvrtc4_func = _compress_pvrtc4;
- //Image::_image_compress_etc_func=_compress_etc; //use the built in one for ETC
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index ff6832177e..11a0a42b9e 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -568,15 +568,21 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
return;
editor_data->get_undo_redo().create_action("Make node as Root");
- _node_replace_owner(root, node, node, MODE_DO);
editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node);
+ editor_data->get_undo_redo().add_do_method(root->get_parent(), "remove_child", root);
+ editor_data->get_undo_redo().add_do_method(node, "add_child", root);
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node);
editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename());
+ editor_data->get_undo_redo().add_do_method(root, "set_filename", String());
+ _node_replace_owner(root, root, node, MODE_DO);
+ editor_data->get_undo_redo().add_undo_method(root, "set_filename", root->get_filename());
editor_data->get_undo_redo().add_undo_method(node, "set_filename", String());
+ editor_data->get_undo_redo().add_undo_method(node, "remove_child", root);
editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root);
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node);
- _node_replace_owner(root, node, root, MODE_UNDO);
+ _node_replace_owner(root, root, root, MODE_UNDO);
+
editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_reference(root);
@@ -690,21 +696,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *node = e->get();
if (node) {
bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node);
- int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
- int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder"));
- editable = !editable;
- EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node, editable);
-
- menu->set_item_checked(editable_item_idx, editable);
if (editable) {
- node->set_scene_instance_load_placeholder(false);
- menu->set_item_checked(placeholder_item_idx, false);
+ editable_instance_remove_dialog->set_text(TTR("Disabling \"editable_instance\" will cause all properties of the node to be reverted to their default."));
+ editable_instance_remove_dialog->popup_centered_minsize();
+ break;
}
-
- SpatialEditor::get_singleton()->update_all_gizmos(node);
-
- scene_tree->update_tree();
+ _toggle_editable_children();
}
}
} break;
@@ -975,24 +973,22 @@ void SceneTreeDock::_notification(int p_what) {
void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root, ReplaceOwnerMode p_mode) {
- if (p_base != p_node) {
- if (p_node->get_owner() == p_base) {
- UndoRedo *undo_redo = &editor_data->get_undo_redo();
- switch (p_mode) {
- case MODE_BIDI: {
- undo_redo->add_do_method(p_node, "set_owner", p_root);
- undo_redo->add_undo_method(p_node, "set_owner", p_base);
+ if (p_node->get_owner() == p_base || !p_node->get_owner()) {
+ UndoRedo *undo_redo = &editor_data->get_undo_redo();
+ switch (p_mode) {
+ case MODE_BIDI: {
+ undo_redo->add_do_method(p_node, "set_owner", p_root);
+ undo_redo->add_undo_method(p_node, "set_owner", p_base);
- } break;
- case MODE_DO: {
- undo_redo->add_do_method(p_node, "set_owner", p_root);
+ } break;
+ case MODE_DO: {
+ undo_redo->add_do_method(p_node, "set_owner", p_root);
- } break;
- case MODE_UNDO: {
- undo_redo->add_undo_method(p_node, "set_owner", p_root);
+ } break;
+ case MODE_UNDO: {
+ undo_redo->add_undo_method(p_node, "set_owner", p_root);
- } break;
- }
+ } break;
}
}
@@ -1489,6 +1485,33 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
editor->push_item(p_script.operator->());
}
+void SceneTreeDock::_toggle_editable_children() {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
+ bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node);
+
+ int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
+ int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder"));
+ editable = !editable;
+
+ EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node, editable);
+
+ menu->set_item_checked(editable_item_idx, editable);
+ if (editable) {
+ node->set_scene_instance_load_placeholder(false);
+ menu->set_item_checked(placeholder_item_idx, false);
+ }
+
+ SpatialEditor::get_singleton()->update_all_gizmos(node);
+
+ scene_tree->update_tree();
+ }
+ }
+}
+
void SceneTreeDock::_delete_confirm() {
List<Node *> remove_list = editor_selection->get_selected_node_list();
@@ -1570,7 +1593,7 @@ void SceneTreeDock::_delete_confirm() {
// Fixes the EditorHistory from still offering deleted notes
EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
editor_history->cleanup_history();
- EditorNode::get_singleton()->call("_prepare_history");
+ EditorNode::get_singleton()->get_inspector_dock()->call("_prepare_history");
}
void SceneTreeDock::_update_script_button() {
@@ -1587,6 +1610,10 @@ void SceneTreeDock::_selection_changed() {
if (selection_size > 1) {
//automatically turn on multi-edit
_tool_selected(TOOL_MULTI_EDIT);
+ } else if (selection_size == 1) {
+ editor->push_item(EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]);
+ } else {
+ editor->push_item(NULL);
}
_update_script_button();
}
@@ -1852,32 +1879,6 @@ static bool _has_visible_children(Node *p_node) {
return false;
}
-static Node *_find_last_visible(Node *p_node) {
-
- Node *last = NULL;
-
- bool collapsed = p_node->is_displayed_folded();
-
- if (!collapsed) {
- for (int i = 0; i < p_node->get_child_count(); i++) {
- if (_is_node_visible(p_node->get_child(i))) {
- last = p_node->get_child(i);
- }
- }
- }
-
- if (last) {
- Node *lastc = _find_last_visible(last);
- if (lastc)
- last = lastc;
-
- } else {
- last = p_node;
- }
-
- return last;
-}
-
void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
to_pos = -1;
@@ -2262,6 +2263,7 @@ void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_input"), &SceneTreeDock::_input);
ClassDB::bind_method(D_METHOD("_nodes_drag_begin"), &SceneTreeDock::_nodes_drag_begin);
ClassDB::bind_method(D_METHOD("_delete_confirm"), &SceneTreeDock::_delete_confirm);
+ ClassDB::bind_method(D_METHOD("_toggle_editable_children"), &SceneTreeDock::_toggle_editable_children);
ClassDB::bind_method(D_METHOD("_node_prerenamed"), &SceneTreeDock::_node_prerenamed);
ClassDB::bind_method(D_METHOD("_import_subscene"), &SceneTreeDock::_import_subscene);
ClassDB::bind_method(D_METHOD("_selection_changed"), &SceneTreeDock::_selection_changed);
@@ -2427,6 +2429,10 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
add_child(delete_dialog);
delete_dialog->connect("confirmed", this, "_delete_confirm");
+ editable_instance_remove_dialog = memnew(ConfirmationDialog);
+ add_child(editable_instance_remove_dialog);
+ editable_instance_remove_dialog->connect("confirmed", this, "_toggle_editable_children");
+
import_subscene_dialog = memnew(EditorSubScene);
add_child(import_subscene_dialog);
import_subscene_dialog->connect("subscene_selected", this, "_import_subscene");
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 34a7c98d11..269b0b69db 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -121,6 +121,7 @@ class SceneTreeDock : public VBoxContainer {
ScriptCreateDialog *script_create_dialog;
AcceptDialog *accept;
ConfirmationDialog *delete_dialog;
+ ConfirmationDialog *editable_instance_remove_dialog;
ReparentDialog *reparent_dialog;
EditorFileDialog *file;
@@ -169,6 +170,8 @@ class SceneTreeDock : public VBoxContainer {
void _delete_confirm();
+ void _toggle_editable_children();
+
void _node_prerenamed(Node *p_node, const String &p_new_name);
void _nodes_drag_begin();
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index cc477314e9..eb72d0aa6e 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -30,6 +30,7 @@
#include "script_editor_debugger.h"
+#include "core/io/marshalls.h"
#include "core/project_settings.h"
#include "core/ustring.h"
#include "editor_node.h"
@@ -501,8 +502,12 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String str = var;
var = str.substr(4, str.length());
- if (str.begins_with("PATH"))
- var = ResourceLoader::load(var);
+ if (str.begins_with("PATH")) {
+ if (String(var).empty())
+ var = RES();
+ else
+ var = ResourceLoader::load(var);
+ }
}
debugObj->prop_values[pinfo.name] = var;
@@ -576,11 +581,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String hs = String();
if (v.get_type() == Variant::OBJECT) {
+ v = Object::cast_to<EncodedObjectAsID>(v)->get_object_id();
h = PROPERTY_HINT_OBJECT_ID;
- String s = v;
- s = s.replace("[", "");
- hs = s.get_slice(":", 0);
- v = s.get_slice(":", 1).to_int();
+ hs = "Object";
}
variables->add_property("Locals/" + n, v, h, hs);
@@ -597,11 +600,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String hs = String();
if (v.get_type() == Variant::OBJECT) {
+ v = Object::cast_to<EncodedObjectAsID>(v)->get_object_id();
h = PROPERTY_HINT_OBJECT_ID;
- String s = v;
- s = s.replace("[", "");
- hs = s.get_slice(":", 0);
- v = s.get_slice(":", 1).to_int();
+ hs = "Object";
}
variables->add_property("Members/" + n, v, h, hs);
@@ -618,11 +619,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String hs = String();
if (v.get_type() == Variant::OBJECT) {
+ v = Object::cast_to<EncodedObjectAsID>(v)->get_object_id();
h = PROPERTY_HINT_OBJECT_ID;
- String s = v;
- s = s.replace("[", "");
- hs = s.get_slice(":", 0);
- v = s.get_slice(":", 1).to_int();
+ hs = "Object";
}
variables->add_property("Globals/" + n, v, h, hs);
@@ -727,9 +726,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String source(err[5]);
bool source_is_project_file = source.begins_with("res://");
if (source_is_project_file)
- source = source.get_file();
+ txt = source.get_file() + ":" + String(err[6]);
+ else
+ txt = source + ":" + String(err[6]);
- txt = source + ":" + String(err[6]);
String method = err[4];
if (method.length() > 0)
txt += " @ " + method + "()";
@@ -1294,9 +1294,6 @@ void ScriptEditorDebugger::stop() {
EditorNode::get_singleton()->get_scene_tree_dock()->hide_remote_tree();
EditorNode::get_singleton()->get_scene_tree_dock()->hide_tab_buttons();
- Node *node = editor->get_scene_tree_dock()->get_tree_editor()->get_selected();
- editor->push_item(node);
-
if (hide_on_stop) {
if (is_visible_in_tree())
EditorNode::get_singleton()->hide_bottom_panel();
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index fe384da75b..537c9ac6b8 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -361,7 +361,7 @@ void EditorSettingsDialog::_tabs_tab_changed(int p_tab) {
void EditorSettingsDialog::_focus_current_search_box() {
Control *tab = tabs->get_current_tab_control();
- LineEdit *current_search_box;
+ LineEdit *current_search_box = NULL;
if (tab == tab_general)
current_search_box = search_box;
else if (tab == tab_shortcuts)
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 3097f0d0b9..96bca86f83 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -715,6 +715,7 @@ EditorSpatialGizmo::EditorSpatialGizmo() {
instanced = false;
spatial_node = NULL;
gizmo_plugin = NULL;
+ selectable_icon_size = -1.0f;
}
EditorSpatialGizmo::~EditorSpatialGizmo() {