editor_scene_importer_blend.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**************************************************************************/
  2. /* editor_scene_importer_blend.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef EDITOR_SCENE_IMPORTER_BLEND_H
  31. #define EDITOR_SCENE_IMPORTER_BLEND_H
  32. #ifdef TOOLS_ENABLED
  33. #include "editor/editor_file_system.h"
  34. #include "editor/import/resource_importer_scene.h"
  35. class Animation;
  36. class Node;
  37. class ConfirmationDialog;
  38. class EditorSceneFormatImporterBlend : public EditorSceneFormatImporter {
  39. GDCLASS(EditorSceneFormatImporterBlend, EditorSceneFormatImporter);
  40. int blender_major_version = -1;
  41. int blender_minor_version = -1;
  42. public:
  43. enum {
  44. BLEND_VISIBLE_ALL,
  45. BLEND_VISIBLE_VISIBLE_ONLY,
  46. BLEND_VISIBLE_RENDERABLE
  47. };
  48. enum {
  49. BLEND_BONE_INFLUENCES_NONE,
  50. BLEND_BONE_INFLUENCES_COMPATIBLE,
  51. BLEND_BONE_INFLUENCES_ALL
  52. };
  53. enum {
  54. BLEND_MATERIAL_EXPORT_PLACEHOLDER,
  55. BLEND_MATERIAL_EXPORT_EXPORT
  56. };
  57. enum {
  58. BLEND_MODIFIERS_NONE,
  59. BLEND_MODIFIERS_ALL
  60. };
  61. virtual uint32_t get_import_flags() const override;
  62. virtual void get_extensions(List<String> *r_extensions) const override;
  63. virtual Node *import_scene(const String &p_path, uint32_t p_flags,
  64. const HashMap<StringName, Variant> &p_options,
  65. List<String> *r_missing_deps, Error *r_err = nullptr) override;
  66. virtual void get_import_options(const String &p_path,
  67. List<ResourceImporter::ImportOption> *r_options) override;
  68. virtual Variant get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option,
  69. const HashMap<StringName, Variant> &p_options) override;
  70. };
  71. class LineEdit;
  72. class Button;
  73. class EditorFileDialog;
  74. class Label;
  75. class EditorFileSystemImportFormatSupportQueryBlend : public EditorFileSystemImportFormatSupportQuery {
  76. GDCLASS(EditorFileSystemImportFormatSupportQueryBlend, EditorFileSystemImportFormatSupportQuery);
  77. ConfirmationDialog *configure_blender_dialog = nullptr;
  78. LineEdit *blender_path = nullptr;
  79. Button *blender_path_browse = nullptr;
  80. EditorFileDialog *browse_dialog = nullptr;
  81. Label *path_status = nullptr;
  82. bool confirmed = false;
  83. String auto_detected_path;
  84. void _validate_path(String p_path);
  85. bool _autodetect_path(String p_path);
  86. void _path_confirmed();
  87. void _select_install(String p_path);
  88. void _browse_install();
  89. public:
  90. virtual bool is_active() const override;
  91. virtual Vector<String> get_file_extensions() const override;
  92. virtual bool query() override;
  93. EditorFileSystemImportFormatSupportQueryBlend();
  94. };
  95. #endif // TOOLS_ENABLED
  96. #endif // EDITOR_SCENE_IMPORTER_BLEND_H