1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Generate script resource preview without parsing

This commit is contained in:
Yuri Sizov
2024-01-26 13:03:32 +01:00
parent c848bfc1bb
commit 9c919ea285
4 changed files with 45 additions and 10 deletions

View File

@@ -34,6 +34,8 @@
#include "core/templates/safe_refcount.h"
#include "editor/editor_resource_preview.h"
class ScriptLanguage;
void post_process_preview(Ref<Image> p_image);
class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
@@ -112,9 +114,12 @@ public:
class EditorScriptPreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorScriptPreviewPlugin, EditorResourcePreviewGenerator);
Ref<Texture2D> _generate_from_source_code(const ScriptLanguage *p_language, const String &p_source_code, const Size2 &p_size, Dictionary &p_metadata) const;
public:
virtual bool handles(const String &p_type) const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
virtual Ref<Texture2D> generate_from_path(const String &p_path, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorScriptPreviewPlugin();
};