diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-09 00:52:09 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-09 00:52:09 +0100 |
commit | 1c8ef9e25208f95277a1d076fcba09ef77368cfd (patch) | |
tree | ec183929e8052a612e8bb08087ccbab79254fcdd | |
parent | d78fafa4b049f4e2b792b90153a6c2ebafa75dd8 (diff) | |
parent | 7319b612f3512b5077279c51230b48b56622c564 (diff) | |
download | redot-engine-1c8ef9e25208f95277a1d076fcba09ef77368cfd.tar.gz |
Merge pull request #89251 from KoBeWi/fastpector
Speed up inspector updates for TileMap
-rw-r--r-- | core/io/resource.cpp | 4 | ||||
-rw-r--r-- | core/io/resource.h | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 4 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 4 | ||||
-rw-r--r-- | scene/resources/2d/tile_set.h | 4 |
5 files changed, 13 insertions, 5 deletions
diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 6d32035d25..5edb045760 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -435,7 +435,7 @@ RID Resource::get_rid() const { #ifdef TOOLS_ENABLED -uint32_t Resource::hash_edited_version() const { +uint32_t Resource::hash_edited_version_for_preview() const { uint32_t hash = hash_murmur3_one_32(get_edited_version()); List<PropertyInfo> plist; @@ -445,7 +445,7 @@ uint32_t Resource::hash_edited_version() const { if (E.usage & PROPERTY_USAGE_STORAGE && E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_RESOURCE_TYPE) { Ref<Resource> res = get(E.name); if (res.is_valid()) { - hash = hash_murmur3_one_32(res->hash_edited_version(), hash); + hash = hash_murmur3_one_32(res->hash_edited_version_for_preview(), hash); } } } diff --git a/core/io/resource.h b/core/io/resource.h index f0f686af57..cc8a0d4387 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -125,7 +125,7 @@ public: #ifdef TOOLS_ENABLED - uint32_t hash_edited_version() const; + virtual uint32_t hash_edited_version_for_preview() const; virtual void set_last_modified_time(uint64_t p_time) { last_modified_time = p_time; } uint64_t get_last_modified_time() const { return last_modified_time; } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 83a7e115c9..a14c6e8462 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2009,6 +2009,10 @@ Array EditorInspectorArray::_extract_properties_as_array(const List<PropertyInfo Array output; for (const PropertyInfo &pi : p_list) { + if (!(pi.usage & PROPERTY_USAGE_EDITOR)) { + continue; + } + if (pi.name.begins_with(array_element_prefix)) { String str = pi.name.trim_prefix(array_element_prefix); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 94bf15ae66..ddf230dfdb 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -269,7 +269,7 @@ void EditorResourcePreview::_iterate() { if (item.resource.is_valid()) { Dictionary preview_metadata; _generate_preview(texture, small_texture, item, String(), preview_metadata); - _preview_ready(item.path, item.resource->hash_edited_version(), texture, small_texture, item.id, item.function, item.userdata, preview_metadata); + _preview_ready(item.path, item.resource->hash_edited_version_for_preview(), texture, small_texture, item.id, item.function, item.userdata, preview_metadata); return; } @@ -407,7 +407,7 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p String path_id = "ID:" + itos(p_res->get_instance_id()); - if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) { + if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version_for_preview()) { cache[path_id].order = order++; p_receiver->call(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata); return; diff --git a/scene/resources/2d/tile_set.h b/scene/resources/2d/tile_set.h index b55afd2de5..c17241a436 100644 --- a/scene/resources/2d/tile_set.h +++ b/scene/resources/2d/tile_set.h @@ -299,6 +299,10 @@ protected: void _get_property_list(List<PropertyInfo> *p_list) const; void _validate_property(PropertyInfo &p_property) const; +#ifdef TOOLS_ENABLED + virtual uint32_t hash_edited_version_for_preview() const override { return 0; } // Not using preview, so disable it for performance. +#endif + private: // --- TileSet data --- // Basic shape and layout. |