summaryrefslogtreecommitdiff
path: root/tools/editor/resources_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/resources_dock.cpp')
-rw-r--r--tools/editor/resources_dock.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp
index c73c8c081c..e89262db25 100644
--- a/tools/editor/resources_dock.cpp
+++ b/tools/editor/resources_dock.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 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 */
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resources_dock.h"
+
#include "editor_node.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
@@ -122,14 +123,16 @@ void ResourcesDock::_notification(int p_what) {
void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_resource) {
- editor->get_editor_data().apply_changes_in_editors();;
+ editor->get_editor_data().apply_changes_in_editors();
int flg=0;
if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources"))
flg|=ResourceSaver::FLAG_COMPRESS;
- //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative"))
- // flg|=ResourceSaver::FLAG_RELATIVE_PATHS;
+ /*
+ if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative"))
+ flg|=ResourceSaver::FLAG_RELATIVE_PATHS;
+ */
- String path = Globals::get_singleton()->localize_path(p_path);
+ String path = GlobalConfig::get_singleton()->localize_path(p_path);
Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
if (err!=OK) {
@@ -137,7 +140,7 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re
accept->popup_centered_minsize();
return;
}
-// EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type());
+ //EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type());
((Resource*)p_resource.ptr())->set_path(path);
editor->emit_signal("resource_saved",p_resource);
@@ -161,7 +164,7 @@ void ResourcesDock::save_resource_as(const Ref<Resource>& p_resource) {
String existing;
if (extensions.size()) {
- existing="new_"+res->get_type().to_lower()+"."+extensions.front()->get().to_lower();
+ existing="new_"+res->get_class().to_lower()+"."+extensions.front()->get().to_lower();
}
file->set_current_file(existing);
@@ -214,7 +217,7 @@ void ResourcesDock::_update_name(TreeItem *item) {
else if (res->get_path()!="" && res->get_path().find("::")==-1)
item->set_text(0,res->get_path().get_file());
else
- item->set_text(0,res->get_type()+" ("+itos(res->get_instance_ID())+")");
+ item->set_text(0,res->get_class()+" ("+itos(res->get_instance_ID())+")");
}
@@ -267,8 +270,8 @@ void ResourcesDock::add_resource(const Ref<Resource>& p_resource) {
TreeItem *res = resources->create_item(root);
res->set_metadata(0,p_resource);
- if (has_icon(p_resource->get_type(),"EditorIcons")) {
- res->set_icon(0,get_icon(p_resource->get_type(),"EditorIcons"));
+ if (has_icon(p_resource->get_class(),"EditorIcons")) {
+ res->set_icon(0,get_icon(p_resource->get_class(),"EditorIcons"));
}
_update_name(res);
@@ -319,12 +322,12 @@ void ResourcesDock::_create() {
void ResourcesDock::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_tool_selected"),&ResourcesDock::_tool_selected);
- ObjectTypeDB::bind_method(_MD("_create"),&ResourcesDock::_create);
- ObjectTypeDB::bind_method(_MD("_resource_selected"),&ResourcesDock::_resource_selected);
- ObjectTypeDB::bind_method(_MD("_delete"),&ResourcesDock::_delete);
- ObjectTypeDB::bind_method(_MD("remove_resource"),&ResourcesDock::remove_resource);
- ObjectTypeDB::bind_method(_MD("_file_action"),&ResourcesDock::_file_action);
+ ClassDB::bind_method(_MD("_tool_selected"),&ResourcesDock::_tool_selected);
+ ClassDB::bind_method(_MD("_create"),&ResourcesDock::_create);
+ ClassDB::bind_method(_MD("_resource_selected"),&ResourcesDock::_resource_selected);
+ ClassDB::bind_method(_MD("_delete"),&ResourcesDock::_delete);
+ ClassDB::bind_method(_MD("remove_resource"),&ResourcesDock::remove_resource);
+ ClassDB::bind_method(_MD("_file_action"),&ResourcesDock::_file_action);
@@ -366,7 +369,7 @@ ResourcesDock::ResourcesDock(EditorNode *p_editor) {
mb->set_tooltip(TTR("Save Resource"));
mb->get_popup()->add_item(TTR("Save Resource"),TOOL_SAVE);
mb->get_popup()->add_item(TTR("Save Resource As.."),TOOL_SAVE_AS);
- mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
+ mb->get_popup()->connect("id_pressed",this,"_tool_selected" );
hbc->add_child( mb );
button_save=mb;
@@ -377,7 +380,7 @@ ResourcesDock::ResourcesDock(EditorNode *p_editor) {
mb->get_popup()->add_item(TTR("Make Local"),TOOL_MAKE_LOCAL);
mb->get_popup()->add_item(TTR("Copy"),TOOL_COPY);
mb->get_popup()->add_item(TTR("Paste"),TOOL_PASTE);
- mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
+ mb->get_popup()->connect("id_pressed",this,"_tool_selected" );
hbc->add_child( mb );
button_tools=mb;