Skip to content

Commit ce1ba73

Browse files
committed
Merge pull request godotengine#94934 from Hilderin/fix-no-validation-blender-path-on-import
Fix no validation on Blender path on import
2 parents 6bf6402 + 2dc9cf5 commit ce1ba73

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

modules/gltf/editor/editor_scene_importer_blend.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,15 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
115115
List<String> *r_missing_deps, Error *r_err) {
116116
String blender_path = EDITOR_GET("filesystem/import/blender/blender_path");
117117

118-
if (blender_major_version == -1 || blender_minor_version == -1) {
119-
_get_blender_version(blender_path, blender_major_version, blender_minor_version, nullptr);
118+
ERR_FAIL_COND_V_MSG(blender_path.is_empty(), nullptr, "Blender path is empty, check your Editor Settings.");
119+
ERR_FAIL_COND_V_MSG(!FileAccess::exists(blender_path), nullptr, vformat("Invalid Blender path: %s, check your Editor Settings.", blender_path));
120+
121+
if (blender_major_version == -1 || blender_minor_version == -1 || last_tested_blender_path != blender_path) {
122+
String error;
123+
if (!_get_blender_version(blender_path, blender_major_version, blender_minor_version, &error)) {
124+
ERR_FAIL_V_MSG(nullptr, error);
125+
}
126+
last_tested_blender_path = blender_path;
120127
}
121128

122129
// Get global paths for source and sink.

modules/gltf/editor/editor_scene_importer_blend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class EditorSceneFormatImporterBlend : public EditorSceneFormatImporter {
4545

4646
int blender_major_version = -1;
4747
int blender_minor_version = -1;
48+
String last_tested_blender_path;
4849

4950
public:
5051
enum {

0 commit comments

Comments
 (0)