diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 12 | ||||
-rw-r--r-- | editor/editor_file_system.h | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/editor_profiler.cpp | 2 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/resource_preloader_editor_plugin.cpp | 71 | ||||
-rw-r--r-- | editor/plugins/resource_preloader_editor_plugin.h | 8 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 13 | ||||
-rw-r--r-- | editor/project_export.cpp | 6 |
11 files changed, 66 insertions, 66 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 38bdba31ea..f425d0a995 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -501,7 +501,7 @@ void EditorFileDialog::_items_clear_selection() { case MODE_OPEN_FILE: case MODE_OPEN_FILES: get_ok()->set_text(TTR("Open")); - get_ok()->set_disabled(item_list->is_anything_selected() == false); + get_ok()->set_disabled(!item_list->is_anything_selected()); break; case MODE_OPEN_DIR: diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index ee20d95f25..d73bf86f64 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1705,6 +1705,17 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) { emit_signal("resources_reimported", p_files); } +Error EditorFileSystem::_resource_import(const String &p_path) { + + Vector<String> files; + files.push_back(p_path); + + singleton->update_file(p_path); + singleton->reimport_files(files); + + return OK; +} + void EditorFileSystem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_filesystem"), &EditorFileSystem::get_filesystem); @@ -1744,6 +1755,7 @@ void EditorFileSystem::_update_extensions() { EditorFileSystem::EditorFileSystem() { + ResourceLoader::import = _resource_import; reimport_on_missing_imported_files = GLOBAL_DEF("editor/reimport_missing_imported_files", true); singleton = this; diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index f2f72eddbd..47077425a1 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -230,6 +230,8 @@ class EditorFileSystem : public Node { String _get_global_script_class(const String &p_type, const String &p_path, String *r_extends, String *r_icon_path) const; + static Error _resource_import(const String &p_path); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 790e38afca..fda6457e26 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3889,7 +3889,7 @@ void EditorNode::_scene_tab_closed(int p_tab) { } void EditorNode::_scene_tab_hover(int p_tab) { - if (bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover")) == false) { + if (!bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover"))) { return; } int current_tab = scene_tabs->get_current_tab(); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index b57e3826c6..d3978749c0 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -257,7 +257,7 @@ void EditorProfiler::_update_plot() { //get const Metric &m = frame_metrics[idx]; - if (m.valid == false) + if (!m.valid) continue; //skip because invalid float value = 0; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index a6b754de3b..cb15be35f2 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1793,22 +1793,22 @@ template <> struct EditorSceneImporterGLTFInterpolate<Quat> { Quat lerp(const Quat &a, const Quat &b, float c) const { - ERR_FAIL_COND_V(a.is_normalized() == false, Quat()); - ERR_FAIL_COND_V(b.is_normalized() == false, Quat()); + ERR_FAIL_COND_V(!a.is_normalized(), Quat()); + ERR_FAIL_COND_V(!b.is_normalized(), Quat()); return a.slerp(b, c).normalized(); } Quat catmull_rom(const Quat &p0, const Quat &p1, const Quat &p2, const Quat &p3, float c) { - ERR_FAIL_COND_V(p1.is_normalized() == false, Quat()); - ERR_FAIL_COND_V(p2.is_normalized() == false, Quat()); + ERR_FAIL_COND_V(!p1.is_normalized(), Quat()); + ERR_FAIL_COND_V(!p2.is_normalized(), Quat()); return p1.slerp(p2, c).normalized(); } Quat bezier(Quat start, Quat control_1, Quat control_2, Quat end, float t) { - ERR_FAIL_COND_V(start.is_normalized() == false, Quat()); - ERR_FAIL_COND_V(end.is_normalized() == false, Quat()); + ERR_FAIL_COND_V(!start.is_normalized(), Quat()); + ERR_FAIL_COND_V(!end.is_normalized(), Quat()); return start.slerp(end, t).normalized(); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e8f00ce0ba..a9bc5e77ac 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5113,7 +5113,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian type == "AtlasTexture" || type == "LargeTexture") { Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res)); - if (texture.is_valid() == false) { + if (!texture.is_valid()) { continue; } } else { diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index dd327d0a2c..bd4a35c9d8 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -44,7 +44,6 @@ void ResourcePreloaderEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { load->set_icon(get_icon("Folder", "EditorIcons")); - _delete->set_icon(get_icon("Remove", "EditorIcons")); } if (p_what == NOTIFICATION_READY) { @@ -138,15 +137,11 @@ void ResourcePreloaderEditor::_item_edited() { } } -void ResourcePreloaderEditor::_delete_confirm_pressed() { +void ResourcePreloaderEditor::_remove_resource(const String &p_to_remove) { - if (!tree->get_selected()) - return; - - String to_remove = tree->get_selected()->get_text(0); undo_redo->create_action(TTR("Delete Resource")); - undo_redo->add_do_method(preloader, "remove_resource", to_remove); - undo_redo->add_undo_method(preloader, "add_resource", to_remove, preloader->get_resource(to_remove)); + undo_redo->add_do_method(preloader, "remove_resource", p_to_remove); + undo_redo->add_undo_method(preloader, "add_resource", p_to_remove, preloader->get_resource(p_to_remove)); undo_redo->add_do_method(this, "_update_library"); undo_redo->add_undo_method(this, "_update_library"); undo_redo->commit_action(); @@ -184,21 +179,6 @@ void ResourcePreloaderEditor::_paste_pressed() { undo_redo->commit_action(); } -void ResourcePreloaderEditor::_delete_pressed() { - - if (!tree->get_selected()) - return; - - _delete_confirm_pressed(); //it has undo.. why bother with a dialog.. - /* - dialog->set_title("Confirm..."); - dialog->set_text("Remove Resource '"+tree->get_selected()->get_text(0)+"' ?"); - //dialog->get_cancel()->set_text("Cancel"); - //dialog->get_ok()->show(); - dialog->get_ok()->set_text("Remove"); - dialog->popup_centered(Size2(300,60));*/ -} - void ResourcePreloaderEditor::_update_library() { tree->clear(); @@ -228,17 +208,20 @@ void ResourcePreloaderEditor::_update_library() { ERR_CONTINUE(r.is_null()); - ti->set_tooltip(0, r->get_path()); + String type = r->get_class(); + ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(type, "Object")); + ti->set_tooltip(0, TTR("Instance:") + " " + r->get_path() + "\n" + TTR("Type:") + " " + type); + ti->set_text(1, r->get_path()); - ti->add_button(1, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); - ti->set_tooltip(1, TTR("Instance:") + " " + r->get_path() + "\n" + TTR("Type:") + " " + r->get_class()); ti->set_editable(1, false); ti->set_selectable(1, false); - String type = r->get_class(); - ti->set_text(2, type); - ti->set_selectable(2, false); - ti->set_icon(2, EditorNode::get_singleton()->get_class_icon(type, "")); + if (type == "PackedScene") { + ti->add_button(1, get_icon("InstanceOptions", "EditorIcons"), BUTTON_OPEN_SCENE, false, TTR("Open in Editor")); + } else { + ti->add_button(1, get_icon("Load", "EditorIcons"), BUTTON_EDIT_RESOURCE, false, TTR("Open in Editor")); + } + ti->add_button(1, get_icon("Remove", "EditorIcons"), BUTTON_REMOVE, false, TTR("Remove")); } //player->add_resource("default",resource); @@ -249,10 +232,16 @@ void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column, TreeItem *item = Object::cast_to<TreeItem>(p_item); ERR_FAIL_COND(!item); - String rpath = item->get_text(p_column); - - if (p_id == BUTTON_SUBSCENE) { + if (p_id == BUTTON_OPEN_SCENE) { + String rpath = item->get_text(p_column); EditorInterface::get_singleton()->open_scene_from_path(rpath); + + } else if (p_id == BUTTON_EDIT_RESOURCE) { + RES r = preloader->get_resource(item->get_text(0)); + EditorInterface::get_singleton()->edit_resource(r); + + } else if (p_id == BUTTON_REMOVE) { + _remove_resource(item->get_text(0)); } } @@ -365,12 +354,11 @@ void ResourcePreloaderEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &ResourcePreloaderEditor::_gui_input); ClassDB::bind_method(D_METHOD("_load_pressed"), &ResourcePreloaderEditor::_load_pressed); ClassDB::bind_method(D_METHOD("_item_edited"), &ResourcePreloaderEditor::_item_edited); - ClassDB::bind_method(D_METHOD("_delete_pressed"), &ResourcePreloaderEditor::_delete_pressed); ClassDB::bind_method(D_METHOD("_paste_pressed"), &ResourcePreloaderEditor::_paste_pressed); - ClassDB::bind_method(D_METHOD("_delete_confirm_pressed"), &ResourcePreloaderEditor::_delete_confirm_pressed); ClassDB::bind_method(D_METHOD("_files_load_request"), &ResourcePreloaderEditor::_files_load_request); ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library); ClassDB::bind_method(D_METHOD("_cell_button_pressed"), &ResourcePreloaderEditor::_cell_button_pressed); + ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource); ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw); ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw); @@ -391,9 +379,6 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { load->set_tooltip(TTR("Load Resource")); hbc->add_child(load); - _delete = memnew(Button); - hbc->add_child(_delete); - paste = memnew(Button); paste->set_text(TTR("Paste")); hbc->add_child(paste); @@ -403,13 +388,11 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { tree = memnew(Tree); tree->connect("button_pressed", this, "_cell_button_pressed"); - tree->set_columns(3); - tree->set_column_min_width(0, 3); - tree->set_column_min_width(1, 1); - tree->set_column_min_width(2, 1); + tree->set_columns(2); + tree->set_column_min_width(0, 2); + tree->set_column_min_width(1, 3); tree->set_column_expand(0, true); tree->set_column_expand(1, true); - tree->set_column_expand(2, true); tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->set_drag_forwarding(this); @@ -419,10 +402,8 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { add_child(dialog); load->connect("pressed", this, "_load_pressed"); - _delete->connect("pressed", this, "_delete_pressed"); paste->connect("pressed", this, "_paste_pressed"); file->connect("files_selected", this, "_files_load_request"); - //dialog->connect("confirmed", this,"_delete_confirm_pressed"); tree->connect("item_edited", this, "_item_edited"); loading_scene = false; } diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h index e737157785..0a8238ce18 100644 --- a/editor/plugins/resource_preloader_editor_plugin.h +++ b/editor/plugins/resource_preloader_editor_plugin.h @@ -43,11 +43,12 @@ class ResourcePreloaderEditor : public PanelContainer { GDCLASS(ResourcePreloaderEditor, PanelContainer); enum { - BUTTON_SUBSCENE = 0, + BUTTON_OPEN_SCENE, + BUTTON_EDIT_RESOURCE, + BUTTON_REMOVE }; Button *load; - Button *_delete; Button *paste; Tree *tree; bool loading_scene; @@ -62,8 +63,7 @@ class ResourcePreloaderEditor : public PanelContainer { void _load_scene_pressed(); void _files_load_request(const Vector<String> &p_paths); void _paste_pressed(); - void _delete_pressed(); - void _delete_confirm_pressed(); + void _remove_resource(const String &p_to_remove); void _update_library(); void _cell_button_pressed(Object *p_item, int p_column, int p_id); void _item_edited(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 114610c562..f57614b3b3 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -534,9 +534,9 @@ void SpatialEditorViewport::_update_name() { String view_mode = orthogonal ? TTR("Orthogonal") : TTR("Perspective"); if (name != "") - view_menu->set_text("[ " + name + " " + view_mode + " ]"); + view_menu->set_text(name + " " + view_mode); else - view_menu->set_text("[ " + view_mode + " ]"); + view_menu->set_text(view_mode); view_menu->set_size(Vector2(0, 0)); // resets the button size } @@ -2124,7 +2124,7 @@ void SpatialEditorViewport::_notification(int p_what) { _update_freelook(delta); Node *scene_root = editor->get_scene_tree_dock()->get_editor_data()->get_edited_scene_root(); - if (previewing_cinema == true && scene_root != NULL) { + if (previewing_cinema && scene_root != NULL) { Camera *cam = scene_root->get_viewport()->get_camera(); if (cam != NULL && cam != previewing) { //then switch the viewport's camera to the scene's viewport camera @@ -2260,6 +2260,12 @@ void SpatialEditorViewport::_notification(int p_what) { surface->connect("mouse_exited", this, "_surface_mouse_exit"); surface->connect("focus_entered", this, "_surface_focus_enter"); surface->connect("focus_exited", this, "_surface_focus_exit"); + view_menu->set_flat(false); + view_menu->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_style_override("hover", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_style_override("pressed", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_style_override("focus", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_style_override("disabled", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); info_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); fps_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); cinema_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); @@ -3421,7 +3427,6 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu = memnew(MenuButton); surface->add_child(view_menu); view_menu->set_position(Point2(4, 4) * EDSCALE); - view_menu->set_self_modulate(Color(1, 1, 1, 0.5)); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index fa6dce1771..3ec49e187f 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -638,10 +638,10 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem for (int i = 0; i < p_dir->get_subdir_count(); i++) { TreeItem *subdir = include_files->create_item(p_item); - if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes) == false) { - memdelete(subdir); - } else { + if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) { used = true; + } else { + memdelete(subdir); } } |