summaryrefslogtreecommitdiffstats
path: root/core/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/resource.cpp')
-rw-r--r--core/resource.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/resource.cpp b/core/resource.cpp
index 672e64b1bb..97dee3e1d7 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -133,6 +133,7 @@ void ResourceImportMetadata::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, "");
ObjectTypeDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path);
ObjectTypeDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5);
+ ObjectTypeDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5);
ObjectTypeDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source);
ObjectTypeDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count);
ObjectTypeDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option);
@@ -330,6 +331,31 @@ Ref<ResourceImportMetadata> Resource::get_import_metadata() const {
}
+#ifdef TOOLS_ENABLED
+
+uint32_t Resource::hash_edited_version() const {
+
+ uint32_t hash = hash_djb2_one_32(get_edited_version());
+
+ List<PropertyInfo> plist;
+ get_property_list(&plist);
+
+ for (List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) {
+
+ if (E->get().type==Variant::OBJECT && E->get().hint==PROPERTY_HINT_RESOURCE_TYPE) {
+ RES res = get(E->get().name);
+ if (res.is_valid()) {
+ hash = hash_djb2_one_32(res->hash_edited_version(),hash);
+ }
+ }
+ }
+
+ return hash;
+
+}
+
+#endif
+
Resource::Resource() {
@@ -341,6 +367,8 @@ Resource::Resource() {
}
+
+
Resource::~Resource() {
if (path_cache!="")