From e32215fbadc0ff108d5b7d79558e42ad7954cb4e Mon Sep 17 00:00:00 2001 From: reduz Date: Thu, 31 Mar 2022 22:00:17 +0200 Subject: Add Blender install autodetection and configuration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR is a continuation to #54886 * Changed Blender path editor setting from binary to installation. * Add a class to query whether the format is supported. * This class allows to create proper editors to configure support. **NOTE**: This PR only provides autodetection on Linux. Code needs to be added for Windows and MacOS to autodetect the Blender installation. Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com> Co-authored-by: Pedro J. Estébanez --- editor/editor_file_system.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'editor/editor_file_system.h') diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 0ec0094030..0ddac65839 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -109,6 +109,37 @@ public: ~EditorFileSystemDirectory(); }; +class EditorFileSystemImportFormatSupportQuery : public RefCounted { + GDCLASS(EditorFileSystemImportFormatSupportQuery, RefCounted); + +protected: + GDVIRTUAL0RC(bool, _is_active) + GDVIRTUAL0RC(Vector, _get_file_extensions) + GDVIRTUAL0RC(bool, _query) + static void _bind_methods() { + GDVIRTUAL_BIND(_is_active); + GDVIRTUAL_BIND(_get_file_extensions); + GDVIRTUAL_BIND(_query); + } + +public: + virtual bool is_active() const { + bool ret = false; + GDVIRTUAL_REQUIRED_CALL(_is_active, ret); + return ret; + } + virtual Vector get_file_extensions() const { + Vector ret; + GDVIRTUAL_REQUIRED_CALL(_get_file_extensions, ret); + return ret; + } + virtual bool query() { + bool ret = false; + GDVIRTUAL_REQUIRED_CALL(_query, ret); + return ret; + } +}; + class EditorFileSystem : public Node { GDCLASS(EditorFileSystem, Node); @@ -257,6 +288,9 @@ class EditorFileSystem : public Node { static ResourceUID::ID _resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate); bool _scan_extensions(); + bool _scan_import_support(Vector reimports); + + Vector> import_support_queries; protected: void _notification(int p_what); @@ -289,6 +323,8 @@ public: static bool _should_skip_directory(const String &p_path); + void add_import_format_support_query(Ref p_query); + void remove_import_format_support_query(Ref p_query); EditorFileSystem(); ~EditorFileSystem(); }; -- cgit v1.2.3