summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp6
-rw-r--r--editor/animation_track_editor.h6
-rw-r--r--editor/code_editor.cpp57
-rw-r--r--editor/code_editor.h1
-rw-r--r--editor/editor_export.cpp106
-rw-r--r--editor/editor_export.h11
-rw-r--r--editor/editor_node.cpp9
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_plugin.cpp2
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/rename_dialog.cpp6
-rw-r--r--editor/rename_dialog.h7
-rw-r--r--editor/scene_tree_dock.cpp44
-rw-r--r--editor/scene_tree_dock.h1
-rw-r--r--editor/script_create_dialog.cpp4
-rw-r--r--editor/script_create_dialog.h4
18 files changed, 212 insertions, 60 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index c835dda1b9..f5b5cfa848 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -5273,17 +5273,17 @@ AnimationTrackEditor::AnimationTrackEditor() {
VBoxContainer *cleanup_vb = memnew(VBoxContainer);
cleanup_dialog->add_child(cleanup_vb);
- cleanup_keys = memnew(CheckButton);
+ cleanup_keys = memnew(CheckBox);
cleanup_keys->set_text(TTR("Remove invalid keys"));
cleanup_keys->set_pressed(true);
cleanup_vb->add_child(cleanup_keys);
- cleanup_tracks = memnew(CheckButton);
+ cleanup_tracks = memnew(CheckBox);
cleanup_tracks->set_text(TTR("Remove unresolved and empty tracks"));
cleanup_tracks->set_pressed(true);
cleanup_vb->add_child(cleanup_tracks);
- cleanup_all = memnew(CheckButton);
+ cleanup_all = memnew(CheckBox);
cleanup_all->set_text(TTR("Clean-up all animations"));
cleanup_vb->add_child(cleanup_all);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 0d5a621e07..8dc2304a95 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -439,9 +439,9 @@ class AnimationTrackEditor : public VBoxContainer {
SpinBox *optimize_max_angle;
ConfirmationDialog *cleanup_dialog;
- CheckButton *cleanup_keys;
- CheckButton *cleanup_tracks;
- CheckButton *cleanup_all;
+ CheckBox *cleanup_keys;
+ CheckBox *cleanup_tracks;
+ CheckBox *cleanup_all;
ConfirmationDialog *scale_dialog;
SpinBox *scale;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index d5aae7b562..7c396e1da3 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -341,7 +341,11 @@ bool FindReplaceBar::search_prev() {
bool FindReplaceBar::search_next() {
uint32_t flags = 0;
- String text = get_search_text();
+ String text;
+ if (replace_all_mode)
+ text = get_replace_text();
+ else
+ text = get_search_text();
if (is_whole_words())
flags |= TextEdit::SEARCH_WHOLE_WORDS;
@@ -734,15 +738,54 @@ void CodeTextEditor::_complete_request() {
if (entries.size() == 0)
return;
- Vector<String> options;
- options.resize(entries.size());
- size_t i = 0;
for (List<ScriptCodeCompletionOption>::Element *E = entries.front(); E; E = E->next()) {
- options.write[i] = E->get().insert_text;
- i++;
+ E->get().icon = _get_completion_icon(E->get());
}
+ text_editor->code_complete(entries, forced);
+}
- text_editor->code_complete(options, forced);
+Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) {
+ Ref<Texture> tex;
+ switch (p_option.kind) {
+ case ScriptCodeCompletionOption::KIND_CLASS: {
+ if (has_icon(p_option.display, "EditorIcons")) {
+ tex = get_icon(p_option.display, "EditorIcons");
+ } else {
+ tex = get_icon("Object", "EditorIcons");
+ }
+ } break;
+ case ScriptCodeCompletionOption::KIND_ENUM:
+ tex = get_icon("Enum", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_FILE_PATH:
+ tex = get_icon("File", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_NODE_PATH:
+ tex = get_icon("NodePath", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_VARIABLE:
+ tex = get_icon("Variant", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_CONSTANT:
+ tex = get_icon("MemberConstant", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_MEMBER:
+ tex = get_icon("MemberProperty", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_SIGNAL:
+ tex = get_icon("MemberSignal", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_FUNCTION:
+ tex = get_icon("MemberMethod", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_PLAIN_TEXT:
+ tex = get_icon("CubeMesh", "EditorIcons");
+ break;
+ default:
+ tex = get_icon("String", "EditorIcons");
+ break;
+ }
+ return tex;
}
void CodeTextEditor::_font_resize_timeout() {
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 2653a8cecc..5af1f531a9 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -162,6 +162,7 @@ class CodeTextEditor : public VBoxContainer {
void _update_font();
void _complete_request();
+ Ref<Texture> _get_completion_icon(const ScriptCodeCompletionOption &p_option);
void _font_resize_timeout();
bool _add_font_size(int p_delta);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 9c10c05b59..ed262d9c4f 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -899,7 +899,7 @@ Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObj
return OK;
}
-Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files) {
+Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) {
EditorProgress ep("savepack", TTR("Packing"), 102, true);
@@ -921,9 +921,34 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
pd.file_ofs.sort(); //do sort, so we can do binary search later
- FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_CANT_CREATE);
- f->store_32(0x43504447); //GDPK
+ FileAccess *f;
+ int64_t embed_pos = 0;
+ if (!p_embed) {
+ // Regular output to separate PCK file
+ f = FileAccess::open(p_path, FileAccess::WRITE);
+ ERR_FAIL_COND_V(!f, ERR_CANT_CREATE);
+ } else {
+ // Append to executable
+ f = FileAccess::open(p_path, FileAccess::READ_WRITE);
+ ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
+
+ f->seek_end();
+ embed_pos = f->get_position();
+
+ if (r_embedded_start) {
+ *r_embedded_start = embed_pos;
+ }
+
+ // Ensure embedded PCK starts at a 64-bit multiple
+ int pad = f->get_position() % 8;
+ for (int i = 0; i < pad; i++) {
+ f->store_8(0);
+ }
+ }
+
+ int64_t pck_start_pos = f->get_position();
+
+ f->store_32(0x43504447); //GDPC
f->store_32(1); //pack version
f->store_32(VERSION_MAJOR);
f->store_32(VERSION_MINOR);
@@ -935,29 +960,29 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
f->store_32(pd.file_ofs.size()); //amount of files
- size_t header_size = f->get_position();
+ int64_t header_size = f->get_position();
//precalculate header size
for (int i = 0; i < pd.file_ofs.size(); i++) {
header_size += 4; // size of path string (32 bits is enough)
- uint32_t string_len = pd.file_ofs[i].path_utf8.length();
+ int string_len = pd.file_ofs[i].path_utf8.length();
header_size += string_len + _get_pad(4, string_len); ///size of path string
header_size += 8; // offset to file _with_ header size included
header_size += 8; // size of file
header_size += 16; // md5
}
- size_t header_padding = _get_pad(PCK_PADDING, header_size);
+ int header_padding = _get_pad(PCK_PADDING, header_size);
for (int i = 0; i < pd.file_ofs.size(); i++) {
- uint32_t string_len = pd.file_ofs[i].path_utf8.length();
- uint32_t pad = _get_pad(4, string_len);
- ;
+ int string_len = pd.file_ofs[i].path_utf8.length();
+ int pad = _get_pad(4, string_len);
+
f->store_32(string_len + pad);
f->store_buffer((const uint8_t *)pd.file_ofs[i].path_utf8.get_data(), string_len);
- for (uint32_t j = 0; j < pad; j++) {
+ for (int j = 0; j < pad; j++) {
f->store_8(0);
}
@@ -966,7 +991,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
f->store_buffer(pd.file_ofs[i].md5.ptr(), 16); //also save md5 for file
}
- for (uint32_t j = 0; j < header_padding; j++) {
+ for (int i = 0; i < header_padding; i++) {
f->store_8(0);
}
@@ -992,7 +1017,23 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
memdelete(ftmp);
- f->store_32(0x43504447); //GDPK
+ if (p_embed) {
+ // Ensure embedded data ends at a 64-bit multiple
+ int64_t embed_end = f->get_position() - embed_pos + 12;
+ int pad = embed_end % 8;
+ for (int i = 0; i < pad; i++) {
+ f->store_8(0);
+ }
+
+ int64_t pck_size = f->get_position() - pck_start_pos;
+ f->store_64(pck_size);
+ f->store_32(0x43504447); //GDPC
+
+ if (r_embedded_size) {
+ *r_embedded_size = f->get_position() - embed_pos;
+ }
+ }
+
memdelete(f);
return OK;
@@ -1399,6 +1440,7 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/no_bptc_fallbacks"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), ""));
}
@@ -1516,12 +1558,33 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = da->copy(template_path, p_path, get_chmod_flags());
+ memdelete(da);
+
if (err == OK) {
- String pck_path = p_path.get_basename() + ".pck";
+ String pck_path;
+ if (p_preset->get("binary_format/embed_pck")) {
+ pck_path = p_path;
+ } else {
+ pck_path = p_path.get_basename() + ".pck";
+ }
Vector<SharedObject> so_files;
- err = save_pack(p_preset, pck_path, &so_files);
+ int64_t embedded_pos;
+ int64_t embedded_size;
+ err = save_pack(p_preset, pck_path, &so_files, p_preset->get("binary_format/embed_pck"), &embedded_pos, &embedded_size);
+ if (err == OK && p_preset->get("binary_format/embed_pck")) {
+
+ if (embedded_size >= 0x100000000 && !p_preset->get("binary_format/64_bits")) {
+ EditorNode::get_singleton()->show_warning(TTR("On 32-bit exports the embedded PCK cannot be bigger than 4 GiB."));
+ return ERR_UNAVAILABLE;
+ }
+
+ FixUpEmbeddedPckFunc fixup_func = get_fixup_embedded_pck_func();
+ if (fixup_func) {
+ err = fixup_func(p_path, embedded_pos, embedded_size);
+ }
+ }
if (err == OK && !so_files.empty()) {
//if shared object files, copy them
@@ -1529,10 +1592,10 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
for (int i = 0; i < so_files.size() && err == OK; i++) {
err = da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
}
+ memdelete(da);
}
}
- memdelete(da);
return err;
}
@@ -1603,9 +1666,20 @@ void EditorExportPlatformPC::set_chmod_flags(int p_flags) {
chmod_flags = p_flags;
}
+EditorExportPlatformPC::FixUpEmbeddedPckFunc EditorExportPlatformPC::get_fixup_embedded_pck_func() const {
+
+ return fixup_embedded_pck_func;
+}
+
+void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func) {
+
+ fixup_embedded_pck_func = p_fixup_embedded_pck_func;
+}
+
EditorExportPlatformPC::EditorExportPlatformPC() {
chmod_flags = -1;
+ fixup_embedded_pck_func = NULL;
}
///////////////////////
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 7c01abe0e9..3152e249bd 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -240,7 +240,7 @@ public:
Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = NULL);
- Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL);
+ Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL, bool p_embed = false, int64_t *r_embedded_start = NULL, int64_t *r_embedded_size = NULL);
Error save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path);
virtual bool poll_devices() { return false; }
@@ -391,6 +391,10 @@ class EditorExportPlatformPC : public EditorExportPlatform {
GDCLASS(EditorExportPlatformPC, EditorExportPlatform);
+public:
+ typedef Error (*FixUpEmbeddedPckFunc)(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size);
+
+private:
Ref<ImageTexture> logo;
String name;
String os_name;
@@ -405,6 +409,8 @@ class EditorExportPlatformPC : public EditorExportPlatform {
int chmod_flags;
+ FixUpEmbeddedPckFunc fixup_embedded_pck_func;
+
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features);
@@ -436,6 +442,9 @@ public:
int get_chmod_flags() const;
void set_chmod_flags(int p_flags);
+ FixUpEmbeddedPckFunc get_fixup_embedded_pck_func() const;
+ void set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func);
+
EditorExportPlatformPC();
};
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d9600172d7..9d3be1ab9e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2622,6 +2622,13 @@ void EditorNode::_exit_editor() {
exiting = true;
resource_preview->stop(); //stop early to avoid crashes
_save_docks();
+
+ // Dim the editor window while it's quitting to make it clearer that it's busy.
+ // No transition is applied, as the effect needs to be visible immediately
+ float c = 1.0f - float(EDITOR_GET("interface/editor/dim_amount"));
+ Color dim_color = Color(c, c, c);
+ gui_base->set_modulate(dim_color);
+
get_tree()->quit();
}
@@ -6258,7 +6265,7 @@ EditorNode::EditorNode() {
file_export_lib->set_title(TTR("Export Library"));
file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file_export_lib->connect("file_selected", this, "_dialog_action");
- file_export_lib_merge = memnew(CheckButton);
+ file_export_lib_merge = memnew(CheckBox);
file_export_lib_merge->set_text(TTR("Merge With Existing"));
file_export_lib_merge->set_pressed(true);
file_export_lib->get_vbox()->add_child(file_export_lib_merge);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index ca64126c60..733f29c8ff 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -330,7 +330,7 @@ private:
EditorFileDialog *file_export;
EditorFileDialog *file_export_lib;
EditorFileDialog *file_script;
- CheckButton *file_export_lib_merge;
+ CheckBox *file_export_lib_merge;
LineEdit *file_export_password;
String current_path;
MenuButton *update_spinner;
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 90d6c3a983..c2a845653e 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -220,7 +220,7 @@ EditorSelection *EditorInterface::get_selection() {
return EditorNode::get_singleton()->get_editor_selection();
}
-EditorSettings *EditorInterface::get_editor_settings() {
+Ref<EditorSettings> EditorInterface::get_editor_settings() {
return EditorSettings::get_singleton();
}
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index ec369bbdbb..75c230adb7 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -87,7 +87,7 @@ public:
EditorSelection *get_selection();
//EditorImportExport *get_import_export();
- EditorSettings *get_editor_settings();
+ Ref<EditorSettings> get_editor_settings();
EditorResourcePreview *get_resource_previewer();
EditorFileSystem *get_resource_file_system();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index ecc63b1a8d..8e8c12ba44 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1579,6 +1579,8 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_recent_dirs"), &EditorSettings::get_recent_dirs);
ADD_SIGNAL(MethodInfo("settings_changed"));
+
+ BIND_CONSTANT(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
}
EditorSettings::EditorSettings() {
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 3bddc6d6d4..0404115269 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -119,7 +119,7 @@ public:
void set_spatial_node(Spatial *p_node);
Spatial *get_spatial_node() const { return spatial_node; }
- EditorSpatialGizmoPlugin *get_plugin() const { return gizmo_plugin; }
+ Ref<EditorSpatialGizmoPlugin> get_plugin() const { return gizmo_plugin; }
Vector3 get_handle_pos(int p_idx) const;
bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum);
bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 40343cf908..cc9e14975f 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -131,7 +131,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc_substitute->set_name(TTR("Substitute"));
tabc_features->add_child(vbc_substitute);
- cbut_substitute = memnew(CheckButton);
+ cbut_substitute = memnew(CheckBox);
cbut_substitute->set_text(TTR("Substitute"));
vbc_substitute->add_child(cbut_substitute);
@@ -246,7 +246,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height));
tabc_features->add_child(vbc_regex);
- cbut_regex = memnew(CheckButton);
+ cbut_regex = memnew(CheckBox);
cbut_regex->set_text(TTR("Regular Expressions"));
vbc_regex->add_child(cbut_regex);
@@ -258,7 +258,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
tabc_features->add_child(vbc_process);
- cbut_process = memnew(CheckButton);
+ cbut_process = memnew(CheckBox);
cbut_process->set_text(TTR("Post-Process"));
vbc_process->add_child(cbut_process);
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index 4e0fab6a9f..9f0fbf66a1 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -32,7 +32,6 @@
#define RENAME_DIALOG_H
#include "scene/gui/check_box.h"
-#include "scene/gui/check_button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/option_button.h"
#include "scene/gui/spin_box.h"
@@ -75,9 +74,9 @@ class RenameDialog : public ConfirmationDialog {
TabContainer *tabc_features;
- CheckButton *cbut_substitute;
- CheckButton *cbut_regex;
- CheckButton *cbut_process;
+ CheckBox *cbut_substitute;
+ CheckBox *cbut_regex;
+ CheckBox *cbut_process;
CheckBox *chk_per_level_counter;
Button *but_insert_name;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 442de08ffa..5f62ed0702 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -439,6 +439,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
}
script_create_dialog->connect("script_created", this, "_script_created");
script_create_dialog->connect("popup_hide", this, "_script_creation_closed");
+ script_create_dialog->set_inheritance_base_type("Node");
script_create_dialog->config(inherits, path);
script_create_dialog->popup_centered();
@@ -572,6 +573,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *node = E->get();
Node *parent = node->get_parent();
+ Node *selection_tail = _get_selection_group_tail(node, selection);
List<Node *> owned;
node->get_owned_by(node->get_owner(), &owned);
@@ -589,7 +591,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
dup->set_name(parent->validate_child_name(dup));
- editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", node, dup);
+ editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", selection_tail, dup);
for (List<Node *>::Element *F = owned.front(); F; F = F->next()) {
if (!duplimap.has(F->get())) {
@@ -597,7 +599,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
continue;
}
Node *d = duplimap[F->get()];
- editor_data->get_undo_redo().add_do_method(d, "set_owner", node->get_owner());
+ editor_data->get_undo_redo().add_do_method(d, "set_owner", selection_tail->get_owner());
}
editor_data->get_undo_redo().add_do_method(editor_selection, "add_node", dup);
editor_data->get_undo_redo().add_undo_method(parent, "remove_child", dup);
@@ -1884,6 +1886,23 @@ void SceneTreeDock::_selection_changed() {
_update_script_button();
}
+Node *SceneTreeDock::_get_selection_group_tail(Node *p_node, List<Node *> p_list) {
+
+ Node *tail = p_node;
+ Node *parent = tail->get_parent();
+
+ for (int i = p_node->get_position_in_parent(); i < parent->get_child_count(); i++) {
+ Node *sibling = parent->get_child(i);
+
+ if (p_list.find(sibling))
+ tail = sibling;
+ else
+ break;
+ }
+
+ return tail;
+}
+
void SceneTreeDock::_create() {
if (current_option == TOOL_NEW) {
@@ -2225,23 +2244,20 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) {
void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) {
- Vector<Node *> nodes;
- Node *to_node;
-
- for (int i = 0; i < p_nodes.size(); i++) {
- Node *n = get_node((p_nodes[i]));
- if (n) {
- nodes.push_back(n);
- }
- }
+ List<Node *> selection = editor_selection->get_selected_node_list();
- if (nodes.size() == 0)
- return;
+ if (selection.empty())
+ return; //nothing to reparent
- to_node = get_node(p_to);
+ Node *to_node = get_node(p_to);
if (!to_node)
return;
+ Vector<Node *> nodes;
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ nodes.push_back(E->get());
+ }
+
int to_pos = -1;
_normalize_drop(to_node, to_pos, p_type);
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 3729e27ce6..8a2b237b8b 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -195,6 +195,7 @@ class SceneTreeDock : public VBoxContainer {
bool _validate_no_foreign();
void _selection_changed();
void _update_script_button();
+ Node *_get_selection_group_tail(Node *p_node, List<Node *> p_list);
void _fill_path_renames(Vector<StringName> base_path, Vector<StringName> new_base_path, Node *p_node, List<Pair<NodePath, NodePath> > *p_renames);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 8916f4d8c4..bebfe6d3a1 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -742,8 +742,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Built-in Script */
- internal = memnew(CheckButton);
- internal->set_h_size_flags(0);
+ internal = memnew(CheckBox);
+ internal->set_text(TTR("On"));
internal->connect("pressed", this, "_built_in_pressed");
internal_label = memnew(Label(TTR("Built-in Script")));
internal_label->set_align(Label::ALIGN_RIGHT);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 61f87f5732..288b8f604b 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -33,7 +33,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_settings.h"
-#include "scene/gui/check_button.h"
+#include "scene/gui/check_box.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/line_edit.h"
@@ -57,7 +57,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
LineEdit *file_path;
Button *path_button;
EditorFileDialog *file_browse;
- CheckButton *internal;
+ CheckBox *internal;
Label *internal_label;
VBoxContainer *path_vb;
AcceptDialog *alert;