mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #77000 from reduz/make-more-base-nodes-thread-safe
Make more base nodes thread safe
This commit is contained in:
commit
8cfa19a078
17 changed files with 965 additions and 133 deletions
|
@ -158,8 +158,6 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
|
|||
}
|
||||
r_texture = generated;
|
||||
|
||||
int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_theme_icon(SNAME("Object"), SNAME("EditorIcons"))->get_width(); // Kind of a workaround to retrieve the default icon size
|
||||
|
||||
if (preview_generators[i]->can_generate_small_preview()) {
|
||||
Ref<Texture2D> generated_small;
|
||||
Dictionary d;
|
||||
|
@ -340,9 +338,16 @@ void EditorResourcePreview::_thread() {
|
|||
exited.set();
|
||||
}
|
||||
|
||||
void EditorResourcePreview::_update_thumbnail_sizes() {
|
||||
if (small_thumbnail_size == -1) {
|
||||
small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_theme_icon(SNAME("Object"), SNAME("EditorIcons"))->get_width(); // Kind of a workaround to retrieve the default icon size
|
||||
}
|
||||
}
|
||||
|
||||
void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata) {
|
||||
ERR_FAIL_NULL(p_receiver);
|
||||
ERR_FAIL_COND(!p_res.is_valid());
|
||||
_update_thumbnail_sizes();
|
||||
|
||||
{
|
||||
MutexLock lock(preview_mutex);
|
||||
|
@ -370,6 +375,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p
|
|||
}
|
||||
|
||||
void EditorResourcePreview::queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata) {
|
||||
_update_thumbnail_sizes();
|
||||
|
||||
ERR_FAIL_NULL(p_receiver);
|
||||
{
|
||||
MutexLock lock(preview_mutex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue