summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/collada/collada.cpp1
-rw-r--r--editor/editor_log.cpp29
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/import/resource_importer_wav.cpp52
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp9
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp38
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp22
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/project_manager.h1
-rw-r--r--editor/script_editor_debugger.cpp1
11 files changed, 108 insertions, 78 deletions
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index ab1e397ccc..169c34782d 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -2220,6 +2220,7 @@ void Collada::_merge_skeletons(VisualScene *p_vscene, Node *p_node) {
ERR_CONTINUE(!state.scene_map.has(nodeid)); //weird, it should have it...
NodeJoint *nj = SAFE_CAST<NodeJoint *>(state.scene_map[nodeid]);
+ ERR_CONTINUE(!nj); //broken collada
if (!nj->owner) {
print_line("no owner for: " + String(nodeid));
}
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 5ada5f9095..c5e15b97b0 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -52,31 +52,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
*/
err_str = " " + err_str;
- self->log->add_newline();
-
- Ref<Texture> icon;
-
- switch (p_type) {
- case ERR_HANDLER_ERROR: {
-
- icon = self->get_icon("Error", "EditorIcons");
- return; // these are confusing
- } break;
- case ERR_HANDLER_WARNING: {
-
- icon = self->get_icon("Error", "EditorIcons");
-
- } break;
- case ERR_HANDLER_SCRIPT: {
-
- icon = self->get_icon("ScriptError", "EditorIcons");
- } break;
- case ERR_HANDLER_SHADER: {
-
- icon = self->get_icon("Shader", "EditorIcons");
- } break;
- }
-
self->add_message(err_str, true);
}
@@ -114,16 +89,16 @@ void EditorLog::clear() {
void EditorLog::add_message(const String &p_msg, bool p_error) {
+ log->add_newline();
if (p_error) {
+ log->push_color(get_color("fg_error", "Editor"));
Ref<Texture> icon = get_icon("Error", "EditorIcons");
log->add_image(icon);
//button->set_icon(icon);
- log->push_color(get_color("fg_error", "Editor"));
} else {
//button->set_icon(Ref<Texture>());
}
- log->add_newline();
log->add_text(p_msg);
//button->set_text(p_msg);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 7e90098044..8e40850a0c 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -102,7 +102,7 @@ void FileSystemDock::_notification(int p_what) {
case NOTIFICATION_RESIZED: {
- bool new_mode = get_size().height < get_viewport_rect().size.height * 3 / 4;
+ bool new_mode = get_size().height < get_viewport_rect().size.height / 2;
if (new_mode != split_mode) {
@@ -589,7 +589,7 @@ void FileSystemDock::_go_to_dir(const String &p_dir) {
void FileSystemDock::_preview_invalidated(const String &p_path) {
- if (p_path.get_base_dir() == path && search_box->get_text() == String() && file_list_vb->is_visible_in_tree()) {
+ if (display_mode == DISPLAY_THUMBNAILS && p_path.get_base_dir() == path && search_box->get_text() == String() && file_list_vb->is_visible_in_tree()) {
for (int i = 0; i < files->get_item_count(); i++) {
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 8cb712cb78..07f1f4dd9f 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -123,6 +123,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int format_channels = 0;
AudioStreamSample::LoopMode loop = AudioStreamSample::LOOP_DISABLED;
+ uint16_t compression_code = 1;
bool format_found = false;
bool data_found = false;
int format_freq = 0;
@@ -151,11 +152,10 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
if (chunkID[0] == 'f' && chunkID[1] == 'm' && chunkID[2] == 't' && chunkID[3] == ' ' && !format_found) {
/* IS FORMAT CHUNK */
- uint16_t compression_code = file->get_16();
-
//Issue: #7755 : Not a bug - usage of other formats (format codes) are unsupported in current importer version.
//Consider revision for engine version 3.0
- if (compression_code != 1) {
+ compression_code = file->get_16();
+ if (compression_code != 1 && compression_code != 3) {
ERR_PRINT("Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead.");
break;
}
@@ -210,33 +210,37 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
data.resize(frames * format_channels);
- for (int i = 0; i < frames; i++) {
-
- for (int c = 0; c < format_channels; c++) {
-
- if (format_bits == 8) {
- // 8 bit samples are UNSIGNED
-
- uint8_t s = file->get_8();
- s -= 128;
- int8_t *sp = (int8_t *)&s;
+ if (format_bits == 8) {
+ for (int i = 0; i < frames * format_channels; i++) {
+ // 8 bit samples are UNSIGNED
- data[i * format_channels + c] = float(*sp) / 128.0;
+ data[i] = int8_t(file->get_8() - 128) / 128.f;
+ }
+ } else if (format_bits == 32 && compression_code == 3) {
+ for (int i = 0; i < frames * format_channels; i++) {
+ //32 bit IEEE Float
- } else {
- //16+ bits samples are SIGNED
- // if sample is > 16 bits, just read extra bytes
+ data[i] = file->get_float();
+ }
+ } else if (format_bits == 16) {
+ for (int i = 0; i < frames * format_channels; i++) {
+ //16 bit SIGNED
- uint32_t s = 0;
- for (int b = 0; b < (format_bits >> 3); b++) {
+ data[i] = int16_t(file->get_16()) / 32768.f;
+ }
+ } else {
+ for (int i = 0; i < frames * format_channels; i++) {
+ //16+ bits samples are SIGNED
+ // if sample is > 16 bits, just read extra bytes
- s |= ((uint32_t)file->get_8()) << (b * 8);
- }
- s <<= (32 - format_bits);
- int32_t ss = s;
+ uint32_t s = 0;
+ for (int b = 0; b < (format_bits >> 3); b++) {
- data[i * format_channels + c] = (ss >> 16) / 32768.0;
+ s |= ((uint32_t)file->get_8()) << (b * 8);
}
+ s <<= (32 - format_bits);
+
+ data[i] = (int32_t(s) >> 16) / 32768.f;
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index f5d9da195a..ac6d78adc2 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -375,6 +375,8 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES);
skeleton_menu->set_item_checked(idx, skeleton_show_bones);
}
+
+ viewport->update();
}
void CanvasItemEditor::_add_canvas_item(CanvasItem *p_canvas_item) {
@@ -1390,7 +1392,12 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
while ((n && n != scene && n->get_owner() != scene) || (n && !n->is_class("CanvasItem"))) {
n = n->get_parent();
};
- c = n->cast_to<CanvasItem>();
+
+ if (n) {
+ c = n->cast_to<CanvasItem>();
+ } else {
+ c = NULL;
+ }
// Select the item
additive_selection = b->get_shift();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 50d2f193ed..0dba1f12a2 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1190,17 +1190,47 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
motion = motion_mask.dot(motion) * motion_mask;
}
+ //set_message("Translating: "+motion);
+
+ List<Node *> &selection = editor_selection->get_selected_node_list();
+
float snap = 0;
if (_edit.snap || spatial_editor->is_snap_enabled()) {
snap = spatial_editor->get_translate_snap();
- motion.snap(Vector3(snap, snap, snap));
- }
+ bool local_coords = spatial_editor->are_local_coords_enabled();
+
+ if (local_coords) {
+ bool multiple = false;
+ Spatial *node = NULL;
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp) {
+ continue;
+ }
+ if (node) {
+ multiple = true;
+ break;
+ } else {
+ node = sp;
+ }
+ }
- //set_message("Translating: "+motion);
+ if (multiple) {
+ motion.snap(Vector3(snap, snap, snap));
+ } else {
+ Basis b = node->get_global_transform().basis.orthonormalized();
+ Vector3 local_motion = b.inverse().xform(motion);
+ local_motion.snap(Vector3(snap, snap, snap));
+ motion = b.xform(local_motion);
+ }
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ } else {
+ motion.snap(Vector3(snap, snap, snap));
+ }
+ }
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 9b626054c0..e9857f8b0c 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -514,6 +514,8 @@ public:
float get_rotate_snap() const { return snap_rotate->get_text().to_double(); }
float get_scale_snap() const { return snap_scale->get_text().to_double(); }
+ bool are_local_coords_enabled() const { return transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(SpatialEditor::MENU_TRANSFORM_LOCAL_COORDS)); }
+
Ref<ArrayMesh> get_move_gizmo(int idx) const { return move_gizmo[idx]; }
Ref<ArrayMesh> get_rotate_gizmo(int idx) const { return rotate_gizmo[idx]; }
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index e7bc8a4dab..a52a875338 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -1451,6 +1451,11 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A);
ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S);
+ HBoxContainer *tool_hb1 = memnew(HBoxContainer);
+ add_child(tool_hb1);
+ HBoxContainer *tool_hb2 = memnew(HBoxContainer);
+ add_child(tool_hb2);
+
search_box = memnew(LineEdit);
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
search_box->connect("text_entered", this, "_text_entered");
@@ -1514,47 +1519,44 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
transp->set_tooltip(TTR("Transpose") + " (" + ED_GET_SHORTCUT("tile_map_editor/transpose")->get_as_text() + ")");
transp->set_focus_mode(FOCUS_NONE);
transp->connect("pressed", this, "_update_transform_buttons", make_binds(transp));
- toolbar->add_child(transp);
+ tool_hb1->add_child(transp);
mirror_x = memnew(ToolButton);
mirror_x->set_toggle_mode(true);
mirror_x->set_tooltip(TTR("Mirror X") + " (" + ED_GET_SHORTCUT("tile_map_editor/mirror_x")->get_as_text() + ")");
mirror_x->set_focus_mode(FOCUS_NONE);
mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x));
- toolbar->add_child(mirror_x);
+ tool_hb1->add_child(mirror_x);
mirror_y = memnew(ToolButton);
mirror_y->set_toggle_mode(true);
mirror_y->set_tooltip(TTR("Mirror Y") + " (" + ED_GET_SHORTCUT("tile_map_editor/mirror_y")->get_as_text() + ")");
mirror_y->set_focus_mode(FOCUS_NONE);
mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y));
- toolbar->add_child(mirror_y);
-
- toolbar->add_child(memnew(VSeparator));
+ tool_hb1->add_child(mirror_y);
rotate_0 = memnew(ToolButton);
rotate_0->set_toggle_mode(true);
rotate_0->set_tooltip(TTR("Rotate 0 degrees"));
rotate_0->set_focus_mode(FOCUS_NONE);
rotate_0->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_0));
- toolbar->add_child(rotate_0);
+ tool_hb2->add_child(rotate_0);
rotate_90 = memnew(ToolButton);
rotate_90->set_toggle_mode(true);
rotate_90->set_tooltip(TTR("Rotate 90 degrees"));
rotate_90->set_focus_mode(FOCUS_NONE);
rotate_90->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_90));
- toolbar->add_child(rotate_90);
+ tool_hb2->add_child(rotate_90);
rotate_180 = memnew(ToolButton);
rotate_180->set_toggle_mode(true);
rotate_180->set_tooltip(TTR("Rotate 180 degrees"));
rotate_180->set_focus_mode(FOCUS_NONE);
rotate_180->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_180));
- toolbar->add_child(rotate_180);
+ tool_hb2->add_child(rotate_180);
rotate_270 = memnew(ToolButton);
rotate_270->set_toggle_mode(true);
rotate_270->set_tooltip(TTR("Rotate 270 degrees"));
rotate_270->set_focus_mode(FOCUS_NONE);
rotate_270->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_270));
- toolbar->add_child(rotate_270);
- toolbar->hide();
+ tool_hb2->add_child(rotate_270);
rotate_0->set_pressed(true);
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index d5a56f644f..b77544befa 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -491,17 +491,8 @@ void ProjectManager::_update_project_buttons() {
item->update();
}
- bool has_runnable_scene = false;
- for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
- const String &selected_main = E->get();
- if (selected_main == "") continue;
- has_runnable_scene = true;
- break;
- }
-
erase_btn->set_disabled(selected_list.size() < 1);
open_btn->set_disabled(selected_list.size() < 1);
- run_btn->set_disabled(!has_runnable_scene);
}
void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
@@ -969,10 +960,22 @@ void ProjectManager::_run_project_confirm() {
for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
const String &selected_main = E->get();
- if (selected_main == "") continue;
+ if (selected_main == "") {
+ run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in \"Project Settings\" under the \"Application\" category."));
+ run_error_diag->popup_centered();
+ return;
+ }
+
const String &selected = E->key();
String path = EditorSettings::get_singleton()->get("projects/" + selected);
+
+ if (!DirAccess::exists(path + "/.import")) {
+ run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import."));
+ run_error_diag->popup_centered();
+ return;
+ }
+
print_line("OPENING: " + path + " (" + selected + ")");
List<String> args;
@@ -1390,6 +1393,10 @@ ProjectManager::ProjectManager() {
last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
+
+ run_error_diag = memnew(AcceptDialog);
+ gui_base->add_child(run_error_diag);
+ run_error_diag->set_title(TTR("Can't run project"));
}
ProjectManager::~ProjectManager() {
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 27886132c5..181d3cc5d9 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -57,6 +57,7 @@ class ProjectManager : public Control {
ConfirmationDialog *multi_open_ask;
ConfirmationDialog *multi_run_ask;
ConfirmationDialog *multi_scan_ask;
+ AcceptDialog *run_error_diag;
NewProjectDialog *npdialog;
ScrollContainer *scroll;
VBoxContainer *scroll_childs;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index b8c531bbce..01cfdc1b57 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1597,6 +1597,7 @@ void ScriptEditorDebugger::_bind_methods() {
ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
ppeer = Ref<PacketPeerStream>(memnew(PacketPeerStream));
+ ppeer->set_input_buffer_max_size(1024 * 1024 * 8); //8mb should be enough
editor = p_editor;
tabs = memnew(TabContainer);