summaryrefslogtreecommitdiff
path: root/editor/editor_resource_preview.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_resource_preview.h')
-rw-r--r--editor/editor_resource_preview.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 8091fbafdc..2f4bc65de9 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -37,7 +37,6 @@
#include "scene/resources/texture.h"
class EditorResourcePreviewGenerator : public Reference {
-
GDCLASS(EditorResourcePreviewGenerator, Reference);
protected:
@@ -45,8 +44,8 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from, const Size2 &p_size) const;
- virtual Ref<Texture> generate_from_path(const String &p_path, const Size2 &p_size) const;
+ virtual Ref<Texture2D> generate(const RES &p_from, const Size2 &p_size) const;
+ virtual Ref<Texture2D> generate_from_path(const String &p_path, const Size2 &p_size) const;
virtual bool generate_small_preview_automatically() const;
virtual bool can_generate_small_preview() const;
@@ -55,7 +54,6 @@ public:
};
class EditorResourcePreview : public Node {
-
GDCLASS(EditorResourcePreview, Node);
static EditorResourcePreview *singleton;
@@ -70,15 +68,15 @@ class EditorResourcePreview : public Node {
List<QueueItem> queue;
- Mutex *preview_mutex;
- Semaphore *preview_sem;
+ Mutex preview_mutex;
+ Semaphore preview_sem;
Thread *thread;
volatile bool exit;
volatile bool exited;
struct Item {
- Ref<Texture> preview;
- Ref<Texture> small_preview;
+ Ref<Texture2D> preview;
+ Ref<Texture2D> small_preview;
int order;
uint32_t last_hash;
uint64_t modified_time;
@@ -88,13 +86,13 @@ class EditorResourcePreview : public Node {
Map<String, Item> cache;
- void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, const Ref<Texture> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
+ void _preview_ready(const String &p_str, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
void _generate_preview(Ref<ImageTexture> &r_texture, Ref<ImageTexture> &r_small_texture, const QueueItem &p_item, const String &cache_base);
static void _thread_func(void *ud);
void _thread();
- Vector<Ref<EditorResourcePreviewGenerator> > preview_generators;
+ Vector<Ref<EditorResourcePreviewGenerator>> preview_generators;
protected:
static void _bind_methods();
@@ -102,7 +100,7 @@ protected:
public:
static EditorResourcePreview *get_singleton();
- //callback function is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
+ //callback function is callback(String p_path,Ref<Texture2D> preview,Variant udata) preview null if could not load
void queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
void queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);