summaryrefslogtreecommitdiff
path: root/tools/editor/dependency_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/dependency_editor.cpp')
-rw-r--r--tools/editor/dependency_editor.cpp65
1 files changed, 49 insertions, 16 deletions
diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp
index 784315522c..ad2eb57f00 100644
--- a/tools/editor/dependency_editor.cpp
+++ b/tools/editor/dependency_editor.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* dependency_editor.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "dependency_editor.h"
#include "os/file_access.h"
#include "scene/gui/margin_container.h"
@@ -27,7 +55,7 @@ void DependencyEditor::_load_pressed(Object* p_item,int p_cell,int p_button){
String fname = ti->get_text(0);
replacing = ti->get_text(1);
- search->set_title(TTR("Search Replacement For: ")+replacing.get_file());
+ search->set_title(TTR("Search Replacement For:")+" "+replacing.get_file());
search->clear_filters();
List<String> ext;
@@ -180,7 +208,7 @@ void DependencyEditor::_update_list() {
String name = path.get_file();
Ref<Texture> icon;
- if (has_icon(type,TTR("EditorIcons"))) {
+ if (has_icon(type,"EditorIcons")) {
icon=get_icon(type,"EditorIcons");
} else {
icon=get_icon("Object","EditorIcons");
@@ -209,15 +237,15 @@ void DependencyEditor::edit(const String& p_path) {
editing=p_path;
- set_title(TTR("Dependencies For: ")+p_path.get_file());
+ set_title(TTR("Dependencies For:")+" "+p_path.get_file());
_update_list();
popup_centered_ratio();
if (EditorNode::get_singleton()->is_scene_open(p_path)) {
- EditorNode::get_singleton()->show_warning(TTR("Scene '")+p_path.get_file()+"' is currently being edited.\nChanges will not take effect unless reloaded.");
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will not take effect unless reloaded."),p_path.get_file()));
} else if (ResourceCache::has(p_path)) {
- EditorNode::get_singleton()->show_warning(TTR("Resource '")+p_path.get_file()+"' is in use.\nChanges will take effect when reloaded.");
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will take effect when reloaded."),p_path.get_file()));
}
}
@@ -240,8 +268,8 @@ DependencyEditor::DependencyEditor() {
tree = memnew( Tree );
tree->set_columns(2);
tree->set_column_titles_visible(true);
- tree->set_column_title(0,"Resource");
- tree->set_column_title(1,"Path");
+ tree->set_column_title(0,TTR("Resource"));
+ tree->set_column_title(1,TTR("Path"));
tree->set_hide_root(true);
tree->connect("button_pressed",this,"_load_pressed");
@@ -301,7 +329,7 @@ void DependencyEditorOwners::_fill_owners(EditorFileSystemDirectory *efsd) {
Ref<Texture> icon;
String type=efsd->get_file_type(i);
- if (!has_icon(type,TTR("EditorIcons"))) {
+ if (!has_icon(type,"EditorIcons")) {
icon=get_icon("Object","EditorIcons");
} else {
icon=get_icon(type,"EditorIcons");
@@ -319,7 +347,7 @@ void DependencyEditorOwners::show(const String& p_path) {
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
popup_centered_ratio();
- set_title(TTR("Owners Of: ")+p_path.get_file());
+ set_title(TTR("Owners Of:")+" "+p_path.get_file());
}
@@ -362,7 +390,7 @@ void DependencyRemoveDialog::_fill_owners(EditorFileSystemDirectory *efsd) {
Ref<Texture> icon;
String type=efsd->get_file_type(i);
- if (!has_icon(type,TTR("EditorIcons"))) {
+ if (!has_icon(type,"EditorIcons")) {
icon=get_icon("Object","EditorIcons");
} else {
icon=get_icon(type,"EditorIcons");
@@ -399,9 +427,10 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
+
if (exist) {
owners->show();
- text->set_text("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)");
+ text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)"));
popup_centered_minsize(Size2(500,220));
} else {
owners->hide();
@@ -417,6 +446,10 @@ void DependencyRemoveDialog::ok_pressed() {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
for (Map<String,TreeItem*>::Element *E=files.front();E;E=E->next()) {
+ if (ResourceCache::has(E->key())) {
+ Resource *res = ResourceCache::get(E->key());
+ res->set_path(""); //clear reference to path
+ }
da->remove(E->key());
EditorFileSystem::get_singleton()->update_file(E->key());
}
@@ -448,7 +481,7 @@ void DependencyErrorDialog::show(const String& p_for_file,const Vector<String> &
for_file=p_for_file;
- set_title(TTR("Error loading: ")+p_for_file.get_file());
+ set_title(TTR("Error loading:")+" "+p_for_file.get_file());
files->clear();
TreeItem *root = files->create_item(NULL);
@@ -461,7 +494,7 @@ void DependencyErrorDialog::show(const String& p_for_file,const Vector<String> &
type=report[i].get_slice("::",1);
Ref<Texture> icon;
- if (!has_icon(type,TTR("EditorIcons"))) {
+ if (!has_icon(type,"EditorIcons")) {
icon=get_icon("Object","EditorIcons");
} else {
icon=get_icon(type,"EditorIcons");
@@ -523,7 +556,7 @@ void OrphanResourcesDialog::ok_pressed() {
if (paths.empty())
return;
- delete_confirm->set_text(TTR("Permanently Delete ")+itos(paths.size())+" Item(s) ? (No Undo!!)");
+ delete_confirm->set_text(vformat(TTR("Permanently delete %d item(s)? (No undo!)"),paths.size()));
delete_confirm->popup_centered_minsize();
}
@@ -580,7 +613,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd,HashMap
String type=efsd->get_file_type(i);
Ref<Texture> icon;
- if (has_icon(type,TTR("EditorIcons"))) {
+ if (has_icon(type,"EditorIcons")) {
icon=get_icon(type,"EditorIcons");
} else {
icon=get_icon("Object","EditorIcons");
@@ -675,7 +708,7 @@ OrphanResourcesDialog::OrphanResourcesDialog(){
files->set_column_min_width(1,100);
files->set_column_expand(0,true);
files->set_column_expand(1,false);
- files->set_column_title(0,"Resource");
+ files->set_column_title(0,TTR("Resource"));
files->set_column_title(1,TTR("Owns"));
files->set_hide_root(true);
vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"),files,true);