summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/collada/collada.h2
-rw-r--r--editor/doc/doc_data.cpp2
-rw-r--r--editor/editor_autoload_settings.cpp2
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_node.cpp29
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_resource_preview.cpp2
-rw-r--r--editor/file_type_cache.cpp2
-rw-r--r--editor/filesystem_dock.cpp2
-rw-r--r--editor/import/editor_import_collada.cpp4
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/io_plugins/editor_export_scene.cpp2
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.cpp2
-rw-r--r--editor/io_plugins/editor_texture_import_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp21
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/sample_editor_plugin.cpp2
-rw-r--r--editor/plugins/sample_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp70
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp59
-rw-r--r--editor/plugins/theme_editor_plugin.h3
-rw-r--r--editor/project_export.cpp2
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/property_editor.cpp12
-rw-r--r--editor/scene_tree_dock.cpp4
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--editor/script_editor_debugger.cpp2
-rw-r--r--editor/settings_config_dialog.cpp2
33 files changed, 140 insertions, 139 deletions
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index 38e66a7e45..8945e14cce 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -32,9 +32,9 @@
#ifndef COLLADA_H
#define COLLADA_H
-#include "project_settings.h"
#include "io/xml_parser.h"
#include "map.h"
+#include "project_settings.h"
#include "scene/resources/material.h"
class Collada {
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index fa90cd36b3..69d7475f4c 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "doc_data.h"
-#include "project_settings.h"
#include "global_constants.h"
#include "io/compression.h"
#include "io/marshalls.h"
+#include "project_settings.h"
#include "scene/resources/theme.h"
#include "script_language.h"
#include "version.h"
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 399c22bf2c..dde94cb334 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -30,8 +30,8 @@
#include "editor_autoload_settings.h"
#include "editor_node.h"
-#include "project_settings.h"
#include "global_constants.h"
+#include "project_settings.h"
#define PREVIEW_LIST_MAX_SIZE 10
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index f8dbd9abe5..c82e8f1226 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -31,10 +31,10 @@
#include "editor_node.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "os/dir_access.h"
#include "os/file_access.h"
+#include "project_settings.h"
#include "scene/resources/packed_scene.h"
void EditorHistory::_cleanup_history() {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0c47daf5e6..0cdb981306 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1949,7 +1949,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_CLOSE: {
if (!p_confirmed && (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER)) {
- tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene();
+ tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
@@ -2481,7 +2481,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- if (_next_unsaved_scene() == -1) {
+ bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
+ if (_next_unsaved_scene(!save_each) == -1) {
bool confirm = EDITOR_DEF("interface/quit_confirmation", true);
if (confirm) {
@@ -2495,21 +2496,16 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
} else {
- bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
if (save_each) {
_menu_option_confirm(p_option == FILE_QUIT ? FILE_CLOSE_ALL_AND_QUIT : FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, false);
} else {
String unsaved_scenes;
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
- int current = editor_data.get_edited_scene();
- bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
- if (unsaved) {
-
- String scene_filename = editor_data.get_edited_scene_root(i)->get_filename();
- unsaved_scenes += "\n " + scene_filename;
- }
+ int i = _next_unsaved_scene(true, 0);
+ while (i != -1) {
+ unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_filename();
+ i = _next_unsaved_scene(true, ++i);
}
save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
@@ -2522,7 +2518,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
- if (_next_unsaved_scene() != -1) {
+ if (_next_unsaved_scene(true) != -1) {
_save_all_scenes();
}
_discard_changes();
@@ -2751,15 +2747,18 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
-int EditorNode::_next_unsaved_scene() {
+int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ for (int i = p_start; i < editor_data.get_edited_scene_count(); i++) {
if (!editor_data.get_edited_scene_root(i))
continue;
int current = editor_data.get_edited_scene();
bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
if (unsaved) {
+ String scene_filename = editor_data.get_edited_scene_root(i)->get_filename();
+ if (p_valid_filename && scene_filename.length() == 0)
+ continue;
return i;
}
}
@@ -2779,7 +2778,7 @@ void EditorNode::_discard_changes(const String &p_str) {
_update_scene_tabs();
if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
- if (_next_unsaved_scene() == -1) {
+ if (_next_unsaved_scene(false) == -1) {
current_option = current_option == FILE_CLOSE_ALL_AND_QUIT ? FILE_QUIT : RUN_PROJECT_MANAGER;
_discard_changes();
} else {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 6553d3eee2..a440aaa1e6 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -464,7 +464,7 @@ private:
void _save_scene(String p_file, int idx = -1);
void _save_all_scenes();
- int _next_unsaved_scene();
+ int _next_unsaved_scene(bool p_valid_filename, int p_start = 0);
void _discard_changes(const String &p_str = String());
void _instance_request(const Vector<String> &p_files);
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 6ab1468b1d..63bee33092 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -30,10 +30,10 @@
#include "editor_plugin_settings.h"
#include "editor_node.h"
-#include "project_settings.h"
#include "io/config_file.h"
#include "os/file_access.h"
#include "os/main_loop.h"
+#include "project_settings.h"
#include "scene/gui/margin_container.h"
void EditorPluginSettings::_notification(int p_what) {
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 3a6b34b7b4..89fa004eb1 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -31,11 +31,11 @@
#include "editor_scale.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "message_queue.h"
#include "os/file_access.h"
+#include "project_settings.h"
bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp
index 100ebe21cd..728e80bba7 100644
--- a/editor/file_type_cache.cpp
+++ b/editor/file_type_cache.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "file_type_cache.h"
-#include "project_settings.h"
#include "os/file_access.h"
+#include "project_settings.h"
FileTypeCache *FileTypeCache::singleton = NULL;
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index eacb1d2cd9..77ca1a5145 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -31,11 +31,11 @@
#include "editor_node.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "os/dir_access.h"
#include "os/file_access.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/main/viewport.h"
bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir) {
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 5bf2da9912..3626c6be59 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -554,10 +554,10 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c
tangent = Vector3();
} else {
tangent = Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
- (t2 * z1 - t1 * z2) * r)
+ (t2 * z1 - t1 * z2) * r)
.normalized();
binormal = Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r,
- (s1 * z2 - s2 * z1) * r)
+ (s1 * z2 - s2 * z1) * r)
.normalized();
}
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 25548f7899..8f86e64cf2 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -323,8 +323,8 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
surf_tool->add_smooth_group(false);
else
surf_tool->add_smooth_group(true);
- } else if (l.begins_with("g ") || l.begins_with("usemtl ") || (l.begins_with("o ") || f->eof_reached())) { //commit group to mesh
-
+ } else if (/*l.begins_with("g ") ||*/ l.begins_with("usemtl ") || (l.begins_with("o ") || f->eof_reached())) { //commit group to mesh
+ //groups are too annoying
if (surf_tool->get_vertex_array().size()) {
//another group going on, commit it
if (normals.size() == 0) {
diff --git a/editor/io_plugins/editor_export_scene.cpp b/editor/io_plugins/editor_export_scene.cpp
index 390217053a..6392b4a715 100644
--- a/editor/io_plugins/editor_export_scene.cpp
+++ b/editor/io_plugins/editor_export_scene.cpp
@@ -30,11 +30,11 @@
#include "editor_export_scene.h"
#if 0
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/dir_access.h"
#include "os/file_access.h"
+#include "project_settings.h"
#include "scene/resources/packed_scene.h"
Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) {
diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp
index 5f0e928844..aa96f731ce 100644
--- a/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -31,10 +31,10 @@
#if 0
#include "editor/create_dialog.h"
#include "editor/editor_node.h"
-#include "project_settings.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/3d/body_shape.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation.h"
diff --git a/editor/io_plugins/editor_texture_import_plugin.cpp b/editor/io_plugins/editor_texture_import_plugin.cpp
index 842c43f4de..095bc02fa0 100644
--- a/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -33,10 +33,10 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor_atlas.h"
-#include "project_settings.h"
#include "io/image_loader.h"
#include "io/marshalls.h"
#include "io/resource_saver.h"
+#include "project_settings.h"
#include "scene/gui/button_group.h"
#include "scene/gui/check_button.h"
#include "scene/gui/margin_container.h"
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 82b03d3a19..c4e79bf263 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -31,10 +31,10 @@
#include "editor/animation_editor.h"
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/keyboard.h"
+#include "project_settings.h"
void AnimationPlayerEditor::_node_removed(Node *p_node) {
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 4c4cd88dfb..a809a68c23 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -176,7 +176,6 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Node2D *n2d = E->get()->cast_to<Node2D>();
-
if (n2d && n2d->edit_has_pivot()) {
Vector2 offset = n2d->edit_get_pivot();
@@ -1736,11 +1735,9 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
Ref<InputEventKey> k = p_event;
-
if (k.is_valid()) {
-
if (k->is_pressed() && drag == DRAG_NONE) {
-
+ // Move the object with the arrow keys
KeyMoveMODE move_mode = MOVE_VIEW_BASE;
if (k->get_alt()) move_mode = MOVE_LOCAL_BASE;
if (k->get_control() || k->get_metakey()) move_mode = MOVE_LOCAL_WITH_ROT;
@@ -1773,13 +1770,23 @@ void CanvasItemEditor::_viewport_draw() {
RID ci = viewport->get_canvas_item();
if (snap_show_grid) {
+ //Draw the grid
Size2 s = viewport->get_size();
int last_cell;
Transform2D xform = transform.affine_inverse();
+ Vector2 grid_offset;
+ if (snap_relative && snap_grid && get_item_count() > 0) {
+ Vector2 topleft = _find_topleftmost_point();
+ grid_offset.x = fmod(topleft.x, snap_step.x);
+ grid_offset.y = fmod(topleft.y, snap_step.y);
+ } else {
+ grid_offset = snap_offset;
+ }
+
if (snap_step.x != 0) {
for (int i = 0; i < s.width; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - snap_offset.x) / snap_step.x));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - grid_offset.x) / snap_step.x));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -1790,7 +1797,7 @@ void CanvasItemEditor::_viewport_draw() {
if (snap_step.y != 0) {
for (int i = 0; i < s.height; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - snap_offset.y) / snap_step.y));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - grid_offset.y) / snap_step.y));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -2383,6 +2390,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
snap_grid = !snap_grid;
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
edit_menu->get_popup()->set_item_checked(idx, snap_grid);
+ viewport->update();
} break;
case SNAP_SHOW_GRID: {
snap_show_grid = !snap_show_grid;
@@ -2399,6 +2407,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
snap_relative = !snap_relative;
int idx = edit_menu->get_popup()->get_item_index(SNAP_RELATIVE);
edit_menu->get_popup()->set_item_checked(idx, snap_relative);
+ viewport->update();
} break;
case SNAP_USE_PIXEL: {
snap_pixel = !snap_pixel;
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 463b6360ad..2703da12fe 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "resource_preloader_editor_plugin.h"
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
+#include "project_settings.h"
void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp
index 0b99ab5460..739a8abb53 100644
--- a/editor/plugins/sample_editor_plugin.cpp
+++ b/editor/plugins/sample_editor_plugin.cpp
@@ -31,8 +31,8 @@
#if 0
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
+#include "project_settings.h"
diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp
index 04c805165f..5ccfde15ff 100644
--- a/editor/plugins/sample_library_editor_plugin.cpp
+++ b/editor/plugins/sample_library_editor_plugin.cpp
@@ -32,8 +32,8 @@
#include "sample_library_editor_plugin.h"
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
+#include "project_settings.h"
#include "sample_editor_plugin.h"
#include "scene/main/viewport.h"
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index fef7f07abb..77c540b746 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2229,7 +2229,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
- ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String")));
+ ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script:Script")));
}
ScriptEditor::ScriptEditor(EditorNode *p_editor) {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index ef7ed5f7f6..2d77bfb2c1 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1563,13 +1563,13 @@ void SpatialEditorViewport::_update_freelook(real_t delta) {
Vector3 right = camera->get_transform().basis.xform(Vector3(1, 0, 0));
Vector3 up = camera->get_transform().basis.xform(Vector3(0, 1, 0));
- int key_left = ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_right = ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_forward = ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_backwards = ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_up = ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_down = ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_speed_modifier = ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_left = ED_GET_SHORTCUT("spatial_editor/freelook_left")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_right = ED_GET_SHORTCUT("spatial_editor/freelook_right")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_forward = ED_GET_SHORTCUT("spatial_editor/freelook_forward")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_backwards = ED_GET_SHORTCUT("spatial_editor/freelook_backwards")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_up = ED_GET_SHORTCUT("spatial_editor/freelook_up")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_down = ED_GET_SHORTCUT("spatial_editor/freelook_down")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_speed_modifier = ED_GET_SHORTCUT("spatial_editor/freelook_speed_modifier")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
Vector3 velocity;
bool pressed = false;
@@ -2424,6 +2424,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW);
view_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+ ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A);
+ ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D);
+ ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W);
+ ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S);
+ ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q);
+ ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E);
+ ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT);
+
preview_camera = memnew(Button);
preview_camera->set_toggle_mode(true);
preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90);
@@ -3134,7 +3142,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
xform_scale[i]->set_text("1");
}
- xform_dialog->popup_centered(Size2(200, 200));
+ xform_dialog->popup_centered(Size2(320, 240) * EDSCALE);
} break;
case MENU_VIEW_USE_1_VIEWPORT: {
@@ -3956,55 +3964,59 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
xform_dialog = memnew(ConfirmationDialog);
xform_dialog->set_title(TTR("Transform Change"));
add_child(xform_dialog);
+
+ VBoxContainer *xform_vbc = memnew(VBoxContainer);
+ xform_dialog->add_child(xform_vbc);
+
Label *l = memnew(Label);
l->set_text(TTR("Translate:"));
- l->set_position(Point2(5, 5));
- xform_dialog->add_child(l);
+ xform_vbc->add_child(l);
+
+ HBoxContainer *xform_hbc = memnew(HBoxContainer);
+ xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_translate[i] = memnew(LineEdit);
- xform_translate[i]->set_position(Point2(15 + i * 60, 22));
- xform_translate[i]->set_size(Size2(50, 12));
- xform_dialog->add_child(xform_translate[i]);
+ xform_translate[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ xform_hbc->add_child(xform_translate[i]);
}
l = memnew(Label);
l->set_text(TTR("Rotate (deg.):"));
- l->set_position(Point2(5, 45));
- xform_dialog->add_child(l);
+ xform_vbc->add_child(l);
+
+ xform_hbc = memnew(HBoxContainer);
+ xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_rotate[i] = memnew(LineEdit);
- xform_rotate[i]->set_position(Point2(15 + i * 60, 62));
- xform_rotate[i]->set_size(Size2(50, 22));
- xform_dialog->add_child(xform_rotate[i]);
+ xform_rotate[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ xform_hbc->add_child(xform_rotate[i]);
}
l = memnew(Label);
l->set_text(TTR("Scale (ratio):"));
- l->set_position(Point2(5, 85));
- xform_dialog->add_child(l);
+ xform_vbc->add_child(l);
+
+ xform_hbc = memnew(HBoxContainer);
+ xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_scale[i] = memnew(LineEdit);
- xform_scale[i]->set_position(Point2(15 + i * 60, 102));
- xform_scale[i]->set_size(Size2(50, 22));
- xform_dialog->add_child(xform_scale[i]);
+ xform_scale[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ xform_hbc->add_child(xform_scale[i]);
}
l = memnew(Label);
l->set_text(TTR("Transform Type"));
- l->set_position(Point2(5, 125));
- xform_dialog->add_child(l);
+ xform_vbc->add_child(l);
xform_type = memnew(OptionButton);
- xform_type->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- xform_type->set_begin(Point2(15, 142));
- xform_type->set_end(Point2(15, 75));
+ xform_type->set_h_size_flags(SIZE_EXPAND_FILL);
xform_type->add_item(TTR("Pre"));
xform_type->add_item(TTR("Post"));
- xform_dialog->add_child(xform_type);
+ xform_vbc->add_child(xform_type);
xform_dialog->connect("confirmed", this, "_xform_dialog_action");
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index fa80894f7b..6a010062f2 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "sprite_frames_editor_plugin.h"
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
+#include "project_settings.h"
#include "scene/3d/sprite_3d.h"
void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 70a1227c52..125d906460 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -30,8 +30,8 @@
#include "texture_editor_plugin.h"
#include "editor/editor_settings.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
+#include "project_settings.h"
void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
}
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index a83ea70508..f5bb9d4a35 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -493,11 +493,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
Ref<Theme> base_theme;
- type_select->show();
- type_select_label->show();
name_select_label->show();
- name_edit->show();
- name_menu->show();
+ name_hbc->show();
+ type_select_label->show();
+ type_select->show();
if (p_option == POPUP_ADD) { //add
@@ -515,11 +514,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
- type_select->hide();
name_select_label->hide();
+ name_hbc->hide();
type_select_label->hide();
- name_edit->hide();
- name_menu->hide();
+ type_select->hide();
} else if (p_option == POPUP_REMOVE) {
@@ -537,11 +535,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
- type_select->hide();
name_select_label->hide();
+ name_hbc->hide();
type_select_label->hide();
- name_edit->hide();
- name_menu->hide();
+ type_select->hide();
}
popup_mode = p_option;
@@ -832,48 +829,46 @@ ThemeEditor::ThemeEditor() {
add_del_dialog->hide();
add_child(add_del_dialog);
+ VBoxContainer *dialog_vbc = memnew(VBoxContainer);
+ add_del_dialog->add_child(dialog_vbc);
+
Label *l = memnew(Label);
- l->set_position(Point2(5, 5) * EDSCALE);
l->set_text(TTR("Type:"));
- add_del_dialog->add_child(l);
- dtype_select_label = l;
+ dialog_vbc->add_child(l);
+
+ type_hbc = memnew(HBoxContainer);
+ dialog_vbc->add_child(type_hbc);
type_edit = memnew(LineEdit);
- type_edit->set_position(Point2(5, 25) * EDSCALE);
- type_edit->set_size(Point2(150, 5) * EDSCALE);
- add_del_dialog->add_child(type_edit);
+ type_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ type_hbc->add_child(type_edit);
type_menu = memnew(MenuButton);
- type_menu->set_position(Point2(160, 25) * EDSCALE);
- type_menu->set_size(Point2(30, 5) * EDSCALE);
type_menu->set_text("..");
- add_del_dialog->add_child(type_menu);
+ type_hbc->add_child(type_menu);
type_menu->get_popup()->connect("id_pressed", this, "_type_menu_cbk");
l = memnew(Label);
- l->set_position(Point2(200, 5) * EDSCALE);
l->set_text(TTR("Name:"));
- add_del_dialog->add_child(l);
+ dialog_vbc->add_child(l);
name_select_label = l;
+ name_hbc = memnew(HBoxContainer);
+ dialog_vbc->add_child(name_hbc);
+
name_edit = memnew(LineEdit);
- name_edit->set_position(Point2(200, 25) * EDSCALE);
- name_edit->set_size(Point2(150, 5) * EDSCALE);
- add_del_dialog->add_child(name_edit);
+ name_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ name_hbc->add_child(name_edit);
name_menu = memnew(MenuButton);
- name_menu->set_position(Point2(360, 25) * EDSCALE);
- name_menu->set_size(Point2(30, 5) * EDSCALE);
name_menu->set_text("..");
-
- add_del_dialog->add_child(name_menu);
+ name_hbc->add_child(name_menu);
name_menu->get_popup()->connect("about_to_show", this, "_name_menu_about_to_show");
name_menu->get_popup()->connect("id_pressed", this, "_name_menu_cbk");
type_select_label = memnew(Label);
- type_select_label->set_position(Point2(400, 5) * EDSCALE);
type_select_label->set_text(TTR("Data Type:"));
- add_del_dialog->add_child(type_select_label);
+ dialog_vbc->add_child(type_select_label);
type_select = memnew(OptionButton);
type_select->add_item(TTR("Icon"));
@@ -881,10 +876,8 @@ ThemeEditor::ThemeEditor() {
type_select->add_item(TTR("Font"));
type_select->add_item(TTR("Color"));
type_select->add_item(TTR("Constant"));
- type_select->set_position(Point2(400, 25) * EDSCALE);
- type_select->set_size(Point2(80, 5) * EDSCALE);
- add_del_dialog->add_child(type_select);
+ dialog_vbc->add_child(type_select);
add_del_dialog->get_ok()->connect("pressed", this, "_dialog_cbk");
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index 6db01c6246..a75b83e76a 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -54,14 +54,15 @@ class ThemeEditor : public Control {
MenuButton *theme_menu;
ConfirmationDialog *add_del_dialog;
+ HBoxContainer *type_hbc;
MenuButton *type_menu;
LineEdit *type_edit;
+ HBoxContainer *name_hbc;
MenuButton *name_menu;
LineEdit *name_edit;
OptionButton *type_select;
Label *type_select_label;
Label *name_select_label;
- Label *dtype_select_label;
enum PopupMode {
POPUP_ADD,
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index b498044a65..b9694dffcb 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -32,7 +32,6 @@
#include "editor_data.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "io/image_loader.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
@@ -40,6 +39,7 @@
#include "os/dir_access.h"
#include "os/file_access.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/scroll_container.h"
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index acf5fe02cc..82f17b80d5 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -187,30 +187,17 @@ private:
} else {
if (mode == MODE_NEW) {
- FileAccess *f = FileAccess::open(dir.plus_file("/project.godot"), FileAccess::WRITE);
- if (!f) {
+ ProjectSettings::CustomMap initial_settings;
+ initial_settings["application/config/name"] = project_name->get_text();
+ initial_settings["application/config/icon"] = "res://icon.png";
+ initial_settings["rendering/environment/default_environment"] = "res://default_env.tres";
+
+ if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) {
error->set_text(TTR("Couldn't create project.godot in project path."));
} else {
-
- f->store_line("; Engine configuration file.");
- f->store_line("; It's best edited using the editor UI and not directly,");
- f->store_line("; since the parameters that go here are not all obvious.");
- f->store_line("; ");
- f->store_line("; Format: ");
- f->store_line("; [section] ; section goes between []");
- f->store_line("; param=value ; assign values to parameters");
- f->store_line("\n");
- f->store_line("[application]");
- f->store_line("\n");
- f->store_line("config/name=\"" + project_name->get_text() + "\"");
- f->store_line("config/icon=\"res://icon.png\"");
- f->store_line("[rendering]");
- f->store_line("environment/default_environment=\"res://default_env.tres\"");
- memdelete(f);
-
ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
- f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
+ FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
if (!f) {
error->set_text(TTR("Couldn't create project.godot in project path."));
} else {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index c2af2445cc..42485317c1 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1957,11 +1957,6 @@ CustomPropertyEditor::CustomPropertyEditor() {
add_child(error);
//error->get_cancel()->hide();
- type_button = memnew(MenuButton);
- add_child(type_button);
- type_button->hide();
- type_button->get_popup()->connect("id_pressed", this, "_type_create_selected");
-
scene_tree = memnew(SceneTreeDialog);
add_child(scene_tree);
scene_tree->connect("selected", this, "_node_path_selected");
@@ -1979,6 +1974,11 @@ CustomPropertyEditor::CustomPropertyEditor() {
//easing_draw->emit_signal(SceneStringNames::get_singleton()->input_event,InputEvent());
easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE);
+ type_button = memnew(MenuButton);
+ add_child(type_button);
+ type_button->hide();
+ type_button->get_popup()->connect("id_pressed", this, "_type_create_selected");
+
menu = memnew(PopupMenu);
add_child(menu);
menu->connect("id_pressed", this, "_menu_option");
@@ -3858,7 +3858,7 @@ void PropertyEditor::_item_edited() {
break;
if (type == Variant::INT)
- _edit_set(name, int(item->get_range(1)), refresh_all);
+ _edit_set(name, round(item->get_range(1)), refresh_all);
else
_edit_set(name, item->get_range(1), refresh_all);
} break;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 57ab931827..47a9185389 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -37,9 +37,9 @@
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "multi_node_edit.h"
#include "os/keyboard.h"
+#include "project_settings.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
#include "script_editor_debugger.h"
@@ -1885,7 +1885,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
if (is_external) {
bool is_inherited = selection[0]->get_scene_inherited_state() != NULL;
bool is_top_level = selection[0]->get_owner() == NULL;
- if (is_inherited) {
+ if (is_inherited && is_top_level) {
menu->add_separator();
menu->add_item(TTR("Clear Inheritance"), TOOL_SCENE_CLEAR_INHERITANCE);
menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN_INHERITED);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index c3a3410717..d81161ae94 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -31,9 +31,9 @@
#include "editor/editor_scale.h"
#include "editor_file_system.h"
-#include "project_settings.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
+#include "project_settings.h"
#include "script_language.h"
void ScriptCreateDialog::_notification(int p_what) {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 2af3bd5f31..f4ed430d3d 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -32,8 +32,8 @@
#include "editor_node.h"
#include "editor_profiler.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "main/performance.h"
+#include "project_settings.h"
#include "property_editor.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/label.h"
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index eec047cd9a..d455e0cea9 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -32,8 +32,8 @@
#include "editor_file_system.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "project_settings.h"
#include "os/keyboard.h"
+#include "project_settings.h"
#include "scene/gui/margin_container.h"
void EditorSettingsDialog::ok_pressed() {