diff options
Diffstat (limited to 'editor')
27 files changed, 80 insertions, 78 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_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_texture.cpp b/editor/import/resource_importer_texture.cpp index 98020ed9b8..c0c507c2d6 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -236,7 +236,7 @@ void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String format |= StreamTexture::FORMAT_BIT_DETECT_NORMAL; if ((p_compress_mode == COMPRESS_LOSSLESS || p_compress_mode == COMPRESS_LOSSY) && p_image->get_format() > Image::FORMAT_RGBA8) { - p_compress_mode == COMPRESS_UNCOMPRESSED; //these can't go as lossy + p_compress_mode = COMPRESS_UNCOMPRESSED; //these can't go as lossy } switch (p_compress_mode) { diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 18c4bed5dd..8cb712cb78 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -291,7 +291,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s bool limit_rate = p_options["force/max_rate"]; int limit_rate_hz = p_options["force/max_rate_hz"]; - if (limit_rate && rate > limit_rate_hz) { + if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) { //resampleeee!!! int new_data_frames = frames * limit_rate_hz / rate; Vector<float> new_data; @@ -356,7 +356,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s bool trim = p_options["edit/trim"]; - if (trim && !loop) { + if (trim && !loop && format_channels > 0) { int first = 0; int last = (frames * format_channels) - 1; 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/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/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index c31e11cc38..2d77bfb2c1 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3142,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: { @@ -3964,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..57c27a8a7e 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) { } @@ -102,14 +102,24 @@ void TextureEditor::_notification(int p_what) { } } +void TextureEditor::_changed_callback(Object *p_changed, const char *p_prop) { + + if (!is_visible()) + return; + update(); +} + void TextureEditor::edit(Ref<Texture> p_texture) { + if (!texture.is_null()) + texture->remove_change_receptor(this); + texture = p_texture; - if (!texture.is_null()) + if (!texture.is_null()) { + texture->add_change_receptor(this); update(); - else { - + } else { hide(); } } diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index 9382983538..13f8dd7fbd 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -43,6 +43,7 @@ class TextureEditor : public Control { protected: void _notification(int p_what); void _gui_input(Ref<InputEvent> p_event); + void _changed_callback(Object *p_changed, const char *p_prop); static void _bind_methods(); public: diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 8a7dcea393..4cd18b090a 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -617,38 +617,24 @@ void TextureRegionEditor::_bind_methods() { } void TextureRegionEditor::edit(Object *p_obj) { - if (node_sprite && node_sprite->is_connected("texture_changed", this, "_edit_region")) - node_sprite->disconnect("texture_changed", this, "_edit_region"); - if (node_patch9 && node_patch9->is_connected("texture_changed", this, "_edit_region")) - node_patch9->disconnect("texture_changed", this, "_edit_region"); - if (obj_styleBox.is_valid() && obj_styleBox->is_connected("texture_changed", this, "_edit_region")) - obj_styleBox->disconnect("texture_changed", this, "_edit_region"); - if (atlas_tex.is_valid() && atlas_tex->is_connected("atlas_changed", this, "_edit_region")) - atlas_tex->disconnect("atlas_changed", this, "_edit_region"); + if (node_sprite) + node_sprite->remove_change_receptor(this); + if (node_patch9) + node_patch9->remove_change_receptor(this); + if (obj_styleBox.is_valid()) + obj_styleBox->remove_change_receptor(this); + if (atlas_tex.is_valid()) + atlas_tex->remove_change_receptor(this); if (p_obj) { node_sprite = p_obj->cast_to<Sprite>(); node_patch9 = p_obj->cast_to<NinePatchRect>(); if (p_obj->cast_to<StyleBoxTexture>()) obj_styleBox = Ref<StyleBoxTexture>(p_obj->cast_to<StyleBoxTexture>()); - if (p_obj->cast_to<AtlasTexture>()) { + if (p_obj->cast_to<AtlasTexture>()) atlas_tex = Ref<AtlasTexture>(p_obj->cast_to<AtlasTexture>()); - atlas_tex->connect("atlas_changed", this, "_edit_region"); - } else { - p_obj->connect("texture_changed", this, "_edit_region"); - } p_obj->add_change_receptor(this); - p_obj->connect("tree_exited", this, "_node_removed", varray(p_obj), CONNECT_ONESHOT); _edit_region(); } else { - if (node_sprite) - node_sprite->disconnect("tree_exited", this, "_node_removed"); - else if (node_patch9) - node_patch9->disconnect("tree_exited", this, "_node_removed"); - else if (obj_styleBox.is_valid()) - obj_styleBox->disconnect("tree_exited", this, "_node_removed"); - else if (atlas_tex.is_valid()) - atlas_tex->disconnect("tree_exited", this, "_node_removed"); - node_sprite = NULL; node_patch9 = NULL; obj_styleBox = Ref<StyleBoxTexture>(NULL); @@ -658,9 +644,11 @@ void TextureRegionEditor::edit(Object *p_obj) { } void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) { - if ((String)p_prop == "region_rect") { + + if (!is_visible()) + return; + if (p_prop == StringName("atlas") || p_prop == StringName("texture")) _edit_region(); - } } void TextureRegionEditor::_edit_region() { 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/property_editor.cpp b/editor/property_editor.cpp index febaa0e040..42485317c1 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2199,7 +2199,6 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p case Variant::BOOL: { p_item->set_checked(1, obj->get(p_name)); - p_item->set_text(1, obj->get(p_name) ? TTR("On") : TTR("Off")); } break; case Variant::REAL: case Variant::INT: { @@ -3142,7 +3141,7 @@ void PropertyEditor::update_tree() { case Variant::BOOL: { item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK); - item->set_text(1, obj->get(p.name) ? TTR("On") : TTR("Off")); + item->set_text(1, TTR("On")); item->set_tooltip(1, obj->get(p.name) ? "True" : "False"); item->set_checked(1, obj->get(p.name)); if (show_type_icons) @@ -3859,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/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() { |