diff options
Diffstat (limited to 'editor/editor_resource_preview.h')
-rw-r--r-- | editor/editor_resource_preview.h | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index e4a593330d..ad7f0946e5 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -29,9 +29,9 @@ #ifndef EDITORRESOURCEPREVIEW_H #define EDITORRESOURCEPREVIEW_H -#include "scene/main/node.h" #include "os/semaphore.h" #include "os/thread.h" +#include "scene/main/node.h" #include "scene/resources/texture.h" /* make previews for: @@ -52,30 +52,26 @@ -curve and curve2D */ - class EditorResourcePreviewGenerator : public Reference { - GDCLASS(EditorResourcePreviewGenerator,Reference ); + GDCLASS(EditorResourcePreviewGenerator, Reference); protected: - static void _bind_methods(); -public: - virtual bool handles(const String& p_type) const; - virtual Ref<Texture> generate(const RES& p_from); - virtual Ref<Texture> generate_from_path(const String& p_path); +public: + virtual bool handles(const String &p_type) const; + virtual Ref<Texture> generate(const RES &p_from); + virtual Ref<Texture> generate_from_path(const String &p_path); EditorResourcePreviewGenerator(); }; - class EditorResourcePreview : public Node { - GDCLASS(EditorResourcePreview,Node); - + GDCLASS(EditorResourcePreview, Node); - static EditorResourcePreview* singleton; + static EditorResourcePreview *singleton; struct QueueItem { Ref<Resource> resource; @@ -101,31 +97,29 @@ class EditorResourcePreview : public Node { int order; - Map<String,Item> cache; + Map<String, Item> cache; - void _preview_ready(const String& p_str,const Ref<Texture>& p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud); - Ref<Texture> _generate_preview(const QueueItem& p_item, const String &cache_base); + void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud); + Ref<Texture> _generate_preview(const QueueItem &p_item, const String &cache_base); static void _thread_func(void *ud); void _thread(); Vector<Ref<EditorResourcePreviewGenerator> > preview_generators; - protected: - static void _bind_methods(); -public: - static EditorResourcePreview* get_singleton(); +public: + static EditorResourcePreview *get_singleton(); //callback funtion is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load - void queue_resource_preview(const String& p_res, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata); - void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata); + void queue_resource_preview(const String &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); + void queue_edited_resource_preview(const Ref<Resource> &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); - void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator); - void remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator); - void check_for_invalidation(const String& p_path); + void add_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator); + void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator); + void check_for_invalidation(const String &p_path); EditorResourcePreview(); ~EditorResourcePreview(); |